#!/usr/bin/perl use Net::SNMP; my $host = "192.168.0.49"; my $community = "eX0gyN37"; my ($snmp,$snmperror) = Net::SNMP->session( -hostname => $host, -community => $community ); # hostname OID (this line doesnt work) # my $OID = "1.3.6.1.4.1.9.2.1.3"; # number of interfaces OID (this line works) my $OID = "1.3.6.1.2.1.2.1.0"; my $result = $snmp->get_request ( $OID ) or die "FAIL: $! \n"; print $result->{$OID} . "\n"; #### $ snmpwalk -v2c -c eX0gyN37 192.168.0.49 1.3.6.1.2.1.2.1.0 IF-MIB::ifNumber.0 = INTEGER: 53 $ snmpwalk -v2c -c eX0gyN37 192.168.0.49 1.3.6.1.4.1.9.2.1.3 SNMPv2-SMI::enterprises.9.2.1.3.0 = STRING: "sw-studentcenter-basement-1"