nagios 监控远端服务公共数据
admin
2023-02-09 06:20:12
0


使用nagios 监控

创建监控对象配置文件 xxx.cfg

加载监控对象配置文件 nagios.cfg

重启nagios服务

登录监控页面


远端主机配置

能正常与监控服务器通信

安装监控插件

安装nrpe

定义监控命令

启动nrpe服务


被监控端


yum -y install openssl-devel

1、安装监控插件

useradd nagios

groupadd nagcmd

usermod -G nagcmd nagios

tar -zxvf nagios-plugins-1.4.14.tar.gz

cd nagios-plugins-1.4.14;

 ./configure --with-nagios-user=nagios --with-nagios-group=nagcmd  &&  make  && make  install 


2、安装nrpe

tar -zxvf nrpe-2.12.tar.gz 

cd nrpe-2.12

./configure   &&  make   &&  make  install

make install-plugin

make install-daemon

make install-daemon-config

make install-xinetd


3、定义监控命令


 vim /usr/local/nagios/etc/nrpe.cfg

command[check_users]=/usr/local/nagios/libexec/check_users -w 3 -c 5

command[check_load]=/usr/local/nagios/libexec/check_load -w 15,10,5 -c 30,25,20

command[check_sda2]=/usr/local/nagios/libexec/check_disk -w 20% -c 10% -p /dev/sda2

command[check_zombie_procs]=/usr/local/nagios/libexec/check_procs -w 5 -c 10 -s Z

command[check_total_procs]=/usr/local/nagios/libexec/check_procs -w 150 -c 200 

command[check_swap]=/usr/local/nagios/libexec/check_swap -w 40% -c 30%

4、启动nrpe服务

[root@localhost ~]# vim /etc/xinetd.d/nrpe  

        only_from       = 127.0.0.1     xxx.xxx.xxx.xxx #监控端

[root@localhost ~]# vim  /etc/services     //指定nrpe对应端口

nrpe     5666/tcp #nrpe service


5、重启服务

service xinetd restart

6、 减产nrpe 是否已经运行

cd /usr/local/nagios/libexec

./check_nrpe -H localhost





nagios服务器配置


新建远程主机的公有数据

新建监控对象文件


/usr/local/nagios/etc/objects

cp localhost.cfg s2.cfg

vim s2.cfg


define host{

        use                     linux-server            ; Name of host template to use

                                                        ; This host definition will inherit all variables that are defined

                                                        ; in (or inherited by) the linux-server host template definition.

        host_name               s2

        alias                   s2

        address                 127.0.0.1

        }




将其中的localhost 修改为s2

%s/localhost/s2/g

修改address xxx.xxx.xxx.xxx


修改主配置文件 nagios.cfg

vim /usr/local/nagios/etc/nagios.cfg


# Definitions for monitoring the local (Linux) host

cfg_file=/usr/local/nagios/etc/objects/localhost.cfg

cfg_file=/usr/local/nagios/etc/objects/s2.cfg


相关内容

热门资讯

王虹、邓煜为啥能获菲尔兹奖? 当地时间7月23日早晨,2026年国际数学家大会在美国费城开幕。国际数学联盟在开幕式上正式公布第二十...
高温津贴,不能用绿豆汤冲抵 近日,深圳市人力资源和社会保障局发布关于高温津贴的典型劳动仲裁案例,并普法提醒:即便劳动合同约定日薪...
菲律宾,你到底想干什么 中国和菲律宾关系,又出幺蛾子了。反正,最近几天,麻烦不断,场面火爆。仁爱礁,菲两艘小艇冲撞我巡逻船只...
聚焦长期价值,方舟云康以数智化... 来源:江南时报 在慢病管理领域,单纯追逐“流量”的互联网医疗模式已显疲态。当线上获客成本持续走高、用...
阿拉比卡以后喝不到了?对话云大... 搜狐科技《思想大爆炸——对话科学家》栏目第157期,对话云南大学农学院教授何飞飞。 嘉宾简介: 何飞...
微信重磅更新!超实用 7月23日,微信派发文晒微信未成年人模式,进入“未成年人模式”后,家长可为孩子设置“每日消费限额”和...
13岁少年帮聋哑舅舅卖瓜,记者... 河南13岁少年帮聋哑舅舅卖瓜走红,记者购买2万斤西瓜助农,临走时少年妈妈拉着记者表示感谢:“如果不是...
12999元起!三星首款阔折叠... 7月22日晚,三星举行 Galaxy Z8 系列折叠屏手机全球发布会,一口气带来了Galaxy Z ...
西门子抽油烟机为什么不转了 西门子抽油烟机为什么不转了1、可能是油烟机里面的电机坏掉了,或者是里面的风扇叶片上有太多的油渍,也有...
四预警齐发!台风“红霞”最新路... 今天(24日)6时,中央气象台发布高温黄色预警、暴雨蓝色预警、强对流天气蓝色预警、台风橙色预警。高温...