Page 1 of 2

Listing the routing OSPF mikrotik

Posted: Thu Jan 03, 2019 8:28 am
by pintu
I need to check the routing route in my mikrotik, Is there a path on OSPF 0.0.0.0?
I used this forum: https://forum.mikrotik.com/viewtopic.php?t=51835
I also downloaded check_ospf2 script (https://exchange.nagios.org/directory/P ... f2/details)
but I don't think I can use it because I have it all the time:

Code: Select all

check_ospf.pl v$Revision: 0.1 $  (nagios-plugins 2.2.1)
The nagios plugins come with ABSOLUTELY NO WARRANTY. You may redistribute
copies of the plugins under the terms of the GNU General Public License.
For more information about these matters, see the file named COPYING.

Re: Listing the routing OSPF mikrotik

Posted: Thu Jan 03, 2019 9:23 am
by scottwilkerson
How are you trying to run the plugin? With what arguments?

Re: Listing the routing OSPF mikrotik

Posted: Tue Jan 08, 2019 11:07 am
by pintu
various, example:
./check_ospf.0.1.pl -H Hostaddress -C public -V 2 -p 161
./check_ospf.0.1.pl -H Hostaddress -C public -V SNMP v2c

Re: Listing the routing OSPF mikrotik

Posted: Tue Jan 08, 2019 12:13 pm
by scottwilkerson
should be

Code: Select all

./check_ospf.0.1.pl -H Hostaddress -C public -v v2c

Re: Listing the routing OSPF mikrotik

Posted: Wed Jan 09, 2019 5:54 am
by pintu
./check_ospf.0.1.pl -H Hostaddress -C public -V SNMP v2c

Code: Select all

Value "v2c" invalid for option v (number expected)
Usage:
  check_ospf.0.1.pl -H <HOSTNAME> [-C <community>] -p <peer>
  check_ospf.0.1.pl [-h | --help]
  check_ospf.0.1.pl [-V | --version]

Code: Select all

./check_ospf.0.1.pl -h
check_ospf.0.1.pl v$Revision: 0.1 $  (nagios-plugins 2.2.1)
The nagios plugins come with ABSOLUTELY NO WARRANTY. You may redistribute
copies of the plugins under the terms of the GNU General Public License.
For more information about these matters, see the file named COPYING.
Copyright (c) 2006 Larry Low
This program is licensed under the terms of the
GNU General Public License
(check source code for details)

Check OSPF peer status via SNMP.

Usage:
  check_ospf.0.1.pl -H <HOSTNAME> [-C <community>] -p <peer>
  check_ospf.0.1.pl [-h | --help]
  check_ospf.0.1.pl [-V | --version]

 -H (--hostname)     Hostname to query - (required)
 -C (--community)    SNMP read community or v3 auth (defaults to public)
                     (v3 specified as username:authpassword:... )
                       username = SNMPv3 security name
                       authpassword = SNMPv3 authentication pass phrase (or hexidecimal key)
                       authprotocol = SNMPv3 authentication protocol (md5 (default) or sha)
                       privpassword = SNMPv3 privacy pass phrase (or hexidecmal key)
                       privprotocol = SNMPv3 privacy protocol (des (default) or aes)
 -v (--snmp_version) 1 for SNMP v1
                     2 for SNMP v2c (default)
                     3 for SNMP v3
 -p {--peer}         IP of peer
 -V (--version)      Plugin version
 -h (--help)         usage help

Send email to help@nagios-plugins.org if you have questions regarding use
of this software. To submit patches or suggest improvements, send email to
devel@nagios-plugins.org. Please include version information with all
correspondence (when possible, use output from the --version option of the
plugin itself).

Re: Listing the routing OSPF mikrotik

Posted: Wed Jan 09, 2019 9:19 am
by scottwilkerson
looking at the help again it should be

Code: Select all

./check_ospf.0.1.pl -H Hostaddress -C public -v 2
Sorry I can't test this because I don't have the equipment

Re: Listing the routing OSPF mikrotik

Posted: Fri Jan 11, 2019 5:04 pm
by pintu
./check_ospf.0.1.pl -H Hostaddress -C public -v 2
Usage:
check_ospf.0.1.pl -H <HOSTNAME> [-C <community>] -p <peer>
check_ospf.0.1.pl [-h | --help]
check_ospf.0.1.pl [-V | --version]
so I asked this forum how to check OSPF mikrotik

Re: Listing the routing OSPF mikrotik

Posted: Fri Jan 11, 2019 5:57 pm
by scottwilkerson
You would need to also pass the peer per the usage

Code: Select all

-p <peer>

Re: Listing the routing OSPF mikrotik

Posted: Mon Jan 14, 2019 5:31 am
by pintu
I've added

Code: Select all

./check_ospf.0.1.pl -H Hostaddress -C public -v 2 -p 192.168.1.0/24
I get:

Code: Select all

UNKNOWN: SNMP error: The OBJECT IDENTIFIER value "1.3.6.1.2.1.14.10.1.3.192.168.1.0/24.0" is expected in dotted decimal notatio
when typing without a subnet mask, then you will get:
./check_ospf.0.1.pl -H Hostaddress -C public -v 2 -p 192.168.1.0
Use of uninitialized value in concatenation (.) or string at ./check_ospf.0.1.pl line 141.
Argument "noSuchObject" isn't numeric in numeric eq (==) at ./check_ospf.0.1.pl line 143.
CRITICAL - 192.168.1.0 (Router ID noSuchObject) state is
Lines 141 i 143:

Code: Select all

                $output = "$peer (Router ID $ospfNbrRtrId) state is ".$ospfNbrStates{$ospfNbrState};

                if (($ospfNbrState == 4) || ($ospfNbrState == 8)) {

Re: Listing the routing OSPF mikrotik

Posted: Mon Jan 14, 2019 12:54 pm
by scottwilkerson
This looks like your router isn't responding with a correct response for that OID

What version of Mikrotik are you using?

Can you run these replacing Hostaddress with your Mikrotik?

Code: Select all

snmpget -v 2c -c public Hostaddress .1.3.6.1.2.1.4.21.1.7.0.0.0.0
snmpget -v 2c -c public Hostaddress .1.3.6.1.2.1.4.21.1.7.192.168.1.0