1.6 KiB
Simple nagios monitoring and notification scripts.
check_ircd
attempts to connect to an IRC server.
check_senderscore
checks the senderscore (a metric for whether an IP address
tends to send spam email) of an IP address.
ircbot.sh
runs as a daemon as the nagios user, connects to the configured
IRC server and channel, keeps the connection open, and relays messages from
nagios to the channel.
Setting up notify_irc
Change the configuration parameters in the script itself.
Edit your nagios commands configuration (eg
/usr/local/nagios/etc/commands.cfg
) and define a new host and service
commands that write to the file /tmp/ircmsg
. For example:
define command {
command_name notify-service-by-irc
command_line /usr/bin/printf "%b" "$NOTIFICATIONTYPE$ Service: $SERVICEDESC$ Host: $HOSTALIAS$ Address: $HOSTADDRESS$ State: $SERVICESTATE$ Additional Info: $SERVICEOUTPUT$\n" >> /tmp/ircmsg
}
define command {
command_name notify-host-by-irc
command_line /usr/bin/printf "%b" "$NOTIFICATIONTYPE$ Host: $HOSTNAME$ State: $HOSTSTATE$ Address: $HOSTADDRESS$ Info: $HOSTOUTPUT$\n" >> /tmp/ircmsg
}
Then create a contact with parameters:
service_notification_commands notify-service-by-irc
host_notification_commands notify-host-by-irc
Check that the new configuration is valid:
sudo /usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg
And then restart nagios with systemctl
or rcctl
.
Register ircbot.sh
as a service with systemd
or rc
. (TODO: write service
files for these.)