Nagios has quite a complex notification system. It can notify network admins of problems using a large variety of methods, such as emails, pagers, IM and so on.
In this quick guide I note the procedure I followed to send email notifications to testlab network admins.
1. Installed the postfix package as described in the nagios ubuntu quickstart guide, and changed the command path as described in the same article (section 9)
2. Double-checked and went over the generic-contact template in templates.cfg in the objects directory. Almost all default contacts inherit the attributes of this template hence why the double-check
One thing of note is the notification_options. These take the form of single letter flags such as d,u,w,c and so on. They are fully explained in the template section of the nagios documentation here, but basicallythese flags determine for which events the contact should be notified. For example, d = down, w = warning, c = critical
3. Defined individual contacts in contacts.cfg (its easy, just copied the default template that already exists in there and modified this to what I needed)
4. Grouped the contacts into different groups for easier management. this is done in the same file, contacts.cfg, and all that’s really needed is to add the correct contact_name to the members option
5. Attach contact_groups to the specific hosts / services. This is done in hosts.cfg or services.cfg, and involves simply adding contact_groups to the definition.
Just wanted to note one last thing. The more “specific” contacts over-ride the contacts defined in the templates. Let me try illustrate.
Let’s say you defined a SonicWALL firewall under switches.cfg, along with a service. The service by default inherits the generic-service from the templates.cfg. Now again by default generic-service has the admins group defined as a contact. If we wish to over-ride this, we simply put a contact_groups clause directly in the sonicwall service in switches.cfg. This group will be used over the one defined in the template.cfg.