Network monitoring: Nagios

The templates

by ross at 09:14:30 on December 29, 2011

Edit objects/templates.cfg:

Find freebsd-server definition and change:

  • notification_period from workhours to 24x7
  • notification_interval from 120 to 30 or whatever interval you prefer.
  • Add hostgroups freebsd-servers line before register 0.

Find windows-server definition and change:

  • notification_options from d,r to d,u,r

Add linux-server template:

define host{
        name                    linux-server    ; The name of this host template
        use                     generic-host    ; Inherit default values from the generic-host template
        check_period            24x7            ; By default, Linux servers are monitored round the clock
        check_interval          5               ; Actively check the server every 5 minutes
        retry_interval          1               ; Schedule host check retries at 1 minute intervals
        max_check_attempts      10              ; Check each server 10 times (max)
        check_command           check-host-alive        ; Default command to check if servers are "alive"
        notification_period     24x7            ; Send notification out at any time - day or night
        notification_interval   30              ; Resend notifications every 30 minutes
        notification_options    d,u,r           ; Only send notifications for specific host states
        contact_groups          admins          ; Notifications get sent to the admins by default
        hostgroups              linux-servers   ; Host groups that Linux servers should be a member of
        register                0               ; DONT REGISTER THIS - ITS JUST A TEMPLATE
        }

Add device template:

define host{
        name                    device          ; The name of this host template
        use                     generic-host    ; Inherit default values from the generic-host template
        check_period            24x7            ; By default, devices are monitored round the clock
        check_interval          5               ; Actively check the printer every 5 minutes
        retry_interval          1               ; Schedule host check retries at 1 minute intervals
        max_check_attempts      10              ; Check each printer 10 times (max)
        check_command           check-host-alive        ; Default command to check if devices are "alive"
        notification_period     workhours       ; Send notification out at any time - day or night
        notification_interval   30              ; Resend notifications every 30 minutes
        notification_options    d,u,r           ; Only send notifications for specific host states
        contact_groups          admins          ; Notifications get sent to the admins by default
        hostgroups              devices         ; Host groups that devices should be a member of
        register                0               ; DONT REGISTER THIS - ITS JUST A TEMPLATE
        }

There are generic-printer and generic-switch templates — I use device template instead. As you can see devices are monitored 24x7. You might want to change notification_period to workhours.

Of course you can adjust options as you see fit. Refer to this document.

 

Comments