tar zxvf nagiosgraph-1.4.4.tar.gz
cd nagiosgraph-1.4.4
以下都是在nagiosgraph-1.4.4目录下完成的,安装前检测安装环境
[root@localhostnagiosgraph-1.4.4]# perl install.pl--check-prereq
checking required PERL modules
Carp...1.20
CGI... ***FAIL***
Data::Dumper...2.130_02
File::Basename...2.82
File::Find...1.19
MIME::Base64...3.13
POSIX...1.24
RRDs...1.4004
Time::HiRes...1.972101
checking optional PERL modules
GD...***FAIL***
checking nagios installation
found nagios at /usr/local/nagios/bin/nagios
checking web server installation
found apache at /usr/sbin/httpd
*** one or more problems were detected! 以上是我的结果,错误是perl的cgi模块没有安装
使用yum 安装,如下
yum install perl-CGI
重新检验
perl install.pl --check-prereq
结果就正确了
安装
perl install.pl//安装命令
出现的结果如下,注意后面最好不要一路回车,自己多注意一下都是什么要求
checking required PERL modules
Carp...1.20
CGI...3.52
Data::Dumper...2.130_02
File::Basename...2.82
File::Find...1.19
MIME::Base64...3.13
POSIX...1.24
RRDs...1.4004
Time::HiRes...1.972101
checking optional PERL modules
GD...2.44
checking nagios installation
found nagios at /usr/local/nagios/bin/nagios
checking web server installation
found apache at /usr/sbin/httpd
Destination directory (prefix)?[/usr/local/nagiosgraph] /usr/local/nagios/nagiosgraph//此处是nagiosgraph的目录,这个可以自己选择一下
Location of configuration files (etc-dir)?[/usr/local/nagios/nagiosgraph/etc]
Location of executables?[/usr/local/nagios/nagiosgraph/bin]
Location of CGI scripts?[/usr/local/nagios/nagiosgraph/cgi]
Location of documentation (doc-dir)?[/usr/local/nagios/nagiosgraph/doc]
Location of examples?[/usr/local/nagios/nagiosgraph/examples]
Location of CSS and JavaScript files?[/usr/local/nagios/nagiosgraph/share]
Location of utilities?[/usr/local/nagios/nagiosgraph/util]
Location of state files (var-dir)?[/usr/local/nagios/nagiosgraph/var]
Location of RRD files?[/usr/local/nagios/nagiosgraph/var/rrd]
Location of log files (log-dir)?[/usr/local/nagios/nagiosgraph/var]
Path of log file?[/usr/local/nagios/nagiosgraph/var/nagiosgraph.log]
Path of CGI log file?[/usr/local/nagios/nagiosgraph/var/nagiosgraph-cgi.log]
URL of CGI scripts? [/nagiosgraph/cgi-bin]
URL of CSS file?[/nagiosgraph/nagiosgraph.css]
URL of JavaScript file?[/nagiosgraph/nagiosgraph.js]
Path of Nagios performance data file?[/tmp/perfdata.log]
URL of Nagios CGI scripts?[/nagios/cgi-bin]
username or userid of Nagios user? [nagios]//此处注意你选择的用户
username or userid of web server user? [apache]nagios////此处注意你选择的用户
* In the nagios configuration file (e.g.nagios.cfg),
add these lines:
# process nagiosperformance data using nagiosgraph
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 * In the nagios commands file (e.g.command.cfg),
add these lines:
# command to processnagios performance data for nagiosgraph
define command {
command_nameprocess-service-perfdata-for-nagiosgraph
command_line/usr/local/nagios/nagiosgraph/bin/insert.pl
} * In the apache configuration file (e.g.httpd.conf),
add this line:
include/usr/local/nagios/nagiosgraph/etc/nagiosgraph-apache.conf * Restart nagios to start data collection:
/etc/init.d/nagiosrestart * Restart apache to enable display of graphs:
/etc/init.d/apacherestart
* To enable graph links and mouseovers, seeREADME sections:
Displaying Per-Service and Per-HostGraph Icons and Links
Displaying Graphs in Nagios Mouseovers 注意最后出现的这几行,这是对于以后nagiosgraph的配置信息
(1):在nagios的配置文件(nagios.cfg)中加入以下几行
# process nagiosperformance data using nagiosgraph
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
(2):在nagios命令文件(command.cfg)中加入以下几行
# command to processnagios performance data for nagiosgraph
define command {
command_nameprocess-service-perfdata-for-nagiosgraph
command_line/usr/local/nagios/nagiosgraph/bin/insert.pl
}