[x]
Posted via EE Mobile

Search, ask, and monitor your questions on the go with EE Mobile. Visit Experts Exchange from your mobile device and never be out of touch again.

10/06/2006 at 10:09AM PDT, ID: 22015746
[x]
Attachment Details
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

8.8

convert this CLI script to a Webbased script

Asked by ashvillerob in Perl Programming Language

Tags: encode_oid

I use the following simple script at the command line to run a few mibs on a cable modem. I need help converting this command line script to a webinterface script.

The script is run from the command line as follows:

>myscript.pl <community string> <hostname>

I can hard code the community string into the script, but I need an input form on the new webscript so the user can manually enter the <hostname> for the script to sun on.


#!C:\perl\bin\perl -w


use strict;
use BER;
use SNMP_Session;

### Prototypes
sub usage($ );

my $hostname = $ARGV[0] || usage (1);
#my $community = $ARGV[1] || usage (1);


my $session;

## Set this if you want to see the OID for all printed values.
my $print_oids_p = 0;

die unless ($session = SNMP_Session->open ($hostname, $community, 161));

my @base_oids =
(


encode_oid (split ('\.', '1.3.6.1.2.1.69.1.4.5')), # Bootfile Name
encode_oid (split ('\.', '1.3.6.1.2.1.10.127.1.1.4.1.5')), # DS SNR
encode_oid (split ('\.', '1.3.6.1.2.1.10.127.1.1.1.1.6')), # RX PWR
encode_oid (split ('\.', '1.3.6.1.2.1.10.127.1.2.2.1.3')), # TX PWR
encode_oid (split ('\.', '1.3.6.1.2.1.10.127.1.1.1.1.2')), # DS FREQ
encode_oid (split ('\.', '1.3.6.1.2.1.10.127.1.1.2.1.2')), # US FREQ
encode_oid (split ('\.', '1.3.6.1.2')), # modem SysInfo
 
);


my $oid;
my $i;
my @next_oids = @base_oids;
ROW_LOOP:
for (;;) {
    if ($session->getnext_request_response (@next_oids)) {
      my $response = $session->pdu_buffer;
      my ($bindings, $binding, $oid, $value);
      my ($base_oid);

      ($bindings) = $session->decode_get_response ($response);
      @next_oids = ();

      foreach $base_oid (@base_oids) {
          ($binding,$bindings) = decode_sequence ($bindings);
          ($oid,$value) = decode_by_template ($binding, "%O%@");
          last ROW_LOOP
            unless BER::encoded_oid_prefix_p ($base_oid, $oid);
          push @next_oids, $oid;
          print pretty_print ($value);
          print ' [',pretty_print ($oid), "]" if $print_oids_p;
          print "\n";
      }
    } else {
      die "No response received.\n";
    }
}

$session->close ();

1;

sub usage ($ )
{
    print STDERR "Usage: $0 hostname community\n";
    exit (1) if $_[0];
}
[+][-]10/06/06 02:09 PM, ID: 17679965

View this solution now by starting your 30-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: encode_oid
Sign Up Now!
Solution Provided By: Adam314
Participating Experts: 2
Solution Grade: A
 
 
[+][-]10/12/06 07:50 PM, ID: 17721164

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 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]10/13/06 06:19 AM, ID: 17723822

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 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]10/13/06 07:33 AM, ID: 17724490

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 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]12/03/06 07:56 PM, ID: 18066168

Experts Exchange has a courteous staff of administrators who help members get the most out of the website by means of administrative comments like this one.

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

 
[+][-]12/09/06 03:47 AM, ID: 18107332

Experts Exchange has a courteous staff of administrators who help members get the most out of the website by means of administrative comments like this one.

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

 
 
Loading Advertisement...
20091111-EE-VQP-91