(RADIATOR) New Cisco SNMP query

Vangelis Kyriakakis vkyriak at forthnet.gr
Tue Nov 11 04:49:32 CST 2003


Hello,

      With Cisco IOS 12.2.15T there is a new SNMP OID that gives the 
users that are connected  according to the Decimal  Acct-Session-Id. So 
with this OID you can always use snmpget to check if a user is still 
online. This works for Async, ISDN and ADSL users. You need to use the 
Decimal form of the Acct-Session-Id not the Hexadecimal. We use an SQL 
Session database and we do the conversion there. I don't know if there 
is a Hextoint function in Perl

          Regards
               Vangelis


package Radius::Nas::Cisco;
use Radius::SNMP;
use strict;

# The Cisco SNMP MIB
$Radius::Nas::CiscoMIB = '.iso.org.dod.internet.private.enterprises.9';

sub isOnline
{
    my ($name, $nas_id, $nas_port, $session_id, $client) = @_;

    return 1 unless &Radius::SNMP::snmpgetprogExists();

        &main::log($main::LOG_DEBUG, "Cisco: Checking $session_id-> 
$nas_id:$nas_port:$name" );

        my $result = &Radius::SNMP::snmpget
            ($nas_id,
             $client->{SNMPCommunity},
             "$Radius::Nas::CiscoMIB.9.150.1.1.3.1.2.$session_id");

        return 1 if (!$result || $result =~ /no response/i); # Could not 
SNMP. Assume still there
        return uc($1) eq uc($name)
            if ($result =~ /^.*\"([^"]+)".*$/);

    return 0; # not there
}

1;


===
Archive at http://www.open.com.au/archives/radiator/
Announcements on radiator-announce at open.com.au
To unsubscribe, email 'majordomo at open.com.au' with
'unsubscribe radiator' in the body of the message.


More information about the radiator mailing list