How can I get an event handler to change (set) the state of a dummy host?
I have been stuck for a week trying to do something like this. Any help greatly appreciated!
Thank you very much!
Joy
capture return value from event handler?
Re: capture return value from event handler?
Well, you usually configure the output of the dummy plugin in the config. So you would have to change the config and restart nagios. You could have the event handler submit a passive check for the object instead of trying to change the dummy state.
Former Nagios employee
"It is turtles. All. The. Way. Down. . . .and maybe an elephant or two."
VI VI VI - The editor of the Beast!
Come to the Dark Side.
"It is turtles. All. The. Way. Down. . . .and maybe an elephant or two."
VI VI VI - The editor of the Beast!
Come to the Dark Side.
Re: capture return value from event handler?
Thank you for the response, but my problem is a little different ... some clarification:
We need to be able to continually change the status of a dummy host on the fly - not by shutting Nagios down and restarting - based on the status of various hosts/services that are checked within the event handler.
Joy
We need to be able to continually change the status of a dummy host on the fly - not by shutting Nagios down and restarting - based on the status of various hosts/services that are checked within the event handler.
Joy
Re: capture return value from event handler?
Gotcha. I still think the best method is to submit a passive check to set the state of the object. You can do so from the cli through the command pipe, or through an external call to the cgi with a get request. You would want to turn off freshness checking and active checks on the object so that only the passive checks will effect its state.
Former Nagios employee
"It is turtles. All. The. Way. Down. . . .and maybe an elephant or two."
VI VI VI - The editor of the Beast!
Come to the Dark Side.
"It is turtles. All. The. Way. Down. . . .and maybe an elephant or two."
VI VI VI - The editor of the Beast!
Come to the Dark Side.
Re: capture return value from event handler?
Thank you for your response. I understand, I think, that I can set the state of the dummy host via having my event handler write a PROCESS_SERVICE_CHECK_RESULT command to the nagios.cmd file. However, I do not understand your reference to a "get request". Could you please give me some more information on what you meant by that?
Thanks!
Joy
Thanks!
Joy
Re: capture return value from event handler?
The cmd.cgi can accept commands through an http get request. For example, to submit a passive check for a host, you can do a wget or curl on the following url:
Make sure to change <nagios server ip>, <hostname>, and <state id: 0,1,2> as you see fit. The url needs to be url encoded, that is why the space in the plugin_output is encoded as %20.
Code: Select all
http://<nagios server ip>/nagios/cgi-bin/cmd.cgi?cmd_typ=87&cmd_mod=2&host=<hostname>&plugin_state=<state id: 0,1,2>&plugin_output=TEST%20Output&performance_data=&btnSubmit=CommitFormer Nagios employee
"It is turtles. All. The. Way. Down. . . .and maybe an elephant or two."
VI VI VI - The editor of the Beast!
Come to the Dark Side.
"It is turtles. All. The. Way. Down. . . .and maybe an elephant or two."
VI VI VI - The editor of the Beast!
Come to the Dark Side.