Customcontact-创新互联

Modify the command file:
# vi /etc/nagios/objects/commands.cfg

创新互联公司专注于网站建设|成都网站维护|优化|托管以及网络推广,积累了大量的网站设计与制作经验,为许多企业提供了网站定制设计服务,案例作品覆盖房屋鉴定等行业。能根据企业所处的行业与销售的产品,结合品牌形象的塑造,量身制作品质网站。
# 'notify-host-by-email' command definition
define command{
    command_name      notify-host-by-email
    command_line      /usr/bin/printf "\nHost: $HOSTADDRESS$\nInfo: $HOSTOUTPUT$\n\nDate/Time\n" | /bin/mail -s "$NOTIFICATIONTYPE$ Host Alert: $HOSTNAME$ is $HO
STSTATE$" $CONTACTEMAIL$
    }
# 'notify-service-by-email' command definition
define command{
    command_name      notify-service-by-email
    command_line      /usr/bin/printf "\nHost: $HOSTADDRESS$\nInfo: $SERVICEOUTPUT$\n\nDate/Time\n" | /bin/mail -s "$NOTIFICATIONTYPE$ Service Alert: $SERVICEDES
C$ is $SERVICESTATE$" $CONTACTEMAIL$
    }

Modify the template file:
# vi /etc/nagios/objects/templates.cfg

define contact{
    name                           generic-contact         ;The name of this contact template
    service_notification_period    24x7
    host_notification_period       24x7
    service_notification_options  w,u,c,r,f,s
    host_notification_options      d,u,r,f,s
    service_notification_commands  notify-service-by-email ;send service notifications via email
    host_notification_commands     notify-host-by-email    ;send host notifications via email
    register                       0                       ;DONT REGISTER THIS DEFINITION - ITS NOT A REAL CONTACT, JUST A TEMPLATE!
    }

Modify the contact file:
# vi /etc/nagios/objects/contacts.cfg

define contact{
    contact_name                   test1              ; Short name of user
    use                            generic-contact
    alias                          network Admin      ; Full name of user
    host_notifications_enabled     1
    service_notifications_enabled  1
    host_notification_period       24x7
    service_notification_period    24x7
    host_notification_options      d,u,r
    service_notification_options  w,u,c,r
    host_notification_commands     notify-host-by-email
    service_notification_commands  notify-service-by-email
    email                          test@163.com
    }
define contact{
    contact_name                   test2              ; Short name of user
    use                            generic-contact
    alias                          network Admin      ; Full name of user
    host_notifications_enabled     1
    service_notifications_enabled  1
    email                          test2@localhost.localdomain
    }
define contact{
    contact_name                   test3              ; Short name of user
    use                            generic-contact
    alias                          system Admin       ; Full name of user
    host_notifications_enabled     1
    service_notifications_enabled  1
    host_notification_period       24x7
    service_notification_period    24x7
    host_notification_options      d,u,r
    service_notification_options  w,u,c,r
    host_notification_commands     notify-host-by-email
    service_notification_commands  notify-service-by-email
    email                          464165559@qq.com
    }
define contactgroup{
    contactgroup_name    Network
    alias                Network Administrators
    members              test1,test2
    }
define contactgroup{
    contactgroup_name    System
    alias                System Administrators
    members              test3
    }

Modify the hosts file to be monitored:
# vi /etc/nagios/Linuxhosts/localhost.cfg

define service{
    use                       local-service,srv-pnp  ; Name of service template to use
    host_name                 Monitor
    service_description       Root Partition
    check_command             check_local_disk!60%!90%!/dev/sda2
    contacts                  test3
    contact_groups            Network
    }

Grammar Checker&&Restart:
# /usr/local/nagios/bin/nagios -v /etc/nagios/nagios.cfg
# service nagios restart

另外有需要云服务器可以了解下创新互联scvps.cn,海内外云服务器15元起步,三天无理由+7*72小时售后在线,公司持有idc许可证,提供“云服务器、裸金属服务器、高防服务器、香港服务器、美国服务器、虚拟主机、免备案服务器”等云主机租用服务以及企业上云的综合解决方案,具有“安全稳定、简单易用、服务可用性高、性价比高”等特点与优势,专为企业上云打造定制,能够满足用户丰富、多元化的应用场景需求。


网站题目:Customcontact-创新互联
本文来源:http://cdiso.cn/article/ejoei.html

其他资讯