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

nagios 3.X pnp-0.4.3

nagios 3.X pnp-0.4.3 配置小记 作者:刘宇 liuyu.blog.51cto.com 配置环境:cetnos5 apache2 nagios3  pnp-0.4.3 安装过程 引用石头兄的话: 1. compile php with zlib and gd option; 2. configure and make install the pnp; 3. modify the nagios.cfg and command.cfg with the process_perfdata and host/service_data option; 4. rename PNP‘s templates.dist as templates; 此步骤不是必须的(不过改了也没问题) 5. rename all PNP’s cfg_sample files _sample suffix; 6.Action_url: action_url,在2.x中,只能通过serviceextinfo来做。在3.x中,可以通过模板来继承,因此在3.x中,配置量会减少很多(特别是太规模部署时) 本文不详细介绍安装过程:看官方文档 [url]http://www.pnp4nagios.org/pnp/install[/url] 如果你是用的centos5 像zlib gb rrdtool 可以直接使用yum 方法来源:linuxtone.org  [netseek兄弟]

01

Linux下sendmail发送邮件

sendEmail的主页http://caspian.dotconf.net/menu/Software/SendEmail/ 下载地址http://caspian.dotconf.net/menu/Software/SendEmail/sendEmail-v1.56.tar.gz #tar –zxvf sendEmail-v1.56.tar.gz #cd sendEmail-v1.56 #cp sendEmail /usr/local/bin 然后给确认确实它具有执行权限 ll /usr/local/bin/sendEmail -rwxr-xr-x 1 root root 77882 11-03 14:23 /usr/local/bin/sendEmail 这样程序就装好了,使用也很简单.直接运行sendEmail就会显示详细的用法 先看一个典型的例子 /usr/local/bin/sendEmail –f sender@163.com –t receiver@163.com –s smtp.163.com –u “from nagios” –xu sender –xp 123456 –m happy 解释: -f 表示发送者的邮箱 -t 表示接收者的邮箱 -s 表示SMTP服务器的域名或者ip -u 表示邮件的主题 -xu 表示SMTP验证的用户名 -xp 表示SMTP验证的密码(注意,这个密码貌似有限制,例如我用d!5neyland就不能被正确识别) -m 表示邮件的内容 如果你不带-m参数的话,就会提示你自行输入 Reading message body from STDIN because the ‘-m’ option was not used. If you are manually typing in a message: - First line must be received within 60 seconds. - End manual input with a CTRL-D on its own line 输入完成后使用CTRL-D来结束 当然我们也可以将一个文件的内容作为邮件的正文发出去的 那么就可以使用: cat 文件名 | /usr/local/bin/sendEmail –f sender@163.com –t receiver@163.com –s smtp.163.com –u "subject” –xu sender –xp 123456 –m happy 有关sendEmail的用法就讲到这里 既然nagios要使用sendEmail来发警告邮件,那么就要修改commands.cfg中关于发邮件的命令的定义,我们现在来修改notify-by-email这个命令,如下(注意其中粗体的部分) # 'notify-by-email' command definition define command{ command_name notify-by-email command_line /usr/bin/printf "%b" "***** Nagios 2.9 *****\n\nNotification Type: $NOTIFICATIONTYPE$\n\nService: $SERVICEDESC$\nHost: $HOSTALIAS$\nAddress: $HOSTADDRESS$\nState: $SERVICESTATE$\n\nDate/Time: $LONGDATETIME$\n\nAdditional Info:\n\n$SERVICEOUTPUT$" | /usr/local/bin/sendEmail -f sender@163.com -t $CONTACTEMAIL$ -s smtp.163.com -u "** $NOTIFICATIONTYPE$ alert - $HOSTALIAS$/$SERVICEDESC$ is $SERVICESTATE$ **" -xu sender -xp 123456 } 注:其实sendEmail是一个十分有用的程序,我们在这个地方用了它,其实别的地方也可以用,典型的好处就是你不需要每台机器都装sendmail,开启smtp服务.直接用现成的一台邮件服务器就行了,这无疑很大的加强了系统的安全性,也节约了资源.

03

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
领券