Question about notification


#1

Hi all,

I have a nagios installed and i want to have two kind of notifications

1-Notify by Email 24/7
2-Notify by SMS (which is indeed sent through an email) from 17:00 PM to 11:00 PM PST

How can I do this ?

Thanks a lot


#2

Any help here would be greatly appreciated


#3

Any one please ?


#4

Set your hosts/services to use a contactgroup which comprises of 2 other contactgroups, one for email and one for ‘sms’, and create 2 contact objects for each recipient, one containing the normal email and using the 24x7 timeperiod for notifications (make this a member of your ‘email’ contactgroup, and the other with the ‘sms’ ‘email’ and the other timeperiod (and in the other group)… like

[blockquote]define contactgroup{
contactgroup_name alertgroup
alias Alert Group
contactgroup_members mail-alerts,sms-alerts
}
define contactgroup{
contactgroup_name mail-alerts
alias Email Group
members joebloggs-email
}
define contactgroup{
contactgroup_name sms-alerts
alias Email Group
members joebloggs-sms
}
define contact{
contact_name joebloggs-email
use generic-contact
alias Joe Bloggs Email Notifications
email joebloggs@email.com
service_notification_period 24x7
host_notification_period 24x7
}
define contact{
contact_name joebloggs-sms
use generic-contact
alias Joe Bloggs SMS Notifications
email joebloggs-sms@email.com
service_notification_period post-core-hours
host_notification_period post-core-hours
service_notification_commands notify-by-sms
host_notification_commands host-notify-by-sms
}
define timeperiod{
timeperiod_name post-core-hours
alias 5pm to 11pm, 7 Days A Week
sunday 17:00-23:00
monday 17:00-23:00
tuesday 17:00-23;00
wednesday 17:00-23:00
thursday 17:00-23:00
friday 17:00-23:00
saturday 17:00-23:00
}
[/blockquote]
Job Done


#5

Thanks a lot for the help here is my setup

[blockquote]define contactgroup{
contactgroup_name admins
alias Nagios Administrators
members nagiosadmin
}

define contactgroup{
contactgroup_name seo
alias seo
contactgroup_members sms, email alert
}

define contactgroup{
contactgroup_name sms
alias Email
members andress, javiers, cristians,
}

define contactgroup{
contactgroup_name email alert
alias Email
members tarek, andres, javier, cristian, mahmoud, majd, houssam, saeed[/blockquote]

But i’m getting this error
[blockquote]
Error: Invalid contactgroup object directive ‘contactgroup_members’.
Error: Could not add object property in file ‘/etc/nagios/contactgroups.cfg’ on line 21.[/blockquote]

Can you help please?


#6

Oh dear, you are using v2 and not v3? Nested contact groups are not supported until v3


#7

Ops, and i’ve wasted hours trying to figure out what is the problem :frowning: so is there another way to do this ?


#8

Another question please , is there an easy way to upgrade ?


#9

You could just have the 2 contact groups specified in each service/host-template I guess, but if you were able to upgrade I would suggest you do so… There is some official documentation on upgrading at nagios.sourceforge.net/docs/3_0/upgrading.html….
and according to that [blockquote]“It shouldn’t be too difficult to upgrade from Nagios 2.x to Nagios 3…” [/blockquote]
:o


#10

Thanks a lot for the help , i’m upgrading now it seems it worth doing so :wink:


#11

It wasn’t easy at all :frowning: i had to do a clean installation but now i’m getting this error

Error: Service notification command ‘notify-by-email’ specified for contact ‘andres’ is not defined anywhere!
Error: Host notification command ‘notify-by-email’ specified for contact ‘andres’ is not defined anywhere!
Error: Service notification command ‘notify-by-sms’ specified for contact ‘andresn’ is not defined anywhere!
Error: Host notification command ‘notify-by-sms’ specified for contact ‘andresn’ is not defined anywhere!


#12

Can you please help ? i did created the contact groups as you told me but now i don’t know how to use them in services , the group i use now is the “admins” which include both email and sms groups. I did also create a timeperiod for non working hours but what next ? and how can i fix the above problem.


#13

The default email notification commands in v3 are now called “notify-host-by-email” and “notify-service-by-email” for host and service alerts respectively. These are defined in commands.cfg. Either rename those or rename the references to the email notifications in your contact object definititions or template. Similarly, you will need to define your notify-by-sms command object in commands.cfg


#14

Thanks I renamed them and every thing is fine now . but how can i now define when to send SMS and when to send Email ?


#15

That’s defined through the notification period parameters in the 2 contact objects for each of your contacts (one in the email group and the other in the sms group)…
[blockquote]define contact{
contact_name joebloggs-email
use generic-contact
alias Joe Bloggs Email Notifications
email -email-
service_notification_period 24x7
host_notification_period 24x7
}
define contact{
contact_name joebloggs-sms
use generic-contact
alias Joe Bloggs SMS Notifications
email -email-
service_notification_period post-core-hours
host_notification_period post-core-hours
service_notification_commands notify-by-sms
host_notification_commands host-notify-by-sms
}
[/blockquote]
So when your host or service goes down and it notifies the ‘top-level’ group, the notifications go through to the 2 sub-groups and whether or not the members of those groups get notified depends on the time of the notification. So for our fictional Joe Bloggs character above, as his notification periods are 24x7, he will always get an email, whatever the time. Now, if the alert is at 2pm then this is outside the post-core-hours period, so he won’t get an SMS, however, if the alert is at 7pm, this falls within that time period so he will get an SMS as well. Does that make sense?


#16

Thanks a lot it makes perfect sense. I really appreciate your help and the time you’ve spent helping me.


#17

no problem, glad to help.


#18

I hate to annoy you but i do have another problem ':wink:

meulie.net/portal_plugins/fo … 12040.last

Can you please help again


#19

heh… i have to admit I was just toying with the idea of replying to that one :frowning: