I sent this out earlier this month and am still stuck and haven't seen a
response so I wanted to ask one more time. Can anyone send a working example
in perl? I would rather keep the program in perl instead of using system
calls to snmptrap.

>From the SNMP pod I have the following code, but I cannot seem to find out
how to make it actually send the trap :)



#!/usr/bin/perl

use SNMP;

my $host = '127.0.0.1';
my $comm = 'public';

$oid = "1.3.6.1.4.1.683.6.0";
$ipaddress = "123.12.123.1";

my $sess = new SNMP::TrapSession ( HostName => $host, Community => $comm,
Debug => "1", Port => 162 );
$sess->trap(enterprise=>'.1.3.6.1.4.1.2021',
        agent => '127.0.0.1',
        generic => specific,
        specific => 5,
        uptime => 1234);


Thanks,

Greg




> -----Original Message-----
> From: [EMAIL PROTECTED] 
> [mailto:[EMAIL PROTECTED] On Behalf 
> Of King, John (Greg) (LMIT-HOU)
> Sent: Wednesday, May 11, 2005 10:07 AM
> To: net-snmp-users@lists.sourceforge.net
> Subject: Perl snmp_trap examples?
> 
>  
> I need some help in figuring out how to send a trap via a 
> perl script using the net-snmp libraries for Perl. I have 
> searched various places (google, this list etc) and found 
> examples of using Perl system calls to call the snmptrap 
> binary but none just using either
> 
> SNMP::TrapSession
> Or
> Snmp_trap()
> 
> The list search for the above returns an error (colons and _ 
> I guess cause the search program to kick it). Google returns 
> pages but so far all I found were examples that I used to create this:
> 
> system "/usr/bin/snmptrap -v1 -c $SNMP_COMM_NAME 
> $SNMP_TRAP_HOST $SNMP_ENTERPRISE_ID $HOSTNAME $SNMP_GEN_TRAP 
> $SNMP_SPECIFIC_TRAP ''
> $SNMP_EVENT_IDENT_ONE $SNMP_EVENT_VTYPE_ONE \"$SNMP_EVENT_VAR_ONE\"";
> 
> I also checked the tarballs for examples and there is a trap 
> example but it reads like a trap listener of some sort and 
> not something to send a trap out.
> 
> This is on a RHES system using net-snmp-perl-5.0.9-2.30E.12
> 
> 
> Thanks,
> 
> Greg
> 
> 
> -------------------------------------------------------
> This SF.Net email is sponsored by Oracle Space Sweepstakes 
> Want to be the first software developer in space?
> Enter now for the Oracle Space Sweepstakes!
> http://ads.osdn.com/?ad_id=7393&alloc_id=16281&op=click
> _______________________________________________
> Net-snmp-users mailing list
> Net-snmp-users@lists.sourceforge.net
> Please see the following page to unsubscribe or change other options:
> https://lists.sourceforge.net/lists/listinfo/net-snmp-users
> 


-------------------------------------------------------
This SF.Net email is sponsored by Yahoo.
Introducing Yahoo! Search Developer Network - Create apps using Yahoo!
Search APIs Find out how you can build Yahoo! directly into your own
Applications - visit http://developer.yahoo.net/?fr=offad-ysdn-ostg-q22005
_______________________________________________
Net-snmp-users mailing list
Net-snmp-users@lists.sourceforge.net
Please see the following page to unsubscribe or change other options:
https://lists.sourceforge.net/lists/listinfo/net-snmp-users

Reply via email to