Archived community.zenoss.org | full text search
Skip navigation
1 2 Previous Next 111648 Views 18 Replies Latest reply: Jan 12, 2010 12:02 PM by jcurry RSS Go to original post
  • gramik Rank: White Belt 40 posts since
    Oct 29, 2008
    Currently Being Moderated
    16. Jan 12, 2010 9:42 AM (in response to jcurry)
    Re: RenderServer - Generating links to graphs

    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";
    
    
  • gramik Rank: White Belt 40 posts since
    Oct 29, 2008
    Currently Being Moderated
    17. Jan 12, 2010 9:59 AM (in response to gramik)
    Re: RenderServer - Generating links to graphs

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

     


  • jcurry ZenossMaster 1,021 posts since
    Apr 15, 2008
    Currently Being Moderated
    18. Jan 12, 2010 12:02 PM (in response to jcurry)
    Re: RenderServer - Generating links to graphs

    Many thanks to joll200x and gramik!

    Cheers,

    Jane

1 2 Previous Next

More Like This

  • Retrieving data ...

Legend

  • Correct Answers - 4 points
  • Helpful Answers - 2 points