Does anyone know how to configure Nagios to page for Critical events and only email for Warning events?
Make two separate contact definitions for email and pager. In contact definition for pager put notification_options for Critical, and in the contact definition for e-mail put the notification_options for Warning.
Do you put this in contacts.cfg? I am trying to find an example of the syntax without much luck. Also, do you have to create different contact group names for each? We have 4 main contact groups currently, so does this mean I would have to create 4 more?
[blockquote]Do you put this in contacts.cfg?[/blockquote]
You can put it in any file as long as those configuration files are defined in nagios.cfg. At the beginning of the nagios.cfg you can find
# OBJECT CONFIGURATION FILE(S) part of the file where you can define every .cfg file separately, like this (there is also an example in the file):
or just set the directory containing all of your .cfg files (which is much more simple thing to do), like this:
(in this case, you have to hold all of your configuration files in that directory).
Then add any configuration file (which you can also create on your own), but be careful to set the file permissions so nagios user could read them.
You are free to use both options as well, but it is advisable for you to use only one of those, until you get familiar with Nagios. If you will use cfg_dir, then comment out (#) those cfg_file lines in nagios.cfg. If you would like to use cfg_file, then comment out (#) the cfg_dir
[blockquote]I am trying to find an example of the syntax without much luck.[/blockquote]
nagios.sourceforge.net/docs/3_0/ … ml#contact
I will now write the example of how you can do what I’ve meant, but I would strongly suggest you to read the documentation of Nagios which explains everything very well.
First, define two separate contacts, one for email with notification_options you wish (I’ve put Warning and Recovery here), and second one for pager (with Critical and Recovery options). I have left the host-notify options in default values (Down, Unreachable, Recovery) in both definitions, so you can specify them to follow your needs.
Then make contactgroup definition:
This way both contacts are in the same group, but the contact definition of each contact have it’s own setting which notifications should be sent to those.
And then use that group as contact_group variable in your host/service definitions.