GithubHelp home page GithubHelp logo

samuel-p / cachet-monitor Goto Github PK

View Code? Open in Web Editor NEW
6.0 3.0 1.0 57 KB

Simple monitor to watch URLs (HTTP) or ports (TCP, UDP) and update Cachet status. (Mirror)

Home Page: https://git.sp-codes.de/samuel-p/cachet-monitor

License: GNU General Public License v3.0

Dockerfile 3.42% JavaScript 96.58%
cachet cachethq cachet-monitor monitor monitoring

cachet-monitor's Introduction

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).

cachet-monitor's People

Contributors

samuel-p avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

hugmatj

cachet-monitor's Issues

Error callback was already called

Trace: Error: Error: Callback was already called.
at process.on (/var/www/monitor/bin/cachet-monitor/node_modules/libnmap/lib/libnmap.js:116:17)
at process.emit (events.js:198:13)
at process._fatalException (internal/bootstrap/node.js:497:27)
at process.on (/var/www/monitor/bin/cachet-monitor/node_modules/libnmap/lib/libnmap.js:116:11)
at process.emit (events.js:198:13)
at process._fatalException (internal/bootstrap/node.js:497:27)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.