Skip to content

Instantly share code, notes, and snippets.

@kazeburo
Created November 11, 2011 08:04
Show Gist options
  • Select an option

  • Save kazeburo/1357479 to your computer and use it in GitHub Desktop.

Select an option

Save kazeburo/1357479 to your computer and use it in GitHub Desktop.
package CloudForecast::Data::Bigipvstraffic;
use CloudForecast::Data -base;
use CloudForecast::Log;
use SNMP;
SNMP::loadModules('F5-BIGIP-LOCAL-MIB');
rrds map { [ $_, 'COUNTER' ] } qw /in out/;
graphs 'traffic' => 'Throughput';
title {
my $c = shift;
my $vsname = $c->args->[1] || $c->args->[0] || '0';
return "Throughput ($vsname)";
};
fetcher {
my $c = shift;
my $vsname = $c->args->[0] || 0;
# .1.3.6.1.4.1.3375.2.2.10.2.3.1.1 ltmVirtualServStatName
# .1.3.6.1.4.1.3375.2.2.10.2.3.1.7 ltmVirtualServStatClientBytesIn
# .1.3.6.1.4.1.3375.2.2.10.2.3.1.9 ltmVirtualServStatClientBytesOut
my $iid;
my ($arrayret) = $c->component('SNMP')->session->bulkwalk( 0, 1,
SNMP::VarList->new(['.1.3.6.1.4.1.3375.2.2.10.2.3.1.1']) );
for my $ret ( @$arrayret ) {
if ( $vsname eq $ret->val ) {
$iid = $ret->iid;
last;
}
}
if ( !$iid ) {
CloudForecast::Log->warn("couldnot find virtualserver");
return [undef, undef];
}
$c->component('SNMP')->get(
['.1.3.6.1.4.1.3375.2.2.10.2.3.1.7.' . $iid],
['.1.3.6.1.4.1.3375.2.2.10.2.3.1.9.' . $iid],
);
};
__DATA__
@@ traffic
DEF:ind=<%RRD%>:in:AVERAGE
DEF:outd=<%RRD%>:out:AVERAGE
CDEF:in=ind,0,2500000000,LIMIT,8,*
CDEF:out=outd,0,2500000000,LIMIT,8,*
AREA:in#00C000: Inbound
GPRINT:in:LAST:Current\:%6.2lf %sbps
GPRINT:in:AVERAGE:Ave\:%6.2lf %sbps
GPRINT:in:MAX:Max\:%6.2lf %sbps\c
LINE1:out#0000FF: Outbound
GPRINT:out:LAST:Current\:%6.2lf %sbps
GPRINT:out:AVERAGE:Ave\:%6.2lf %sbps
GPRINT:out:MAX:Max\:%6.2lf %sbps\c
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment