Nagios Reactor

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.
User avatar
lmiltchev
Former Nagios Staff
Posts: 13587
Joined: Mon May 23, 2011 12:15 pm

Re: Nagios Reactor

Post by lmiltchev »

You take an action, when a certain predefined condition evaluates to true or false. I you would like to learn more about the Nagios Reactor and what it does, I would recommend visiting: http://www.nagios.com/products/nagios-reactor

You can review the Reactor documentation here:
http://library.nagios.com/library/produ ... umentation
Be sure to check out our Knowledgebase for helpful articles and solutions!
ziedmahjoub
Posts: 142
Joined: Fri Jan 16, 2015 5:22 am

Re: Nagios Reactor

Post by ziedmahjoub »

ok i've followed the instructions and made the first event chain , but now i wanna made chains for my hosts and services in nagios core in the other server .

How can i do it ? as i can see now my nagios Reactor is not integrated with my nagios core .

Sorry for many questions and thanks a lot for help nagios team
ssax
Dreams In Code
Posts: 7682
Joined: Wed Feb 11, 2015 12:54 pm

Re: Nagios Reactor

Post by ssax »

Your service definitions need to call an event handler which will call the URL/API for Reactor so that Reactor will fire that chain.
ziedmahjoub
Posts: 142
Joined: Fri Jan 16, 2015 5:22 am

Re: Nagios Reactor

Post by ziedmahjoub »

ssax wrote:Your service definitions need to call an event handler which will call the URL/API for Reactor so that Reactor will fire that chain.
thanks ssax , its very clear , but the docs that i have seen talks about Reactor intergration with Nagios XI is there any docs that show me or at least gives me an example
of Reactor integration with Nagios Core ?

i know its the same logic as with Nagios XI but in Nagios Core we don't have the Reactor Integration menu option like in Nagios XI
ssax
Dreams In Code
Posts: 7682
Joined: Wed Feb 11, 2015 12:54 pm

Re: Nagios Reactor

Post by ssax »

There is no real integration with Nagios Core, you just setup and event handler on your service and have it call (with curl or wget) the event chain URL.

You can follow this information for event handlers:

http://nagios.sourceforge.net/docs/nagi ... dlers.html

And you can grab the URL of the event chain by going into your even chain and clicking more info (see screenshot).

When anything accesses that URL it will automatically run that event chain, so when curl or wget runs from your event handler it will run that chain.
reactor_chain.png
ziedmahjoub
Posts: 142
Joined: Fri Jan 16, 2015 5:22 am

Re: Nagios Reactor

Post by ziedmahjoub »

Hey ssax,

(sorry for my questions since i'm new to reactor ) i wanna confirm something , when you told me you just setup and event handler on your service and have it call (with curl or wget) the event chain URL , it means my service will be similar to that? :

Code: Select all

define service{
	host_name			somehost
	service_description	HTTP
	max_check_attempts		4
	event_handler		restart-httpd
	...
	}

Code: Select all

define command{
	command_name	restart-httpd

	command_line	<curl or wget of  the event chain URL>
	}
thanks
ssax
Dreams In Code
Posts: 7682
Joined: Wed Feb 11, 2015 12:54 pm

Re: Nagios Reactor

Post by ssax »

I'll give a better example here so that you can use it to run any chain that you want:

The "4" in the event handler command below is the chain you want it to run.

Code: Select all

define service{
        use                             local-service
        host_name                       localhost
        service_description             SSH
        check_command                   check_ssh
        check_interval                  1
        max_check_attempts              3
        retry_interval                  1
        event_handler                   run_chain!4
        notifications_enabled           0
        }

Code: Select all

define command{
        command_name    run_chain
        command_line    $USER1$/eventhandlers/run_chain.sh $SERVICESTATE$ $SERVICESTATETYPE$ $SERVICEATTEMPT$ $ARG1$
        }
See the attached file, read through it so you understand what is happening.

You would need to modify it to change the max_check_attempts if yours is different, make sure to change YOUR_REACTOR_IP_ADDRESS and YOUR_API_KEY.

Copy run_chain.sh to /usr/local/nagios/libexec/eventhandlers

Code: Select all

chown nagios.nagios /usr/local/nagios/libexec/eventhandlers/run_chain.sh
chmod 774 /usr/local/nagios/libexec/eventhandlers/run_chain.sh
Attachments
run_chain.zip
(1.17 KiB) Downloaded 148 times
Locked