I'm new to PRTG but did get this going with a bit of help from Andrew Jones post on https://kb.paessler.com/en/topic/39513-is-there-a-shell-script-example-for-prtg-s-ssh-script-sensor ,
As per above. Create the folder /var/prtg/scripts
Make a new script file eg. vi query_process.sh
Add the lines below;
#!/bin/sh
pgrep $1 2>&1 1>/dev/null
if [ $? -ne 0 ]; then
echo "1:$?:$1 Down"
else
echo "0:$?:OK"
fi
Save the file and make it executable with:
chmod +x query_process.sh
If not executable, the sensor wont allow you add the script by name when adding the sensor.
Add the ssh script sensor in PRTG to the device (make sure your SSH Credentials have been set correctly)
Set the parameter field of the sensor to the process name -eg. ntpd
ps -e
will give you a list of available processes to query.
Cheers
Add comment