Nagios+Nrpe如何监控其他主机

发布时间:2021-11-23 09:59:01 作者:小新
来源:亿速云 阅读:120

这篇文章给大家分享的是有关Nagios+Nrpe如何监控其他主机的内容。小编觉得挺实用的,因此分享给大家做个参考,一起跟随小编过来看看吧。

监控本机运行状态和Mysq主机

需要的包:nagios-plugins-2.1.1.tar.gz 

                  nrpe-2.15.tar.gz

服务器端:server1.example.com        172.25.254.1

新监控端:server2.example.com        172.25.254.2

实验前提:

      /etc/init.d/httpd start

/etc/init.d/nagios start

/etc/init.d/mysqld start##如果启不开的化,cd /var/lib/mysql/,然后,rm -rf mysql.sock再启动

chkconfig httpd on

chkconfig mysqld on

浏览器登陆 172.25.38.6/nagios查看服务状态

1.新监控端配置(server2)

    1.1  .tar zxf nrpe-2.15.tar.gz

       tar zxf nagios-plugins-2.1.1.tar.gz          #nagios 插件安装

       cd nagios-plugins-2.1.1

        yum install gcc -y openssl-devel mysql-devel

         useradd -M -d /usr/local/nagios nagios    ##id号不规定一定是要900,因为服务器上设置的是900,所以认为统一比较好

     1.2 ./configure --with-nagios-user=nagios --with-nagios-group=nagios

        make

        make install 

     1.3   chown nagios.nagios /usr/local/nagios

        chown -R nagios.nagios /usr/local/nagios/libexec

        yum install xinetd

     1.4 cd nrpe-2.15 

           ./configure 

           make all

           make install-plugin

           make install-daemon

           make install-daemon-config

           make install-xinetd

         cd /etc/xinetd.d/

      1.5 vim nrpe

Nagios+Nrpe如何监控其他主机

#nrpe 服务监听端口

     1.6 vim /etc/services

  加入

Nagios+Nrpe如何监控其他主机  

    1.7 cd ../etc/

         vim  nrpe.cfg   Nagios+Nrpe如何监控其他主机

#根分区监测

/etc/init.d/xinetd start

    1.8 cd /usr/local/nagios/libexec/

          scp check_nrpe root@172.25.254.1:/usr/local/nagios/libexec/

2.服务器端配置(server1)

    2.1  [root@server1 libexec]# ll check_nrpe

 -rwxr-xr-x 1 root root 76769 Jul 23 10:02 check_nrpe

   [root@server1 libexec]# chown nagios:nagios check_nrpe##更改脚本权限为nagios所有

   [root@server1 libexec]# ll check_nrpe

  -rwxr-xr-x 1 nagios nagios 76769 Jul 23 10:02 check_nrpe

    2.2  [root@server1 libexec]# ./check_nrpe -H 172.25.254.2 -c check_disk##执行脚本

  DISK OK - free space: / 5333 MB (83% inode=92%);| /=1086MB;5410;6086;0;6763

           [root@server1 libexec]# ./check_nrpe -H 172.25.254.2 -c check_load##执行脚本

  OK - load average: 0.00, 0.00, 0.00|load1=0.000;15.000;30.000;0;                                                          load5=0.000;10.000;25.000;0; load15=0.000;5.000;20.000;0; 

    2.3  cd /usr/local/nagios/etc/objects/

            vim commands.cfg

*****************************************************************************************

218 #'check_nrpe' command definition

219 define command{

220         command_name    check_nrpe

221         command_line    $USER1$/check_nrpe -H $HOSTADDRESS$ -c $ARG1$

222        

}

****************************************************************************************

    vim services.cfg

*****************************************************************************************************

117 ###########check_nrpe############################

118 define service{

119         use                              local-service      

120         host_name                       server2.example.com

121         service_description                根分区

122         check_command                  check_nrpe!check_disk

123         }

124 

125 

126 define service{

127         use                               local-service 

128         host_name                        server2.example.com

129         service_description                 登录用户数

130         check_command                   check_nrpe!check_users

131         }

*******************************************************************************************

    vim   hosts.cfg

*******************************************************************************************define host{

        use                     linux-server            ; 

        host_name               server2.example.com

        alias                   server2

        address                 172.25.254.2

        icon_p_w_picpath              switch.gif

        statusmap_p_w_picpath         switch.gd2

        2d_coords               400,100

        3d_coords               400,200,100

        }

*******************************************************************************************

    2.4 /etc/init.d/nagios reload

浏览器端刷新访问:


Nagios+Nrpe如何监控其他主机


感谢各位的阅读!关于“Nagios+Nrpe如何监控其他主机”这篇文章就分享到这里了,希望以上内容可以对大家有一定的帮助,让大家可以学到更多知识,如果觉得文章不错,可以把它分享出去让更多的人看到吧!

推荐阅读:
  1. nagios监控远端主机
  2. prometheus 监控liunx主机

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

nagios nrpe

上一篇:Python怎么爬取网站音乐素材

下一篇:c语言怎么实现含递归清场版扫雷游戏

相关阅读

您好,登录后才能下订单哦!

密码登录
登录注册
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》