Not able to pass brackets [] within a service check
Posted: Wed Nov 20, 2013 3:00 pm
I have a check command that I can get to work at the command line and from the service using "Test Check Command", but when it is runs normally. It appears since I have to pass brackets as part of the network interface name, some where the command format is being modified, maybe...
I first start coping a large file to create network traffic.
From the command line, note that I have output for bytes_in and bytes_out and notice the [R] is part the interface name.
When I run the "Test Check Command" from the service, I have to modify the Interface name by adding quotes around the name and additional quotes around [R]. I also see that the test automatically adds backslashes to the command. This will work. I can see network traffic.
If I don't have the syntax correct, I do not receive an error, instead I just get the input and output is zero.
Command Config
Service Config, note I do not add backslashes around "[R]"
Test output for "Test Check Command" button, note the test inserts backslashes automatically: "\[R\]"
But when I run the "Immediate test" from the active service, the service output shows no traffic, 0 MBytes. I'm not certain how to see the command output from NagiosXI at this point.
Thank you for helping!
Don
I first start coping a large file to create network traffic.
From the command line, note that I have output for bytes_in and bytes_out and notice the [R] is part the interface name.
Code: Select all
# ./check_win_net_usage.sh -H test1 -i "Intel[R] PRO_1000 MT Network Connection" -o MB
Network OK - 0 MBytes received/sec, 0 MBytes sent/sec|bytes_in=342;bytes_out=60
If I don't have the syntax correct, I do not receive an error, instead I just get the input and output is zero.
Command Config
Code: Select all
define command {
command_name check_net_traffic_win
command_line $USER1$/check_win_net_usage.sh -H $HOSTADDRESS$ -i $ARG1$ -o $ARG2$
}
Code: Select all
define service {
host_name test1
service_description Network_Traffic
use st_check_60_auto_ack__24x7
check_command check_net_traffic_win!"Intel"[R]" PRO_1000 MT Network Connection"!MB!!!!!!
register 1
}
Code: Select all
Testing check from command line...
COMMAND: /usr/local/nagios/libexec/check_win_net_usage.sh -H test1 -i "Intel"\[R\]" PRO_1000 MT Network Connection" -o MB
OUTPUT: Network OK - 0 MBytes received/sec, 0 MBytes sent/sec|bytes_in=406;bytes_out=60
Code: Select all
Network OK - 0 MBytes received/sec, 0 MBytes sent/sec
Don