Advertisement

02.22.2008 at 10:05AM PST, ID: 23185272
[x]
Attachment Details

Need help with SNMP Walking Script to output to MySQL database

Asked by s2000lover in Perl Programming Language

Tags: perl

Hello,

I'm trying to make a SNMP walking script that will save the results to a database. Here is a example of what i'm trying to do...

The Access Point i'm trying to poll using SNMP uses LUID to uniquely mark every device connected to it. All the snmp walk results are all marked by the LUID in the snmp walk. For example the last digit in the snmpwalk .luid at the end. I would like these results to be added to a mysql database table that way we can query the database when needed.

Here is a few snmp strings i want to track.

AdaptRate 1.3.6.1.4.1.161.19.3.1.4.1.40
LinkESN 1.3.6.1.4.1.161.19.3.1.4.1.20
LastPowerLevel 1.3.6.1.4.1.161.19.3.1.4.1.35
LastJitter 1.3.6.1.4.1.161.19.3.1.4.1.23

These are the SNMP Strings if you add.LUID when you walk the SNMP string that will give you the value for that device.

So for example i would like a table updated in mysql to match the luid results. So there would be a record that coordinates with the LUID that also on that same record will have the luid results for that string i'm trying to get.

Example:
LUID 1 => 1.3.6.1.4.1.161.19.3.1.4.1.40.1
LUID 2 => 1.3.6.1.4.1.161.19.3.1.4.1.40.2
and so on.

Here is a example of the table i want to create.

LUID,AdaptRate,LinkESN,LastPowerLevel,LastJitter
1,1x,00-0e-f0-00-03-26,-78,6
2,2x,00-0e-f1-03-34-25,-79,2

Any help will be greatly appreciated. I have attached what i have so far.

*** I need the SNMP part. This is the section that i'm having a very hard time with. I also need to modify this MySQL section that will auto check to see if record already exists and updates it if it does.Start Free Trial
1:
2:
3:
4:
5:
6:
7:
use DBI;
 
my $dbh = DBI->connect($data_source, $username, $password);
my $sth = $dbh->prepare("INSERT INTO table (LUID, AdaptRate, LinkESN, LastPowerLevel, LastJitter) VALUES (?, ?, ?, ?, ?)");
 
#Then for all of your data:
$sth->execute($Luid, $AdaptRate, $LinkESN, $LastPowerLevel, $LastJitter);
[+][-]02.22.2008 at 11:07AM PST, ID: 20960323

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]02.22.2008 at 12:40PM PST, ID: 20961197

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]02.22.2008 at 01:19PM PST, ID: 20961533

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zone: Perl Programming Language
Tags: perl
Sign Up Now!
Solution Provided By: FishMonger
Participating Experts: 2
Solution Grade: A
 
 
[+][-]02.25.2008 at 02:05PM PST, ID: 20979731

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]02.25.2008 at 02:08PM PST, ID: 20979764

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]02.25.2008 at 03:07PM PST, ID: 20980198

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]02.25.2008 at 03:11PM PST, ID: 20980223

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]02.25.2008 at 03:38PM PST, ID: 20980381

Assisted solutions are selected by the member who asked the question as a comment that contributed to their question's solution.

Start your 7-day free trial to view this Assisted Solution or ask the Experts your question.

 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_2_20070628