Page 1 of 1

"command type" for imported commands

Posted: Thu May 17, 2018 5:50 pm
by tyrant2424
When importing commands using the CCM "Import Config Files" tool, we find that the "command type" of the commands ends up being "misc command" type. And thus cannot be picked from the "Check command" drop-down list in services.

Is there a way to import commands with the type set to "check command"?

Re: "command type" for imported commands

Posted: Fri May 18, 2018 9:03 am
by lmiltchev
We haven't been able to recreate the issue in house. Our imported commands are always set as "check commands", not "misc". Can you show us the config that you are trying to import?

Note: Usually perfdata commands, and event handlers are set as "misc" commands.

Re: "command type" for imported commands

Posted: Mon Jun 04, 2018 4:52 pm
by rexconsulting
I've figured out how to duplicate this and how to work around it.

This is duplicable by setting up a command like this:

define command {
command_name "mycheck_nrpeversion"
command_line $USER5$/check_nrpe -A /etc/ssl/mycert.pem -D -O -H $HOSTADDRESS
}

To work around this problem, you can add a dummy ARG, like this:

define command {
command_name "mycheck_nrpeversion"
command_line $USER5$/check_nrpe -A /etc/ssl/mycert.pem -D -O -H $HOSTADDRESS $ARG1$
}

Re: "command type" for imported commands

Posted: Tue Jun 05, 2018 8:52 am
by lmiltchev
This actually makes sense. We were not able to recreate the issue as we always used args in our commands... The only way nagios can "know" this is a check command is when it has args. Not all commands have args, but most of them do anyway. So, if nagios "doesn't know" what the command is, it sets it as "misc" command. I can confirm that adding an argument, e.g. $ARG1$, fixes the issue.
Probably, this is why the example of a check command (in the GUI) is shown with args.
Example: $USER1$/check_example -H $HOSTADDRESS$ -P $ARG1$ $ARG2$
I am glad that we got to the bottom of this. :) Thanks for reporting the issue and for the feedback!

Is it all right if we locked this topic now since you have a workaround in place?

Re: "command type" for imported commands

Posted: Tue Jun 05, 2018 10:12 am
by rexconsulting
Thanks && yes you can lock this one. The workaround is fine.

CP