<html><head><style type="text/css"><!-- DIV {margin:0px;} --></style></head><body><div style="font-family:times new roman, new york, times, serif;font-size:10pt"><br>hello all,<br><br>i configure my cisco router <br><br>router ospf 1<br>network 10.1.3.0 0.255.255.255 area 1<br><br><br>when i lunch ./check_ospf.pl 10.1.3.133 nothing work help me please <br><br><br><br>my ospf.pl<br><br>#!/usr/bin/perl<br><br>#########################################################################<br>#              SCRIPT TO CHECK OSPF neighbors status on a router.       #<br>#-----------------------------------------------------------------------#<br># Version 1.00
 (16-09-2002)                                             #<br>#  - First release                                                      #<br>#                                     #<br>#                               
         #<br>#                                    #<br>#                                                                       #<br>#########################################################################<br><br>use Net::SNMP(qw(oid_lex_sort));<br># use warnings;<br>use strict;<br><br>#############################<br># Declaration of variables. #<br>#############################<br>my $community       =
 "public";<br>my $port            = 161;<br> my $version         = "v2c"; Uncomment to use with Version 2 SNMP<br>my $version         = "v1";<br>my $timeout         = 20;               # seconds<br>my $retries         = 2;                # times<br><br>my $ospfstate         = ".1.3.6.1.2.1.14.10.1.6"; # ospfNbrState (Integer)<br>my $localaddr       = ".1.3.6.1.2.1.14.10.1.1"; # ospfNbrIpAddr (IpAddress)<br>my $remoteaddr      = ".1.3.6.1.2.1.14.10.1.3"; # ospfNbrRtrId (IpAddress)<br>my
 $ospfstatus        = ".1.3.6.1.2.1.14.10.1.9"; # ospfNBMANbrStatus (Integer)<br><br>my $session;<br>my $error;<br>my %DataTable;<br>my $tmp;<br><br>my $pctwarning      = 98; # Minimum percent of Neighbors Established before a warning is generated.<br>my $pctalert        = 75; # Minimum percent of Neighbors Establisted before an alert is generated.<br><br># Get the ipaddress from the parameters.<br># --------------------------------------<br>my $arg_router = $ARGV[0];<br><br># Get the data from the router.<br># -----------------------------<br><br># Open SNMP session on the router.<br>($session, $error) = Net::SNMP->session( -hostname    =>
 $arg_router,<br>                                         -community   => $community,<br>                                         -port        => $port,<br>                                         -version     =>
 $version,<br>                                         -timeout     => $timeout,<br>                                         -retries     => $retries );<br><br># Exit if no session could be opened.<br>if (!defined ($session)) {<br>    print "Error\n";<br>    exit 1;<br>}<br><br># Get the Neighbor Status.<br># ------------------<br>my %OSPFStatus       = &snmptableget($ospfstatus);<br>my %LocalIp        =
 &snmptableget($localaddr);<br>my %RemoteIp       = &snmptableget($remoteaddr);<br>my %OSPFState      = &snmptableget($ospfstate);<br><br># Calculate the Neighbor Data.<br>my $TotalNeighbor = scalar (keys %OSPFState);<br>if ($TotalNeighbor != 0) {<br>    my $Down=0;<br>    my $Attempt=0;<br>    my $Init=0;<br>    my $TwoWay=0;<br>    my $ExchangeStart=0;<br>    my $Exchange=0;<br>    my $Loading=0;<br>    my $Full=0;<br>    foreach $tmp (sort keys %OSPFState) {<br>        # Neighbors Down<br>        if ($OSPFState{$tmp} == 1) {<br>            $Down++;<br>        }<br>        # Neighbors
 Attempt<br>               if ($OSPFState{$tmp} == 2) {<br>                       $Attempt++;<br>            }<br>        # Neighbors Init<br>        if ($OSPFState{$tmp} == 3) {<br>            $Init++;<br>        }<br>            # Neighbors TwoWay<br>            if ($OSPFState{$tmp} == 4) {<br>                    $TwoWay++;<br>            }<br>   
         # Neighbors ExchangeStart<br>            if ($OSPFState{$tmp} == 5) {<br>                    $ExchangeStart++;<br>            }<br>            # Neighbors Exchange<br>            if ($OSPFState{$tmp} == 6) {<br>                    $Exchange++;<br>            }<br>            # Neighbors Loading<br>            if ($OSPFState{$tmp} == 7) {<br>   
                 $Loading++;<br>            }<br>            # Neighbors Full<br>            if ($OSPFState{$tmp} == 8) {<br>                    $Full++;<br>            }<br>    }<br>    # Print the data.<br>    # ---------------<br>    my $msgcolor;<br>    my $pctDown          = int (($Down / $TotalNeighbor) * 100);<br>    my $pctAttempt         = int (($Attempt / $TotalNeighbor) * 100);<br>    my
 $pctInit         = int (($Init / $TotalNeighbor) * 100);<br>    my $pctTwoWay        = int (($TwoWay / $TotalNeighbor) * 100);<br>    my $pctExchangeStart = int (($ExchangeStart / $TotalNeighbor) * 100);<br>    my $pctExchange      = int (($Exchange / $TotalNeighbor) * 100);<br>    my $pctLoading       = int (($Loading / $TotalNeighbor) * 100);<br>    my $pctFull          = int (($Full / $TotalNeighbor) * 100);<br><br>    my $pctTotal         = int ($pctFull + $pctTwoWay);<br><br>    if ($pctTotal > $pctwarning) {<br>        $msgcolor = "green";<br>    }<br>    if ($pctTotal <=
 $pctalert) {<br>        $msgcolor = "red";<br>    }<br>    if ($pctTotal <= $pctwarning) {<br>        $msgcolor = "yellow";<br>    }<br>    if (!$msgcolor) {<br>        $msgcolor = "purple";<br>    }<br><br>    print "$msgcolor\n";<br>    print "<br> <br>";<br>    print "<table border=\"1\">";<br>    print "<tr> <td> Number of Neighbors      </td> <td> $TotalNeighbor </td> </tr>";<br>    print "<tr> <td> Neighbor Down        </td> <td> $Down ($pctDown\%) </td> </tr>";<br>    print "<tr> <td> Neighbor Attempt    
 </td> <td> $Attempt ($pctAttempt\%) </td> </tr>";<br>    print "<tr> <td> Neighbor Init      </td> <td> $Init ($pctInit\%) </td> </tr>";<br>    print "<tr> <td> Neighbor TwoWay    </td> <td> $TwoWay ($pctTwoWay\%) </td> </tr>";<br>    print "<tr> <td> Neighbor ExchangeStart </td> <td> $ExchangeStart ($pctExchangeStart\%) </td> </tr>";<br>    print "<tr> <td> Neighbor Exchange </td> <td> $Exchange ($pctExchange\%) </td> </tr>";<br>    print "<tr> <td> Neighbor Loading </td> <td> $Loading ($pctLoading\%) </td> </tr>";<br>    print "<tr> <td> Neighbor Full </td> <td> $Full ($pctFull\%) </td>
 </tr>";<br>    print "</table>";<br>    print "<br> <small> Total may not equal 100% </small> <br>";<br>    print "<br> Table for neighbor NOT full <br>";<br>    print "<table border=\"1\">";<br>    print "<tr> <th> Source </th> <th> Dest </th> <th> Status </th> </tr>";<br>    foreach $tmp (sort keys %OSPFState) {<br>        if ($OSPFState{$tmp} != "8") {<br>            my $Status = &getstatus($OSPFState{$tmp});<br>            print "<tr> <td> $LocalIp{$tmp} </td> <td> $RemoteIp{$tmp} </td> <td> $Status </td> </tr>";<br>        }<br>   
 }<br>    print "</table>";<br>} else {<br>    print "purple\n";<br>    print "<br>Error while fetching data or no OSPF data found...\n";<br>}<br><br>###########################<br># SUBROUTINES START HERE. #<br>###########################<br><br>sub snmptableget ($) {<br>        my $snmpvar = shift;<br>    my $index;<br>    my %snmpresult;<br>        my $response = $session->get_table($snmpvar);<br>    foreach (keys %snmpresult) { delete $snmpresult{$_}; }  # old values need to be deleted.<br>        if (defined ($response)) {<br>                foreach (oid_lex_sort(keys(%{$response})))
 {<br>                        $snmpresult{$_} = $response->{$_};<br>                }<br>        }<br>    foreach $index (sort keys %snmpresult) {<br>        $index =~ /$snmpvar\./;<br>        $DataTable{$'} = $snmpresult{$index};<br>    }<br>        return (%DataTable);<br>}<br><br>sub getstatus($) {<br>        return {<br>                 '1' => 'Down'<br>                ,'2' =>
 'Attempt'<br>                ,'3' => 'Init'<br>                ,'4' => 'TwoWay'<br>                ,'5' => 'ExchangeStart'<br>                ,'6' => 'Established'<br>                ,'7' => 'Loading'<br>                ,'8' => 'Full'<br>        }->{(shift)};<br>}<br><br><br><br><br><br><div> </div>C'est pas parce que c'est difficile qu'on n'ose pas,<br>c'est parce qu'on ose pas que c'est difficile !<div><br></div><div style="font-family: times new
 roman,new york,times,serif; font-size: 10pt;"><br><div style="font-family: times new roman,new york,times,serif; font-size: 12pt;">----- Message d'origine ----<br>De : Alex Dehaini <alexdehaini@gmail.com><br>À : Ange AMBEMOU <angeolivier2003@yahoo.fr>; Nagios Users Mailinglist <nagios-users@lists.sourceforge.net><br>Envoyé le : Vendredi, 11 Juillet 2008, 11h32mn 05s<br>Objet : Re: [Nagios-users] OSPF<br><br>Yes it is. Check the nagiosexchange site for this plugin.<br><br>Lex<br><br><div class="gmail_quote">On Fri, Jul 11, 2008 at 10:29 AM, Ange AMBEMOU <<a rel="nofollow" ymailto="mailto:angeolivier2003@yahoo.fr" target="_blank" href="mailto:angeolivier2003@yahoo.fr">angeolivier2003@yahoo.fr</a>> wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><div><div style="font-family: times new roman,new york,times,serif; font-size: 10pt;">helo all, <br>
<br>i want to know if is possible to nagios to check the OSPF on router thanks<br><div class="WgoR0d"><br><br><br></div></div><div class="WgoR0d"><br>


      <hr size="1"> 
Envoyé avec <a rel="nofollow" target="_blank" href="http://us.rd.yahoo.com/mailuk/taglines/isp/control/*http://us.rd.yahoo.com/evt=52423/*http://fr.docs.yahoo.com/mail/overview/index.html">Yahoo! Mail</a>.<br>Une boite mail plus intelligente. </div>
</div><br>-------------------------------------------------------------------------<br>
Sponsored by: SourceForge.net Community Choice Awards: VOTE NOW!<br>
Studies have shown that voting for your favorite open source project,<br>
along with a healthy diet, reduces your potential for chronic lameness<br>
and boredom. Vote Now at <a rel="nofollow" target="_blank" href="http://www.sourceforge.net/community/cca08">http://www.sourceforge.net/community/cca08</a><br>_______________________________________________<br>
Nagios-users mailing list<br>
<a rel="nofollow" ymailto="mailto:Nagios-users@lists.sourceforge.net" target="_blank" href="mailto:Nagios-users@lists.sourceforge.net">Nagios-users@lists.sourceforge.net</a><br>
<a rel="nofollow" target="_blank" href="https://lists.sourceforge.net/lists/listinfo/nagios-users">https://lists.sourceforge.net/lists/listinfo/nagios-users</a><br>
::: Please include Nagios version, plugin version (-v) and OS when reporting any issue.<br>
::: Messages without supporting info will risk being sent to /dev/null<br></blockquote></div><br><br clear="all"><br>-- <br>Alex Dehaini<br>Developer<br>Team - <a rel="nofollow" target="_blank" href="http://www.konolabs.com">www.konolabs.com</a><br>Site - <a rel="nofollow" target="_blank" href="http://www.alexdehaini.com">www.alexdehaini.com</a><br>
Email - <a rel="nofollow" ymailto="mailto:alexdehaini@gmail.com" target="_blank" href="mailto:alexdehaini@gmail.com">alexdehaini@gmail.com</a>
</div></div></div><br>


      <hr size="1"> 
Envoyé avec <a href="http://us.rd.yahoo.com/mailuk/taglines/isp/control/*http://us.rd.yahoo.com/evt=52423/*http://fr.docs.yahoo.com/mail/overview/index.html">Yahoo! Mail</a>.<br>Une boite mail plus intelligente. </a></body></html>