Chinaunix首页 | 论坛 | 博客
  • 博客访问: 504117
  • 博文数量: 240
  • 博客积分: 791
  • 博客等级: 军士长
  • 技术积分: 1694
  • 用 户 组: 普通用户
  • 注册时间: 2011-08-23 18:21
文章分类

全部博文(240)

文章存档

2013年(21)

2012年(219)

我的朋友

分类: LINUX

2012-02-03 13:38:13

nagios依赖

nagios分为3个部分

  • nagios 里面包含网页cgi等等主程序。
  • nagios-plugins 扩展插件。
  • nrpe 客户端和服务器端ssl通信所用。客户端和服务器端都要安装。


还依赖如下库文件 gd gd-devel glibc glibc-common

安装库

#yum -y install gcc glibc glibc-common gd gd-devel

安装apache 和 php

#yum -y httpd phpnagios的安装

创建一个名为nagcmd的用户组用于从Web接口执行外部命令

[root@centos ~]# useradd nagios [root@centos ~]# groupadd nagcmd

将nagios用户和Apache用户都加入到该用户组中

[root@centos ~]# usermod -a -G nagcmd nagios [root@centos ~]# usermod -a -G nagcmd apache

编译nagios主程序

[root@centos ~]# tar -zxvf nagios-3.2.1.tar.gz [root@centos ~]# cd nagios-3.2.1 [root@centos nagios-3.2.1]# ./configure --with-command-group=nagcmd [root@centos nagios-3.2.1]# make all [root@centos nagios-3.2.1]# make install 使用make install来安装主程序,CGI和HTML文件 [root@centos nagios-3.2.1]# make install-init 使用make install-init在/etc/rc.d/init.d安装启动脚本 [root@centos nagios-3.2.1]# make install-commandmode 来配置目录权限 [root@centos nagios-3.2.1]# make install-config 安装基本的配置 [root@centos nagios-3.2.0]# make install-webconf 自动添加apache的虚拟主机等权限设定。nagios目录功能的简要说明
  • bin Nagios执行程序所在目录,nagios文件即为主程序
  • etc Nagios配置文件位置
  • sbin Nagios Cgi文件所在目录,也就是执行外部命令所需文件所在的目录
  • Share Nagios网页文件所在的目录
  • var Nagios日志文件、spid 等文件所在的目录
  • libexec nagios 插件安装时产生的文件
nagios配置文件名称及作用

nagios文件的具体含义:(/usr/local/nagios/etc/objects)

  • command.cfg 定义nagios能调用的命令;
  • contacts.cfg 定义联系人;
  • localhost.cfg 定义监控本机的对象;
  • printer.cfg 定义对打印机的监控;
  • switch.cfg 定义对交换机的监控;
  • templates.cfg 定义模板;
  • timeperiods.cfg 定义时间对象;
  • windows.cfg 定义监控的windows主机;


设置访问密码

#htpasswd -c /usr/local/nagios/etc/htpasswd.users nagiosadmin

账号最好是nagiosadmin 存放密码文件的路径也必须是/usr/local/nagios/etc/htpasswd.users 因为/usr/local/nagios/etc/cgi.cfg默认配置了

安装nagios-plugins[root@centos nagios]# tar zxvf nagios-plugins-1.4.13.tar.gz [root@centos nagios-plugins-1.4.13]# ./configure --with-nagios-user=nagios --with-nagios-group=nagcmd && make && make install安装nrpe[root@centos ~]# tar -xzvf nrpe-2.12.tar.gz [root@centos ~]# cd nrpe-2.12 [root@centos nrpe-2.12]# ./configure [root@centos nrpe-2.12]# make all [root@centos nrpe-2.12]# make install-plugin // 在Nagios服务器端只要安装nrpe监控插件就行

将nrpe添加开机自启动

[root@centos nrpe-2.12]# cp init-script /etc/init.d/nrpe [root@centos nrpe-2.12]# chmod 755 /etc/init.d/nrpe [root@centos nrpe-2.12]# chkconfig --add nrpe [root@centos nrpe-2.12]# chkconfig nrpe on [root@centos nrpe-2.12]# chkconfig nagios on [root@centos nrpe-2.12]# chkconfig httpd on

添加对nrpe的支持

[root@centos ~]#vim /usr/local/nagios/etc/objects/commands.cfg #'check_nrpe' command definition define command { command_name check_nrpe command_line $USER1$/check_nrpe -H $HOSTADDRESS$ -c $ARG1$ }


启动服务

[root@centos ~]# service httpd start [root@centos ~]# service nagios start [root@centos ~]# service nrpe start
阅读(3175) | 评论(0) | 转发(0) |
0

上一篇:配置kickstart安装

下一篇:mysq主从搭建

给主人留下些什么吧!~~