nagiosgraph安装步骤

  1. 下载nagiosgraph文件到Nagios监控服务器上
# wget http://sourceforge.net/projects/nagiosgraph/files/nagiosgraph/1.5.2/nagiosgraph-1.5.2.tar.gz
  1. 解压文件,并进入解压目录
# tar zxvf nagiosgraph-1.5.2.tar.gz 
# cd nagiosgraph-1.5.2
  1. 通过其自带的perl安装脚本先检测nagiosgraph所依赖的应用程序是否已经安装
# ./install.pl --check-prereq 
checking required PERL modules
  Carp...1.11
  CGI... ***FAIL***
  Data::Dumper...2.124
  Digest::MD5...2.39
  File::Basename...2.77
  File::Find...1.14
  MIME::Base64...3.08
  POSIX...1.17
  RRDs... ***FAIL***
  Time::HiRes... ***FAIL***
checking optional PERL modules
  GD... ***FAIL***
  Nagios::Config... ***FAIL***
checking nagios installation
  found nagios exectuable at /usr/local/nagios/bin/nagios
  found nagios init script at /etc/init.d/nagios
checking web server installation
  found apache executable at /usr/sbin/httpd
  found apache init script at /etc/init.d/httpd
*** one or more problems were detected!

安装缺少的perl模块

# yum -y install perl-GD php-gd rrdtool-perl rrdtool-php rrdtool perl-CGI perl-Time-HiRes perl-CPAN perl-Module-Build

通过cpan安装Nagios::Config

# cpan
# cpan> install Nagios:Config

重新运行依赖检测确认没有 FAIL 4. 继续安装nagiosgraph

# ./install.pl --install

在安装过程中会有很多安装提示,大多情况下你只需要选择默认值。 个人建议最后两项modify_nagios_config和modify_apache_config选择y,这会帮助你自动完成如下事项: - 自动在apache服务器配置目录/etc/httpd/conf.d/中加入如下配置文件nagiosgraph.conf

# enable nagiosgraph CGI scripts
ScriptAlias /nagiosgraph/cgi-bin "/usr/local/nagiosgraph/cgi"
<Directory "/usr/local/nagiosgraph/cgi">
   Options ExecCGI
   AllowOverride None
   Order allow,deny
   Allow from all
#   AuthName "Nagios Access"
#   AuthType Basic
#   AuthUserFile NAGIOS_ETC_DIR/htpasswd.users
#   Require valid-user
</Directory>
# enable nagiosgraph CSS and JavaScript
Alias /nagiosgraph "/usr/local/nagiosgraph/share"
<Directory "/usr/local/nagiosgraph/share">
   Options None
   AllowOverride None
   Order allow,deny
   Allow from all
</Directory>
- 自动修改nagios的配置文件nagios.conf,加入如下关于perfdata的设置,这些设置是关于如何处理性能数据的:
process_performance_data=1
service_perfdata_file=/tmp/perfdata.log
service_perfdata_file_template=$LASTSERVICECHECK$||$HOSTNAME$||$SERVICEDESC$||$SERVICEOUTPUT$||$SERVICEPERFDATA$
service_perfdata_file_mode=a
service_perfdata_file_processing_interval=30
service_perfdata_file_processing_command=process-service-perfdata-for-nagiosgraph
- 自动个性nagios的命令配置文件/usr/local/nagios/etc/objects/commands.cfg,加入如下命令:
# begin nagiosgraph configuration
# command to process nagios performance data for nagiosgraph
define command {
  command_name process-service-perfdata-for-nagiosgraph
  command_line /usr/local/nagiosgraph/bin/insert.pl
}
# end nagiosgraph configuration

该命令正是上面nagios配置文件指定处理性能数据所用的命令。 5. 在你的nagios配置文件中添加一个service模板,并在你需要使用图形的service上应用

define service {
    name graphed-service
    action_url /nagiosgraph/cgi-bin/show.cgi?host=$HOSTNAME$&service=$SERVICEDESC$
    action_url /nagiosgraph/cgi-bin/show.cgi?host=$HOSTNAME$&service=$SERVICEDESC$' onMouseOver='showGraphPopup(this)' onMouseOut='hideGraphPopup()' rel='/nagiosgraph/cgi-bin/showgraph.cgi?host=$HOSTNAME$&service=$SERVICEDESC$
    register 0
}
use generic-service
# ==>
use generic-service,graphed-service
  1. 也可以为Host指定action_url,为Host应用图形
action_url        $HOSTNAME$
  1. 最后将在nagios下创建common-header.ssh来为图表启用javascript的mouseover事件处理
cp -a /usr/local/nagiosgraph/examples/nagiosgraph.ssi /usr/local/nagios/share/ssicommon-header.ssi
  1. 最后,验证nagios配置正确性,并重新nagios与apache服务
# /usr/sbin/apachectl configtest
# /usr/sbin/apachectl restart
# /usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg
# /etc/init.d/nagios restart

访问nagios的web页面,验收成果

http://<Your Nagioshost>/nagiosgraph/cgi-bin/showconfig.cgi 
http://<Your Nagioshost>/nagiosgraph/cgi-bin/showhost.cgi?host=<Your Host Name>

图片来自动官方 参考文档 Centos6.x/RHEL6.x–Apache/Nagios4.x–Install nagiosgraph plugin Steps to configure Nagiosgraph with Nagios Core nagiosgraph-graphs-in-nagios

转载于:https://my.oschina.net/sqzy/blog/475590

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值