samuel-p
2b09aaef19
All checks were successful
continuous-integration/drone/push Build is passing
updated checks to run in parallel |
||
---|---|---|
.dockerignore | ||
.drone.yml | ||
.gitignore | ||
Dockerfile | ||
index.js | ||
package-lock.json | ||
package.json | ||
README.md |
cachet-monitor
Simple monitor to watch URLs (HTTP
) or ports (TCP
, UDP
) and update Cachet status.
Configuration
cachet-monitor can monitor a list of services. Therefore it requires to setup all services in ./data/config.json
. The id of each service has to match the cachet component id you want to update! You also can specify a custom timeout in seconds for each service. If the service timeout is passed the status will be SLOW
(Cachet Performance Issues
).
You also need to specify the interval (cron
) your services should be checked. You can use the cron syntax from node-cron
. You also have to set offlineTimeUntilMajor
which is the offline time in seconds until the state of an offline service turns from partial to major outage. Finally you need to provide the information to your cachet instance (api
and token
). The "global" timeout
value will be used as a final request timeout for each service. If the check request does not complete in this time the service will be marked as offline.
Example:
{
"services": [
{
"id": 1,
"type": "HTTP",
"url": "https://sp-codes.de",
"timeout": 60
},
{
"id": 2,
"type": "TCP",
"host": "sp-codes.de",
"port": 443,
"timeout": 60
}
],
"cron": "0 * * * * *",
"timeout": 30,
"offlineTimeUntilMajor": 300,
"api": "https://<cachet-url>/api/v1",
"token": "<user-token>"
}
Run with docker
You can use the docker image samuelph/cachet-monitor
and mount a volume to /monitor/data
to persist cache and config:
docker run -v /your/path/monitor/data:/monitor/data samuelph/cachet-monitor
You also can use it in docker-compose.yml
:
services:
monitor:
image: samuelph/cachet-monitor
restart: always
volumes:
- /your/path/monitor:/monitor/data
Run from source
-
clone the repo
git clone https://git.sp-codes.de/samuel-p/cachet-monitor.git
-
install dependencies
npm install
-
run
npm run start