Welcome to Linux Forums!

With a comprehensive Linux Forum, information on various types of Linux software and many Linux Reviews articles, we have all the knowledge you need a click away, or accessible via our knowledgeable members.

Linux Forum ArticlesLinux ForumsLinux Forum DownloadsLinux Hosts
Home|Register|FAQ|Member List|Calendar|Unanswered Posts|Forum Rules|Today's Posts|Advanced Search|
SEARCH FOR IN
Go Back   Linux Forums > Your Distro > Gentoo Linux Help
Reload this Page Net-SNMP
Linux Forums
Linux Forums
Welcome To The Linux Forums!
Welcome to Linux Forums. We pride ourselves in being one of the largest Linux communities on the web, we encourage you to REGISTER on our forums and participate in the community. There are over 150,000 members ready to answer your questions. JOINING US today will allow you to make new posts, get support, send messages to other members and submit downloads to our downloads directory and many other great features!

Gentoo Linux Help For help and discussion related to Gentoo Linux

Reply
 
Thread Tools Display Modes
Old 11-20-2007   #1 (permalink)
minutemaid
Just Joined!
 
Join Date: Nov 2007
Posts: 5
Net-SNMP

I've installed net-snmp in hopes to be able to capture the SNMP messages sent out by our UPS on our nix/win boxes in case of power failure. Is there a way to log all snmp traffic sent? In windows with loriotpro the message I get is:

<0> americanpower () for agent 192.168.10.187 from proxy [192.168.10.187] ups: switched to battery backup power.

I'm really confused on how to make a trap for this and I thought if I could at least log everything I could sort through to find the data I need. I tried Net-SNMP in windows but got the same results.
minutemaid is offline   Reply With Quote
Old 11-21-2007   #2 (permalink)
robin_bga
Just Joined!
 
Join Date: Nov 2007
Posts: 59
Well i always recommend Ntop for such issues. U have one machine sniffing all the packets and u can see the whole network's throughput. in both graphs and pie charts.
All the best
Cheers
Robin
robin_bga is offline   Reply With Quote
Old 11-21-2007   #3 (permalink)
minutemaid
Just Joined!
 
Join Date: Nov 2007
Posts: 5
I'll give it a shot. It wouldn't be so hard if there was some short of shell/gui on the boxes so I could use some of the many available apps but they are just bare essential installs of gentoo.

I ended up writing a program to ssh from win into nix and shutdown that way which is not my preferred method.

Last edited by minutemaid; 11-21-2007 at 08:44 PM. Reason: added more to the post
minutemaid is offline   Reply With Quote
Old 11-23-2007   #4 (permalink)
minutemaid
Just Joined!
 
Join Date: Nov 2007
Posts: 5
ntop is nice but it doesn't have working snmp logging yet:
"SNMP support disabled or not available"

Wish there was a better net-snmp guide out there. The ones they provide are good but the trap testing part is too vague for me to follow
minutemaid is offline   Reply With Quote
Old 11-26-2007   #5 (permalink)
minutemaid
Just Joined!
 
Join Date: Nov 2007
Posts: 5
When the UPS send out its messages it works in windows but in linux I get:
<28>Nov 26 11:13:23 snmptrapd[8224]: No access configuration - dropping trap.


snmptrapd.conf:
Code:
traphandle default /usr/local/bin/Hello
traphandle public /usr/local/bin/Hello
traphandle "default" /usr/local/bin/Hello
traphandle "public" /usr/local/bin/Hello
traphandle americanPower.1.3.2.13 /usr/local/bin/Hello
minutemaid is offline   Reply With Quote
Old 11-28-2007   #6 (permalink)
minutemaid
Just Joined!
 
Join Date: Nov 2007
Posts: 5
So I have everything sorted out and figured I'd post what I ended up doing to get Net-SNMP to log everything and have a traphandle trigger an event which is my custom perl script:

Requirements
Code:
Net-SNMP (Only need to use snmptrapd)
Perl
File::ReadBackwards Perl module from CPAN
snmptrapd.conf
snmppl (custom script)
My snmptrapd.conf contains:
Code:
disableAuthorization yes
traphandle default /usr/local/bin/snmppl
My /usr/local/bin/snmppl contains:
Code:
#!/usr/bin/perl
use File::ReadBackwards;
$bw = File::ReadBackwards->new( '/var/log/everything/current' ) or die "can not read $!";
$errString = $bw->readline;
print "$errString\n";

if ($errString =~ /Switched to battery backup power/) {
        print "Switched to battery power\n";
        system "shutdown -h +2";
} elsif ($errString =~ /Returned from battery backup power/) {
        print "Power returned switching off battery power\n";
        system "shutdown -c";
}
if ($errString =~ /configuration/) {
       print "Config change\n";
}
Edited /etc/conf.d/snmptrapd :
Code:
SNMPTRAPD_FLAGS="-Lf /var/log/snmptrapd.out"
Then I added it to my start up:
Code:
rc-update -a snmptrapd default
And I ended up finding the OID:
1.3.6.1.4.1.318.2.3.3.0 being the full oid with object for the msg
SNMPv2-SMI::enterprises.318.2.3.3.0 same but named
1.3.6.1.4.1.318 just the root OID

When I changed data I got this and every message has the same OID just the STRING changes:
SNMPv2-SMI::enterprises.318.2.3.3.0 = STRING: "System: SNMP configuration change. SNMP trap receiver 4 address."

I hope this helps some one, took way longer to sort all this out then it should of. I know it's not perfect but it works.
minutemaid is offline   Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
IPTables SNMP problems drewrockshard Linux Networking 1 10-20-2007 02:18 AM
SNMP agent/CLI parser igor_a The Linux Kernel 1 11-17-2005 10:30 AM
SNMP RHAS 3.0 vs RHAS2.1 nitind Redhat / Fedora Linux Help 0 05-13-2005 11:13 AM
SNMP in RedHat linux 3.0 nitind Redhat / Fedora Linux Help 0 05-12-2005 11:53 AM
SNMP Configuration Problem keenlearner Linux Security 8 02-04-2005 02:41 AM




All times are GMT. The time now is 11:53 AM.




© 2000 - 2008 - All Rights Reserved - Property of  MAS Media

Content Relevant URLs by vBSEO 3.0.0