Page 1 of 1

NRPE : Veeam Agent for Linux - RESOLVED

Posted: Thu Nov 21, 2019 4:15 am
by focheur91300
Hello to the community,

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
On the host machine the script works fine.

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
Or nagios:

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
On the other hand, as soon as I execute on the server, I leave inevitably in UNKNOWN (exit 3) of the script.

Code: Select all

root@nagios:~# /usr/local/nagios/libexec/check_nrpe -H 192.168.10.253 -c check_backup
UNKNOWN test
I can not seem to find where the problem.
I thank you in advance.

Re: NRPE : Veeam Agent for Linux

Posted: Thu Nov 21, 2019 10:35 am
by scottwilkerson
My guess is you need to provide the full path to veeamconfig, changing this line

Code: Select all

veeamlist=$(veeamconfig session list | grep "Backup" | tail -1)
to

Code: Select all

veeamlist=$(/full/path/to/veeamconfig session list | grep "Backup" | tail -1)

Re: NRPE : Veeam Agent for Linux

Posted: Thu Nov 21, 2019 11:45 am
by focheur91300
thank you for your comeback.

I tried adding the full path, it does not work either.

Re: NRPE : Veeam Agent for Linux

Posted: Thu Nov 21, 2019 12:42 pm
by scottwilkerson
Can you run the following on the remote system and show the output

Code: Select all

su nagios
veeamconfig session list | grep "Backup" | tail -1

Re: NRPE : Veeam Agent for Linux

Posted: Fri Nov 22, 2019 3:23 am
by focheur91300
I found a solution through the agent logs.

Code: Select all

date=$(date +"%d.%m.%Y")

veeamlist=$(cat /var/log/veeam/Backup/*/*/* | grep "JOB STATUS" | grep "$date")
veeamend=$(echo $veeamlist | awk '{print $2}' | awk -F "]" '{print $1}')

Re: NRPE : Veeam Agent for Linux

Posted: Fri Nov 22, 2019 7:33 am
by scottwilkerson
focheur91300 wrote:I found a solution through the agent logs.

Code: Select all

date=$(date +"%d.%m.%Y")

veeamlist=$(cat /var/log/veeam/Backup/*/*/* | grep "JOB STATUS" | grep "$date")
veeamend=$(echo $veeamlist | awk '{print $2}' | awk -F "]" '{print $1}')
Great! Glad to hear it is resolved!

Locking thread