Since there is no official kubernetes support by PRTG, I decided to create something fast and simple by my own. It took 10 minutes to write the script and configure PRTG sensor.
1. Create shell script
touch /var/prtg/scripts/podmon.sh
2. Add the content to the script
#!/bin/bash
serviceIsRunning=false
status=$(kubectl get pods |grep elasticsearch-master-0 |awk '{print $3}')
if [ "$status" == Running ]
then
serviceIsRunning=true
echo "0:200:$status"
fi
if [ $serviceIsRunning == false ]
then
echo "2:404:$status"
fi
3. Save the script and make it executable
chmod +x podmon.sh
Try to run it
./podmon.sh
0:200:RunningGo to the PRTG, and add the SSH Script sensor to the device
In the ‘Script’ field choose podmon.sh and SAVE
Normal response will be “200 Running”
! Make sure your PRTG Server has access to Asterisk Server, if not, add root username and password to the credentials in the BASIC DEVICE SETTINGS
And here’s the result:

I also have telegram notification alerts configured in PRTG, so I get the notifications in telegram group like this:

