Rrdtool graph

From I Will Fear No Evil
Revision as of 20:03, 28 May 2023 by Chubbard (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

RRDtool Graph examples

This seems to be the biggest PITA to deal with. There are simply too many options and they are VERY sensitive to n00bs.

This works (but looks like crap since I am learning)

rrdtool graph ${DEST}  --width 500 --height 100 --title "temp and humidity (2 hour resolution)" \
--font AXIS:8: \
--font LEGEND:8: \
--font UNIT:8: \
--x-grid MINUTE:30:HOUR:2:HOUR:2:0:"%I%p" \
           DEF:ds0=/opt/nmsApi/rrd/database.rrd:temperature:AVERAGE \
           DEF:ds0max=/opt/nmsApi/rrd/database.rrd:temperature:MAX \
           DEF:ds0min=/opt/nmsApi/rrd/database.rrd:temperature:MIN \
           DEF:ds1=/opt/nmsApi/rrd/database.rrd:humidity:AVERAGE \
           DEF:ds1max=/opt/nmsApi/rrd/database.rrd:humidity:MAX \
           DEF:ds1min=/opt/nmsApi/rrd/database.rrd:humidity:MIN \
           COMMENT:'BLAH                  ' COMMENT:' Last ' COMMENT:' Avg ' COMMENT:' Min ' COMMENT:' Max ' COMMENT:'\l' \
           LINE1.25:ds0#00cc00:'temperature ' GPRINT:ds0:LAST:%5.1lf%s GPRINT:ds0:AVERAGE:%5.1lf%s GPRINT:ds0min:MIN:%5.1lf%s GPRINT:ds0max:MAX:%5.1lf%s COMMENT:'\l' \
           LINE3.25:ds1#0000ff:'humidity ' GPRINT:ds1:LAST:%5.1lf%s GPRINT:ds1:AVERAGE:%5.1lf%s GPRINT:ds1min:MIN:%5.1lf%s GPRINT:ds1max:MAX:%5.1lf%s COMMENT:'\l'

Adding a line like a threshold value is done with the HRULE

  • Value 50 will show up in the legend
  • This is outside of the DS or anything dealing with our raw data, you can just add whatever.
HRULE:50#FF0000:"Value 50"

To debug before attempting graphs simply change graph to graphv

graph_left = 57
graph_top = 28
graph_width = 500
graph_height = 100
image_width = 587
image_height = 213
graph_start = 1685322126
graph_end = 1685329326
value_min = 2.0000000000e+01
value_max = 7.0000000000e+01
legend[0] = "BLAH                  "
coords[0] = "16,150,170,164"
legend[1] = " Last "
coords[1] = "186,150,228,164"
legend[2] = " Avg "
coords[2] = "244,150,279,164"
legend[3] = " Min "
coords[3] = "295,150,330,164"
legend[4] = " Max "
coords[4] = "346,150,381,164"
legend[5] = "  temperature "
coords[5] = "16,164,114,178"
legend[6] = " 31.0 "
coords[6] = "130,164,172,178"
legend[7] = " 27.4 "
coords[7] = "188,164,230,178"
legend[8] = " 29.2 "
coords[8] = "246,164,288,178"
legend[9] = " 31.0 "
coords[9] = "304,164,346,178"
legend[10] = "  humidity "
coords[10] = "16,178,93,192"
legend[11] = " 65.0 "
coords[11] = "109,178,151,192"
legend[12] = " 64.9 "
coords[12] = "167,178,209,192"
legend[13] = " 64.0 "
coords[13] = "225,178,267,192"
legend[14] = " 66.0 "
coords[14] = "283,178,325,192"
legend[15] = "  Value 50"
coords[15] = "16,192,86,206"