Perl snmp script problem


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Perl snmp script problem
# 1  
Old 12-20-2013
Perl snmp script problem

does anyone know why this isn't showing me any output?

Code:
#!/usr/bin/perl

use strict;
use Net::SNMP;

my $host = 'localhost';
my $community = 'public';
my $session;
my $error;
my $response = undef;  

($session, $error) = Net::SNMP->session(
  -hostname => $host,
  -version => 2,
  -community =>$community,
  -port => 161,
  -timeout => 10
);

my $oid_ifTable = '1.3.6.1.2.1.2.2';

if( !defined( $response = $session->get_next_request($oid_ifTable)))
{
  if( $session->error_status == 2)
  {
    my $sessionError = $session->error;
    print ("($sessionError) OID not supported ($oid_ifTable).\n");
  }
}
else
{
  print ("$response");
}

Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. IP Networking

SNMP Problem - SNMP not getting to the agent.

I am having a problem with an SNMP event, and I am not sure where I should be looking to solve this problem. Description: There is an SNMP event in our system that for one reason or another is not getting sent out as an email because it is never getting to our SNMP agent. I see where the... (0 Replies)
Discussion started by: broberts
0 Replies

2. Programming

Problem with my perl script

hiii alll i wrote a prgm which would take position and strand from file 1 and tries to locate a string 250 characters ahead/before that position in anothe file (based on strand 0 or 1) open my $fhConditions, "<", "1.txt" or die "Epic Fail: $!"; open my $fhCharacters, "<", "2.txt" or die "OMG... (1 Reply)
Discussion started by: anurupa777
1 Replies

3. Web Development

problem with exporting vairable from one perl cgi to another perl cgi script while redirecting.

Can anyone tell me how to export a variable from one perl CGI script to another perl cgi script when using a redirect. Upon running the login.pl the user is prompted to enter user name and password. Upon entering the correct credentials (admin/admin) the user is redirected to welcome page. My... (3 Replies)
Discussion started by: Arun_Linux
3 Replies

4. Programming

Perl SNMP set pdu with multiple values

Hi, I'm trying to set two OID's in the same PDU (so both OIDs and values are sent in the same packet) at present I am only able to send one at a time which does not trigger the hardware response as the two specific OID's need to be set simultaneously in order to work. I'm using perl along... (0 Replies)
Discussion started by: MCLASS
0 Replies

5. Shell Programming and Scripting

Need help with SNMP perl script

I want to have a script that takes the following: Runs this Command: snmpwalk -v 1 -c public devicename 1.3.2.1.15.1.1.3 which returns the following: SNMPv2-SMI::mib-2.10.1.3.3.54.124.178.134 = INTEGER: 6 SNMPv2-SMI::mib-2.10.1.1.3.62.52.16.38 = INTEGER: 6... (1 Reply)
Discussion started by: streetfighter2
1 Replies

6. Shell Programming and Scripting

perl Net::SNMP version getting info from cisco switch

I am having trouble working with SNMP module with perl. I am trying to get SNMP version of target system. I use following code to get it however it resturns error as "Argument "v6.0.1" isn't numeric in numeric lt (<) at ./chk_env_upd.pl line 447." Get load table my $resultat =... (1 Reply)
Discussion started by: dynamax
1 Replies

7. IP Networking

SNMP Problem

Hi, basically I'm just looking at the O'Reilly book 'Essential SNMP' and am following one of the examples. The code in the example is: #!/usr/bin/perl use SNMP::Util; my $MIB1 = $ARGV; my $HOST = $ARGV; ($MIB1) && ($HOST) || die "Usage: $0 MIB_OID HOSTNAME"; my $value =... (0 Replies)
Discussion started by: cabaiste
0 Replies

8. Infrastructure Monitoring

SNMP problem

Hi all I had the server, when i run the below snmp command in the server (CNORA4/10.86.33.18), it cant give me the result. # snmpwalk -v1 -ctestuser 10.86.33.18 hrProcessorLoad Timeout: No Response from 10.86.33.18 but when i run another command, it seem like ok # snmpwalk -v1 -ctestuser... (1 Reply)
Discussion started by: SmartAntz
1 Replies

9. Infrastructure Monitoring

Facing problem while configuring snmp

HI, I am facing these two errors while configuring snmp can any body guide me. vi /var/log/snmpd.log Error opening specified endpoint "udp:161" Server Exiting with code 1 i also tried bash-3.00# netstat -a | grep snm *.snmpd Idle bash-3.00# lsof -i :161 bash: lsof: command not... (2 Replies)
Discussion started by: nir1785
2 Replies

10. Shell Programming and Scripting

call shell script from perl cgi script problem

hi,, i have perl scipt with line : system('./try.sh $t $d $m'); in shell scipt try.sh i have the line: echo $1 its not printing value of $t that i hav passed..y is it so..i am running it from apache web server (2 Replies)
Discussion started by: raksha.s
2 Replies
Login or Register to Ask a Question
cups-snmp(8)							    Apple Inc.							      cups-snmp(8)

NAME
snmp - cups snmp backend SYNOPSIS
/usr/lib/cups/backend/snmp ip-address-or-hostname /usr/libexec/cups/backend/snmp ip-address-or-hostname lpinfo -v --include-schemes snmp DESCRIPTION
The CUPS SNMP backend provides legacy discovery and identification of network printers using SNMPv1. When used for discovery through the scheduler, the backend will list all printers that respond to a broadcast SNMPv1 query with the "public" community name. Additional queries are then sent to printers that respond in order to determine the correct device URI, make and model, and other information needed for printing. In the first form, the SNMP backend is run directly by the user to look up the device URI and other information when you have an IP address or hostname. This can be used for programs that need to configure print queues where the user has supplied an address but nothing else. In the second form, the SNMP backend is run indirectly using the lpinfo(8) command. The output provides all printers detected via SNMP on the configured broadcast addresses. Note: no broadcast addresses are configured by default. MIBS
The CUPS SNMP backend uses the information from the Host, Printer, and Port Monitor MIBs along with some vendor private MIBs and intelli- gent port probes to determine the correct device URI and make and model for each printer. CONFIGURATION
The SNMP backend reads the /etc/cups/snmp.conf configuration file, if present, to set the default broadcast address, community name, and logging level. The configuration file is documented in cups-snmp.conf(5). The DebugLevel value can be overridden using the CUPS_DEBUG_LEVEL environment variable and the MaxRunTime value can be overridden using the CUPS_MAX_RUN_TIME environment variable. SEE ALSO
backend(7), cups-snmp.conf(5), cupsd(8), cupsd.conf(5), filter(7), lpinfo(8), http://localhost:631/help COPYRIGHT
Copyright 2007-2013 by Apple Inc. 8 July 2013 CUPS cups-snmp(8)