Simple nagios monitoring scripts
This repository has been archived on 2025-03-03. You can view files and clone it, but cannot push or open issues or pull requests.
Go to file
2023-09-16 14:15:18 -07:00
services ircbot: Restart on failure, do not self-exec if running under systemd 2023-09-16 14:15:18 -07:00
check_ircd check_ircd: improve cross-POSIX-platform support 2021-11-17 20:10:44 -08:00
check_onion add a check_onion script for checking tor onions 2021-10-20 17:14:39 -07:00
check_senderscore initial commit 2020-08-26 12:45:51 -07:00
ircbot.conf.default set conf permissions correctly; change log location 2021-11-15 00:31:01 -08:00
ircbot.sh ircbot: Restart on failure, do not self-exec if running under systemd 2023-09-16 14:15:18 -07:00
Makefile ircbot: Follow standard permissions for rc service file 2023-09-16 14:12:58 -07:00
README.md set conf permissions correctly; change log location 2021-11-15 00:31:01 -08:00

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.

check_onion attempts to connect to a Tor Onion service via torsocks.

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.

Installing

To install, edit Makefile with the appropriate path to your nagios directory and run make install as root. To install the systemd service, run make systemd; for rc service (on OpenBSD), run make rc.

Setting up ircbot

Edit ircbot and change the configuration parameters as needed.

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, eg with:

     sudo /usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg

And then restart nagios with systemctl or rcctl.

If you followed the install instructions, a service file was installed for systemd or rc. Start it with systemctl start ircbot or rcctl start ircbot.

Bugs

The nagios IRC bot (ircbot.sh) does not automatically rejoin the IRC server and channel after it loses the connection.