mikaku / Monitorix

Monitorix is a free, open source, lightweight system monitoring tool.
https://www.monitorix.org
GNU General Public License v2.0
1.1k stars 166 forks source link

Feature Request: rrdtools PNG debug output #213

Open gitqlt opened 5 years ago

gitqlt commented 5 years ago

For debugging, I'd like to generate slightly modified PNG graphs width the rrdtool graph utility. It would be very useful to see in the monitorix debug log the construction strings of the RRD PNG graphs assembled by the monitorix CGI functions. Something like

rrdtool graph 'graph.png' \
--width '400' \
--height '100' \
--start end-1d \
'DEF:d1=db.rrd:ds1:AVERAGE' \
'CDEF:q=d1,200,+' \
'VDEF:qv=d1,LAST' \
'VRULE:qv#000000' \
'AREA:d1#33FF66:ltex' \
'PRINT:qv:%.1lf'

(The example above was created by http://rrdwizard.appspot.com/)

mikaku commented 5 years ago

Can you, please, provide a screen shot? Sometimes a picture is worth a thousand words. ;-)

gitqlt commented 5 years ago

Sorry, I cannot provide a screenshot. I suppose that monitorix creates the graphs using the data read from its files (like /var/lib/monitorix/zfs.rrd) and I will be able to regenerate the graphs with rrdtool graph commands, when having the evaluated graph construction strings from the debug log would be a great help. (The example below is from /usr/lib/monitorix/zfs.pm). Please ignore my request if I was wrong and generating the graphs this way is not possible.

    $pic = $rrd{$version}->

    ("$IMG_DIR" . "$IMG1",
        "--title=$config->{graphs}->{_zfs1}  ($tf->{nwhen}$tf->{twhen})",
        "--start=-$tf->{nwhen}$tf->{twhen}",
        "--imgformat=$imgfmt_uc",
        "--vertical-label=bytes",
        "--width=$width",
        "--height=$height",
        @riglim,
        $zoom,
        @{$cgi->{version12}},
        @{$colors->{graph_colors}},
        "DEF:arcsize=$rrd:zfs_arcsize:AVERAGE",
        "DEF:cmax=$rrd:zfs_cmax:AVERAGE",
        "DEF:cmin=$rrd:zfs_cmin:AVERAGE",
        "DEF:c=$rrd:zfs_arctgtsize:AVERAGE",
        "DEF:limit=$rrd:zfs_metalimit:AVERAGE",
        "DEF:max=$rrd:zfs_metamax:AVERAGE",
        "DEF:used=$rrd:zfs_metaused:AVERAGE",
        "CDEF:allvalues=arcsize,cmax,cmin,c,limit,max,used,+,+,+,+,+,+",
        @CDEF,
        "COMMENT: \\n",
        @tmp);
mikaku commented 5 years ago

Ah, I think I understood it now. You mean that you'd like to see real call to RRDs::graph[v], with all the values instead of their corresponding variables?

I don't know if RRDtool has a method to obtain such information, otherwise that would require to include a pre-formatting line before making the call, in order to be able to log its contents.

mikaku commented 4 years ago

In the latest Monitorix version, I've introduced a new option which may help you here.

With this new option, you might include any extra RRDtool option during the graph generation without having to touch a line of Perl code.

I hope that helped you.