Skip to end of metadata
Go to start of metadata

The following image shows the directory structure of n2rrd/rrd2graph configuration files, including RRA and GRAPH template search order.
The table below elaborates more about it in detail.


 

Assume CONF_DIR=/etc/n2rrd

Directory/Files

Description

/etc/n2rrd/n2rrd.conf

The main configuration file used by n2rrd.pl and rrd2grapg.cgi

/etc/n2rrd/js/zooms.js

This script is used for zooming in/out of RRD graph timeperiods

/etc/n2rrd/templates/maps/rgb.txt

In this file you maps RGB colors

/etc/n2rrd/templates/maps/rra_plugins_maps

In this file you map check_command (alias) and their return values data types for RRDTOOL
e.g: check_ping returns two values rta and pl and they are of type GAUGE
check_ping=rta:GAUGE,pl:GAUGE

The check_command = command_name value in command definition (see below)



# 'check_ping' command definition
 define command{
     command_name    check_ping
     command_line    $USER1$/check_ping -H $HOSTADDRESS$ -w $ARG1$ -c $ARG2$ -p 5
 }

/etc/n2rrd/templates/maps/service_nam_maps

In this file you map service name(service_description) to some other name, using ':' as field seperator.
 some examples from demo server maps file.

Root Partition: df
RoomTemp: officetemp
Physical memory: mem
Connectivity: icmp
NET Connectivity: icmp
PING: icmp
HTTP: http
SVC HTTP: http
SVC HTTPS: https
FTP: ftp
POP3: pop3
SMTP: smtp
IMAP: imap
DNS: dns
NAG HOST STAT: nagios-host-stat
NAG SERVICE STAT: nagios-service-stat
NAG SERVICE CHECK: nagios-active-service-checks
NAG PROC MEM: nagios-mem-usage
DISK /local: df-local
DISK /: df-root
DISK /var: df-var

/etc/n2rrd/templates/code/*

In this directory you place HOSTNAME_SERVICENAME.pl or SERVICENAME.pl, which is for all SERVICENAME.
e.g: code for mem namely mem.pl

my $tmp_pdata = "";

#
# the following Environment variable is passed by Nagios, see nagios Doc. for more info
if ( $ENV{NAGIOS_SERVICEPERFDATA} ) {
    $tmp_pdata = $ENV{NAGIOS_SERVICEPERFDATA};
    # do something with performance data
}

# OR you can pass performance data passed to n2rrd.pl with option -o  "$HOSTPERFDATA$"
if ($opt->{o}) {
   #do somethign with performance data
   # perl code
}



# e.g. return $tmp_pdata="used=4096 free=1024"

return $tmp_pdata;

/etc/n2rrd/templates/rewrite/*

(Optional) In this dierctory you place namely HOSTNAME_SERVICENAME_rewrite, where you can redefine/relocate come variables used by n2rrd.pl/rrd2graph.cgie.g: HOSTNAME=localhost
      SERVICENAME=load
then a file namely localhost_load_rewrite

#
# change file name location
#
rrd_file        /srv/www/vhosts/mon.diglinks.com/html/cacti/rra/localhost_load_1min_5.rrd

# graph template to look for
#graph_template     /tmp/load-graph.t
#
# rewrite ds_name
# REAL is what returned by plugin
#               REAL    RENAME
#--------------------------------
ds_name         load1   load_1min
ds_name         load5   load_5min
ds_name         load15  load_15min

/etc/n2rrd/templates/rra/*

In this directory n2rrd.pl searches for RRA templates (see image above for search order)

/etc/n2rrd/templates/rra/dyn/HOSTNAME/HOSTNAME_SERVICE.t

Under /dyn/ directory dynamically created templates are kept.
by default all values are considered as GUAGE, unless you define them in file "/etc/n2rrd/templates/maps/rra_plugins_maps".

/etc/n2rrd/templates/graph/plugins/custom/*

Under /custom/ you define your own version of graph template, which would be used for all SERVICENAME using same check_command alias.

/etc/n2rrd/templates/graph/plugins/default/*

Under /default/ in future default examples of check commands will be part of distribution.

/etc/n2rrd/templates/graph/dyn/HOSTNAME/*

Dynamically generated graph templates are kept in this PATH

  • No labels