The basic idea of tonto is: you write the list of IP numbers you want to monitor, and tonto does the rest.
Tonto gets a list of hosts (HOSTS variable) and pings each of them, if a host does not respond it will send and alert (to EMAIL variable), it will also notify when the host is responsive again. It will also keep a log file with this information and response times (RTT) from ping.
Additionally, if RRDTOOL is available, it will save all this information (RTT and packet loss) in an RRD database file, and create a pretty graph every 5 minutes.
-
Make sure you install all dependencies:
apt-get update apt-get install iputils-ping rrdtool git mailutils
-
Clone GIT repository
cd /opt git clone https://github.com/kastakhov/tonto.git
-
Create user for tonto service:
addgroup --system tonto adduser --system --shell /usr/sbin/nologin --home /opt/tonto --group tonto --no-create-home tonto chown -R tonto:tonto /opt/tonto
-
Create config file from sample:
cp /opt/tonto/tonto.config.sh.sample /opt/tonto/tonto.config.sh
-
Copy crontab file or systemd units to run service every one minute
5.1 crontab
cp /opt/tonto/tonto.cron.sample /etc/cron.d/tonto
5.2 systemd:
cp /opt/tonto/systemd/* /usr/lib/systemd/system/ systemctl enable --now tonto.timer
Use tonto.config.sh to configure all options, you basically need to set the dict HOSTS with the lists of hosts and its names you want to monitor, and the EMAIL address you want to get the alerts.
HOSTS=(["192.168.0.1"]="192.168.0.1")
HOSTS+=(["192.168.0.2"]="home")
HOSTS+=(["192.168.0.3"]="site")
EMAIL_TO=bob@example.com
Other options available include ping deadline, ping packet count, etc.