How do i pass a Piped Linux command in ncpa -a argument
Posted: Wed Feb 10, 2021 10:55 am
Nagios XI 5.7.4
Example command : uname -a | grep Linux | wc -l
I am using a custom script which accepts a linux command as argument.
I tried many ways to pass the command as argument, but it fails.
ncpa command is like : check_ncpaXXXXX -a "uname -a | grep Linux | wc -l"
check_ncpaXXXXX -a ' "uname -a | grep Linux | wc -l" '
check_ncpaXXXXX -a " 'uname -a | grep Linux | wc -l' "
nagios passes the argument to script like this:
uname/-a/|grep/Linux /|wc/-l --> which is wrong syntax for a command to execute.
How can i modify the argument to pass the entire argument as 1 string with no modification
However on different nagiosxi 5.8.1 , it works smoothly as below:
[[email protected] ~]$ /usr/local/nagios/libexec/check_ncpa.py -H 192.168.230.150 -t 'AoOcAeHmnMKMPiuR' -P 5693 -M plugins/serviceguardchecks.sh -a ' "uname -a |grep Linux | wc -l" '
OK - Status is UP. (value =1)
Example command : uname -a | grep Linux | wc -l
I am using a custom script which accepts a linux command as argument.
I tried many ways to pass the command as argument, but it fails.
ncpa command is like : check_ncpaXXXXX -a "uname -a | grep Linux | wc -l"
check_ncpaXXXXX -a ' "uname -a | grep Linux | wc -l" '
check_ncpaXXXXX -a " 'uname -a | grep Linux | wc -l' "
nagios passes the argument to script like this:
uname/-a/|grep/Linux /|wc/-l --> which is wrong syntax for a command to execute.
How can i modify the argument to pass the entire argument as 1 string with no modification
However on different nagiosxi 5.8.1 , it works smoothly as below:
[[email protected] ~]$ /usr/local/nagios/libexec/check_ncpa.py -H 192.168.230.150 -t 'AoOcAeHmnMKMPiuR' -P 5693 -M plugins/serviceguardchecks.sh -a ' "uname -a |grep Linux | wc -l" '
OK - Status is UP. (value =1)