custom notification/event_handler in Nagios Core

Engage with the community of users including those using the open source solutions.
Includes Nagios Core, Plugins, and NCPA

custom notification/event_handler in Nagios Core

Postby sudhir.gimonkar » Tue Jun 08, 2021 5:44 pm

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

Re: custom notification/event_handler in Nagios Core

Postby mcapra » Wed Jun 09, 2021 12:55 pm

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

Re: custom notification/event_handler in Nagios Core

Postby sudhir.gimonkar » Wed Jun 09, 2021 2:59 pm

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

Re: custom notification/event_handler in Nagios Core

Postby snapier3 » Tue Jun 22, 2021 3:23 pm

snapier3
 
Posts: 28
Joined: Tue Apr 23, 2019 7:12 pm


Return to Community Support

Who is online

Users browsing this forum: No registered users and 32 guests