Community discussions

MikroTik App
 
lebowski
Forum Guru
Forum Guru
Topic Author
Posts: 1616
Joined: Wed Aug 27, 2008 5:17 pm

trouble - SNMP probe should return 0 as a valid value

Tue Jul 20, 2010 7:32 pm

You can use a function to see the issue... This is based on a cisco wireless access point. Any counter that is 0 will show this problem.

Here is a label to show the number of wireless users connected to my AP.

In the appearance put the following...
Function:[if(oid_column("1.3.6.1.4.1.9.9.273.1.1.2.1.1"),oid("1.3.6.1.4.1.9.9.273.1.1.2.1.1.1"),"False")]
OID Column:[oid_column("1.3.6.1.4.1.9.9.273.1.1.2.1.1")]
Num users OID:[oid("1.3.6.1.4.1.9.9.273.1.1.2.1.1.1")]

Here is what you will see.
label.png
The function should return "0" instead it returns false.
Notice oid Column is 0, 0 and number of users is 0.

You can imagine the actual values in the function look like this...
if("0, 0" , 0, "False") - no wonder the function returns false.

The only way to graph a value of 0 is to break the probe so that it is always true but then the probe is never down.
This is a cascading issue where a probe that is always true will install on every device if you are using auto discover.

I know it is a complex issue but the code that reads values from SNMP should treat any value returned as true.

Any help would be appreciated,
Lebowski
You do not have the required permissions to view the files attached to this post.
 
User avatar
gsandul
Member Candidate
Member Candidate
Posts: 154
Joined: Mon Oct 19, 2009 1:42 pm

Re: trouble - SNMP probe should return 0 as a valid value

Tue Jul 20, 2010 9:38 pm

Hello, Lebowski

1) Why do you consider, that checking array values in if statement should return something reasonable?
Your function statement should be:
if(array_size(oid_column("1.3.6.1.4.1.9.9.273.1.1.2.1.1")) > 0,oid("1.3.6.1.4.1.9.9.273.1.1.2.1.1.1"),"False")
in order it to work properly.

2) You must know, there are some situations when probe is true in a lot of cases, but it should not be autodiscovered. The only one example of it: you made a probe (of a function type) which checks interface index 1 and, in case it's down, sends alert with interface description. This probe should be never autodiscovered because to many devices have interface index 1, and you do not need to check every interface index 1.
In a such a case there is a solution. Just look at picture
services.jpg
3) It is not true, you can give karma to one person just ones :)
You do not have the required permissions to view the files attached to this post.
 
lebowski
Forum Guru
Forum Guru
Topic Author
Posts: 1616
Joined: Wed Aug 27, 2008 5:17 pm

Re: trouble - SNMP probe should return 0 as a valid value

Wed Jul 21, 2010 12:01 am

Well you got me there :) array values bad for IF, check.

I still have the original issue though, The 0 has moved from the function into the probe where it is also not "true" and the probe shows down on all APs that have 0 users.

Here is the function;
name: totwifiusers
code:if(array_size(oid_column("1.3.6.1.4.1.9.9.273.1.1.2.1.1"))>0,oid("1.3.6.1.4.1.9.9.273.1.1.2.1.1.1",10,19)+oid("1.3.6.1.4.1.9.9.273.1.1.2.1.1.2",10,19),"False")

Here is the probe;
available: totwifiusers() <>"False"
error: if(totwifiusers()<>"False", if(totwifiusers()>=0, "", "failed snmp wifi read") ,"Wifi Device Down")
Value: totwifiusers()

Lebowski
 
User avatar
gsandul
Member Candidate
Member Candidate
Posts: 154
Joined: Mon Oct 19, 2009 1:42 pm

Re: trouble - SNMP probe should return 0 as a valid value

Wed Jul 21, 2010 1:54 pm

Hi, Lebowski
What exactly does it shows down in your probe when there is 0 users on it?
Does it shows "Wifi Device Down" or "failed snmp wifi read"

Unfortunately, I do not have cisco access point to check it. :(
 
lebowski
Forum Guru
Forum Guru
Topic Author
Posts: 1616
Joined: Wed Aug 27, 2008 5:17 pm

Re: trouble - SNMP probe should return 0 as a valid value

Wed Jul 21, 2010 4:31 pm

It shows "Wifi device down" which doesn't makes sense since totwifiusers is 0 at that point.

I put [totwifiusers()] on the device label of both a "down" and "up" AP, on the down AP totwifiusers is "False" as it should be and on the AP that is up with zero users totwifiusers is "0".
 
User avatar
gsandul
Member Candidate
Member Candidate
Posts: 154
Joined: Mon Oct 19, 2009 1:42 pm

Re: trouble - SNMP probe should return 0 as a valid value

Wed Jul 21, 2010 6:00 pm

It seems to be not The Dude problem
I suppose SNMP object cDot11ActiveDevicesTable with OID 1.3.6.1.4.1.9.9.273.1.1.2 becomes empty when there is no wireless client on access point.

You can check if anything is returned while snmpwalking on subtree at 1.3.6.1.4.1.9.9.273.1.1.2 when there are 0 clients registered.

You can modify the probe to show 0 when empty array is returned.
 
lebowski
Forum Guru
Forum Guru
Topic Author
Posts: 1616
Joined: Wed Aug 27, 2008 5:17 pm

Re: trouble - SNMP probe should return 0 as a valid value

Wed Jul 21, 2010 7:09 pm

Here is the SNMP walk showing 0 in the relevant OIDs.
Snmp Walk.png
You do not have the required permissions to view the files attached to this post.
 
User avatar
gsandul
Member Candidate
Member Candidate
Posts: 154
Joined: Mon Oct 19, 2009 1:42 pm

Re: trouble - SNMP probe should return 0 as a valid value

Wed Jul 21, 2010 10:10 pm

Hmmmm.... :shock:
The only thing I'm dubt is oid("1.3.6.1.4.1.9.9.273.1.1.2.1.1.1",10,19) :?

Could you use instead of this
oid("1.3.6.1.4.1.9.9.273.1.1.2.1.1.1",10,19)+oid("1.3.6.1.4.1.9.9.273.1.1.2.1.1.2",10,19)

this code 8)
sum(oid_column_raw("1.3.6.1.4.1.9.9.273.1.1.2.1.1"))

?????????????
 
lebowski
Forum Guru
Forum Guru
Topic Author
Posts: 1616
Joined: Wed Aug 27, 2008 5:17 pm

Re: trouble - SNMP probe should return 0 as a valid value

Wed Jul 21, 2010 10:54 pm

Ok now my function is...

Function
if(array_size(oid_column("1.3.6.1.4.1.9.9.273.1.1.2.1.1"))>0,sum(oid_column_raw("1.3.6.1.4.1.9.9.273.1.1.2.1.1")),"False")

Probe
if(totwifiusers()<>"False", if(totwifiusers()>=0, "", "failed snmp wifi read") ,"Wifi Device Down")

Same trouble...
Service.png
BTW thanks for all your help, your code examples are great!
You do not have the required permissions to view the files attached to this post.
 
lebowski
Forum Guru
Forum Guru
Topic Author
Posts: 1616
Joined: Wed Aug 27, 2008 5:17 pm

Re: trouble - SNMP probe should return 0 as a valid value

Thu Jul 22, 2010 7:18 pm

A work around to the 0 problem.

Just FYI, When I was using sum(oid_column_raw("")) in the function the probe did not graph, I had to go back to adding the separate OIDs together.

The solution for now...
In the function I added 1 to the value returned, then in the probe I subtracted 1... This way if the function is False the device is down and if it is up with 0 users the Error line of the probe is tricked into working.

Function
if(array_size(oid_column("1.3.6.1.4.1.9.9.273.1.1.2.1.1"))>0,oid("1.3.6.1.4.1.9.9.273.1.1.2.1.1.1",10,19)+oid("1.3.6.1.4.1.9.9.273.1.1.2.1.1.2",10,19)+1,"False")

Probe
Error: if(totwifiusers()<>"False",if(totwifiusers()-1>=0, "", "failed snmp wifi read") ,"Wifi Device Down")
Value: totwifiusers()-1

To break down exactly what is happening when I don't add 1 the first IF on the error line "if(totwifiusers()<>"False""... is working out to be true. So at that point the probe fails if there are no users connected to the AP.
wifi.png
Here you can see a device with 0 users on it, I put labels on the devices to see the values being returned.
On the top AP you can see "totwifiusers" vs the actual "Num users OID" and in the lower AP that is offline you can see totwifiusers is correctly reporting false and the device shows down.

Thanks for your help gsandul
You do not have the required permissions to view the files attached to this post.

Who is online

Users browsing this forum: No registered users and 13 guests