I've made a mainscript and a subscript that must be implemented in NAGIOS.
What do those scripts do, well:
the mainscript makes connection to a remote server, then it copies another script (=subscript) to it and executes it, then the result of that subscript is redirected to a variable on the local server where the mainscript can do something with it (e.g. if the variable contains a 1 -> OK, 2 -> WARNING, ...)
# Initiliaze variables
# Copying a file to the remote server
# Then executing the script I just copied
scp /folder/scriptname user@host:/home/vusbe
VAR=$(ssh user@host './scp_cd.sh')
if [ $VAR = 2 ]; then
elif [ $VAR = 1 ]; then
echo niks aan de hand
# End of script
echo script is finished
the result (NAGIOS):
error=`ls /some/folder/ | grep error* | wc -w`
if [ $error -gt 0 ]; then
i="2" # ERROR MESSAGE
i="0" # OK MESSAGE
niks aan de hand
script is finished
but it should give me the STATE_ERROR !!
so, can anyone say what i'm doing wrong (i'm not experienced with NAGIOS, i'm a first-timer to this
is it also possible to copy another script in a NAGIOS plugin?
I know it's a lot of information/code and it can be a little tricky to answer, but i hope you guys are up for the challenge