I will come to you because I have a problem with the exit when running /usr/local/nagios/libexec/check_nrpe .
I develop a plug-in that allows me to check the status of the latest veeam backup.
Code below:
Code: Select all
#!/bin/sh
copyright=$(
echo "##############################################"
echo "# NAME : NAGIOS VEEAM"
echo "# VERSION : 1.0"
echo "# AUTHOR : focheur91300"
echo "# LAST UPDATE : 20/11/2019"
echo "##############################################"
echo " "
)
clear
LANG=en_US.UTF-8
veeamlist=$(veeamconfig session list | grep "Backup" | tail -1)
veeamend=$(echo $veeamlist | awk '{print $5" "$6}')
if [ "$(echo $veeamlist | grep "Success")" != "" ]
then
echo "OK - Backup success - End: $veeamend"
exit 0
elif [ "$(echo $veeamlist | grep "Warning")" != "" ]
then
echo "WARNING - Backup warning - End: $veeamend"
exit 1
elif [ "$(echo $veeamlist | grep "Failed")" != "" ]
then
echo "CRITICAL - Backup failed - End: $veeamend"
exit 2
else
echo "UNKNOWN test"
exit 3
fi
Whether with the root user:
Code: Select all
root@bastion:/data/dev# /usr/local/nagios/libexec/nagios_veeam_custom.sh
OK - Backup success - End: 2019-11-21 00:00
Code: Select all
root@bastion:/data/dev# sudo -u nagios -H /usr/local/nagios/libexec/nagios_veeam_custom.sh
OK - Backup success - End: 2019-11-21 00:00
Code: Select all
root@nagios:~# /usr/local/nagios/libexec/check_nrpe -H 192.168.10.253 -c check_backup
UNKNOWN test
I thank you in advance.