#!/usr/bin/perl

# use strict;

use SNMP;

$SNMP::use_sprint_value = 1;

my $host = "localhost";
my $community="public";

$sess = new SNMP::Session(
	'DestHost'	=> $host,
	'Community'	=> $community,
	'Version'	=>  2
	);

die "cannot create session: ${SNMP::ErrorStr}\n" unless defined $sess;

my $getvars = new SNMP::VarList(
	['ifDescr',2],
	['ifInOctets',2],
	['ifOutOctets',2]
	);

my $count = 0;
my $previnoctets = 0;
my $prevoutoctets = 0;

while ($count < 100) {
	$count++;

	my @response = $sess->get($getvars);

	my $ifname     = @response[0];
	my $ifinoctets = @response[1];
	my $ifoutoctets= @response[2];
	print "$ifname ifinoctets = $ifinoctets;";
	my $delta = $ifinoctets - $previnoctets;
	$previnoctets = $ifinoctets;
	print "\t\tdelta = $delta\n";
	sleep 10;
}

	
