custom notification/event_handler in Nagios Core

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.
Locked
sudhir.gimonkar
Posts: 2
Joined: Wed May 05, 2021 12:28 pm

custom notification/event_handler in Nagios Core

Post 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
User avatar
mcapra
Posts: 3739
Joined: Thu May 05, 2016 3:54 pm

Re: custom notification/event_handler in Nagios Core

Post 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
Former Nagios employee
https://www.mcapra.com/
sudhir.gimonkar
Posts: 2
Joined: Wed May 05, 2021 12:28 pm

Re: custom notification/event_handler in Nagios Core

Post 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
snapier3
Posts: 61
Joined: Tue Apr 23, 2019 7:12 pm

Re: custom notification/event_handler in Nagios Core

Post by snapier3 »

Locked