Main API to authenticate user, start and stop server monitoring.
- Source:
- See:
(require("api"))(config, apiUrl, apiKey, monitorId) → {Object}
Authenticate user and get list of server monitors if monitor id not provided.
Parameters:
| Name | Type | Description |
|---|---|---|
config |
string | Object | The project id or config of the project. |
apiUrl |
string | The url of the api. |
apiKey |
string | The api key of the project. |
monitorId |
string | function | The monitor id or function to resolve monitor id of the server monitor. |
- Source:
Returns:
The server monitor handlers.
- Type
- Object
Methods
(inner) ping(projectId, monitorId, apiUrl, apiKey, interval) → {Object}
Get system information at interval and upload to server.
Parameters:
| Name | Type | Default | Description |
|---|---|---|---|
projectId |
string | The project id of the project. | |
monitorId |
string | The monitor id of the server monitor. | |
apiUrl |
string | The url of the api. | |
apiKey |
string | The api key of the project. | |
interval |
string | * * * * * | The interval of the cron job, must ba a valid cron format. |
- Source:
Returns:
The ping server cron job.
- Type
- Object
(inner) start(id) → {Object|number}
Start server monitor.
Parameters:
| Name | Type | Description |
|---|---|---|
id |
string | The monitor id of the server monitor. |
- Source:
Returns:
The ping server cron job or the error code.
- Type
- Object | number
(inner) stop() → {Object}
Stop server monitor.
- Source:
Returns:
The ping server cron job.
- Type
- Object