Nagios性能分析
监控服务变化曲线的工具 ---- PNP
安装rrdtools(绘图工具)可能需要的库
- yum install cairo pango libart_lgpl libart_lgpl-devel zlib zlib-devel freetype freetype-devel
- yum install cairo pango libart_lgpl libart_lgpl-devel zlib zlib-devel freetype freetype-devel
安装rrdtools
- ./configure
- make
- make install
- ./configure
- make
- make install
编辑nagios.cfg,Nagios 的主配置文件
- vi /usr/local/nagios/etc/nagios.cfg
修改如下:
- process_performance_data=1
- hosthost_perfdata_command=host-service-perfdata
- service_perfdata_command=process-service-perfdata
- vi /usr/local/nagios/etc/nagios.cfg
修改如下:
- process_performance_data=1
- hosthost_perfdata_command=host-service-perfdata
- service_perfdata_command=process-service-perfdata
如果想要对某个监控对象做数据图表,则需在所对应的host或者service 定义中包含如下的定义:
- process_perf_data 1
编辑command.cfg,将“process-service-perfdata”命令对应的执行命令行的内容替换成该脚本:
- define command{
- command_name process-service-perfdata
- # command_line /usr/bin/printf "%b" "$LASTSERVICECHECK$\t$HOSTNAME$\t$SERVICEDESC$\t$SERVICESTATE$\t$SERVICEATTEMPT$\t$SERV
- ICESTATETYPE$\t$SERVICEEXECUTIONTIME$\t$SERVICELATENCY$\t$SERVICEOUTPUT$\t$SERVICEPERFDATA$\n" >> /usr/local/nagios/var/service-perf
- data.out
- command_line /usr/local/nagios/libexec/process_perfdata.pl
- # command_line /usr/bin/perl /usr/local/nagios/sbin/insert.cgi
- }
- define command{
- command_name process-service-perfdata
- # command_line /usr/bin/printf "%b" "$LASTSERVICECHECK$\t$HOSTNAME$\t$SERVICEDESC$\t$SERVICESTATE$\t$SERVICEATTEMPT$\t$SERV
- ICESTATETYPE$\t$SERVICEEXECUTIONTIME$\t$SERVICELATENCY$\t$SERVICEOUTPUT$\t$SERVICEPERFDATA$\n" >> /usr/local/nagios/var/service-perf
- data.out
- command_line /usr/local/nagios/libexec/process_perfdata.pl
- # command_line /usr/bin/perl /usr/local/nagios/sbin/insert.cgi
- }
安装PNP
- ./configure --with-rrdtool=/usr/local/rrdtool-1.0.50/bin/rrdtool
- make all
- make install
- ./configure --with-rrdtool=/usr/local/rrdtool-1.0.50/bin/rrdtool
- make all
- make install
检查Nagios配置文件并重启Nagios
- /usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg
- /etc/init.d/nagios restart
- /usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg
- /etc/init.d/nagios restart
访问web
http://localhost/nagios/pnp/index.php以上就是Nagios的性能分析。
【编辑推荐】