Nagios Nagiosgraph, tools for graphing in Nagios

What is Nagios Nagiosgraph

Nagios Nagiosgraph parses output and performance data from Nagios plugins and stores the data in RRD files. Nagiosgraph creates graphs and generates HTML pages with graphic reports from the data. Like in this tutorial Nagios Core is already install and it works.

RRDtool is the OpenSource industry standard, high performance data logging and graphing system for time series data. RRDtool can be easily integrated in shell scripts, perl, python, ruby, lua or tcl applications.

Step 1. Install Nagios Nagiosgraph

Install nagiosgraph from ports

$ cd /usr/ports/net-mgmt/nagiosgraph/
$ make config
$ make install clean

After installation, check file sample nagiosgraph in /usr/local/etc/nagios/nagiosgraph and move all file .conf-sample to .sample. And appears like below

$ ls /usr/local/etc/nagios/nagiosgraph/
access.conf labels.conf nagiosgraph_fr.conf
datasetdb.conf map ngshared.pm
dump nagiosgraph.conf rrdopts.conf
groupdb.conf nagiosgraph_de.conf servdb.conf
hostdb.conf nagiosgraph_es.conf

Step 2. Configure in Nagios Core

Open file nagios.cfg in directory /usr/local/etc/nagios

Set process_performance_data from 0 to 1

process_performance_data=1

Create file perfdata.log and change permissions 755

$ touch /var/spool/nagios/perfdata.log
$ chmod 755 /var/spool/nagios/perfdata.log

After that, open again nagios.cfg and define file perfdata.log

host_perfdata_file=/var/spool/nagios/perfdata.log
service_perfdata_file=/var/spool/nagios/perfdata.log

Define template in perfdata like this

host_perfdata_file_template=$LASTHOSTCHECK$||$HOSTNAME$||check-host-alive||$HOSTOUTPUT$||$HOSTPERFDATA$
service_perfdata_file_template=$LASTSERVICECHECK$||$HOSTNAME$||$SERVICEDESC$||$SERVICEOUTPUT$||$SERVICEPERFDATA$

Change mode to write log host_perfdata

host_perfdata_file_mode=a
service_perfdata_file_mode=a

Do the same in interval processing

host_perfdata_file_processing_interval=10
service_perfdata_file_processing_interval=10

Create command to execute process perfdata

host_perfdata_file_processing_command=process-host-perfdata-file
service_perfdata_file_processing_command=process-service-perfdata-file

In Nagios after installation, it have program which name insert.pl from Perl. Function of this program to execute nagiosgraph save to RRD Database. Locate in /usr/local/libexec/nagiosgraph/.

Next, define command in fie command.cfg

# 'process-host-perfdata' command definition
define command{
 command_name process-host-perfdata-file
 command_line /usr/local/libexec/nagiosgraph/insert.pl
 }
# 'process-service-perfdata' command definition
define command{
 command_name process-service-perfdata-file
 command_line /usr/local/libexec/nagiosgraph/insert.pl
}

And then, define service in file template.cfg to execute nagiosgraph service

define service {
 name graphed
 use generic-service
 action_url /nagios/cgi-bin/nagiosgraph/show.cgi?host=$HOSTNAME$&service=$SERVICEDESC$' onMouseOver='showGraphPopup(this)' onMouseOut='hideGraphPopup()' rel='/nagios/cgi-bin/nagiosgraph/showgraph.cgi?host=$HOSTNAME$&service=$SERVICEDESC$&period=week&rrdopts=-w+1850+-j
 register 0
}

Step 3. Configuration Nagiosgraph

Before we edit configure nagiosgraph, please open page http://ip/nagios/cgi-bin/nagiosgraph/showconfig.cgi to view any errors. Next, look like below

Figure 1. View Errors Nagiosgraph
Figure 1. View Errors Nagiosgrapher

Fix error in nagiosgrapher type command

$ cd /var/spool/nagios/
$ touch nagiosgraph.log
$ chmod 755 nagiosgraph.log
$ touch nagiosgraph-cgi.log
$ chmod 755 nagiosgraph-cgi.log
$ mkdir nagiosgraph
$ mkdir nagiosgraph/rrd
$ chmod -R 755 nagiosgraph/rrd

Next, change user and group to nagios

$ chown nagios:nagios /var/spool/nagios/nagiosgraph.log
$ chown nagios:nagios /var/spool/nagios/nagiosgraph-cgi.log
$ chown nagios:nagios /var/spool/nagios/perfdata.log
$ chown nagios:nagios /var/spool/nagios/nagiosgraph
$ chown nagios:nagios /var/spool/nagios/nagiosgraph/rrd

After that, open file nagiosgraph.conf in directory /usr/local/etc/nagios/nagiosgraph. Edit file like below

logfile = /var/spool/nagios/nagiosgraph.log
cgilogfile = /var/spool/nagios/nagiosgraph-cgi.log
perflog = /var/spool/nagios/perfdata.log
rrddir = /var/spool/nagios/nagiosgraph/rrd
nagiosgraphcgiurl = /nagios/cgi-bin/nagiosgraph
plotas = AREA
hidejswarnings = 1

Check again in page http://ip/nagios/cgi-bin/nagiosgraph/showconfig.cgi

Figure 2. Nagiosgraph Config
Figure 2. Nagiosgraph Config

Next, define service in host. In this define name serive is graphed

define service {
 use root-service,graphed
 name dig-ser-blok-148-2-30
 hostgroup group-host-ser-dig
 #servicegroups group-ssh-host-ser-blok-148-2-30
 service_description DIG
 check_command check_dig_www_uns
 }

Next, check configuration and restart service nagios

$ nagios -v /usr/local/etc/nagios/nagios.cfg
$ /usr/local/etc/rc.d/nagios restart

View the web interface, appears below

Figure 3. Nagiosgraph
Figure 3. Nagiosgraph

After 1 week we can view graph in nagiosgraph like below

 

Figure 5. Graph in Nagiosgraph
Figure 4. Graph in Nagiosgraph

Source : www.netways.org

Tinggalkan Balasan

Isikan data di bawah atau klik salah satu ikon untuk log in:

Logo WordPress.com

You are commenting using your WordPress.com account. Logout / Ubah )

Gambar Twitter

You are commenting using your Twitter account. Logout / Ubah )

Foto Facebook

You are commenting using your Facebook account. Logout / Ubah )

Foto Google+

You are commenting using your Google+ account. Logout / Ubah )

Connecting to %s