Simple monitor to watch URLs (HTTP) or ports (TCP, UDP) and update Cachet status.
This repository has been archived on 2021-10-31. You can view files and clone it, but cannot push or open issues or pull requests.
Find a file
Renovate Bot 286a820f43
All checks were successful
continuous-integration/drone/push Build is passing
Update node Docker tag to v14.16.0
2021-02-24 05:00:18 +00:00
.dockerignore added Dockerfile 2020-02-27 19:04:38 +01:00
.drone.yml fix pipeline 2020-07-09 21:15:33 +02:00
.gitignore added Dockerfile 2020-02-27 19:04:38 +01:00
Dockerfile Update node Docker tag to v14.16.0 2021-02-24 05:00:18 +00:00
index.js added -Pn flag to nmap (fixes error for hosts blocking nmap) 2020-07-09 21:04:57 +02:00
LICENSE added LICENSE 2020-02-29 14:13:08 +01:00
package-lock.json initial commit 2020-02-26 23:56:42 +01:00
package.json Update dependency node-fetch to ^2.6.1 2020-09-07 02:01:53 +00:00
README.md added -Pn flag to nmap (fixes error for hosts blocking nmap) 2020-07-09 21:04:57 +02:00
renovate.json added -Pn flag to nmap (fixes error for hosts blocking nmap) 2020-07-09 21:04:57 +02:00

cachet-monitor

Build Status License Docker Pulls

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! Each service needs the following attributes (additionally to id and type):

  • type HTTP
    • url
  • type TCP or UDP
    • host
    • port

Optionally you can add the following options to each service, or change the default values globally:

  • retry - number how often the check should be retried if the service is offline (default value 0)
  • waitUntilRetry - number of seconds the retry should be delayed (default value 5)
  • performanceTimeout - time in seconds in which the request has to be completed, otherwise the status will be SLOW (Cachet Performance Issues) (default value 1)
  • requestTimeout - time in seconds in which the request has to be completed, otherwise the status will be offline (default value 30)
  • offlineTimeUntilMajor - time in seconds a service has to be offline until it turns from partial to major outage (default value 300)

You can specify the interval (cron) your services should be checked. You can use the cron syntax from node-cron. Finally you need to provide the information to your cachet instance (api and token).

To change the default values globally you can set the in the defaults object.

Example:

{
	"cron": "0 * * * * *",
	"api": "https://<cachet-url>/api/v1",
	"token": "<user-token>",
	"services": [
		{
			"id": 1,
			"type": "HTTP",
			"url": "https://sp-codes.de",
			"performanceTimeout": 1
		},
		{
			"id": 2,
			"type": "TCP",
			"host": "sp-codes.de",
			"port": 443
		}
	],
	"defaults": {
		"retry": 1,
		"waitUntilRetry": 5,
		"performanceTimeout": 2,
		"requestTimeout": 10,
		"offlineTimeUntilMajor": 600
	}
}

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

  1. clone the repo

    git clone https://git.sp-codes.de/samuel-p/cachet-monitor.git
    
  2. install dependencies

    npm install
    
  3. run

    npm run start
    

    Important: If you want UDP checks, you need to run it as root, because nmap allows UDP scans only for root.

License

GNU GPLv3 Image

cachet-monitor is Free Software: It is licensed under GNU GPL v3 (See LICENSE for more information).