Перейти к содержимому
Калькуляторы

sSIDs

Новичок
  • Публикации

    4
  • Зарегистрирован

  • Посещение

Сообщения, опубликованные пользователем sSIDs


  1. Настроить SNMP агент и сделать snmpwalk на корневой OID.
    простите, но я не совсем понимаю) корневой OID это куда?можно ли объяснить как дилетанту?MIBы вроде бы нашел для моих Ciena 6500, но какой из трех не знаю. по очереди пробовать?

    CIENA-CES-MGMT-INTERFACE-MIB.txt

    CIENA-CES-VLLI-MIB.txt

    SONET_SDH-MIB.my.txt

  2. Оба плагина используют стандартную RFC'шную(т.е. не vendor'скую) SONET-MIB, если оборудование ее поддерживает, то плагины заработают.

    Найти ее в Интернетах - http://www.oidview.com/mibs/0/SONET-MIB.html .

    а как узнать поддерживает оборудование или нет?

  3. поставили Nagios нашел плагины, 2 штуки к нему, админ разбирается, не знаю заработает или нет...я в кодинге не силен.

    Сам плагин под спойлером

    1.

     

    [Nagiosplug-devel] check_sonet plugin
    
    This plug-in uses SNMP to check the Sonet MIB (RFC 2558) for the
    status of SONET or SDH interfaces.
    
    see more at  http://lists.nagios.com/pipermail/nagiosplugin-devel/2004-April/002102.html
    
    
    Jim Mozley jim.mozley at exponential-e.com 
    Thu Apr 22 01:43:05 UTC 2004
    Previous message: [Nagiosplug-devel] [ nagiosplug-New Plugins-939170 ] check_yum - Check if YUM/RPM based system is up-to-date
    Next message: [Nagiosplug-devel] [ nagiosplug-New Plugins-940139 ] check Network UPS Tools daemon
    Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
    Below is a plugin for checking sonet/sdh interfaces. I'm unsure of the 
    submission process for contributed plugins but anyone is welcome to use 
    it. I've aimed to abide by the plug-in guidelines. One obvious 
    difference I can see is that I've used warnings rather than perl -w 
    (which I guess could cause problems with anyone using pre 5.6 perl?). 
    Happy to correct anything like this should the plugin be deemed useful 
    enough or suitable to include in any contrib type distribution.
    
    This has been tested on RiverStone switches so I'd welcome any feedback 
    from anyone who can test it on other vendors equipment.
    
    Jim Mozley
    
    
    
    
    
    #!/usr/local/bin/perl
    
    =head1 Description
    
    This plug-in uses SNMP to check the Sonet MIB (RFC 2558) for the
    status of SONET or SDH interfaces.
    
    The information is collected by querying the ifType table to determine
    the Sonet interfaces. Each physical sonet interface also has a logical
    path interface. If these interfaces are administratively up then the
    Sonet MIB status tables for the line sections and path are checked.
    
    The status is defined in the Sonet MIB as an integer representing a
    binary whose bit positions indicate problems. See RFC 2558. Line and
    section problems are flagged against the physical interface, while path
    errors are flagged against the logical path interface.
    
    It is intended to check the sonet interfaces on a host as one service 
    rather than treating them as individual services to reduce the number of
    SNMP queries to the device.
    
    =cut
    
    
    use strict;
    use warnings;
    
    use POSIX;
    use Net::SNMP;
    use Getopt::Long;
    Getopt::Long::Configure('bundling');
    
    use lib "/usr/local/nagios/libexec"  ;
    use utils qw($TIMEOUT %ERRORS &print_revision &support);
    
    my $PROGNAME = "check_sonet";
    
    my $status;
    my $state = "UNKNOWN";
    my $answer = "";
    my $community = "public";
    my $port = 161;
    my @snmpoids;
    
    my $ifType = '1.3.6.1.2.1.2.2.1.3';
    my $ifAdminStatus = '1.3.6.1.2.1.2.2.1.7';
    my $ifName = '1.3.6.1.2.1.31.1.1.1.1';
    my $ifDescr = '1.3.6.1.2.1.2.2.1.2';
    my $lineStatus = '1.3.6.1.2.1.10.39.1.3.1.1.1';
    my $sectionStatus = '1.3.6.1.2.1.10.39.1.2.1.1.1';
    my $pathStatus = '1.3.6.1.2.1.10.39.2.1.1.1.2';
    
    my $hostname;
    my %ifStatus;
    my $lineup = 0;
    my $sectionup = 0;
    my $pathup = 0;
    my $iferr = 0;
    my $ifmessage = "";
    my $snmp_version = 1;
    
    my $opt_h;
    my $opt_V;
    
    
    # Just in case of problems, let's not hang Nagios
    $SIG{'ALRM'} = sub {
         print ("ERROR: No snmp response from $hostname (alarm timeout)\n");
         exit $ERRORS{"UNKNOWN"};
    };
    alarm($TIMEOUT);
    
    
    #Option checking
    $status = GetOptions(
         "V"   => \$opt_V,        "version"         => \$opt_V,
         "h"   => \$opt_h,        "help"            => \$opt_h,
         "v=i" => \$snmp_version, "snmp_version=i"  => \$snmp_version,
         "C=s" => \$community,    "community=s"     => \$community,
         "p=i" => \$port,         "port=i"          => \$port,
         "H=s" => \$hostname,     "hostname=s"      => \$hostname,
         );
    
    if ($status == 0)
    {
         print_help() ;
         exit $ERRORS{'OK'};
    }
    
    
    if ($opt_V) {
        print_revision($PROGNAME,'$Revision: 1.0 $ ');
        exit $ERRORS{'OK'};
    }
    
    if ($opt_h) {
        print_help();
        exit $ERRORS{'OK'};
    }
    
    if (! utils::is_hostname($hostname)){
        usage();
        exit $ERRORS{"UNKNOWN"};
    }
    
    unless  ( $snmp_version =~ /[12]/ ) {
        $state='UNKNOWN';
        print ("$state: No support for SNMP v$snmp_version yet\n");
        exit $ERRORS{$state};
    }
    
    
    my ($session, $error) = Net::SNMP->session(
        -hostname  => $hostname,
        -community => $community,
        -port      => $port,
        -version   => $snmp_version
    );
    
    unless ( $session ) {
            $state='UNKNOWN';
            $answer=$error;
            print ("$state: $answer");
            exit $ERRORS{$state};
    }
    
    push(@snmpoids,
         $ifType,
         $ifAdminStatus,
         $ifDescr,
         $lineStatus,
         $sectionStatus,
         $pathStatus
         );
    
    foreach my $tableoid (@snmpoids) {
        my $varbind_ref;
        my $oid;
    
        unless (defined($varbind_ref = $session->get_table($tableoid))) {
            $answer = $session->error;
            $session->close;
            $state = 'CRITICAL';
            print ("$state: $answer for $tableoid with snmp version 
    $snmp_version\n");
            exit $ERRORS{$state};
        }
    
        foreach (keys %{$varbind_ref}) {
            my ( $index ) = /.*\.(\d+)$/;
            $ifStatus{$index}{$tableoid} = $varbind_ref->{$_};
        }
    }
    
    $session->close;
    
    foreach my $index (keys %ifStatus) {
    
        # check only if interface is administratively up
        if ($ifStatus{$index}{$ifAdminStatus} == 1 ) {
    
            # if interface is a sonet (39) check sonetLineCurrentStatus
            # and sonetSectionCurrentStatus tables
            if ( $ifStatus{$index}{$ifType} == 39 ) {
                if ( $ifStatus{$index}{$lineStatus} == 1 ) {
                     $lineup++;
                }
                else {
                    $iferr++;
                    my @status = line_status(
                        bit_positions( $ifStatus{$index}{$lineStatus} )
                        );
                    $ifmessage .= sprintf(
                                          "%s: line status %s ",
                                          $ifStatus{$index}{$ifDescr},
                                          join ',', @status
                                          );
                }
                if ( $ifStatus{$index}{$sectionStatus} == 1 ) {
                    $sectionup++;
                }
                else {
                    $iferr++;
                    my @status = section_status(
                        bit_positions( $ifStatus{$index}{$sectionStatus} )
                        );
                    $ifmessage .= sprintf(
                                          "%s: section status is %s ",
                                          $ifStatus{$index}{$ifDescr},
                                          join ',', @status
                                          );
                }
            }
    
            # if interface is a sonetPath (50) check
            # sonetPathCurrentStatus table
            if ( $ifStatus{$index}{$ifType} == 50 ) {
                if ( $ifStatus{$index}{$pathStatus} == 1 ) {
                    $pathup++;
                }
                else {
                    $iferr++;
                    my @status = path_status(
                        bit_positions( $ifStatus{$index}{$pathStatus} )
                        );
                    $ifmessage .= sprintf(
                                          "%s: path status is %s ",
                                          $ifStatus{$index}{$ifDescr},
                                          join ',', @status
                                          );
                }
            }
    
        }
    }
    
    
    if ($iferr > 0) {
        $state = 'CRITICAL';
        $answer = sprintf(
                          "host '%s' - %d errors: ",
                          $hostname,
                          $iferr,
                          );
        $answer = $answer . $ifmessage . "\n";
    }
    else {
        $state = 'OK';
        $answer = sprintf(
                          "host '%s', %d lines, sections and paths up",
                          $hostname,
                          $lineup + $sectionup + $pathup,
                          );
        $answer = $answer . $ifmessage . "\n";
    }
    
    print ("$state: $answer");
    exit $ERRORS{$state};
    
    
    # Name: bit_positions
    # Input: integer
    # Description: Takes an integer and converts this to a binary. Each bit
    # that is set to one is converted back to its decimal value and the list
    # of these is returned.
    # e.g. we are passed integer 20 representing binary 10100 so we need
    # to return 16 and 4.
    # Returns: list of bit positions
    sub bit_positions {
        my @bits = split //, dec2bin( shift );
        my @bit_pos;
    
        # go through the bits looking for 1's
        while ( @bits ) {
    my $length = scalar @bits;
    next unless shift @bits; # skip if this bit is zero
    
    # Build the binary number and add the decimal conversion of
    # it to the list of bit positions.
    my $format = "%-$length" . "s";
    my $binnum = sprintf( $format, 1 );
    $binnum =~ tr/ /0/;
    push @bit_pos, bin2dec( $binnum );
        }
    
        return reverse @bit_pos;
    } # end bit_positions
    
    # Names: line_status, section_status, path_status
    # Input: list of numbers
    # Description: These return the status values correponding to the
    # bit positions as in the SONET-MIB
    # Returns: list of status values
    
    sub line_status {
        my %status = (
    	  1 => 'sonetLineNoDefect',
    	  2 => 'sonetLineAIS',
    	  4 => 'sonetLineRDI',
    	 );
    
        return @status{ @_ };
    } # end line_status
    
    sub section_status {
        my %status = (
    	  1 => 'sonetSectionNoDefect',
    	  2 => 'sonetSectionLOS',
    	  4 => 'sonetSectionLOF',
    	 );
    
        return @status{ @_ };
    } # end section_status
    
    sub path_status {
        my %status = (
    	  1 => 'sonetPathNoDefect',
    	  2 => 'sonetPathSTSLOP',
    	  4 => 'sonetPathSTSAIS',
    	  8 => 'sonetPathSTSRDI',
    	  16 => 'sonetPathUnequipped',
    	  32 => 'sonetPathSignalLabelMismatch',
    	 );
    
        return @status{ @_ };
    } # end path_status
    
    # Names: dec2bin, bin2dec
    # Input: decimal or binary
    # Description: These convert decimal to binary
    # Returns: converted number
    
    sub dec2bin {
        my $str = unpack("B32", pack("N", shift));
        $str =~ s/^0+(?=\d)//;   # remove leading zeros
        return $str;
    }
    
    sub bin2dec {
        return unpack("N", pack("B32", substr("0" x 32 . shift, -32)));
    }
    
    sub usage {
        (my $usage = <<'    USAGEEND') =~ s/^\s+//gm;
        Usage:
    
        check_sonet -H <hostname> -p <port> -v <snmp-version> -C 
    <read-community>
    
        check_sonet -h  # for help
        check_sonet -V  # for version of this plug-in
        USAGEEND
        print $usage;
        support();
        exit $ERRORS{"UNKNOWN"};
    } # end usage
    
    sub print_help  {
        (my $help = <<'    HELPEND') =~ s/^\s+//gm;
        Help:
    
        check_sonet plugin for Nagios monitors the status
        of Sonet network interface on the target host
    
        Options:
    
        -H (--hostname)      Hostname to query - (required)
        -p (--port)          SNMP port (default 161)
        -C (--community)     SNMP read community (defaults to public)
        -v (--snmp_version)  1 for SNMPv1 (default) 2 for SNMPv2c
        -V                   Plugin version
        -h (--help)          help
    
        HELPEND
        print $help;
        print_revision($PROGNAME, '$Revision: 1.0 $');
    } # end print_help
    
    
    
    
    Previous message: [Nagiosplug-devel] [ nagiosplug-New Plugins-939170 ] check_yum - Check if YUM/RPM based system is up-to-date
    Next message: [Nagiosplug-devel] [ nagiosplug-New Plugins-940139 ] check Network UPS Tools daemon
    Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
    More information about the Nagiosplugin-devel mailing list

     

     

    второй плагин

    #!/usr/local/bin/perl
    #
    # check sonet line error stats
    # 
    # by Doke Scott, doke@udel.edu, 2004 Apr 5 
    
    #use strict;
    use Socket;
    use Getopt::Std;
    
    $ENV{PATH} = "/usr/bin:/usr/local/bin:/usr/local/net-snmp/bin";
    
    my $warn_cv = 1;  
    my $warn_es = 1;  
    my $warn_ses = 1;  
    my $warn_sefs = 1;  
    my $warn_uas = 1;  
    
    my $crit_cv = 50;  
    my $crit_es = 25;  
    my $crit_ses = 10;  
    my $crit_sefs = 5;  
    my $crit_uas = 3;  
    
    my $verbose = 0;
    my $use_snmpv2 = 1;
    
    
    ######################
    
    
    my( $community, $host, %line_curr_table, %line_interval_table, %opts,
       %section_curr_table, @crit_errors, @warn_errors, @unknown_errors, $rc );
    
    
    sub usage { 
       my( $rc ) = @_;
       print qq{Usage: $0 [-w <thresholds>] [-c <thresholds>] -C <community> -H <host> [-v]
       threshold is "<cv>,<es>,<ses>,<sefs>,<uas>", ie "50,25,10,5,3"
    };
    
       exit $rc;
       }
    
    getopts( 'w:c:H:C:v', \%opts );
    
    $verbose++ if ( $opts{ v } );
    
    &usage() if ( ! $opts{ H } );
    $host = $opts{ H };
    
    &usage() if ( ! $opts{ C } );
    $community = $opts{ C };
    
    if ( $opts{ w } ) { 
       ( $warn_cv, $warn_es, $warn_ses, $warn_sefs, $warn_uas )
    = split( /,/, $opts{ w }, );
       }
    if ( $opts{ c } ) { 
       ( $crit_cv, $crit_es, $crit_ses, $crit_sefs, $crit_uas )
    = split( /,/, $opts{ c }, );
       }
    
    &get_info( $host, $community ); 
    &check_current();
    &check_prev();
    
    
    $rc = 0;   # nagios ok exit code
    $" = ", ";
    if ( scalar( @crit_errors ) ) { 
       print "CRITICAL: @crit_errors ";
       $rc = 2;
       }
    if ( scalar( @warn_errors ) ) { 
       print "; " if ( $rc != 0 );
       print "Warning: @warn_errors ";
       $rc = 1 if ( $rc == 0 );
       }
    if ( scalar( @unknown_errors ) ) { 
       print "; " if ( $rc != 0 );
       print "Unknown: @unknown_errors ";
       $rc = -1 if ( $rc == 0 );
       }
    elsif ( $rc == 0 ) { 
       print "OK"; 
       }
    print "\n";
    exit $rc;   
    
    
    ##########################
    
    
    
    
    
    
    sub get_info { 
       my( $host, $community ) = @_;
       my( $col, $slot, $val, $interval );
    
       # get the sonetSectionCurrentTable
       &snmpwalk( *fH,  $host, $community, "mib-2.10.39.1.2.1" );
       while ( <fH> ) { 
    next unless ( m/\.2\.1\.1\.(\d+)\.(\d+) (\d+)/ );
    $col = $1;
    $slot = $2 >> 12;
    $val = $3;
    $section_curr_table{ $slot }{ $col } = $val;
    }
       close fH;
    
       # get the sonetLineCurrentTable
       &snmpwalk( *fH,  $host, $community, "mib-2.10.39.1.3.1" );
       while ( <fH> ) { 
    next unless ( m/\.3\.1\.1\.(\d+)\.(\d+) (\d+)/ );
    $col = $1;
    $slot = $2 >> 12;
    $val = $3;
    $line_curr_table{ $slot }{ $col } = $val;
    }
       close fH;
    
    #    # get the sonetLineIntervalTable
    #    &snmpwalk( *fH,  $host, $community, "mib-2.10.39.1.3.2" );
    #    while ( <fH> ) { 
    #	next unless ( m/\.3\.2\.1\.(\d+)\.(\d+)\.(\d+) (\d+)/ );
    #	$col = $1;
    #	$slot = $2 >> 12;
    #	$interval = $3;
    #	$val = $4;
    #	$line_interval_table{ $slot }{ $col }{ $interval } = $val;
    #	}
    
       # get selected bits of sonetLineIntervalTable, 
       # performance tweek, walking the interval table is slow, and we 
       # only want the most recent interval.
       $interval = 1;
       foreach $col ( 2, 3, 4, 5, 6 ) {
    foreach $slot ( 6, 12 ) {
        $ifIndex = ( $slot << 12 ) + 2;
        $oid = sprintf "mib-2.10.39.1.3.2.1.%d.%d.%d", 
    	$col, $ifIndex, $interval;
        $val = snmpget( $host, $community, $oid );
        $line_interval_table{ $slot }{ $col }{ $interval } = $val;
        }
    }
       close fH;
    
       }
    
    
    
    sub check_current() { 
       my( $slot, $es, $ses, $sefs, $cv, $uas );
    
       if ( scalar( keys %section_curr_table ) < 1 ) { 
    push @unknown_errors, "couldn't get section current table";
    }
    
       foreach $slot ( sort keys %section_curr_table ) { 
    $verbose && print "slot $slot s-status $section_curr_table{ $slot }{ 1 }\n";
    if ( $section_curr_table{ $slot }{ 1 } & 0x2 ) { 
        # sonet section LOS
        push @crit_errors, "slot $slot s-LOS";
        }
    if ( $section_curr_table{ $slot }{ 1 } & 0x4 ) { 
        # sonet section LOF
        push @warn_errors, "slot $slot s-LOF";
        }
    $es = $section_curr_table{ $slot }{ 2 };
    $verbose && print "slot $slot s-es $es\n";
    if ( $es >= $crit_es ) { 
        push @crit_errors, "slot $slot s-es $es ge $crit_es";
        }
    elsif ( $es >= $warn_es ) { 
        push @warn_errors, "slot $slot s-es $es ge $warn_es";
        }
    $ses = $section_curr_table{ $slot }{ 3 };
    $verbose && print "slot $slot s-ses $ses\n";
    if ( $ses >= $crit_ses ) { 
        push @crit_errors, "slot $slot s-ses $ses ge $crit_ses";
        }
    elsif ( $ses >= $warn_ses ) { 
        push @warn_errors, "slot $slot s-ses $ses ge $warn_ses";
        }
    $sefs = $section_curr_table{ $slot }{ 4 };
    $verbose && print "slot $slot s-sefs $sefs\n";
    if ( $sefs >= $crit_sefs ) { 
        push @crit_errors, "slot $slot s-sefs $sefs ge $crit_sefs";
        }
    elsif ( $sefs >= $warn_sefs ) { 
        push @warn_errors, "slot $slot s-sefs $sefs ge $warn_sefs";
        }
    $cv = $section_curr_table{ $slot }{ 5 };
    $verbose && print "slot $slot s-cv $cv\n";
    if ( $cv >= $crit_cv ) { 
        push @crit_errors, "slot $slot s-cv $cv ge $crit_cv";
        }
    elsif ( $cv >= $warn_cv ) { 
        push @warn_errors, "slot $slot s-cv $cv ge $warn_cv";
        }
    }
    
       if ( scalar( keys %line_curr_table ) < 1 ) { 
    push @unknown_errors, "couldn't get line current table";
    }
    
       foreach $slot ( sort keys %line_curr_table ) { 
    $verbose && print "slot $slot l-status $line_curr_table{ $slot }{ 1 }\n";
    if ( $line_curr_table{ $slot }{ 1 } & 0x2 ) { 
        # sonet line AIS
        push @warn_errors, "slot $slot l-AIS";
        }
    if ( $line_curr_table{ $slot }{ 1 } & 0x4 ) { 
        # sonet line RDI
        push @warn_errors, "slot $slot l-RDI";
        }
    $es = $line_curr_table{ $slot }{ 2 };
    $verbose && print "slot $slot l-es $es\n";
    if ( $es >= $crit_es ) { 
        push @crit_errors, "slot $slot l-es $es ge $crit_es";
        }
    elsif ( $es >= $warn_es ) { 
        push @warn_errors, "slot $slot l-es $es ge $warn_es";
        }
    $ses = $line_curr_table{ $slot }{ 3 };
    $verbose && print "slot $slot l-ses $ses\n";
    if ( $ses >= $crit_ses ) { 
        push @crit_errors, "slot $slot l-ses $ses ge $crit_ses";
        }
    elsif ( $ses >= $warn_ses ) { 
        push @warn_errors, "slot $slot l-ses $ses ge $warn_ses";
        }
    $cv = $line_curr_table{ $slot }{ 4 };
    $verbose && print "slot $slot l-cv $cv\n";
    if ( $cv >= $crit_cv ) { 
        push @crit_errors, "slot $slot l-cv $cv ge $crit_cv";
        }
    elsif ( $cv >= $warn_cv ) { 
        push @warn_errors, "slot $slot l-cv $cv ge $warn_cv";
        }
    $uas = $line_curr_table{ $slot }{ 5 };
    $verbose && print "slot $slot l-uas $uas\n";
    if ( $uas >= $crit_uas ) { 
        push @crit_errors, "slot $slot l-uas $uas ge $crit_uas";
        }
    elsif ( $uas >= $warn_uas ) { 
        push @warn_errors, "slot $slot l-uas $uas ge $warn_uas";
        }
    }
    
       }
    
    
    
    
    sub check_prev() { 
       my( $slot, $es, $ses, $cv, $uas );
    
       if ( scalar( keys %line_interval_table ) < 1 ) { 
    push @unknown_errors, "couldn't get line interval table";
    }
    
       # check the previous interval, if any counts are above critical, then 
       # raise a warning.  We don't raise a crit because this is older data.
       foreach $slot ( sort keys %line_interval_table ) { 
    $verbose && print "prev slot $slot valid $line_interval_table{ $slot }{ 6 }{ 1 }\n";
    # check if data interval holds valid data
    next if ( $line_interval_table{ $slot }{ 6 }{ 1 } != 1 );
    $es = $line_interval_table{ $slot }{ 2 }{ 1 };
    $verbose && print "prev slot $slot l-es $es\n";
    if ( $es >= $crit_es ) { 
        push @warn_errors, "prev slot $slot l-es $es ge $crit_es";
        }
    $ses = $line_interval_table{ $slot }{ 3 }{ 1 };
    $verbose && print "prev slot $slot l-ses $ses\n";
    if ( $ses >= $crit_ses ) { 
        push @warn_errors, "prev slot $slot l-ses $ses ge $crit_ses";
        }
    $cv = $line_interval_table{ $slot }{ 4 }{ 1 };
    $verbose && print "prev slot $slot l-cv $cv\n";
    if ( $cv >= $crit_cv ) { 
        push @warn_errors, "prev slot $slot l-cv $cv ge $crit_cv";
        }
    $uas = $line_interval_table{ $slot }{ 5 }{ 1 };
    $verbose && print "prev slot $slot l-uas $uas\n";
    if ( $uas >= $crit_uas ) { 
        push @warn_errors, "prev slot $slot l-uas $uas ge $crit_uas";
        }
    }
       }
    
    
    
    sub snmpwalk { 
       my( $fH, $host, $community, $oid ) = @_;
       my( $cmd );
    
       if ( $use_snmpv2 ) { 
    $cmd = "snmpbulkwalk -v 2c -Oq -c $community $host $oid |";
    }
       else { 
    $cmd = "snmpwalk -v 1 -Oq -c $community $host $oid |";
    }
       $verbose && print "cmd = '$cmd'\n";
       open( $fH, $cmd ) || die "can't snmpwalk: $!\n";
       }
    
    
    
    
    sub snmpget { 
       my( $host, $community, $oid ) = @_;
       my( $cmd, $val ); 
    
       $cmd = "snmpget -v 1 -Oq -Ov -c $community $host $oid |";
       $verbose && print "cmd = '$cmd'\n";
       open( getH, $cmd ) || die "can't snmpget: $!\n";
       $val = <getH>;
       close getH;
       chomp $val;
       return $val;
       }
    
    
    
    
    sub ip2name { 
       my( $ipaddr ) = @_;
       my( $ippat, $themaddr, $host );
       $ippat = '(\d+)\.' x 3 . '(\d+)';
       $ipaddr =~ m/$ippat/o;
       $themaddr = pack( "C4", $1, $2, $3, $4 );
       $host = gethostbyaddr( $themaddr, &AF_INET );
       $host = "unknown" if ! $host;
       return $host;
       }

     

     

    а где можно MIBы найти?

     

    нашел но не знаю что :)

    http://www.snmplink.org/cgi-bin/nd/m/Ent/C/Ciena%20Corporation/

  4. почитал тут...есть у меня парк из Ciena 6500 мультиплексоров...как вот прикрутить Нагиос к ним, какие плагины и есть ли фриварный софт для мониторинга и управления.

    Родной софт не знаю где. производителе молчат....

     

    спасибо за любую действую помощь!