Seperate service notifications
Seperate service notifications
Hello, I'm rather new to Nagios, I have seen it run, and used it before, but never managed it.
Anyway, I have a few machines that only need to be checked they are still alive. For these machines, if they don't respond (appear dead) I want a single person to be notified.
I created a Host Group called Ping_Only for these machines and have the check_Ping service pointing at that group.
but in testing, the people that are listed as contacts for the Ping service are notified, and not the person that is assigned to the machine.
Is there a way to have nagios send notifications to the Host Contact instead of the service contact??
Anyway, I have a few machines that only need to be checked they are still alive. For these machines, if they don't respond (appear dead) I want a single person to be notified.
I created a Host Group called Ping_Only for these machines and have the check_Ping service pointing at that group.
but in testing, the people that are listed as contacts for the Ping service are notified, and not the person that is assigned to the machine.
Is there a way to have nagios send notifications to the Host Contact instead of the service contact??
Everybody is somebody else’s weirdo
Re: Seperate service notifications
You can change the notification command to use the notify-host-by-email (or whatever it's called on your system) instead of the service-notify-by-email command, but you'd have to change the formatting to service-specific things instead of host-specific things.
Why not just change the contact(s) on the service(s) to be the same as on the host(s)?
Why not just change the contact(s) on the service(s) to be the same as on the host(s)?
Eric Loyd • http://everwatch.global • 844.240.EVER • @EricLoyd
I'm a Nagios Fanatic! • Join our public Nagios Discord Server!
Re: Seperate service notifications
On Server A (for example), if the C Drive is getting to full, Bob needs to be notified.Why not just change the contact(s) on the service(s) to be the same as on the host(s)?
On Server B, if the C Drive gets full, Frank needs to get notified., and for the sake of having fun, notify frank every minute. (he gets distracted easy)
Ahhhhhhh, I thought that was just for if the HOST machine was down.notify-host-by-email
So using my example above, if I understand correctly, if I set the C Drive check to:
Code: Select all
check_period 24x7
event_handler notify-host-by-email
notification_interval 5
notification_period 24x7
notification_options w,c,r
notifications_enabled 1
contacts Server_Alerts
contact_groups TEXT_GROUP
Code: Select all
active_checks_enabled 1
check_period Customer-Service-Normal-Hours
contacts Frank
notification_interval 60
while if I have it set as:
Code: Select all
check_period 24x7
event_handler notify-service-by-email
notification_interval 5
notification_period 24x7
notification_options w,c,r
notifications_enabled 1
contacts Server_Alerts
contact_groups TEXT_GROUP
Everybody is somebody else’s weirdo
Re: Seperate service notifications
Yes, but remember to look at the commands.cfg definition for those notify commands. They send different things (one is expecting to tell people about a host and one about a service).
Eric Loyd • http://everwatch.global • 844.240.EVER • @EricLoyd
I'm a Nagios Fanatic! • Join our public Nagios Discord Server!
Re: Seperate service notifications
I don't see anything special. Or am I not understanding what you are asking me to check in the commands.cfg file
Code: Select all
# 'notify-host-by-email' command definition
define command{
command_name notify-host-by-email
command_line /usr/bin/printf "%b" "***** Nagios *****\n\nNotification Type: $NOTIFICATIONTYPE$\nHost: $HOSTNAME$\nState: $HOSTSTATE$\nAddress: $HOSTADDRESS$\nInfo: $HOSTOUTPUT$\n\nDate/Time: $LONGDATETIME$\n" | /bin/mail -s "** $NOTIFICATIONTYPE$ Host Alert: $HOSTNAME$ is $HOSTSTATE$ **" $CONTACTEMAIL$
}
# 'notify-service-by-email' command definition
define command{
command_name notify-service-by-email
command_line /usr/bin/printf "%b" "***** Nagios *****\n\nNotification Type: $NOTIFICATIONTYPE$\n\nService: $SERVICEDESC$\nHost: $HOSTALIAS$\nAddress: $HOSTADDRESS$\nState: $SERVICESTATE$\n\nDate/Time: $LONGDATETIME$\n\nAdditional Info:\n\n$SERVICEOUTPUT$\n" | /bin/mail -s "** $NOTIFICATIONTYPE$ Service Alert: $HOSTALIAS$/$SERVICEDESC$ is $SERVICESTATE$ **" $CONTACTEMAIL$
}Everybody is somebody else’s weirdo
Re: Seperate service notifications
notify-host-by-email sends information that includes:
notify-service-by-email sends:Host: $HOSTNAME$\nState: $HOSTSTATE$\n
The host notification command doesn't send any service-related information because it's not designed to. So if you use this approach, you may want to just create a third command and copy "notify-service-by-email" to "notify-service-by-email-use-host-contact" and use that for the notification command so that it will use the host contact instead of the service contact.Service: $SERVICEDESC$\nHost: $HOSTALIAS$\nAddress: $HOSTADDRESS$\nState: $SERVICESTATE$
Eric Loyd • http://everwatch.global • 844.240.EVER • @EricLoyd
I'm a Nagios Fanatic! • Join our public Nagios Discord Server!
Re: Seperate service notifications
I think I understand what your saying. I will test things out and see what happens. Thank you
Everybody is somebody else’s weirdo
Re: Seperate service notifications
Good luck. I've been using Nagios for 14 years, so I sometimes forget some of the "more basic" stuff. Let me know if there's anything I glossed over that you need more help with.
Eric Loyd • http://everwatch.global • 844.240.EVER • @EricLoyd
I'm a Nagios Fanatic! • Join our public Nagios Discord Server!
Re: Seperate service notifications
well, I tried the option you suggested and that didn't really seem to make an difference, perhaps I didn't do it correctly.
But what I did, and this works (I suppose lol)
The from individual services, service templates, host templates, I remove the contact info. (Granted Nagios doesn't like that, but it deals with it)
Then for the Host config, I put the 'owner' for that server as the contact. that way that person gets notified with anything that is up with that server.
My next plan is to setup an escalation so that if Frank (or anybody else) is being too lazy to fix or acknowledge an issue, then a group of people will get notified, then after a bit another group with get notified.
At least that is what I want to do.
But what I did, and this works (I suppose lol)
The from individual services, service templates, host templates, I remove the contact info. (Granted Nagios doesn't like that, but it deals with it)
Then for the Host config, I put the 'owner' for that server as the contact. that way that person gets notified with anything that is up with that server.
My next plan is to setup an escalation so that if Frank (or anybody else) is being too lazy to fix or acknowledge an issue, then a group of people will get notified, then after a bit another group with get notified.
At least that is what I want to do.
Everybody is somebody else’s weirdo
Re: Seperate service notifications
Well that's what escalations are for, so you're on track with that. If you want to try to do more with the other issue(s), PM me and we'll talk offline.
Eric Loyd • http://everwatch.global • 844.240.EVER • @EricLoyd
I'm a Nagios Fanatic! • Join our public Nagios Discord Server!