I created a bash script that SSH into another machine and gets a value and sets it to a variable and prints the variable out.
But when the command in executed by Nagios it does not print the variable.
Sudo code goes as follow:
var_used=$(SSH root@host free -m | get the used memory)
echo used $var_used
In nagios it prints out used $
I have also tried it with
var_used=2 and still get the same results.
Nagios Core Bash Command Does not return Variable
Re: Nagios Core Bash Command Does not return Variable
When you test it, are you executing it as the nagios user? This is by far the most common cause of scripts executing differently under Nagios vs. from the command line.
Re: Nagios Core Bash Command Does not return Variable
Thanks you for that information. I changed to my nagios user and allowed the nagios user to SSH into the remote linux machine and execute command without need a password. I created a RSA authorization for my linux servers.
Thanks Again.
Thanks Again.