Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7781883
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T19:22:03+00:00 2026-06-01T19:22:03+00:00

I have a Perl script that monitors any SNMP enabled service. The way it

  • 0

I have a Perl script that monitors any SNMP enabled service.

The way it works is I have a config file with multiple services, and each service has a list of metrics to collect.

Example:

[switch]
switch_stuff1 = 1.3.6.1.2.1.7.1.0
switch_stuff2 = 1.3.6.1.2.1.7.4.0
switch_stuff3 = 1.3.6.1.2.1.6.2.0
switch_stuff4 = 1.3.6.1.2.1.6.3.0
switch_stuff5 = 1.3.6.1.2.1.6.5.0

[router]
router_stuff1 = 1.3.6.1.2.1.6.8.0
router_stuff2 = 1.3.6.1.2.1.6.8.0
router_stuff3 = 1.3.6.1.2.1.6.9.0

[database]
db_stuff1 = 1.3.6.1.2.1.6.4.0
db_stuff2 = 1.3.6.1.2.1.6.5.0

The script will loop through the config file, obtain the information for all the metrics and write the output to a CSV file.

Now, onto what I need help with.

I was asked to implement logic that would allow the use of wildcards in the SNMP paths to collect. So my config file would now need to look like this:

[switch]
switch_stuff1 = 1.5.1.6.*
switch_stuff2 = 1.45.*.12

So when the collection will happen, it will somehow loop like this:

      switch_stuff1

1.5.1.6.0 – found, continue
1.5.1.6.1 – found, continue
1.5.1.6.2 – not found, stop

      switch_stuff2           

1.45.0.12 – found, continue
1.45.1.12 – found, continue
1.45.2.12 – found, continue
1.45.3.12 – not found, stop

I’m currently using the Net::SNMP library:

http://metacpan.org/pod/Net::SNMP

Would this be possible to do? I was thinking of somehow simulating an “snmpwalk” via the get_entries or get_table methods, but I’m not quite sure if that would work.

If anyone can help out or at least point me in the right direction, it would be greatly appreciated.

Thank you.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-01T19:22:05+00:00Added an answer on June 1, 2026 at 7:22 pm

    For entries like switch_stuff1 = 1.5.1.6.* you could simply send first request and after that loop through get_next_request as long as you get data.

    However, with config like switch_stuff2 = 1.45.*.12 it is not so simple any more. You can’t use get_next_request and you have to iterate over possible values yourself. The problem is that numbers are “usually” continuous but not always and in latter case it makes it quite stressful for the system to just try all possible numbers. At least if you really need to do this then I suggest to cache somehow OIDs that exists and not scan them every time you collect data.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a Perl script that works on Windows XP. It uses File::Copy's move
I have a Perl script that uses WWW::Mechanize to read from a file and
I have a Perl script that replaces any Us or Ns at the end
I have a Perl script that reads a command file and restarts itself if
I have a perl script that is inserting records from a text file into
I am new to Perl, by the way. I have a Perl script that
I have a Perl script that I'm attempting to set up using Perl Threads
I have a Perl script that sets up variables near the top for directories
I have a Perl script that I'd like to run on Windows, using either
I have a Perl script that pops up a message box when its work

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.