Discussion:
ZENRRD - External Front-End for Zenoss Graphs. Cacti Like zooming with date ranges
ace6285
2012-11-23 13:32:35 UTC
Permalink
ace6285 [http://community.zenoss.org/people/ace6285] created the discussion

"Re: ZENRRD - External Front-End for Zenoss Graphs. Cacti Like zooming with date ranges"

To view the discussion, visit: http://community.zenoss.org/message/70124#70124

--------------------------------------------------------------
Hi robetr. First of all, great job with this awesome work. I've tried this and it works great. However, I'm trying to add another metric for the interfaces (since the default is just throughput, packets and errors) but can't seem to properly load it (please note that the RRDs for this metric is already in Zenoss). Haven't found any directions on how to do that (README and github), but tried to figure it out by reviewing the codes. First I've tried to define the RRD files in zenoss_rrd.cgi as well as the template to be used (and type called by functions.php). I've just copy pasted the existing codes and just change the appropriate variables/fields. Then in functions.php, copied the part in which the type is called. Then of course created the appropriate template in the templates folder. Bel
ow is the template:

-F
-E
--disable-rrdtool-tag
--height=100
--lower-limit=0
--vertical-label=bytes
DEF:inboundbytes-raw={$rrd_file_in}:ds0:LAST
DEF:inboundbytes-raw-max={$rrd_file_in}:ds0:MAX
CDEF:inboundbytes-rpn=inboundbytes-raw,1000,*
CDEF:inboundbytes-rpn-max=inboundbytes-raw-max,1000,*
CDEF:inboundbytes=inboundbytes-rpn
AREA:inboundbytes-rpn#00cc00ff:inboundbytes :STACK
GPRINT:inboundbytes-rpn:LAST:cur\:%5.2lf%s
GPRINT:inboundbytes-rpn:AVERAGE:avg\:%5.2lf%s
GPRINT:inboundbytes-rpn-max:MAX:max\:%5.2lf%s\j
DEF:outboundbytes-raw={$rrd_file_out}:ds0:LAST
DEF:outboundbytes-raw-max={$rrd_file_out}:ds0:MAX
CDEF:outboundbytes-rpn=outboundbytes-raw,1000,*
CDEF:outboundbytes-rpn-max=outboundbytes-raw-max,1000,*
CDEF:outboundbytes=outboundbytes-rpn
AREA:outboundbytes-rpn#0000ffff:outboundbytes :STACK
GPRINT:outboundbytes-rpn:LAST:cur\:%5.2lf%s
GPRINT:outboundbytes-rpn:AVERAGE:avg\:%5.2lf%s
GPRINT:outboundbytes-rpn-max:MAX:max\:%5.2lf%s\j


Anything that I'm missing or need to check. Thanks
--------------------------------------------------------------

Reply to this message by replying to this email -or- go to the discussion on Zenoss Community
[http://community.zenoss.org/message/70124#70124]

Start a new discussion in zenoss-users by email
[discussions-community-forums-zenoss--***@community.zenoss.org] -or- at Zenoss Community
[http://community.zenoss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2003]
robertr
2012-11-23 18:37:20 UTC
Permalink
robertr [http://community.zenoss.org/people/robertr] created the discussion

"Re: ZENRRD - External Front-End for Zenoss Graphs. Cacti Like zooming with date ranges"

To view the discussion, visit: http://community.zenoss.org/message/70132#70132

--------------------------------------------------------------
I am glad someone found this useful. It's the first thing I have ever created and published on github.

I checked out the rrd and it looked fine, but I needed to test it to verify it parses. These were the only code changes I needed to add a new template.

1) file: cgi-bin/zenoss_rrd.cgi

# I am assuming the bytes would use the input packets rrd from zenoss

if ($params->{'type'} =~ /bytes/) {
        $rrd_template = 'bytes';
        $label = 'Bytes';
        $rrd_in = $rrd_base_int . $rrd_in_pkt;
        $rrd_out = $rrd_base_int . $rrd_out_pkt;
    }


2) file: functions.php

$type = 'bytes';
print "<p><a href='$zoom&type=$type' target='_Blank' class='zoom_cur'><img title='Click to ZOOM' src='$url&type=$type' ></a>";
if ($show_url) {        print "<br><font size=2><a href='$url&type=$type' target='_blank'>$url&type=$type</a></font>"; }



3) file: templates/bytes

-F
-E
--disable-rrdtool-tag
--height=100
--lower-limit=0
--vertical-label=bytes
DEF:inboundbytes-raw={$rrd_file_in}:ds0:LAST
DEF:inboundbytes-raw-max={$rrd_file_in}:ds0:MAX
CDEF:inboundbytes-rpn=inboundbytes-raw,1000,*
CDEF:inboundbytes-rpn-max=inboundbytes-raw-max,1000,*
CDEF:inboundbytes=inboundbytes-rpn
AREA:inboundbytes-rpn#00cc00ff:inboundbytes :STACK
GPRINT:inboundbytes-rpn:LAST:cur\:%5.2lf%s
GPRINT:inboundbytes-rpn:AVERAGE:avg\:%5.2lf%s
GPRINT:inboundbytes-rpn-max:MAX:max\:%5.2lf%s\j
DEF:outboundbytes-raw={$rrd_file_out}:ds0:LAST
DEF:outboundbytes-raw-max={$rrd_file_out}:ds0:MAX
CDEF:outboundbytes-rpn=outboundbytes-raw,1000,*
CDEF:outboundbytes-rpn-max=outboundbytes-raw-max,1000,*
CDEF:outboundbytes=outboundbytes-rpn
AREA:outboundbytes-rpn#0000ffff:outboundbytes :STACK
GPRINT:outboundbytes-rpn:LAST:cur\:%5.2lf%s
GPRINT:outboundbytes-rpn:AVERAGE:avg\:%5.2lf%s
GPRINT:outboundbytes-rpn-max:MAX:max\:%5.2lf%s\j



This all worked and the graph showed up as a broken image. I imagine this is what you were seeing. So now it's time to figure out why it's broken. I was hoping since I actually didn't check previously that zenoss logs errors when an RRD fails. It does.

* RRD event log file in zenoss, for me, is located in */opt/zenoss/log/event.log*

I tailed the log file and then refreshed the webpage trying to render the image a few times. This is the error I kept seeing
2012-11-23T10:05:06 ERROR zen.RenderServer Failed to generate a graph
Traceback (most recent call last):
  File "/opt/zenoss/Products/ZenRRD/RenderServer.py", line 169, in render
    rrdtool_fn()
  File "/opt/zenoss/Products/ZenUtils/Utils.py", line 1739, in _inner
    return fn(*args,**kwargs)
  File "/opt/zenoss/Products/ZenRRD/RenderServer.py", line 168, in rrdtool_fn
    rrdtool.graph(*(gopts + list(rrd_daemon_args())))
error: the RRD does not contain an RRA matching the chosen CF
------


*tl;dr - Solution*

The rrd config contains a consolidation function the rrd file doesn't like/have. The CF it doesn't like is 'LAST' for the input/output ds0. So I change the two lines:

DEF:inboundbytes-raw={$rrd_file_in}:ds0:LAST
DEF:outboundbytes-raw={$rrd_file_out}:ds0:LAST

- to -
DEF:inboundbytes-raw={$rrd_file_in}:ds0:AVERAGE
DEF:outboundbytes-raw={$rrd_file_out}:ds0:AVERAGE


-- entire file ---
-F
-E
--disable-rrdtool-tag
--height=100
--lower-limit=0
--vertical-label=bytes
DEF:inboundbytes-raw={$rrd_file_in}:ds0:AVERAGE
DEF:inboundbytes-raw-max={$rrd_file_in}:ds0:MAX
CDEF:inboundbytes-rpn=inboundbytes-raw,1000,*
CDEF:inboundbytes-rpn-max=inboundbytes-raw-max,1000,*
CDEF:inboundbytes=inboundbytes-rpn
AREA:inboundbytes-rpn#00cc00ff:inboundbytes :STACK
GPRINT:inboundbytes-rpn:LAST:cur\:%5.2lf%s
GPRINT:inboundbytes-rpn:AVERAGE:avg\:%5.2lf%s
GPRINT:inboundbytes-rpn-max:MAX:max\:%5.2lf%s\j
DEF:outboundbytes-raw={$rrd_file_out}:ds0:AVERAGE
DEF:outboundbytes-raw-max={$rrd_file_out}:ds0:MAX
CDEF:outboundbytes-rpn=outboundbytes-raw,1000,*
CDEF:outboundbytes-rpn-max=outboundbytes-raw-max,1000,*
CDEF:outboundbytes=outboundbytes-rpn
AREA:outboundbytes-rpn#0000ffff:outboundbytes :STACK
GPRINT:outboundbytes-rpn:LAST:cur\:%5.2lf%s
GPRINT:outboundbytes-rpn:AVERAGE:avg\:%5.2lf%s
GPRINT:outboundbytes-rpn-max:MAX:max\:%5.2lf%s\j



When you said that rrd metric is already in zenoss, does it actually show up under the Interfaces? My default install does not include bytes as a default graph. I assume two things with this metric includes - either their template is broken or one would have to add this metric to the interfaces so it starts logging the LAST CF to the rrd file.
--------------------------------------------------------------

Reply to this message by replying to this email -or- go to the discussion on Zenoss Community
[http://community.zenoss.org/message/70132#70132]

Start a new discussion in zenoss-users by email
[discussions-community-forums-zenoss--***@community.zenoss.org] -or- at Zenoss Community
[http://community.zenoss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2003]
ace6285
2012-11-24 06:18:03 UTC
Permalink
ace6285 [http://community.zenoss.org/people/ace6285] created the discussion

"Re: ZENRRD - External Front-End for Zenoss Graphs. Cacti Like zooming with date ranges"

To view the discussion, visit: http://community.zenoss.org/message/70134#70134

--------------------------------------------------------------
Thanks for the detailed reply. Was able to fix the issue. It turns out the error is due to an encoding issue. I've created/edited the template in MS notepad and pasted it directly in the file (ssh shell). This introduced some spaces (or other characters) which usually happens when you paste something edited from MS to a *NIX file. Was able to figure this out by checking the event.log which you have suggested (the log shows " " which causes the error).  Also, just to inform, the LAST function also works. The metric which I want to add (the metric basically shows the total incoming and outgoing bytes volume for the month) is now properly loaded.

Again, thanks for the quick reply and for this awesome work.
--------------------------------------------------------------

Reply to this message by replying to this email -or- go to the discussion on Zenoss Community
[http://community.zenoss.org/message/70134#70134]

Start a new discussion in zenoss-users by email
[discussions-community-forums-zenoss--***@community.zenoss.org] -or- at Zenoss Community
[http://community.zenoss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2003]
Loading...