NRPE : Veeam Agent for Linux - RESOLVED

This forum is intended for the discussion of Nagios plugin development. Feature requests, patches, bug fixes, and all types of development-related discussions are welcome!

NOTE: The SourceForge.net nagiosplug-devel mailing list has been deprecated in favor of this forum in order to expedite support and provide additional features not available on the old mailing list.

NRPE : Veeam Agent for Linux - RESOLVED

Postby focheur91300 » Thu Nov 21, 2019 4:15 am

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.
focheur91300
 
Posts: 3
Joined: Thu Nov 21, 2019 3:55 am

Re: NRPE : Veeam Agent for Linux

Postby scottwilkerson » Thu Nov 21, 2019 10:35 am

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)
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
User avatar
scottwilkerson
DevOps Engineer
 
Posts: 17032
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises

Re: NRPE : Veeam Agent for Linux

Postby focheur91300 » Thu Nov 21, 2019 11:45 am

thank you for your comeback.

I tried adding the full path, it does not work either.
focheur91300
 
Posts: 3
Joined: Thu Nov 21, 2019 3:55 am

Re: NRPE : Veeam Agent for Linux

Postby scottwilkerson » Thu Nov 21, 2019 12:42 pm

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
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
User avatar
scottwilkerson
DevOps Engineer
 
Posts: 17032
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises

Re: NRPE : Veeam Agent for Linux

Postby focheur91300 » Fri Nov 22, 2019 3:23 am

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}')
focheur91300
 
Posts: 3
Joined: Thu Nov 21, 2019 3:55 am

Re: NRPE : Veeam Agent for Linux

Postby scottwilkerson » Fri Nov 22, 2019 7:33 am

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
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
User avatar
scottwilkerson
DevOps Engineer
 
Posts: 17032
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises


Return to Nagios Plugin Development

Who is online

Users browsing this forum: Google [Bot] and 1 guest