This package monitors the machine using Collectd and route notifications to a remote server.
Collectd listens for notification on a well known socket: /var/run/collectd.sock
.
Notifications can be generated by Collectd thresholds, cron jobs or even external daemons like NMS.
You can trigger an alarm named testalarm
from command line:
echo -e "PUTNOTIF host=$(hostname) type=custom type_instance=testalarm severity=failure time=$(date +%s) message=\"$1 FAILURE\"" | nc -U /var/run/collectd.sock &>/dev/null
You can also resolve the above alarm:
echo -e "PUTNOTIF host=$(hostname) type=custom type_instance=testalarm severity=okay time=$(date +%s) message=\"$1 OK\"" | nc -U /var/run/collectd.sock &>/dev/null
Create a /etc/collectd.d/threshold.conf
template fragment using collectd threshold syntax. Enjoy collectd docs here https://collectd.org/documentation/manpages/collectd-threshold.5.shtml
The nethserver_alerts.py file implements a Collectd plugin. The plugin dispatches each notification to remote Dartagnan instance. If the remote Dartagnan instance is not available, the plugin will save the notifications inside a local queue and will retry to resend them later.
Plugin options (inside /etc/collectd.d/threshold.conf
):
api_url
URL where alerts will be dispatchedlk
: System IDsecret
: (optional) if set, the secret will be used as authorization tokendebug
: enable the debug, can beyes
orno
. Default tono
NMS is a python daemon which monitor the status of all services registered inside the configuration db. Each service is checked every 300 seconds, if the status of a service changes, NMS writes a notification to Collectd socket.
URL: https://my.nethserver.com/api/machine/
To configure execute:
config setprop subscription AlertsUrl https://my.nethserver.com/api/machine/ signal-event nethserver-alerts-update
URL: https://my.nethesis.it/isa
To configure execute:
config setprop subscription AlertsUrl https://my.nethesis.it/isa signal-event nethserver-alerts-update