Gesundheit
Get notifications about unexpected system state from your local Gesundheitsdienst.
Install
Arch Linux & Debian
Arch Linux & Debian users can install gesundheit via the
gesundheit package repository.
Linux
Other Linux users can download binaries from the
releases page.
From Source
You will need a Go compiler and Node.js,
if you want to install gesundheit from source. Once you have got that, it is as easy as:
git clone https://github.com/ushis/gesundheit.git
cd gesundheit
npm install
npm run build
go build
Usage
Create a configuration file (e.g. /etc/gesundheit/gesundheit.toml
).
# /etc/gesundheit/gesundheit.toml
#
# We are going to log everything to stdout without timestamps. systemd is
# taking care of the rest.
[Log]
Path = "-"
Timestamps = false
# We love pretty dashboards. Therefore we will enable the web interface.
[Http]
Enabled = true
Listen = "127.0.0.1:8080"
# The configuration files for our modules live in
# /etc/gesundheit/modules.d/*.toml
[Modules]
Config = "modules.d/*.toml"
Create some check and handler configuration files.
# /etc/gesundheit/modules.d/check-backup.toml
#
# Our backup system touches /var/lib/backup/backup.stamp after every
# successful backup run. Lets check once every hour that the stamp has
# been touched within the last 25 hours.
[Check]
Module = "file-mtime"
Description = "Daily Backup"
Interval = "1h"
[Check.Config]
Path = "/var/lib/backup/backup.stamp"
MaxAge = "25h"
# /etc/gesundheit/modules.d/log.toml
#
# We don't trust gesundheit yet. For this reason we are going to use no
# filter and log every single check result.
[Handler]
Module = "log"
# /etc/gesundheit/modules.d/gotify.toml
#
# We need to get notified in case something is off and want to use gotify for
# that. Since people do not want to get spammed with every single check result
# we will filter for result changes (OK -> FAIL and FAIL -> OK). It is also
# important to not disturb them outside of working hours or while they are
# having lunch.
#
# Since this file contains a secret, it is important to set appropriate
# permissions.
#
# chown root:gesundheit /etc/gesundheit/modules.d/*.toml
# chmod 0640 /etc/gesundheit/modules.d/*.toml
#
[Handler]
Module = "gotify"
[Handler.Config]
Url = "https://gotify.example.com/"
Token = "secret"
[[Handler.Filter]]
Module = "result-change"
[[Handler.Filter]]
Module = "office-hours"
[Handler.Filter.Config]
Hours = [
{From = "9:00", To = "13:00"},
{From = "14:00", To = "17:00"},
]
We are ready to go.
gesundheit -conf /etc/gesundheit/gesundheit.toml
Checks
Module |
Description |
Config |
Config Description |
disk-space |
Check available disk space |
MountPoint |
Mount point of the disk to check, e.g. "/" |
MinAvailable |
Min available space considered healthy, e.g. "1G" |
dns-record |
Check DNS record |
Address |
DNS server address, e.g. "127.0.0.1:53" |
Type |
Record type, e.g. "A" |
Name |
Name to lookup, e.g. "example.com" |
Value |
Expected value, e.g. "1.1.1.1" |
exec |
Execute check command |
Command |
Command to execute, e.g.
"/usr/lib/nagios-plugins/check_load"
|
Args |
Command arguments, e.g. ["-w", "2", "-c", "3"] |
file-mtime |
Check mtime of a file |
Path |
Path to file |
MaxAge |
Max age of the file considered healthy,
e.g. "1h5m10s"
|
file-presence |
Check presence of a file |
Path |
Path to file, e.g. "/run/reboot-required" |
Present |
Whether or not presence of the file is considered healthy, e.g.
false
|
heartbeat |
Always OK |
Useful in combination with a
remote handler and a node-alive
check on the remote node
|
http-json |
Check json value in http response |
Method |
HTTP request method, e.g. "GET" |
Url |
Url used to request the json document |
Header |
HTTP request header, e.g.
{Authorization = ["Token secret"]}
|
Query |
GJSON compatible query string,
e.g. "status"
|
Value |
Expected value |
http-status |
Check status of http response |
Method |
HTTP request method, e.g. "GET" |
Url |
Url to request |
Header |
HTTP request header, e.g.
{Authorization = ["Token secret"]}
|
Status |
Status code considered healthy, e.g. 200 |
memory |
Check available memory |
MinAvailable |
Min available memory considered healthy, e.g. "1G" |
node-alive |
Check last appearance of a (remote) node |
Node |
Node to check, e.g. "proxy-01" |
MaxAbsenceTime |
Max time since last appearance considered healthy,
e.g. "1m" .
Configure heartbeat with a low interval on the remote node
if you need timely notifications about absent nodes.
|
tls-cert |
Check tls certificate |
Host |
Host to check, e.g. "example.org" |
Port |
Port to connect to, e.g. 443 |
MinTTL |
Min time until certificate expiry considered healthy,
e.g. "24h"
|
Handlers
Module |
Description |
Config |
Config Description |
amqp |
Send check results to
RabbitMQ
|
Url |
Url of the RabbitMQ server,
e.g. "amqp://guest:guest@localhost:5672"
|
Exchange |
RabbitMQ exchange name, e.g. "gesundheit" |
gotify |
Send check results to Gotify
|
Url |
Url of the Gotify server,
e.g. "https://gotify.example.org"
|
Token |
Gotify application token |
Priority |
Priority of every gotify message |
log |
Log check results |
|
|
remote |
Send check results to a remote gesundheit node |
Address |
Address of the remote node, e.g. "gesundheit.example.org:9999" |
PrivateKey |
Private key of the local node, generated
with gesundheit genkey
|
PublicKey |
Public key of the remote gesundheit node,
generated with gesundheit pubkey
|
Filters
Module |
Description |
Config |
Config Description |
result-change |
Filter changed check results |
|
|
office-hours |
Filter check results inside given time spans |
Hours |
List of time spans, e.g.
[{From = "9:00", To = "17:00"}]
|
Module |
Description |
Config |
Config Description |
amqp |
Receive check results from
RabbitMQ
|
Url |
Url of the RabbitMQ server,
e.g. "amqp://guest:guest@localhost:5672"
|
Exchange |
RabbitMQ exchange name, e.g. "gesundheit" |
Queue |
RabbitMQ queue name, e.g. "notifications" |
remote |
Receive check results from a remote gesundheit node |
Listen |
Address to listen on, e.g. "0.0.0.0:9999" |
PrivateKey |
Private key of the local node, generated
with gesundheit genkey
|
Peers |
List of peers, e.g. [{ PublicKey = "xxx" }]
|
Databases
Module |
Description |
Config |
Config Description |
filesystem |
Simple filesystem baked database suitable for most setups. |
Directory |
Database directory, e.g. "/var/lib/gesundheit" |
VacuumInterval |
Interval in which expired entries are deleted from disk,
e.g. "24h"
|
memory |
In memory database suitable for simple setups and nodes
without persistence requirements
|
|
|
redis |
Redis adapter |
Address |
Address of the redis server, e.g. 127.0.0.1:6379 |
DB |
Redis database to use, e.g. 0 |
Username |
Redis username, e.g. "gesundheit"
|
Password |
Redis password, e.g. "secret"
|