Good evening folks,
I'm trying to read the build version of an in-house built software from several remote servers and display it on Nagios
The script runs perfectly on the command line but on Nagios I'm getting this error message:
"(No output on stdout) stderr: execvp(/usr/local/nagios/libexec/chk_prg_version, ...) failed. errno is 2: No such file or directory"
Here's my script (without the original data, which is sensitive needless to say)
#!/bin/bash
#copy the file to local temp and rename it for uniqueness
sshpass -f "password" scp -r user@serverName://FileLocation/FileName /tmp/storenumber
#Scan the file and grep anything after the string Program-Version:
pversion=$(grep "Program-Version:" /tmp/MFileName | sed 's/^.*: //')
#nagios checks
if [ if the pversion matches the latest release version ]
then
echo "OK - $pversion"
exit 0
elif [ if the pversion is any of the previous releases ]
then
echo "warning error message"
exit 1
elif [ if returns a value that doesn't match any release ]
then
echo "critical error message"
exit 2
else
echo "uknown"
exit 3
fi
#delete the file
rm /tmp/storenumber
I was able to figure out the answer: the command had a typo that reads the plugin. It's working absolutely fine now.