nagos服务配置记录(有图有文本,只是做一个概览备忘,不是细致的)

服务器端(IP:124.172.223.141):

因为服务器自己也要监控本地,所以也要安装nrpe(被监控),plugins插件则是规定服务器可以监控哪些服务和主机


设置需要监控什么


可以添加哪些服务或主机被监控

[root@bogon objects]# cat /usr/local/nagios/etc/objects/linux.cfg
define host{
           use             linux-server
          host_name        124.172.223.141
          alias            124.172.223.141
          address        124.172.223.141
        }
define service{
        use                      generic-service
        host_name             124.172.223.141
        service_description     check-swap
        check_command        check_nrpe!check_swap
        contact_groups                   system
               }
define service{
        use                      generic-service
        host_name             124.172.223.141
        service_description     check-load
       check_command         check_nrpe!check_load
       contact_groups                   system
               }
define service{
        use                      generic-service
        host_name             124.172.223.141
       service_description     check-disk
       check_command        check_nrpe!check_df
       contact_groups                   system
                   }
define service{
        use                      generic-service
        host_name             124.172.223.141
       service_description     check-users
       check_command        check_nrpe!check_users
       contact_groups                   system
               }
define service{
        use                    generic-service
        host_name           124.172.223.141
        service_description  otal_procs
        check_command     check_nrpe!check_total_procs
        notifications_enabled            1
        contact_groups                   system
}

define service{
        use                    generic-service
        host_name            124.172.223.141
        service_description  check_mysql
        check_command     check_nrpe!check_mysql
        action_url           /pnp4nagios/index.php/graph?host=$HOSTNAME$&srv=$SERVICEDESC$' class='tips' rel='/pnp4nagios/index.php/popup?host=$HOSTNAME$&srv=$SERVICEDESC$    
        contact_groups                   system
}

define service{
use                          generic-service
host_name                     124.172.223.141
service_description 05. The Nginx Status
check_command check_nrpe!check_nginx
 notifications_enabled            1
        contact_groups                   system
}


define service{
        use                      generic-service
        host_name             124.172.223.141
        service_description     check-ping
        check_command        check_nrpe!check_ping
        contact_groups                   system
               }

###########################################################################


define host{
           use             linux-server
          host_name        124.172.223.142
          alias            124.172.223.142
          address          124.172.223.142
        }
define service{
        use                      generic-service
        host_name             124.172.223.142
        service_description     check-swap
        check_command        check_nrpe!check_swap
        contact_groups                   system
               }
define service{
        use                      generic-service
        host_name             124.172.223.142
        service_description     check-load
       check_command         check_nrpe!check_load
        contact_groups                   system
               }
define service{
        use                      generic-service
        host_name             124.172.223.142
       service_description     check-disk
       check_command        check_nrpe!check_df
       contact_groups                   system
                   }
define service{
        use                      generic-service
        host_name             124.172.223.142
       service_description     check-users
       check_command        check_nrpe!check_users
       contact_groups                   system
               }
define service{
        use                            generic-service
        host_name                      124.172.223.142
        service_description            otal_procs
        check_command                  check_nrpe!check_total_procs
        contact_groups                   system
        notifications_enabled            1
}



define service{
use                          generic-service
host_name                     124.172.223.142
service_description 05. The Nginx Status
check_command check_nrpe!check_nginx
 notifications_enabled            1
        contact_groups                   system
}

define service{
        use                    generic-service
        host_name            124.172.223.142
        service_description  check_mysql
        check_command     check_nrpe!check_mysql
    #    action_url           /pnp4nagios/index.php/graph?host=$HOSTNAME$&srv=$SERVICEDESC$' class='tips' rel='/pnp4nagios/index.php/popup?host=$HOSTNAME$&srv=$SERVICED
#ESC$
        contact_groups                   system
}

define service{
        use                      generic-service
        host_name             124.172.223.142
        service_description     check-ping
        check_command        check_nrpe!check_ping
        contact_groups                   system
               }
[root@bogon objects]# 


联系人设置,即接受警告的管理人员或组


[root@bogon objects]# cat contacts.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 contactgroup{
        contactgroup_name       admins
        alias                   Nagios Administrators
        members                 nagiosadmin
        }





#######################################################################################
#######################################################################################
##############   SYSTEM ADMINISTRATOR MEMBERS
#######################################################################################
#######################################################################################

define contact{
        contact_name                        li1
        use                                        generic-contact
        alias                                       li1
        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
        host_notification_commands      notify-host-by-email
        email                                       15218402325@139.com
        }

define contact{
        contact_name                           li2
        use                                          generic-contact
        alias                                         li2
        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
        host_notification_commands      notify-host-by-email
        email                                          15218402325@163.com
        }




#######################################################################################
#######################################################################################
##############   SYSTEM ADMINISTRATOR GROUP
#######################################################################################
#######################################################################################
define contactgroup{
        contactgroup_name              system
        alias                                     system
        members                              li1,li2
        }
[root@bogon objects]# 


客户端 (linux客户端也就一个nrpe,这里主要说的是linux)

IP:124.172.223.142



被监控是这么简单


服务器监控本地和客户端的一个截图







  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值