NRPE : Veeam Agent for Linux - RESOLVED

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
Locked
focheur91300
Posts: 3
Joined: Thu Nov 21, 2019 3:55 am

NRPE : Veeam Agent for Linux - RESOLVED

Post 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.
Last edited by focheur91300 on Fri Nov 22, 2019 3:24 am, edited 1 time in total.
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: NRPE : Veeam Agent for Linux

Post 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)
Former Nagios employee
Creator:
ahumandesign.com
enneagrams.com
focheur91300
Posts: 3
Joined: Thu Nov 21, 2019 3:55 am

Re: NRPE : Veeam Agent for Linux

Post by focheur91300 »

thank you for your comeback.

I tried adding the full path, it does not work either.
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: NRPE : Veeam Agent for Linux

Post 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
Former Nagios employee
Creator:
ahumandesign.com
enneagrams.com
focheur91300
Posts: 3
Joined: Thu Nov 21, 2019 3:55 am

Re: NRPE : Veeam Agent for Linux

Post 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}')
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: NRPE : Veeam Agent for Linux

Post 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
Former Nagios employee
Creator:
ahumandesign.com
enneagrams.com
Locked