
目 录
Nagios 安装部署与 Cacti 整合文档 .................................................................................................................................. 1
1. 文档更新记录 ............................................................................................................................................................... 1
2. 文档说明....................................................................................................................................................................... 1
3.
Nagios 的安装 ............................................................................................................................................................... 1
3.1. 安装基础支持套件和添加用户 ................................................................................................................... 1
3.2. 安装 nagios ................................................................................................................................................... 2
3.3. 安装 nagios-plugins ...................................................................................................................................... 2
3.4.
安装 nagios-snmp-plugins ............................................................................................................................ 3
3.5. 其他设置 ....................................................................................................................................................... 4
4. nagios 的配置 ............................................................................................................................................................... 5
4.1. nagios 目录结构 ........................................................................................................................................... 5
4.2. nagios 的配置文件 ....................................................................................................................................... 5
5. 安装 cacti .................................................................................................................................................................... 13
6.
整合 cacti 和 nagios .................................................................................................................................................... 15
6.1. 安装 ndoutils .............................................................................................................................................. 15
6.2. 安装 php-json ............................................................................................................................................. 17
6.3. 安装 npc ...................................................................................................................................................... 17
6.4.
测试页面 ..................................................................................................................................................... 19
7. Nagios 每日健康检查报警短信 ................................................................................................................................. 20
7.1. 编写检查脚本 ............................................................................................................................................. 20
7.2. 添加 crond 计划 ......................................................................................................................................... 21
7.3. 配置飞信机器人报警 ................................................................................................................................. 21
7.3.1.
Commands.cfg 配置文件添加如下内容: ........................................................................................ 21
7.3.2. Contacts.cfg 配置添加: .................................................................................................................... 21
7.3.3. Templates.cfg ....................................................................................................................................... 22
7.3.4. 修改展示页面监控图片大小: /usr/local/nagios/etc/pnp/config.php ..................................... 22
8. Troubleshooting .......................................................................................................................................................... 23
8.1. web 界面修改某个服务时报错 ................................................................................................................. 23
8.2. 点击 host,service 选项时,结果无法显示 ............................................................................................... 23
8.3. nagios3.2.0 以后,安装 nagios 在访问 http://ip/nagios 时出现如下错误提示: ........................... 24
8.4.
出现 pnp 小太阳图标,点击报错如下: ................................................................................................. 24
8.5. 安装 NAGIOS 时发现有 Status Map、Alert Histogram 打不开链接,提示找不到 statusmap.cgi 和
Generated by Foxit PDF Creator © Foxit Software
http://www.foxitsoftware.com For evaluation only.