oneuptime
Version:
OneUptime is a JS package that tracks error event and send logs from your applications to your oneuptime dashboard.
968 lines (269 loc) • 11.2 kB
HTML
<html lang="en">
<head>
<meta charset="utf-8">
<title>JSDoc: Module: api</title>
<script src="scripts/prettify/prettify.js"> </script>
<script src="scripts/prettify/lang-css.js"> </script>
<!--[if lt IE 9]>
<script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
<link type="text/css" rel="stylesheet" href="styles/prettify-tomorrow.css">
<link type="text/css" rel="stylesheet" href="styles/jsdoc-default.css">
</head>
<body>
<div id="main">
<h1 class="page-title">Module: api</h1>
<section>
<header>
</header>
<article>
<div class="container-overview">
<div class="description">Main API to authenticate user, start and stop server monitoring.</div>
<dl class="details">
<dt class="tag-author">Author:</dt>
<dd class="tag-author">
<ul>
<li>HackerBay, Inc.</li>
</ul>
</dd>
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="lib_api.js.html">lib/api.js</a>, <a href="lib_api.js.html#line1">line 1</a>
</li></ul></dd>
<dt class="tag-see">See:</dt>
<dd class="tag-see">
<ul>
<li><a href="module-helpers.html">module:helpers</a></li>
<li><a href="module-logger.html">module:logger</a></li>
</ul>
</dd>
</dl>
<h4 class="name" id="module:api"><span class="type-signature"></span>(require("api"))<span class="signature">(config, apiUrl, apiKey, monitorId)</span><span class="type-signature"> → {Object}</span></h4>
<div class="description">
Authenticate user and get list of server monitors if monitor id not provided.
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>config</code></td>
<td class="type">
<span class="param-type">string</span>
|
<span class="param-type">Object</span>
</td>
<td class="description last">The project id or config of the project.</td>
</tr>
<tr>
<td class="name"><code>apiUrl</code></td>
<td class="type">
<span class="param-type">string</span>
</td>
<td class="description last">The url of the api.</td>
</tr>
<tr>
<td class="name"><code>apiKey</code></td>
<td class="type">
<span class="param-type">string</span>
</td>
<td class="description last">The api key of the project.</td>
</tr>
<tr>
<td class="name"><code>monitorId</code></td>
<td class="type">
<span class="param-type">string</span>
|
<span class="param-type">function</span>
</td>
<td class="description last">The monitor id or function to resolve monitor id of the server monitor.</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="lib_api.js.html">lib/api.js</a>, <a href="lib_api.js.html#line184">line 184</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
The server monitor handlers.
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">Object</span>
</dd>
</dl>
</div>
<h3 class="subsection-title">Methods</h3>
<h4 class="name" id="~ping"><span class="type-signature">(inner) </span>ping<span class="signature">(projectId, monitorId, apiUrl, apiKey, interval)</span><span class="type-signature"> → {Object}</span></h4>
<div class="description">
Get system information at interval and upload to server.
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Default</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>projectId</code></td>
<td class="type">
<span class="param-type">string</span>
</td>
<td class="default">
</td>
<td class="description last">The project id of the project.</td>
</tr>
<tr>
<td class="name"><code>monitorId</code></td>
<td class="type">
<span class="param-type">string</span>
</td>
<td class="default">
</td>
<td class="description last">The monitor id of the server monitor.</td>
</tr>
<tr>
<td class="name"><code>apiUrl</code></td>
<td class="type">
<span class="param-type">string</span>
</td>
<td class="default">
</td>
<td class="description last">The url of the api.</td>
</tr>
<tr>
<td class="name"><code>apiKey</code></td>
<td class="type">
<span class="param-type">string</span>
</td>
<td class="default">
</td>
<td class="description last">The api key of the project.</td>
</tr>
<tr>
<td class="name"><code>interval</code></td>
<td class="type">
<span class="param-type">string</span>
</td>
<td class="default">
* * * * *
</td>
<td class="description last">The interval of the cron job, must ba a valid cron format.</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="lib_api.js.html">lib/api.js</a>, <a href="lib_api.js.html#line34">line 34</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
The ping server cron job.
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">Object</span>
</dd>
</dl>
<h4 class="name" id="~start"><span class="type-signature">(inner) </span>start<span class="signature">(id)</span><span class="type-signature"> → {Object|number}</span></h4>
<div class="description">
Start server monitor.
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>id</code></td>
<td class="type">
<span class="param-type">string</span>
</td>
<td class="description last">The monitor id of the server monitor.</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="lib_api.js.html">lib/api.js</a>, <a href="lib_api.js.html#line209">line 209</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
The ping server cron job or the error code.
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">Object</span>
|
<span class="param-type">number</span>
</dd>
</dl>
<h4 class="name" id="~stop"><span class="type-signature">(inner) </span>stop<span class="signature">()</span><span class="type-signature"> → {Object}</span></h4>
<div class="description">
Stop server monitor.
</div>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="lib_api.js.html">lib/api.js</a>, <a href="lib_api.js.html#line290">line 290</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
The ping server cron job.
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">Object</span>
</dd>
</dl>
</article>
</section>
</div>
<nav>
<h2><a href="index.html">Home</a></h2><h3>Modules</h3><ul><li><a href="module-api.html">api</a></li><li><a href="module-config.html">config</a></li><li><a href="module-helpers.html">helpers</a></li><li><a href="module-logger.html">logger</a></li><li><a href="module-server-monitor.html">server-monitor</a></li></ul>
</nav>
<br class="clear">
<footer>
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.6</a> on Fri Jan 08 2021 00:53:57 GMT+0100 (West Africa Standard Time)
</footer>
<script> prettyPrint(); </script>
<script src="scripts/linenumber.js"> </script>
</body>
</html>