首页
学习
活动
专区
工具
TVP
发布
精选内容/技术社群/优惠产品,尽在小程序
立即前往
  • 您找到你想要的搜索结果了吗?
    是的
    没有找到

    Cacti插件安装之nagios

    一,安装nagios useradd nagios必须的,要不make install时过不去 wget http://cdnetworks-kr-1.dl.sourceforge.net/project/nagios/nagios-3.x/nagios-3.4.1/nagios-3.4.1.tar.gz #tar zxvf nagios-3.4.1.tar.gz -C /opt #cd /opt/nagios #./configure --prefix=/usr/local/nagios #make all # make  install install-base install-cgis install-html install-exfoliation install-config install-init install- commandmode fullinstall nagios.conf文件已生成,不用修改 # egrep 'AuthUserFile' /etc/httpd/conf.d/nagios.conf    AuthUserFile /usr/local/nagios/etc/htpasswd.users    AuthUserFile /usr/local/nagios/etc/htpasswd.users 创建HTTP认证用户登录Nagios,用户名nagiosadmin,密码123456     #htpasswd -c /usr/local/nagios/etc/htpasswd.users nagiosadmin 重启apache     #service httpd restart   其他配置基本不用改,启动nagios   # service nagios start # chkconfig nagios on http://ip/nagios访问即可

    04

    nagios升级要点(从2.x到3.x)

    先将当前的nagios2.9备份 cd /usr/local cp -r nagios nagios2.9 cd /etc/init.d/ cp nagios nagios2.9 升级(从2.9到3.0.3) 下载nagios-3.0.3 首先大致的看一下里面的两篇文章 whatsnew.html和upgrading.html 介绍了新版的特点和升级方法 然后开始升级工作 解压缩后执行 ./configure --with-command-group=nagios make all make install 然后验证 /usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg 报两个warning和一个critical 两个warning是:downtime_file 和 comment_file这两个文件已经不在使用,将他们的内容添加到state_retention_file这个文件的后面 一个critical是:434行有错误,变量不能识别 解决两个warning的方法如下: 先将nagios.cfg中comments 和downtime变量注释掉 # COMMENT FILE # This is the file that Nagios will use for storing host and service # comments. #comment_file=/usr/local/nagios/var/comments.dat # DOWNTIME FILE # This is the file that Nagios will use for storing host and service # downtime data. #downtime_file=/usr/local/nagios/var/downtime.dat 查找state_retention_file=/usr/local/nagios/var/retention.dat 然后执行 cd /usr/local/nagios/var cat comments.dat >>retention.dat cat downtime.dat >>retention.dat 解决critical的方法如下 注释掉434行的#check_result_buffer_slots=4096 这个变量已经不在使用了。 然后再验证启动nagios就没问题了 需要说明:从2.x升级到3.x还有这样一点要注意 Extended host and extended service definitions have been deprecated. They are still read and processed by Nagios, but it is recommended that you move the directives found in these definitions to your host and service definitions, respectively. 我配置的有extended service,但是里面的配置信息是nagios grapher自动生产的。况且3.x是可以读的,只是推荐写到service定义中而已。我这里并没有按照这条的建议。没对原来的配置做修改。 Nagvis启动故障的排查 更新nagios之后 启动nagvis需要的NDO组件 /usr/local/nagios/bin/ndo2db -c /usr/local/nagios/etc/ndo2db.cfg 提示Could not bind socket: Address already in use 查看/usr/local/nagios/etc/ndo2db.cfg 有这样的内容 # SOCKET TYPE # This option determines what type of socket the daemon will create # an accept connections from. # Value: #   unix = Unix domain socket (default) #   tcp  = TCP socket socket_type=unix #socket_type=tcp socket是unix类型的(是一个sock文件),而不是tcp类型的(tcp端口) 原来是/usr/local/nagios/var/ndo.sock还存在(因为ndo是使用kill命令杀掉进程的) 所以删掉这个.sock文件即可 运行/usr/local/nagios/bin/ndo2db -c /usr/local/nagios/etc/ndo2db.cfg 启

    01

    Nagios监控linux服务器

    Nagios监控linux服务器 一、客户端 安装所需的软件(nagios-plugins、nrpe) #wget http://prdownloads.sourceforge.net/sourceforge/nagiosplug/nagios-plugins-1.4.16.tar.gz #wget http://prdownloads.sourceforge.net/sourceforge/nagios/nrpe-2.13.tar.gz 1、安装nagios-plugins #增加一个用户 useradd nagios -s /sbin/nologin -M 解压并安装 #tar zvxf nagios-plugins-1.4.16.tar.gz && cd nagios-plugins-1.4.16 #./configure --with-nagios-user=nagios --with-nagios-group=nagios && make && make install #chown -R nagios:nagios /usr/local/nagios 2、安装nrpe #tar -zxvf nrpe-2.13.tar.gz && cd nrpe-2.13 #./configure --enable-ssl --with-ssl-lib (前提是已经安装了openssl与openssl-devel) #make all && make install-plugin && make install-daemon && make install-daemon-config 3、配置nrpe 配置nrpe信息 #vim /usr/local/nagios/etc/nrpe.cfg,查找并修改如下一行 allowed_hosts=172.16.17.223,127.0.0.1   #注意修改为nagios服务器的IP:172.16.17.223 #配置监控对象 说明:由监控原理可知被监控端做监控,然后将数据传给监控服务器绘总,设置监控详细参数主要是设置被监控端的nrpe.cfg文件,可以看到里面监控对象 vim /usr/local/nagios/etc/nrpe.cfg,查找并修改如下一行 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_disk]=/usr/local/nagios/libexec/check_disk -w 10% -c 5% 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 500 -c 550 command[check_swap]=/usr/local/nagios/libexec/check_swap -w 20% -c 10% command[check_ping]=/usr/local/nagios/libexec/check_ping -H 192.168.1.1 -w 100.0,20% -c 500.0,60% 后两行是自添加的 4、启动nrpe,并测试 #/usr/local/nagios/bin/nrpe -c /usr/local/nagios/etc/nrpe.cfg -d #echo “/usr/local/nagios/bin/nrpe -c /usr/local/nagios/etc/nrpe.cfg -d &> /dev/null” >> /etc/rc.local #netstat -atulnp | grep nrpe tcp        0      0 0.0.0.0:5666                0.0.0.0:*                   LISTEN      5201/nrpe            #/usr/local/nagios/libexec/check_nrpe -H localhost NRPE v2.13 二、服务器端 1、安装所需的软件(nagios、nagios-plugins、nrpe)下载后源码包安装,不赘述 wget http://prdownloads.sourceforge.net/sourceforge/nagios/nagios-3.4.1.tar.gz w

    01
    领券