Hi,
I was asked to define a custom email notification for certain services. (Like "there is no new users for XX minutes")
I looked for a was to associate a notification with a service, without success.
The only way I found for customize notification it's associate custom notification with a contact group, this method seems me very ugly.
TIA,
Vitaly
How to create custom message per service?
Re: How to create custom message per service?
Notification commands are assigned to contacts, and contacts are assigned to hosts and services, so you are correct that this is the way to do it.
One other way to do it is to use event handlers instead of notifications, but that is even uglier and requires more work.
One other way to do it is to use event handlers instead of notifications, but that is even uglier and requires more work.
Former Nagios employee
Re: How to create custom message per service?
To expand a bit, why do you want to know that there are no new users for XX minutes? Is this a problem or a good thing? You could send things to Nagios Log Server and have NLS parse logs for events and then create queries that look for these sorts of strings (like new users being created). Then you could alert based on whether there are too many or too few users being created in a given timeframe.
It's a lot easier, I think.
On the other hand, I write event handlers to do all sorts of fun things and you can get pretty crazy with the cheeze whiz this way. But it's very flexible and you can basically use event handlers to usurp Nagios's notifications if you want and write your own this way.
It's a lot easier, I think.
On the other hand, I write event handlers to do all sorts of fun things and you can get pretty crazy with the cheeze whiz this way. But it's very flexible and you can basically use event handlers to usurp Nagios's notifications if you want and write your own this way.
Eric Loyd • http://everwatch.global • 844.240.EVER • @EricLoyd
I'm a Nagios Fanatic! • Join our public Nagios Discord Server!
Re: How to create custom message per service?
To expand further, this could also be done on a per-plugin basis if you know how to modify plugins, then you would just change the status output to be whatever you wanted and it would just work. Probably less painful than the event handler route, but it would require more coding knowledge.
Former Nagios employee
Re: How to create custom message per service?
To expand even more you would write a wrapper plugin that simply calls the real plugin with all the right parameters passed to it, then uses a massive sed script to change all the outputs to something else. 
Eric Loyd • http://everwatch.global • 844.240.EVER • @EricLoyd
I'm a Nagios Fanatic! • Join our public Nagios Discord Server!
Re: How to create custom message per service?
Former Nagios Employee.
me.
me.
Re: How to create custom message per service?
Dear All - thank you for your answers, they answer my question.
(To say the truth, Nagios way to associate notifications with contacts seems me really weird. IMHO, it should be associated with events/services).
But yes, from practical point of view, I have a way to do what I need.
(To say the truth, Nagios way to associate notifications with contacts seems me really weird. IMHO, it should be associated with events/services).
But yes, from practical point of view, I have a way to do what I need.
Re: How to create custom message per service?
Basically, Nagios expects that you are defining contacts (people) that want to be notified about a service. That person then can be notified in different ways, based on how and when they want to be notified (pager, email, SMS, Asterisk, pushbullet, etc).
Does that help?
Does that help?
Eric Loyd • http://everwatch.global • 844.240.EVER • @EricLoyd
I'm a Nagios Fanatic! • Join our public Nagios Discord Server!
Re: How to create custom message per service?
It can be weird at times, but it makes sense once you get used to it. This way you don't have to configure a different custom email template for every single service. We like reusability!
Former Nagios employee