Skip to end of metadata
Go to start of metadata

Display collectd data with RRDGraph

Simple Example display load data from collected

 

This page contains macros or features from a plugin which requires a valid license.

You will need to contact your administrator.

 

Prerequisite

  1. Functional collectd running on nagiosor remote server
  2. location of rrdfile
  3. Graph Template
  4. nagios command

    # $ARG1$ = hostname
    # $ARG2$ = @3:
    # $ARG3$ = @4:
    define command {
            command_name                    collectd_load
            command_line                    /opt/collectd/bin/collectd-nagios -s /opt/collectd/var/run/collectd-unixsock -H $ARG1$ -n load/load -w $ARG2$  -c $ARG3$
            register                        1
    }
    
    
  5. Sample rewrite rule from demo server

    # Rewrite rule File: /etc/n2rrd/templates/rewrite/collectd/load_rewrite
    # $HOSTALIAS$ in Nagios holds the FQDN name as that is what is used by collectd
    # 
    rrd_file        /opt/collectd/var/lib/collectd/$HOSTALIAS$/load/load.rrd
    graph_template  /etc/n2rrd/templates/graph-collectd/load/load.t
  6. Sample graph template from demo server

    --imgformat=PNG
    --title="$HOSTNAME$ - $SERVICENAME$ Average"
    --rigid
    --height=120
    --width=500
    --alt-autoscale-max
    --lower-limit=0
    --units-exponent=0
    --vertical-label="run queue"
    --slope-mode
    #
    # Define canvas and frame colors
    --color=BACK#CDCDCD
    --color=SHADEA#CDCDCD
    --color=SHADEB#CDCDCD
    --color=FONT#585858
    --color=CANVAS#F0F1F5
    --color=GRID#8D8D8D
    --color=MGRID#B8B8B8
    --color=ARROW#FF0000
    "DEF:s_min=/opt/collectd/var/lib/collectd/$HOSTALIAS$/load/load.rrd:shortterm:MIN"
    "DEF:s_avg=/opt/collectd/var/lib/collectd/$HOSTALIAS$/load/load.rrd:shortterm:AVERAGE"
    "DEF:s_max=/opt/collectd/var/lib/collectd/$HOSTALIAS$/load/load.rrd:shortterm:MAX"
    "DEF:m_min=/opt/collectd/var/lib/collectd/$HOSTALIAS$/load/load.rrd:midterm:MIN"
    "DEF:m_avg=/opt/collectd/var/lib/collectd/$HOSTALIAS$/load/load.rrd:midterm:AVERAGE"
    "DEF:m_max=/opt/collectd/var/lib/collectd/$HOSTALIAS$/load/load.rrd:midterm:MAX"
    "DEF:l_min=/opt/collectd/var/lib/collectd/$HOSTALIAS$/load/load.rrd:longterm:MIN"
    "DEF:l_avg=/opt/collectd/var/lib/collectd/$HOSTALIAS$/load/load.rrd:longterm:AVERAGE"
    "DEF:l_max=/opt/collectd/var/lib/collectd/$HOSTALIAS$/load/load.rrd:longterm:MAX"
    "AREA:s_max#70DB93"
    "AREA:s_min#FFFFFF"
    "LINE1:s_avg#008000: 1 min"
    "GPRINT:s_min:MIN:%.2lf Min,"
    "GPRINT:s_avg:AVERAGE:%.2lf Avg,"
    "GPRINT:s_max:MAX:%.2lf Max,"
    "GPRINT:s_avg:LAST:%.2lf Last\\l"
    "LINE1:m_avg#0000ff: 5 min"
    "GPRINT:m_min:MIN:%.2lf Min,"
    "GPRINT:m_avg:AVERAGE:%.2lf Avg,"
    "GPRINT:m_max:MAX:%.2lf Max,"
    "GPRINT:m_avg:LAST:%.2lf Last\\l"
    "LINE1:l_avg#ff0000:15 min"
    "GPRINT:l_min:MIN:%.2lf Min,"
    "GPRINT:l_avg:AVERAGE:%.2lf Avg,"
    "GPRINT:l_max:MAX:%.2lf Max,"
    "GPRINT:l_avg:LAST:%.2lf Last\\l"
  7. Now have to tell rrd2graph that you want to see collectd data, which is done by collectd tag in service description
    "02_collectd-load" this string is parsed as "collectd" and "load" as service
  8. rrd2graph link "http://sysnetmon.diglinks.com/perl/rrd2graph.cgi?hostname=localhost&service=02_collectd-load&hostalias=localhost", would search for a rewrite rule in "/etc/n2rrd/templates/rewrite/collectd/load_rewrite"

    notes or action URL
    /perl/rrd2graph.cgi?hostname=$HOSTNAME$&service=$SERVICEDESC$&hostalias=$HOSTALIAS$
  9. where the location of RRD file and Graph templates are defined.
  • No labels