Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

  1. Functional collectd running on nagios or remote server
  2. location of rrdfile
  3. Graph Template
  4. nagios command (any)

Advanced Example, ethernet interface stats.

...

  1. Rewrite rule advanced

    Code Block
    #
    # Please note the order is important
    #
    # collectd_type must be defined first, single type could be passed as argument in URL
    # which will override the TYPE definition given below
    # URL: <QUERY_STRING>&collectd_type=if_octets
    # If TYPE variable used please note the following
    #                        TYPE:0   ,TYPE:1    ,TYPE:2
    collectd_type_array      if_octets,if_packets,if_errors
    collectd_rrd_base       /opt/collectd/var/lib/collectd
    #
    # Location of RRD file
    rrd_file         $COLLECTD_RRD_BASE$/$HOSTALIAS$/$COLLECTD_PLUGIN$-$COLLECTD_INSTANCE$/$COLLECTD_TYPE:0$.rrd
    #
    # Location of GRAPH template
    graph_template   /etc/n2rrd/templates/graph-collectd/$COLLECTD_PLUGIN$/$COLLECTD_TYPE:0$.t
  2. graph template if_octets

    Code Block
    titleinstance = if_octets
    --imgformat=PNG
    --title="$HOSTNAME$ - $SERVICENAME$ Average"
    --height=120
    --width=500
    --lower-limit=0
    --vertical-label="Bits per second"
    --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:out_min_raw=$COLLECTD_RRD_BASE$/$HOSTALIAS$/$COLLECTD_PLUGIN$-$COLLECTD_INSTANCE$/if_octets.rrd:tx:MIN
    DEF:out_avg_raw=$COLLECTD_RRD_BASE$/$HOSTALIAS$/$COLLECTD_PLUGIN$-$COLLECTD_INSTANCE$/if_octets.rrd:tx:AVERAGE
    DEF:out_max_raw=$COLLECTD_RRD_BASE$/$HOSTALIAS$/$COLLECTD_PLUGIN$-$COLLECTD_INSTANCE$/if_octets.rrd:tx:MAX
    DEF:inc_min_raw=$COLLECTD_RRD_BASE$/$HOSTALIAS$/$COLLECTD_PLUGIN$-$COLLECTD_INSTANCE$/if_octets.rrd:rx:MIN
    DEF:inc_avg_raw=$COLLECTD_RRD_BASE$/$HOSTALIAS$/$COLLECTD_PLUGIN$-$COLLECTD_INSTANCE$/if_octets.rrd:rx:AVERAGE
    DEF:inc_max_raw=$COLLECTD_RRD_BASE$/$HOSTALIAS$/$COLLECTD_PLUGIN$-$COLLECTD_INSTANCE$/if_octets.rrd:rx:MAX
    CDEF:out_min=out_min_raw,8,*
    CDEF:out_avg=out_avg_raw,8,*
    CDEF:out_max=out_max_raw,8,*
    CDEF:inc_min=inc_min_raw,8,*
    CDEF:inc_avg=inc_avg_raw,8,*
    CDEF:inc_max=inc_max_raw,8,*
    CDEF:overlap=out_avg,inc_avg,GT,inc_avg,out_avg,IF
    CDEF:mytime=out_avg_raw,TIME,TIME,IF
    CDEF:sample_len_raw=mytime,PREV(mytime),-
    CDEF:sample_len=sample_len_raw,UN,0,sample_len_raw,IF
    CDEF:out_avg_sample=out_avg_raw,UN,0,out_avg_raw,IF,sample_len,*
    CDEF:out_avg_sum=PREV,UN,0,PREV,IF,out_avg_sample,+
    CDEF:inc_avg_sample=inc_avg_raw,UN,0,inc_avg_raw,IF,sample_len,*
    CDEF:inc_avg_sum=PREV,UN,0,PREV,IF,inc_avg_sample,+
    AREA:out_avg#D0F5A9
    AREA:inc_avg#CEECF5
    AREA:overlap#E6F8E0
    LINE1:out_avg#00CC00:Outgoing
    GPRINT:out_avg:AVERAGE:%5.1lf%s Avg,
    GPRINT:out_max:MAX:%5.1lf%s Max,
    GPRINT:out_avg:LAST:%5.1lf%s Last
    GPRINT:out_avg_sum:LAST:(ca. %5.1lf%sB Total)\l
    LINE1:inc_avg#4169E1:Incoming
    #'GPRINT:inc_min:MIN:%5.1lf %s Min,
    GPRINT:inc_avg:AVERAGE:%5.1lf%s Avg,
    GPRINT:inc_max:MAX:%5.1lf%s Max,
    GPRINT:inc_avg:LAST:%5.1lf%s Last
    GPRINT:inc_avg_sum:LAST:(ca. %5.1lf%sB Total)\l
  3. graph template if_packets

    Code Block
    titleinstance = if_packets
     --imgformat=PNG
    --title=$HOSTNAME$ - $SERVICENAME$
    --height=120
    --width=500
    --lower-limit=0
    --vertical-label=Packets/s
    --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:tx_min=$COLLECTD_RRD_BASE$/$HOSTALIAS$/$COLLECTD_PLUGIN$-$COLLECTD_INSTANCE$/if_packets.rrd:tx:MIN
    DEF:tx_avg=$COLLECTD_RRD_BASE$/$HOSTALIAS$/$COLLECTD_PLUGIN$-$COLLECTD_INSTANCE$/if_packets.rrd:tx:AVERAGE
    DEF:tx_max=$COLLECTD_RRD_BASE$/$HOSTALIAS$/$COLLECTD_PLUGIN$-$COLLECTD_INSTANCE$/if_packets.rrd:tx:MAX
    DEF:rx_min=$COLLECTD_RRD_BASE$/$HOSTALIAS$/$COLLECTD_PLUGIN$-$COLLECTD_INSTANCE$/if_packets.rrd:rx:MIN
    DEF:rx_avg=$COLLECTD_RRD_BASE$/$HOSTALIAS$/$COLLECTD_PLUGIN$-$COLLECTD_INSTANCE$/if_packets.rrd:rx:AVERAGE
    DEF:rx_max=$COLLECTD_RRD_BASE$/$HOSTALIAS$/$COLLECTD_PLUGIN$-$COLLECTD_INSTANCE$/if_packets.rrd:rx:MAX
    
    CDEF:overlap=tx_avg,rx_avg,GT,rx_avg,tx_avg,IF
    CDEF:mytime=tx_avg,TIME,TIME,IF
    CDEF:sample_len_raw=mytime,PREV(mytime),-
    CDEF:sample_len=sample_len_raw,UN,0,sample_len_raw,IF
    CDEF:tx_avg_sample=tx_avg,UN,0,tx_avg,IF,sample_len,*
    CDEF:tx_avg_sum=PREV,UN,0,PREV,IF,tx_avg_sample,+
    CDEF:rx_avg_sample=rx_avg,UN,0,rx_avg,IF,sample_len,*
    CDEF:rx_avg_sum=PREV,UN,0,PREV,IF,rx_avg_sample,+
    
    AREA:tx_avg#CEF6CE
    AREA:rx_avg#CED8F6
    AREA:overlap#58FAD0
    LINE1:tx_avg#31B404:TX
    GPRINT:tx_avg:AVERAGE:%5.1lf%s Avg
    GPRINT:tx_max:MAX:%5.1lf%s Max
    GPRINT:tx_avg:LAST:%5.1lf%s Last
    GPRINT:tx_avg_sum:LAST:(ca. %4.0lf%s Total)\l
    
    LINE1:rx_avg#08088A:RX
    GPRINT:rx_avg:AVERAGE:%5.1lf%s Avg
    GPRINT:rx_max:MAX:%5.1lf%s Max
    GPRINT:rx_avg:LAST:%5.1lf%s Last
    GPRINT:rx_avg_sum:LAST:(ca. %4.0lf%s Total)\l
    
    
  4. graph template if_errors.t

    Code Block
    --imgformat=PNG
    --title=$HOSTNAME$ - $SERVICENAME$
    --height=120
    --width=500
    --lower-limit=0
    --vertical-label=Errors/s
    --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:tx_min=$COLLECTD_RRD_BASE$/$HOSTALIAS$/$COLLECTD_PLUGIN$-$COLLECTD_INSTANCE$/if_errors.rrd:tx:MIN
    DEF:tx_avg=$COLLECTD_RRD_BASE$/$HOSTALIAS$/$COLLECTD_PLUGIN$-$COLLECTD_INSTANCE$/if_errors.rrd:tx:AVERAGE
    DEF:tx_max=$COLLECTD_RRD_BASE$/$HOSTALIAS$/$COLLECTD_PLUGIN$-$COLLECTD_INSTANCE$/if_errors.rrd:tx:MAX
    DEF:rx_min=$COLLECTD_RRD_BASE$/$HOSTALIAS$/$COLLECTD_PLUGIN$-$COLLECTD_INSTANCE$/if_errors.rrd:rx:MIN
    DEF:rx_avg=$COLLECTD_RRD_BASE$/$HOSTALIAS$/$COLLECTD_PLUGIN$-$COLLECTD_INSTANCE$/if_errors.rrd:rx:AVERAGE
    DEF:rx_max=$COLLECTD_RRD_BASE$/$HOSTALIAS$/$COLLECTD_PLUGIN$-$COLLECTD_INSTANCE$/if_errors.rrd:rx:MAX
    
    CDEF:overlap=tx_avg,rx_avg,GT,rx_avg,tx_avg,IF
    CDEF:mytime=tx_avg,TIME,TIME,IF
    CDEF:sample_len_raw=mytime,PREV(mytime),-
    CDEF:sample_len=sample_len_raw,UN,0,sample_len_raw,IF
    CDEF:tx_avg_sample=tx_avg,UN,0,tx_avg,IF,sample_len,*
    CDEF:tx_avg_sum=PREV,UN,0,PREV,IF,tx_avg_sample,+
    CDEF:rx_avg_sample=rx_avg,UN,0,rx_avg,IF,sample_len,*
    CDEF:rx_avg_sum=PREV,UN,0,PREV,IF,rx_avg_sample,+
    
    AREA:tx_avg#CEF6CE
    AREA:rx_avg#CED8F6
    AREA:overlap#58FAD0
    
    LINE1:tx_avg#31B404:TX
    GPRINT:tx_avg:AVERAGE:%5.1lf%s Avg
    GPRINT:tx_max:MAX:%5.1lf%s Max
    GPRINT:tx_avg:LAST:%5.1lf%s Last
    GPRINT:tx_avg_sum:LAST:(ca. %4.0lf%s Total)\l
    
    LINE1:rx_avg#08088A:RX
    GPRINT:rx_avg:AVERAGE:%5.1lf%s Avg
    GPRINT:rx_max:MAX:%5.1lf%s Max
    GPRINT:rx_avg:LAST:%5.1lf%s Last
    GPRINT:rx_avg_sum:LAST:(ca. %4.0lf%s Total)\l