可作为模板,已测试。

host.cfg

define contact{
        contact_name                    nagiosadmin             ; Short name of user
        use                             generic-contact         ; Inherit default values from generic-contact template (defined above)
        alias                           Nagios Admin            ; Full name of user

        email                           nagios@localhost        ; <<***** CHANGE THIS TO YOUR EMAIL ADDRESS ******
        }
define contact{
        contact_name                    ASSd           ; Short name of user
#       use                             generic-contact         ; Inherit default values from generic-contact template (defined above)
        alias                           test_contact      ; Full name of user
        service_notification_options    w,u,c,r
        host_notification_options       d,u,r
        service_notification_period     24x7
        host_notification_period        24x7
        service_notification_commands   notify-host-by-email
        host_notification_commands      notify-service-by-email
        email                           ****@163.com  ; <<***** CHANGE THIS TO YOUR EMAIL ADDRESS ******
        }



###############################################################################
###############################################################################
#
# CONTACT GROUPS
#
###############################################################################
###############################################################################

# We only have one contact in this simple configuration file, so there is
# no need to create more than one contact group.

define contactgroup{
        contactgroup_name       admins
        alias                   Nagios Administrators
        members                 nagiosadmin,shipb
        }

 

contact

 

## Host config
define hostgroup {
     hostgroup_name   shipb_host_group
     alias            test_monitor_servers
     members          WEBServer
}
define host{
        use                             linux-server
        host_name                       WEBServer
        alias                           shipb_test_host
        address                         192.168.0.16
        check_command                   check-host-alive
        max_check_attempts              5
        check_period                    24x7
        retry_interval                  1
        contact_groups                  admins
        notification_interval           10
        notification_options            d,u,r
        }
define service{
        host_name               WEBServer
        service_description     check_tcp 80
        check_period            24x7
        max_check_attempts      4
        normal_check_interval   3
        retry_check_interval    2
        contacts                 shipb
        notification_interval   10
        notification_period     24x7
        notification_options    w,u,c,r
        check_command           check_tcp!80
}
define service{
        host_name               WEBServer
        service_description     check_tcp 8080
        check_period            24x7
        max_check_attempts      4
        normal_check_interval   3
        retry_check_interval    2
        contact_groups          admins
        notification_interval   10
        notification_period     24x7
        notification_options    w,u,c,r
        check_command           check_tcp!8080
}