Resource icon

Pushover Process Monitor

There are currently 2 add-ons that work with Pushover and XenForo, but Pushover itself supports various different languages.

Pushover: Simple Notifications for Android, iOS, and Desktop

So, I wrote my own little bash script to use their API to monitor the key services on my server, and alert me if they go down.

First, create a list of the processes running
Code:
/usr/local/sbin/nginx
/usr/sbin/mysqld
/usr/local/etc/php-fpm.conf
/usr/local/bin/memcached
/usr/bin/java

Then, the bash script:
Bash:
#!/bin/bash

echo "Checking all processes are running....";

for i in `/bin/cat /root/scripts/process_list.txt`

do

if
[ $(ps aux | grep -e "$i" | grep -v grep | wc -l | tr -s "\n") -eq 0 ];

then
        printf "$i is down.....oh dear!!!\n";
        curl -s \
        -F "token=YOURAPITOKEN" \
        -F "user=YOURDEVICEID" \
        -F "message=$i is down.....oh dear!!!" \
        -F "priority=1"\
        https://api.pushover.net/1/messages.json

else

        printf "$i running\n";

fi

done
This then sends the alert out to my phone, makes it RED, and bypass the "quiet time" settings.

photo 1.PNG photo 2.PNG
Requirements
Pushover Account along with the Pushover App
  • Like
Reactions: Liam W
Author
Matt
Views
841
First release
Last update
Rating
0.00 star(s) 0 ratings

More resources from Matt

Back
Top