Monitorix icon indicating copy to clipboard operation
Monitorix copied to clipboard

Feature Request: rrdtools PNG debug output

Open gitqlt opened this issue 7 years ago • 4 comments

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/)

gitqlt avatar Sep 25 '18 16:09 gitqlt

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

mikaku avatar Sep 26 '18 08:09 mikaku

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);

gitqlt avatar Sep 26 '18 15:09 gitqlt

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 avatar Sep 26 '18 16:09 mikaku

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.

mikaku avatar Feb 24 '20 15:02 mikaku