Hi All,
I just want to confirm I am doing this properly. I am configuring Nagios with the plugins and NRPE on other nodes to do the following:
Monitor services, sent notifications and kick off scripts to repair or process the recovery.
I have the services monitoring set up for 2 (localhost and a remotehost), and notifications work properly for those services (To change the frequency, I change that in the definition of the host template I made for the box or override that in the settings made when actually configuring a host?) but to do some sort of event kick off, I currently have an event handler set up as an email script that I made
define command{
command_name email_me
command_line /usr/bin/printf "%b" " **THIS IS AN EMAIL IN RESPONSE TO A SCRIPT KICKED OFF \n\nNotification Type: $NOTIFICATIONTYPE$ Some script has been kicked off \nHost: $HOSTNAME$ To tell you that a script has been run\nState: $HOSTSTATE$ And I hope this works\nAddress: $HOSTADDRESS$\nInfo: $HOSTOUTPUT$\n\nDate/Time: $LONGDATETIME$\n" | /bin/mail -s "** $NOTIFICATIONTYPE$ Host Alert: $HOSTNAME$ is $HOSTSTATE$ **" [email protected]
}
^and that works for only a few services, but I have it in each of the define services I have set up for that box, but only a few come through...my understanding is that anything triggered will set off an event handler for anything returned back?
Also, how do I set it up so it runs some external script I have (some .sh) file or what not instead of one from Nagios?
Thanks
Notifications and Event Handlers
Re: Notifications and Event Handlers
hellooperator,
Try enabling event logging and see if there are any clues as to why some of your services are not being kicked off.
Take a look at this page which talks about enableing logging for event handlers
http://nagios.manubulon.com/traduction/ ... dlers.html
To run an external script, your command would be a NRPE command which would execute a remote script on a given system.
Regards,
-Yancy
Try enabling event logging and see if there are any clues as to why some of your services are not being kicked off.
Take a look at this page which talks about enableing logging for event handlers
http://nagios.manubulon.com/traduction/ ... dlers.html
To run an external script, your command would be a NRPE command which would execute a remote script on a given system.
Regards,
-Yancy
-
hellooperator
- Posts: 2
- Joined: Thu Aug 30, 2012 6:57 pm
Re: Notifications and Event Handlers
Is there anyway to add a button to the menu of the actions, where the status or status map button is so I can see if a node is down that I can initiate a script?
Also, if I have 5 computers on my cluster, and one goes down, I want to be able to have nagios dynamically change what it monitors on each node based on some file...so for example:
Monitor x y and z on Group A and then a b c on Group B
Group A:
Computer 1:
Group B:
Computer 2:
Computer 3:
Computer 4:
Computer 5:
If computer 1 is dead, some file will be updated on a machine and nagios can check that file when a script is kicked off and all of a sudden the landscape looks like this:
Monitor x y and z on Group A and then a b c on Group B
Group A:
Computer 2:
Group B:
Computer 3:
Computer 4:
Computer 5:
Is that possible?
Also, if I have 5 computers on my cluster, and one goes down, I want to be able to have nagios dynamically change what it monitors on each node based on some file...so for example:
Monitor x y and z on Group A and then a b c on Group B
Group A:
Computer 1:
Group B:
Computer 2:
Computer 3:
Computer 4:
Computer 5:
If computer 1 is dead, some file will be updated on a machine and nagios can check that file when a script is kicked off and all of a sudden the landscape looks like this:
Monitor x y and z on Group A and then a b c on Group B
Group A:
Computer 2:
Group B:
Computer 3:
Computer 4:
Computer 5:
Is that possible?