已阅读5页,还剩3页未读, 继续免费阅读
版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
NagiosNagios 各组件简述及各组件简述及 nrpenrpe 详解详解 一 一 NagiosNagios 各组件简述各组件简述 由于 nagios 配置较为繁锁 且里面组件也较多 这里我将几个关键的组件列举一下 且做一下 简单的介绍及其和其它组件间的关系的描述 我自己的一些理解 如有偏差 欢迎指正 我在部署过程中主要用到了以下组件 nagios 3 2 3 tar gz nagios plugins 1 4 15 tar gz ndoutils 1 4b7 tar gz nrpe 2 12 tar gz 这些组件都是干什么的呢 1 nagios 3 2 3 tar gz 是 nagios 的主要组件 里面包括了各种配置文件 2 nagios plugins 1 4 15 tar gz 是 nagios 的插件 里面提供了各种监控模板及监控命令 如 check tcp 等等有很多常用的监控对象都可以使用这些模式 当然也可以自己编写脚本来实 现 这一点上 nagios 是非常灵活的 3 ndoutils 1 4b7 tar gz 利用它将 nagios 的监控信息存入 mysql 数据库 4 nrpe 2 12 tar gz 是一款用来监控被控端主机资源的工具 没有它 nagios 将无法对被控 端服务器的主机资源进行监控 以上是一些主要的组件 还有一些比较重要的组件 如 NSClient 0 3 8 Win32 zip 被控端为 win 操作系统时要安装 npc 主要用于 cacti 与 nagios 整合时 可用于将 nagios 的监控数 据导给 cacti 关系也大致屡清了 上文讲过部署 nagios 本文将不在嫯述了 下面将 nrpe 的部署过程详细整 理一下 二 二 NrpeNrpe 详解详解 1 先用表格列举一下我的监控对象和阀值 监控对象监控对象监控阀值监控阀值 主机存活 check ping w 3000 0 80 c 5000 0 100 p 5 3000 毫秒响应时间内 丢包率超过 80 报警告 5000 毫秒响应时间内 丢包率超过 100 报危急 一共发送 5 个包 登录用户 check user w 5 c 10 w 为警告 c 为危急 系统负载 check load w 15 10 5 c 30 25 20 1 分钟 5 分钟 15 分钟大于对应 的等待进程数则警告或危急 磁盘占用率 check disk w 20 c 10 p 根分区剩余空间为总大小的 20 警告 10 危急 p 后是根分区 脚本检测磁盘 I O check iostat w 5 c 10 磁盘 I O 的 iowait 超过 5 报警告 超过 10 报危急 检测僵尸进程 check zombie procs w 5 c 10 s Z 有 5 个僵尸进程报警告 10 个报危急 检测总进程数 check total procs w 150 c 200 总进程到 150 个警告 200 个报危急 脚本检测内存剩余 check mem w 90 c 95 内存空闲率 90 以上报警告 95 以上报危急 主 机 资 源 检测交换分区使用率 check swap w 20 c 10 交换分区剩余空间为总大小的 20 警告 10 危急 监控服务端口 check tcp H localhost2 p 80 主机与对应的端口号 监控页面响应时间 check http H localhost2 u http localhost2 test jsp w 5 c 10 检查页面 超过 5s 报警告 超过 10s 报危急 应 用 服 务 监 控 脚本检测 IP 连接数 check ips w 200 c 250 IP 连接数超过 200 报警告 超过 250 报危急 流量 监控 监控 server 流量 Check traffic V 2c C public H localhost2 I 2 w 12 30 c 15 35 M b snmp 版本 用户 主机 对应网卡 警告阀值 危急阀值 数据库的监控以后再补上 2 安装过程 1 主控端 主控端上也要安装 nrpe 因为需要它的 check nrpe 来监控远程主机 tar zxf nrpe 2 12 tar gz cd nrpe 2 12 configure make all make install plugin 只运行这一步就行了 因为只需要 check nrpe 插件 在主控端的 vim usr local nagios etc object commands cfg 中添加 check nrpe command definition define command command name check nrpe command line USER1 check nrpe H HOSTADDRESS c ARG1 2 被控端 被控端上首先要安装 nagios plugins 1 4 15 tar gz 再安装 nrpe 2 12 tar gz 增加用户 useradd nagios 安装 nagios 插件 tar fvxz nagios plugins 1 4 15 tar gz configure with nagios user nagios with nagios group nagios enable redhat pthread workaround prefix usr local nagios make make install chown R nagios nagios usr local nagios 安装 nrpe tar fvxz nrpe 2 12 tar gz cd nrpe 2 12 configure make all make install plugin make install daemon make install daemon config 找到 vim usr local nagios etc nrpe cfg 里面有一些默认的模板了 The following examples use hardcoded command arguments command check users opt nagios libexec check users w 5 c 10 command check load opt nagios libexec check load w 15 10 5 c 30 25 20 command check hda1 opt nagios libexec check disk w 20 c 10 p dev hda1 command check zombie procs opt nagios libexec check procs w 5 c 10 s Z command check total procs opt nagios libexec check procs w 150 c 200 这些命令是由主控端 check nrpe 来执行来远程监控主机资源 我们可以修改这些选项 还可以 添加一些自己想监控的东西 比如自己写的脚本等 下面是我修改后的配置 只简单列了下 以供参考 The following examples use hardcoded command arguments command check users usr local nagios libexec check users w 5 c 10 command check load usr local nagios libexec check load w 15 10 5 c 30 25 20 command check hda1 usr local nagios libexec check disk w 20 c 10 p dev hda1 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 20 c 10 command check disk usr local nagios libexec check disk w 20 c 10 p command check ips usr local nagios libexec ip conn sh 200 250 command check mem usr local nagios libexec check mem sh w 90 c 95 command check iostat usr local nagios libexec check iostat w 5 c 10 command check traffic usr local nagios libexec check traffic sh V 2c C public H localhost2 I 2 w 12 30 c 15 35 M b 注意还要在前面设置给监控主机权限用以监控 allowed hosts 127 0 0 1 192 168 175 200 完成后 启动 nrpe usr local nagios bin nrpe c usr local nagios etc nrpe cfg d 最后在主控端添加要监控的服务如 vim usr local nagios etc object services cfg define service host name localhost2 service description check tcp 8080 check command check tcp 8080 max check attempts 5 normal check interval 3 retry check interval 2 check period 24x7 notification interval 10 notification period 24x7 notification options w u c r contact groups sagroup define service host name localhost2 service description check http check command check http http localhost2 test jsp 5 10 max check attempts 5 normal check interval 3 retry check interval 2 check period 24x7 notification interval 10 notification period 24x7 notification options w u c r contact groups sagroup 如果在 usr local nagios libexec 中已有的命令 那直接在被控端 nrpe cfg 中添加命令 并在 主控端的 services cfg 中添加服务即可 但上面有一些监控对象不是安装的 nagios plugins 插件里自带的 是我在网上找的一些脚本 这些脚本怎么配置的呢 用监控服务的 IP 连接数来举个例子吧 1 放在 usr local nagios libexec 里 如 vim ip conn sh bin sh if ne 2 then echo Usage 0 w num1 c num2 exit 3 fi ip conns netstat an grep tcp grep EST wc l if ip conns lt 1 then echo OK connect counts is ip conns exit 0 fi if ip conns gt 1 a ip conns lt 2 then echo Warning connect counts is ip conns exit 1 fi if ip conns gt 2 then echo Critical connect counts is ip conns exit 2 fi 2 修改所有者及其权限 如 3 可先执行一下脚本看脚本是否能正常工作 如 4 在被控端的 nrpe cfg 中添加命令 如 command check ips usr local nagios libexec ip conn sh 200 250 5 在主控端的 services cfg 中添加监控的服务 如 define serv
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 2026-2031中国股权投资市场研究报告
- 压力容器爆炸事故应急救援演练脚本
- 2025年天津燃气面试试题及答案
- 2025年绿化工职业技能竞赛参考试题库含答案
- 2025年交安B(公路水运)学习资料题库及答案
- 2025年专升本政治真题试卷及答案
- 泌尿外科患者发生引流管脱落的应急预案演练脚本
- 2026年农业基因编辑技术合作合同
- 梯形的面积(教学设计)-2024-2025学年五年级上册数学人教版
- 2025三基医师三严考试试题及答案
- 疾控中心科研管理办法
- 2024下半年特斯拉可持续发展报告:员工价值与企业价值并重
- 2025至2030中国核医学行业发展分析及发展趋势分析与未来投资战略咨询研究报告
- 石油行业采购面试题及答案解析
- 《法律职业伦理(第3版)》全套教学课件
- 乡镇武装工作课件
- 小区规种菜整治方案(3篇)
- 肠梗阻课件完整版本
- 2025年学宪法讲宪法知识竞赛题库答案(小学组)
- 旅游接待服务礼仪规范培训
- 小学介词全面讲解
评论
0/150
提交评论