12/20/2012

Nagiosgraph installation

1. Download nagiosgraph.
http://nagiosgraph.sourceforge.
#tar xvfz nagiosgraph-1.4.4.tar.gz
#cd nagiosgraph-1.4.4
#./install.pl
continue with interactive setup.<br />
== configuration summary ==
  ng_layout            standalone
   ng_prefix            /usr/local/nagiosgraph
   ng_etc_dir           /usr/local/nagiosgraph/etc
   ng_bin_dir           /usr/local/nagiosgraph/bin
   ng_cgi_dir           /usr/local/nagiosgraph/cgi
   ng_doc_dir           /usr/local/nagiosgraph/doc
   ng_examples_dir      /usr/local/nagiosgraph/examples
   ng_www_dir           /usr/local/nagiosgraph/share
   ng_util_dir          /usr/local/nagiosgraph/util
   ng_var_dir           /usr/local/nagiosgraph/var
   ng_rrd_dir           /usr/local/nagiosgraph/var/rrd
   ng_log_dir           /usr/local/nagiosgraph/var
   ng_log_file          /usr/local/nagiosgraph/var/nagiosgraph.log
   ng_cgilog_file       /usr/local/nagiosgraph/var/nagiosgraph-cgi.log
   ng_url               /nagiosgraph
   ng_cgi_url           /nagiosgraph/cgi-bin
   ng_css_url           /nagiosgraph/nagiosgraph.css
   ng_js_url            /nagiosgraph/nagiosgraph.js
   nagios_cgi_url       /nagios/cgi-bin
   nagios_perfdata_file /tmp/perfdata.log
   nagios_user          nagios
   www_user             apache
   modify_nagios_config n
   nagios_config_file
   nagios_commands_file
   modify_apache_config n
   apache_config_dir
   apache_config_file
=====

Post installation
2. #vi /etc/nagios/nagios.cfg
add the following lines
====
# process nagios performance 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
====
3. #vi /etc/nagios/objects/commands.cfg
add the following lines.
====
# 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
}
====
4. #vi /etc/httpd/conf/httpd.conf
add the following line.
====
include /usr/local/nagiosgraph/etc/nagiosgraph-apache.conf
====
5. service restart
#nagios -v /etc/nagios/nagios.cfg
#service nagios restart
#service httpd restart

6. #vi /usr/share/nagios/html/config.inc.php
====
#$cfg['cgi_base_url']='/nagios/cgi-bin/';
$cfg['cgi_base_url']='/nagios/cgi-bin';
$cfg['ng_cgi_base_url']='/nagiosgraph/cgi-bin';
====

7. #cd /usr/share/nagios/html/
#cp side.php side.php.org
edit side.php like below.

# diff side.php.org side.php
92c92,100
< <li><a href="<?php echo $cfg["cgi_base_url"];?>/trends.cgi" target="<?php echo $link_target;?>">Trends</a></li>
---
> <li><a href="<?php echo $cfg["cgi_base_url"];?>/trends.cgi" target="<?php echo $link_target;?>">Trends</a>
> <ul>
> <li><a href="<?php echo $cfg["ng_cgi_base_url"];?>/show.cgi" target="<?php echo $link_target;?>">Graphs</a></li>
> <li><a href="<?php echo $cfg["ng_cgi_base_url"];?>/showhost.cgi" target="<?php echo $link_target;?>">Graphs by Host</a></li>
> <li><a href="<?php echo $cfg["ng_cgi_base_url"];?>/showservice.cgi" target="<?php echo $link_target;?>">Graphs by Service</a></li>
> <li><a href="<?php echo $cfg["ng_cgi_base_url"];?>/showgroup.cgi" target="<?php echo $link_target;?>">Graphs by Group</a></li>
> </ul>
> </li>

7. Refresh your nagios web page in your web browser.
nagios graph menu will be appeared.

No comments: