nagios安装配置(三):nrpe配置
1. 配置nrpe.cfg
vi/usr/local/nagios/etc/nrpe.cfg #设置监听地址 server_address=x.x.x.x allowed_hosts=x.x.x.x
server_address:为本机服务器的IP,一般为内网IP
allowed_hosts:允许连接本服务器进行监控的IP,可以添加多个,用逗号隔开
2. 添加需要监控的服务
以下的代码都添加在command[check_...]下方,根据需要进行添加
a. 磁盘
command[check_disk]=/usr/local/nagios/libexec/check_disk-w20%-c10%-ppartition-ppartition...
patition:磁盘分区,可以是分区挂载的名字,可以添加多个
b. mysql
command[check_mysql]=/usr/local/nagios/libexec/check_mysql-Hhostip-unagios-ppassword-dnagios-s/tmp/mysql.sock
hostip替换为mysql监听的ip,同时需要用以下命令添加一个nagios监控使用的数据库:
mysql-uroot-p >createdatabasenagios; #将hostip替换为相应的主机ip,将password替换为将要访问的密码 >grantallonnagios.*tonagios@‘hostip’identifiedby‘password’
注意:一般我会默认使用配置文件中自带的:command[check_users]、command[check_load]、command[check_ zombie_procs];
3. 启动nrpe
servicenrpestart
查看服务是否正常运行:
netstat-tlnp|grep"5666" tcp00192.168.2.11:56660.0.0.0:*LISTEN3990/nrpe
nrpe服务运行在端口5666
声明:本站所有文章资源内容,如无特殊说明或标注,均为采集网络资源。如若本站内容侵犯了原著者的合法权益,可联系本站删除。