您的位置:首页 > 移动开发 > IOS开发

cacti+nagios之nagios的搭建(三)

2016-07-18 00:00 211 查看
摘要:cacti+nagios之nagios的搭建

cd/root/cactinagios

wgethttp://jaist.dl.sourceforge.net/project/nagios/nagios/nagios-4.x/nagios-4.0.7/nagios-4.0.7.tar.gz

tar–xfnagios-4.0.7.tar.gz

cdnagios-4.0.7

./configure–with-command-group=nagios--prefix=/var/www/html/nagios--enable-event-broker

makeall

makeinstall&&makeinstall-init&&makeinstall-config

makeinstall-commandmode&&makeinstall-webconf

设置登录web界面时http验证的账号密码:

htpasswd-c/var/www/html/nagios/etc/htpasswd.usersnagiosadmin

安装nagios-plugins

cd/root/cactinagios

Wgethttp://nagios-plugins.org/download/nagios-plugins-2.0.2.tar.gz

tar–xfnagios-plugins-2.0.2.tar.gz

cdnagios-plugins-2.0.2

./configure–with-nagios-user=nagios–with-nagios-group=nagios–prefix=/var/www/html/nagios–with-mysql

make

mkeinstall

附apache的配置说明:
找到apache的配置文件:/etc/httpd/httpd.conf
找到:

检查nagios的配置:

/var/www/html/nagios/bin/nagios-v/var/www/html/nagios/etc/nagios.cfg

添加自动启动:

chkconfig–addnagios

chkconfignagioson

servicenagiosstart

登陆页面:

http://localhost/nagios

nagios客户端的安装配置:

cd/yunwei
pssh-hip.txt"mkdir/yunwei"
pscp-hip.txtnagios-plugins-2.0.2.tar.gz
pssh-hip.txt"./configure--prefix=/usr/local/nagios"
pssh-hip.txt"make&&makeinstall"
pssh-hip.txt"chownnagios:nagios/usr/local/nagios"makeinstall-pluginpssh-hip.txt"wgethttp://prdownloads.sourceforge.net/sourceforge/nagios/nrpe-2.13.tar.gz"
tar-xfnrpe-2.13.tar.gz
cdnrpe-2.13
./configure
makeall
makeinstall-plugin
makeinstall-daemon
makeinstall-daemon-config
makeinstall-xinetd
再次查看nagios-plugins目录就会发现有5个目录了;
cat/etc/xinetd.d/nrpe

注意:only_from增加监控端主机的ip地址;
编辑/etc/services文件,增加NRPE服务

servicexinetdrestart
可以看到5566端口已经在监听了;
使用如下命令,测试客户端是否正常安装了nrpe插件
/usr/local/nagios/libexec/check_nrpe-Hlocalhost
在监控端,打开commands.cfg,编辑添加如下内容:

#'check_nrpe'commanddefinitiondefinecommand{command_namecheck_nrpe#定义命令名称为check_nrpe,在services.cfg中要使用这个名称.command_line
$USER1$/check_nrpe-H$HOSTADDRESS$-c$ARG1$#这是定义实际运行的插件程序.#这个命令行的书写要完全按照check_nrpe这个命令的用法,不知道用法的就用check_nrpe–h查看.}

-c后面带的$ARG1$参数是传给nrpedaemon执行的检测命令,之前说过了它必须是nrpe.cfg中所定义的那5条命令中的其中一条。在services.cfg中

使用check_nrpe的时候要用“!”带上这个参数。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  linux