Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
I'm trying to create define service and want to use the "check_tcp" command and I can execute the command like this and it works. I used -h to get the help.
However, I'm not sure how to find the proper syntax & format when I'm trying to define it in the service for the "check_command".
My command syntax doesn't work in the below snipet, but how & where do I find the proper syntax? thanks, ik.
# Define a service to check TCP on the remote machine.
define service{
use local-service ; Name of service template to use
host_name infor1
service_description tcp
check_command check_tcp! -f ok -I 192.168.1.100 -p 80
notifications_enabled 0
}
We'll also need to see the section of your "commands.cfg" that shows the check_tcp command. The "check_command" directive is really just a bunch of fields that go into the template defined by the command called "check_tcp" inside of commands.cfg, so the "fields" have to match.
Please post the appropriate section of your commands.cfg so we can check that out.
# Define a service to check TCP on the remote machine.
define service{
use local-service ; Name of service template to use
host_name iis-server1
service_description tcp
check_command check_tcp!-H 192.168.9.100 -p 80
notifications_enabled 0
}
# Define a service to check TCP on the remote machine.
define service{
use local-service ; Name of service template to use
host_name localhost
service_description tcp
check_command check_tcp!-H 192.168.4.125 -p 80
notifications_enabled 0
}
define service{
use local-service ; Name of service template to use
host_name iis-server1
service_description tcp
check_command check_tcp!-H 192.168.9.100 -p 80
notifications_enabled 0
}
define service{
use local-service ; Name of service template to use
host_name iis-server1
service_description tcp
check_command check_tcp! 80
notifications_enabled 0
}
I'm guessing maybe that yours appears to be working until the next check?
So even if I refer to the content of commands.cfg, this doesn't show me how the syntax works and I'm looking to find out if there is one.
As an example, ! is part of the syntax, but I don't see any where this should be part of the config format.
Mine actually still works after 1 day. The article eloyd posted is where you will find the syntax of !
If you want to pass arguments to commands during runtime, you can use $ARGn$ macros in the command_line directive of the command definition and then separate individual arguments from the command name (and from each other) using bang (!) characters in the object definition directive (host check command, service event handler command, etc) that references the command. More information on how arguments in command definitions are processed during runtime can be found in the documentation on macros.