if you're feeling brave, this is what I have so far...
it's a little rough around the edges but it works.
I don't have the EXACT original Perl code, but I believe this should be pretty close. Just change the @options array to match the RRD options for whatever you're trying to display.
NOTE: $url_end can be modified to specify a different time range. This example uses the default values of "start = 36hrs ago", "end = now". The comment variable is not really necessary - just displays the date start-end times on the graph, which must be manually calculated by you if you wish to use the correct values relative to your chosen time range.
#!/usr/bin/perl -w
use Compress::Zlib;
use MIME::Base64::URLSafe;
my $url_start = 'http://<ZENOSS-SERVER>:8090/render?gopts=';
my $url_end = '&drange=129600&width=500&start=end-129600s&end=now-0s&comment=2009-06-14%203%5C%3A26%5C%3A53%5Ct%5Ct%5Ct%20to%20%5Ct%5Ct%5Ct2009-06-15%2015%5C%3A26%5C%3A53';
my @options = (
'-F',
'-E',
'--height=100',
'--lower-limit=0',
'--rigid',
'--vertical-label=bits/sec',
'DEF:ifHCInOctets-raw=/usr/local/zenoss/perf/Devices/<DEVICE>/os/interfaces/GigabitEthernet4_6/ifHCInOctets_ifHCInOctets.rrd:ds0:MAX',
'CDEF:ifHCInOctets-rpn=ifHCInOctets-raw,8,*',
'CDEF:ifHCInOctets=ifHCInOctets-rpn',
'AREA:ifHCInOctets-rpn#00cc00ff:Inbound Traffic',
'GPRINT:ifHCInOctets-rpn:LAST:cur\:%5.2lf%s',
'GPRINT:ifHCInOctets-rpn:AVERAGE:avg\:%5.2lf%s',
'GPRINT:ifHCInOctets-rpn:MAX:max\:%5.2lf%s\j',
'DEF:ifHCOutOctets-raw=/usr/local/zenoss/perf/Devices/<DEVICE>/os/interfaces/GigabitEthernet4_6/ifHCOutOctets_ifHCOutOctets.rrd:ds0:MAX',
'CDEF:ifHCOutOctets-rpn=ifHCOutOctets-raw,8,*',
'CDEF:ifHCOutOctets=ifHCOutOctets-rpn',
'LINE1:ifHCOutOctets-rpn#0000ff99:Outbound Traffic',
'GPRINT:ifHCOutOctets-rpn:LAST:cur\:%5.2lf%s',
'GPRINT:ifHCOutOctets-rpn:AVERAGE:avg\:%5.2lf%s',
'GPRINT:ifHCOutOctets-rpn:MAX:max\:%5.2lf%s\j'
);
my $gopts = urlsafe_b64encode(compress(join('|', @options), 9)) . '==';
my $URL = $url_start . $gopts . $url_end;
print "$URL\n";
In similar fashion to the previous code, this snippet allows you to "decode" an existing graph URL created by Zenoss, thus allowing you to see what the actual RRD options are for the graph the RenderServer has created. This is akin to viewing the "Graph Commands" tab of a graph definition in a perf template.
#!/usr/bin/perl -w
use Compress::Zlib;
use MIME::Base64::URLSafe;
### The original URL goes here, but remove the first part, up to and including "gopts="
### Also remove the last part, beginning with "&drange="
###
my $gopts = ''; # your data here
my @results = myDecode($gopts);
foreach (@results) {
print "$_\n";
}
sub myDecode {
my $data = shift;
my @results = split /\|/, uncompress(urlsafe_b64decode($data));
return(@results);
}
Many thanks to joll200x and gramik!
Cheers,
Jane
Follow Us On Twitter »
|
Latest from the Zenoss Blog » | Community | Products | Services Resources | Customers Partners | About Us | ||
Copyright © 2005-2011 Zenoss, Inc.
|
||||||||