Page 1 of 1

custom notification/event_handler in Nagios Core

Posted: Tue Jun 08, 2021 5:44 pm
by sudhir.gimonkar
Hi,

I am new to the Nagios monitoring.
I have implemented Nagios core and have following questions

1. Is there any way we can run custom event handler script on remote host using event_handler option while defining a service.
while testing it looks like script runs on local Nagios core server and not on remote host

2. Also any ways to add custom notification in contacts instead of email
The intention is to run custom script instead of sending mail using email option in contacts

Re: custom notification/event_handler in Nagios Core

Posted: Wed Jun 09, 2021 12:55 pm
by mcapra
sudhir.gimonkar wrote:1. Is there any way we can run custom event handler script on remote host using event_handler option while defining a service.
while testing it looks like script runs on local Nagios core server and not on remote host
Your understanding is correct; Out-of-the-box, Nagios Core runs every command (event handlers included) local to the Nagios Core daemon.

You certainly could leverage a command definition that executes something on a separate system via NRPE, NCPA, or SSH. You'd be leveraging a Nagios Plugin to handle that remote communication in every case -- check_nrpe, check_ncpa, check_by_ssh, etc. Nagios Core doesn't manage remote connections by itself.

sudhir.gimonkar wrote:2. Also any ways to add custom notification in contacts instead of email
The intention is to run custom script instead of sending mail using email option in contacts
You can set any arbitrary number of addressn values in your contact definition:
https://assets.nagios.com/downloads/nag ... ml#contact

And reference them in your notification handler using the $CONTACTADDRESSn$ macro:
https://assets.nagios.com/downloads/nag ... actaddress

Re: custom notification/event_handler in Nagios Core

Posted: Wed Jun 09, 2021 2:59 pm
by sudhir.gimonkar
Thanks mcapra for your response

Do you need define similar to below in service defination ? I use ping which has related plugin in /usr/local/ncpa/plugins on remote server ?

check_command check_ncpa!-t '' -P 5693 -M 'plugins/check_ping/-H <remote hostname> -a <arguments>'

Also for the comment below I not quite sure how to add the defination. If you could you please give me some example that would be really helpful

You can set any arbitrary number of addressn values in your contact definition:
https://assets.nagios.com/downloads/nag ... ml#contact

And reference them in your notification handler using the $CONTACTADDRESSn$ macro:
https://assets.nagios.com/downloads/nag ... actaddress

Again thanks for you help

Re: custom notification/event_handler in Nagios Core

Posted: Tue Jun 22, 2021 3:23 pm
by snapier3