Siteping is a tiny bash script for monitoring hosts, it notifies you when a host is unavailable. The notification is using the Telegram-Bot API. Before you can use it, create your personal Telegam-Bot token.
More information: https://core.telegram.org/bots
- Install it on your Raspberry PI or your preferred Linux operating system.
- Copy the scripts into YOUR_HOME_DIR (or elsewhere) be sure that the directory is writable.
- Grant execution rights to both scripts
sudo chmod 755 siteping.sh
sudo chmod 755 tpush.sh
- Edit tpush.sh and replace YOUR_TOKEN with your Telegram-Bot token.
- Edit siteping.sh and add new host names or change the existing host names for your needs. Don't remove the default counter value 1 at the end of each host name. If you do not want to receive a notification every hour, change the default counter value to 5
- Add siteping.sh as cronjob to run as background process. Edit the crontab
sudo crontab -e
- Add these lines and save your crontab
@reboot /YOUR_HOME_DIR/siteping.sh &
0 * * * * /YOUR_HOME_DIR/siteping.sh &
- Test the notification script, go to your home dir an run the tpush.sh script
cd /YOUR_HOME_DIR
./tpush.sh "hello world"
- If your Telegram app does not receive your message, check the above steps again.
Default setting of siteping.sh
count=5 (Sends a notification every 60 seconds 5 times when a host is down or unavailable.)
interval=60 (Checks the host list every 60 seconds)
timeout=1 (ping timeout 1 second)