博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
nagios客户端安装设置
阅读量:6861 次
发布时间:2019-06-26

本文共 2780 字,大约阅读时间需要 9 分钟。

下载安装包

cd /opt

wget
wget

安装依赖包

yum install -y gcc glibc make cmake glibc-common gd gd-devel php perl-devel mysql-server

编译安装nagios-plugins

cd /opt/nagios-plugins-2.1.2

./configure --prefix=/usr/local/nagios
make && make install && echo $?

编译安装nrpe

cd /opt/nrpe-3.2.1

./configure --prefix=/usr/local/nagios --enable-command-args
make all
#添加nagios用户
make install-groups-users
#安装
make install
#添加主配置文件
make install-config
#配置xinetd
make install-inetd
#设置nrpe管理命令
make install-init
#编译插件
make check_nrpe
#安装插件
make install-plugin

配置

#先备份

cp /usr/local/nagios/etc/nrpe.cfg{,.bak}
#修改配置文件
vim /usr/local/nagios/etc/nrpe.cfg
#将hda1改为sda1

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

启动nrpe

/usr/local/nagios/bin/nrpe -c /usr/local/nagios/etc/nrpe.cfg -d

服务器端

#生成配置文件(建议cp原因的配置文件进行修改)(这里以test命名,建议用主机名命名)

cd /usr/local/nagios/etc/servers/
vim test.cfg

## HOST  DEFINITION#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               test #客户端主机名        alias                   test        address                 客户端IP地址        }## HOST GROUP DEFINITION#               define hostgroup{        hostgroup_name  test; The name of the hostgroup        alias           test; Long name of the group        members         test     ; Comma separated list of hosts that belong to this group        }## service DEFINITION#                   define service{        use                             local-service         ; Name of service template to use        host_name                       test        service_description             Root Partition        check_command                   check_local_disk!20%!10%!/        }               define service{        use                             local-service         ; Name of service template to use        host_name                       study        service_description             Root Partition        check_command                   check_local_disk!20%!10%!/        }                               ......

重新读取配置文件

systemctl reload nagios

notifications_enabled

notifications_enabled允许报警,1表示允许,0表示不允许

在nagios中enable_notifications=1定义了默认允许发送报警信息
notifications_enabled是在定义主机配置中对某个服务的定义,如

define service{use                                      local-service         ; Name of service template to usehost_name                          testservice_description             HTTPcheck_command                 check_httpnotifications_enabled           1}

转载于:https://blog.51cto.com/13323775/2085635

你可能感兴趣的文章
linux网络相关命令使用
查看>>
java基础(二)
查看>>
记录一下:chrome上,把网页保存为文件的插件
查看>>
C#和Javascript间互转的Xxtea加解密
查看>>
BAT批处理中的字符串处理详解(字符串截取)
查看>>
智力题集锦【二】
查看>>
读 《我为什么放弃Go语言》 有感
查看>>
删除MySQL中冗余字段
查看>>
MS DOS 命令大全
查看>>
升级10.10 Yosemite 后,cocoapods 出现错误(解决方案)
查看>>
UEditor编辑器两个版本任意文件上传漏洞分析
查看>>
Redis分布式锁服务(八)
查看>>
MySQL的引入
查看>>
C++单例模式
查看>>
bower安装报错”Cannot be run with sudo”解决办法
查看>>
android平台中编写jni模块的方法(3)
查看>>
软件工程网络15结对编程1——四则运算优化
查看>>
进程、应用程序域,线程和上下文之间的关系
查看>>
Spring源码学习之一下载和导入
查看>>
13.使用第三方类实现动画
查看>>