Community discussions

MikroTik App
 
User avatar
macsrwe
Forum Guru
Forum Guru
Topic Author
Posts: 1007
Joined: Mon Apr 02, 2007 5:43 am
Location: Arizona, USA
Contact:

Memory probe flat doesn't work

Tue Jul 07, 2015 5:02 am

I can't get the memory probe to work on any of the Routerboards I have tried. It always fails.

The performance data in Appearance shows CPU and disk, but never memory. If I alter the Appearance string to display "[mem_usage()]", it is always zero.

When I examine the builtin mem_usage function, I see that it uses an oid that doesn't even exist:

iso.org.dod.internet.mgmt.mib-2.host.hrStorage.hrStorageTypes.hrStorageRam

The entire hrStorageTypes tree does not exist / has no contents. I attempted to remove this oid from the function to see if I could get the function returning something other than zero, but because I understood only the syntax and not the semantics of other things I had to remove, it still came up zero.

I can do a successful snmpwalk and get good results, other than the non-existent hrStorageTypes tree. Other SNMP-based probes like CPU work fine, so there are no firewall issues.

I assume this is Dude data rot. Is there a known way around it?
 
lebowski
Forum Guru
Forum Guru
Posts: 1619
Joined: Wed Aug 27, 2008 5:17 pm

Re: Memory probe flat doesn't work

Tue Jul 07, 2015 9:52 pm

You can clone the functions and the probes to new names and put the correct OID (assuming it has moved). If it is a bug and the OID is not being populated you are SOL. I am not going to go looking for where it moved if it did.
 
User avatar
macsrwe
Forum Guru
Forum Guru
Topic Author
Posts: 1007
Joined: Mon Apr 02, 2007 5:43 am
Location: Arizona, USA
Contact:

Re: Memory probe flat doesn't work

Wed Jul 08, 2015 9:33 am

With some research, I was able to fix this problem. The string I identified turned out not to be an actual OID, but a data value (OID content) that resembled an OID. The problem is that this data value has changed in some ROS release since the Dude was last maintained.

The solution is simply to change "Ram" to "Other", so that the string now says:

iso.org.dod.internet.mgmt.mib-2.host.hrStorage.hrStorageTypes.hrStorageOther

This has to be done in two functions: mem_usage and mem_size. Once this is done, both the Appearance and probe features for memory work.

Thanks for the inspiration.
 
lebowski
Forum Guru
Forum Guru
Posts: 1619
Joined: Wed Aug 27, 2008 5:17 pm

Re: Memory probe flat doesn't work

Wed Jul 08, 2015 4:58 pm

Nice job!
 
User avatar
macsrwe
Forum Guru
Forum Guru
Topic Author
Posts: 1007
Joined: Mon Apr 02, 2007 5:43 am
Location: Arizona, USA
Contact:

Re: Memory probe flat doesn't work

Sun Sep 04, 2016 9:20 am

Aaarrggh!

As of ROS 6.36, Mikrotik fixed the SNMP bug described here.

However, if you're still using the "old" Dude (possibly also the new Dude, haven't checked it), and you have a network running mixed releases (some before 6.36, some 6.36 and after), their fix broke you -- you're going to see nonsense values or probe failures on one or the other set of routers in your network.

The solution is yet different code for the functions: code that searches for both strings and uses whichever one is present. (It adds 1 to the sum because the one that is NOT present will return -1.)

mem_size:
oid
   (concatenate
      ("iso.org.dod.internet.mgmt.mib-2.host.hrStorage.hrStorageTable.hrStorageEntry.hrStorageSize.",
       array_element
         (oid_column
            ("iso.org.dod.internet.mgmt.mib-2.host.hrStorage.hrStorageTable.hrStorageEntry.hrStorageIndex", 600),
          array_find
            (oid_column
               ("iso.org.dod.internet.mgmt.mib-2.host.hrStorage.hrStorageTable.hrStorageEntry.hrStorageType", 600),
             "iso.org.dod.internet.mgmt.mib-2.host.hrStorage.hrStorageTypes.hrStorageRam"
            )
          + array_find
            (oid_column
               ("iso.org.dod.internet.mgmt.mib-2.host.hrStorage.hrStorageTable.hrStorageEntry.hrStorageType", 600),
             "iso.org.dod.internet.mgmt.mib-2.host.hrStorage.hrStorageTypes.hrStorageOther"
            )
          + 1
         )
       )
    )
mem_usage:
oid
  (concatenate
     ("iso.org.dod.internet.mgmt.mib-2.host.hrStorage.hrStorageTable.hrStorageEntry.hrStorageUsed.",
       array_element
         (oid_column
            ("iso.org.dod.internet.mgmt.mib-2.host.hrStorage.hrStorageTable.hrStorageEntry.hrStorageIndex", 600),
            array_find
               (oid_column
                  ("iso.org.dod.internet.mgmt.mib-2.host.hrStorage.hrStorageTable.hrStorageEntry.hrStorageType", 600),
                  "iso.org.dod.internet.mgmt.mib-2.host.hrStorage.hrStorageTypes.hrStorageRam"
               )
            + array_find
               (oid_column
                    ("iso.org.dod.internet.mgmt.mib-2.host.hrStorage.hrStorageTable.hrStorageEntry.hrStorageType", 600),
                    "iso.org.dod.internet.mgmt.mib-2.host.hrStorage.hrStorageTypes.hrStorageOther"
               )
            + 1
          )
      )
   ) * 100 / mem_size()
Once all your routers are running 6.36 or above, you can return to the original Dude function code.
 
jarda
Forum Guru
Forum Guru
Posts: 7756
Joined: Mon Oct 22, 2012 4:46 pm

Re: Memory probe flat doesn't work

Sun Sep 04, 2016 9:36 am

I have been using such dual functions for an year already due to mix of devices in my networks. Unfortunately it seems that calling non existent oids in ros makes it to spend too much cpu time in management process around 10-20% cpu time just by processing of internal error messages. It was reported to support, investigated and suggested not to call nonexistent oids. Obviously it is not acceptable solution because mikrotik changes oids very often. Instead of such foolish advice they should correct the ros in order not to bother by non existing oids requests...

Who is online

Users browsing this forum: No registered users and 30 guests