Community discussions

MikroTik App
 
User avatar
Cyclone
just joined
Topic Author
Posts: 12
Joined: Wed May 23, 2007 11:18 am
Location: Cape Town, South Africa
Contact:

ROS version in snmp

Tue Jan 27, 2009 3:26 pm

After some extensive investigation I couldn't find the RouterOS version anywhere using snmp. On normal linux machines the kernel version info is normaly stored in sysDescr but for ROS it only contains router. How about adding the RouterOS version aswell as maybe the RouterBoard type to this description? Looking for RouterOS version to monitor rb ROS versions on highsites on a site.
 
User avatar
jp
Long time Member
Long time Member
Posts: 609
Joined: Wed Mar 02, 2005 5:06 am
Location: Maine
Contact:

Re: ROS version in snmp

Tue Jan 27, 2009 11:50 pm

This is what I gather and how from my mts.
#!/bin/bash
MYCMD="mysql -B -N -h 127.0.0.1 -u root -s -pxxxxxxxxxxxxxxxxxx -e "

for IP in `$MYCMD " use mt; select ip from router;"` ; do
  VER=`snmpget -r2 -v1 -c public -Ovq $IP .1.3.6.1.4.1.14988.1.1.4.4.0 |cut -d" " -f1|sed -e "s/\"//g"`
  NAME=`snmpget -r2 -v1 -c public -Ovq $IP SNMPv2-MIB::sysName.0 |cut -d: -f4`
  RADIOS=`snmpwalk -v1 -c public -Ovq $IP .1.3.6.1.2.1.2.2.1.3 |grep ieee80211 |wc -l`
  ETHERS=`snmpwalk -v1 -c public -Ovq $IP .1.3.6.1.2.1.2.2.1.3 |grep ethernetCsmacd |wc -l`
  VLANS=`snmpwalk -v1 -c public -Ovq $IP .1.3.6.1.2.1.2.2.1.3 |grep l2vlan |wc -l`
  LICENSE=`snmpwalk -v1 -c public -Ovq $IP .1.3.6.1.4.1.14988.1.1.4.3.0`
  SSHACCESS=`$MYCMD "use mt; select sshaccess from router where ip='$IP';"`
  SYSTEM=
  if [ 1 == $SSHACCESS ]
   then
    V=`echo $VER |cut -b1`
    if [ $V -ge 3 ]
     then
     SYSTEM=`ssh jp@10.0.0.7  "ssh admin@$IP system resource print" |grep board-name |cut -d: -f2`
    fi
#   if [ $V -lt 3 ]
#     then
#     SYSTEM=` ssh jp@10.0.0.7  "ssh admin@$IP system routerboard print; ssh admin@$IP system resource print"  |egrep -i "
" |head -n 1 |cut -d: -f2`
#  echo $NAME $SYSTEM
#   fi
  fi
     SYSTEM=` ssh jp@10.0.0.7  "ssh admin@$IP system routerboard print; ssh admin@$IP system resource print"  |egrep -i "m
 |head -n 1 |cut -d: -f2`
     UPTIME=` ssh jp@10.0.0.7  "ssh admin@$IP system resource print"  |grep uptime |cut -d: -f2`
  $MYCMD "use mt; update router set version='$VER' where IP='$IP'"
  $MYCMD "use mt; update router set hostname='$NAME' where ip='$IP'"
  $MYCMD "use mt; update router set radios='$RADIOS' where ip='$IP'"
  $MYCMD "use mt; update router set ethers='$ETHERS' where ip='$IP'"
  $MYCMD "use mt; update router set vlans='$VLANS' where ip='$IP'"
  $MYCMD "use mt; update router set license='$LICENSE' where ip='$IP'"
  $MYCMD "use mt; update router set system='$SYSTEM' where ip='$IP'"
  $MYCMD "use mt; update router set uptime='$UPTIME' where ip='$IP'"
done

echo updated > /tmp/db.update.IP.done

 
User avatar
normis
MikroTik Support
MikroTik Support
Posts: 26379
Joined: Fri May 28, 2004 11:04 am
Location: Riga, Latvia

Re: ROS version in snmp

Wed Jan 28, 2009 8:57 am

do an SNMP-walk on your RouterOS device, and you will find the OID for the Version. Just saw it yesterday, but can't tell you the oid right now ..
 
User avatar
mojiro
Frequent Visitor
Frequent Visitor
Posts: 91
Joined: Sun Jul 24, 2005 9:21 pm

Re: ROS version in snmp

Wed Jan 28, 2009 10:38 am

do an SNMP-walk on your RouterOS device, and you will find the OID for the Version. Just saw it yesterday, but can't tell you the oid right now ..
I did, I rejected known OID's and ...
SNMPv2-MIB::sysDescr.0 = STRING: router
SNMPv2-MIB::sysObjectID.0 = OID: SNMPv2-SMI::enterprises.14988.1
SNMPv2-MIB::sysServices.0 = INTEGER: 78
IP-MIB::ipForwarding.0 = INTEGER: forwarding(1)
IP-MIB::ipDefaultTTL.0 = INTEGER: 255
SNMPv2-SMI::mib-2.17.2.1.0 = INTEGER: 3
However I do not see somewhere "= 3.17" or ("= 3" + "= 17")

If you want, I may attach my real snmpwalk.txt but its quite huge because of 800 routes.
 
User avatar
normis
MikroTik Support
MikroTik Support
Posts: 26379
Joined: Fri May 28, 2004 11:04 am
Location: Riga, Latvia

Re: ROS version in snmp

Wed Jan 28, 2009 10:43 am

maybe I don't understand this thing, but Dude SNMP-walk gives me:

iso.org.dod.internet.private.enterprises.mikrotik.mikrotikExperimentalModule.mtXRouterOs.mtxrLicense.mtxrLicVersion.0
1.3.6.1.4.1.14988.1.1.4.4.0 = 3.20

Edit: maybe it's related to the fact that mine is a routerboard? I will look into this
 
User avatar
mojiro
Frequent Visitor
Frequent Visitor
Posts: 91
Joined: Sun Jul 24, 2005 9:21 pm

Re: ROS version in snmp

Wed Jan 28, 2009 10:58 am

maybe I don't understand this thing, but Dude SNMP-walk gives me:

iso.org.dod.internet.private.enterprises.mikrotik.mikrotikExperimentalModule.mtXRouterOs.mtxrLicense.mtxrLicVersion.0
1.3.6.1.4.1.14988.1.1.4.4.0 = 3.20

Edit: maybe it's related to the fact that mine is a routerboard? I will look into this
My snmpwalk was from RB433ah

Edit:

you are right
# snmpwalk -v 1 -c public 10.86.89.129 1.3.6.1.4.1.14988.1.1.4.4.0
SNMPv2-SMI::enterprises.14988.1.1.4.4.0 = STRING: "3.17"
but because of an unknown reason, when I do snmpwalk, it does not return 1.3.6.1.4.1.14988.*

it just shows
SNMPv2-SMI::mib-2.9999.1.1.1.1.0 = STRING: "MikroTik DHCP server"
SNMPv2-SMI::mib-2.9999.1.1.1.2.0 = OID: SNMPv2-SMI::enterprises.14988.1
SNMPv2-SMI::mib-2.9999.1.1.6.4.1.1.11 = IpAddress: 10.86.89.158
SNMPv2-SMI::mib-2.9999.1.1.6.4.1.4.11 = INTEGER: 2
SNMPv2-SMI::mib-2.9999.1.1.6.4.1.5.11 = Gauge32: 217399
SNMPv2-SMI::mib-2.9999.1.1.6.4.1.7.11 = INTEGER: 3
SNMPv2-SMI::mib-2.9999.1.1.6.4.1.8.11 = Hex-STRING: 00 1F C6 2B E0 2B
 
savage
Forum Guru
Forum Guru
Posts: 1264
Joined: Mon Oct 18, 2004 12:07 am
Location: Cape Town, South Africa
Contact:

Re: ROS version in snmp

Wed Jan 28, 2009 7:44 pm

Seems to me that Mikrotik may need to release a MIB (dictionary) file one of these days....
 
User avatar
mojiro
Frequent Visitor
Frequent Visitor
Posts: 91
Joined: Sun Jul 24, 2005 9:21 pm

Re: ROS version in snmp

Thu Jan 29, 2009 12:16 am

Seems to me that Mikrotik may need to release a MIB (dictionary) file one of these days....
There are many thinks to be fixed and a lot to be created, but this, I think has totally really low priority. I would appreciate to have a better SNMP GUI than a MIB Dictionary. Anyway... lets see what 3.20 has.
 
savage
Forum Guru
Forum Guru
Posts: 1264
Joined: Mon Oct 18, 2004 12:07 am
Location: Cape Town, South Africa
Contact:

Re: ROS version in snmp

Thu Jan 29, 2009 9:16 am

True. In this specific case however, with your OIDs not 'resolving' - a MIB will solve this 100%. Seeing it is working in TheDude, I would bet that Dude actually already has a MIB that it is using.

Who is online

Users browsing this forum: Bing [Bot], lostb1t and 119 guests