#!/usr/local/bin/perl

use SNMP 1.8;

require "parameters.plib";

$var = new SNMP::Varbind(['1.3.6.1.4.1.785.6.1.7', '0']);

$session = new SNMP::Session ( DestHost => $host,
                                Community => $community,
                                RemotePort => $port );

print "Could not open session"
                if !defined($session);

$resp = $session->get($var);

if (!defined($resp)) {
	die "SNMP-request error\n";
}

$value = $var->[$SNMP::Varbind::val_f];

if ($session->{ErrorInd} != 0) {
	printf "Return error status '%d' means '%s' at index '%d'\n", $session->{ErrorNum}, $session->{ErrorStr}, $session->{ErrorInd};
} else {
	print "The max spare servers is '$value'\n";
}
