Linux - NetworkingThis forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
I've got the following script that sends SNMP packets using SNMP_Session perl module (I know it is not the best script you have ever seen, I just found it and using it, later on I will improve it):
Quote:
#!/usr/bin/perl
# use warnings;
# use strict;
my $version=1;
#use lib '/usr/lib/mrtg2'; # location of SNMP_Session.pm and BER.pm;
use SNMP_Session;
use BER;
my $trap_receiver = "xxx.xxx.xxx.xxx";
my $myIpAddress = "yyy.yyy.yyy.yyy";
my $trap_community = "public";
my $trap_session = $version eq '1'
? SNMP_Session->open ($trap_receiver, $trap_community, 162)
: SNMPv2c_Session->open ($trap_receiver, $trap_community, 162);
my $start_time = time;
link_down_trap 1, $ARGV[0], $version;
sub link_down_trap ($$$) {
my ($if_index, $message, $version) = @_;
my $genericTrap = 6;
my $specificTrap = 1;
my @ifIndex_OID = ( 1,3,6,1,4,1,666,2,2 );
my @ifDescr_OID = ( 1,3,6,1,4,1,666,2,2 );
my $upTime = int ((time - $start_time) * 100.0);
my @myOID = ( 1,3,6,1,4,1,666,2,2 );
When I've installed it on 5 different Debian machines (all Sarge), in 2 of them it worked perfectly ok, in 2 of them I get an "Operation not permitted" error message although I am running it as root, and in 1 of them the scripts executes with no error messages but no snmp packet makes its way to the receiver (OpenNMS).
About the last case I am pretty sure it is not a network issue... When I am using a little Java program that sends an snmp packet it goes with no problems!
Any ideas??? I am only using SNMP v1 (for the moment)
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.