Community discussions

MikroTik App
 
User avatar
eben
Member
Member
Topic Author
Posts: 479
Joined: Mon Feb 16, 2009 8:37 pm
Location: Somerset West, South Africa
Contact:

Norification if speed on a link drops

Thu Jul 15, 2010 1:22 am

I'm monitoring a router using Dude.

SNMP ID (6) is the speed of the link.

I was wondering how I could go about setting up some sort of a notification to let me know if either the Tx or the Rx on that link was Zero (0).

In other words, I'd like to get an email or SMS (this part I know how to do) if the link were to logically go down. It often happens that the link is physically up, but there's no traffic on the link due to the upstream traffic provider having problems.

Thank you.
 
adrianatkins
Long time Member
Long time Member
Posts: 556
Joined: Wed Sep 05, 2007 10:34 am
Location: Spain
Contact:

Re: Norification if speed on a link drops

Thu Jul 15, 2010 1:23 am

Ping their gateway ?
 
User avatar
eben
Member
Member
Topic Author
Posts: 479
Joined: Mon Feb 16, 2009 8:37 pm
Location: Somerset West, South Africa
Contact:

Re: Norification if speed on a link drops

Thu Jul 15, 2010 9:47 am

Ping their gateway ?
Not quite that simple.

The traffic providers keep on changing the routes out of their data centres depending on load and which international circuits are actually up and running. More often than not.
 
User avatar
gsandul
Member Candidate
Member Candidate
Posts: 154
Joined: Mon Oct 19, 2009 1:42 pm

Re: Norification if speed on a link drops

Thu Jul 15, 2010 10:47 am

Hi, eben
It is not hard to make such a probe, but it will deffer in Dude 4.0 beta from 3.x
So I need to know your Dude version to help you.
 
User avatar
eben
Member
Member
Topic Author
Posts: 479
Joined: Mon Feb 16, 2009 8:37 pm
Location: Somerset West, South Africa
Contact:

Re: Norification if speed on a link drops

Thu Jul 15, 2010 11:04 am

I'm using 3.6
 
User avatar
gsandul
Member Candidate
Member Candidate
Posts: 154
Joined: Mon Oct 19, 2009 1:42 pm

Re: Norification if speed on a link drops

Thu Jul 15, 2010 5:57 pm

Ok.
The task is to notify when interface transfer rate on interface index 7 is less than 1Mbit/s (you can change it to whatever)
1) Create 2 functions
1_functions.JPG
2_functions.JPG
You can change interface index to your. The difference between function is in OID we check.
the functions codes are
<?xml version="1.0" ?>
<dude version="3.6">
 <Function>
  <sys-type>57</sys-type>
  <sys-id>20107</sys-id>
  <sys-name>If_7_in_rate</sys-name>
  <code>if(oid("1.3.6.1.2.1.2.2.1.10.7"),round(rate(oid("1.3.6.1.2.1.2.2.1.10.7")*8)),-1)</code>
  <descr>**** The inbound rate on interface number 7</descr>
 </Function>
</dude>
<?xml version="1.0" ?>
<dude version="3.6">
 <Function>
  <sys-type>57</sys-type>
  <sys-id>20130</sys-id>
  <sys-name>If_7_out_rate</sys-name>
  <code>if(oid("1.3.6.1.2.1.2.2.1.16.7"),round(rate(oid("1.3.6.1.2.1.2.2.1.16.7")*8)),-1)\0d\0a</code>
  <descr>**** The outbound rate on interface number 7</descr>
 </Function>
</dude>
You can copy XML and paste it in function tab.
The function will return the bitrate of data going through interface.
NOTE: the functions will return -1 if we do not have SNMP access to device for any reason (wrong SNMP community, or no IP access)

2) Next we need to check if functions are working correct. We need to make something like this picture.
3_apear.JPG
to do it - edit device appearance by right clicking on device (go to next post no more than 3 pictures are allowed where)
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: Norification if speed on a link drops

Thu Jul 15, 2010 6:08 pm

4_apear.JPG
5_apear.JPG
The code of appearance is
[Device.Name]
If 7 in rate = [If_7_in_rate()]
If 7 out rate = [If_7_out_rate()]
[device_performance()][Device.ServicesDown]
Now you need to create 2 probes
7_probes.JPG
The code for probes is
<?xml version="1.0" ?>
<dude version="3.6">
 <Probe>
  <sys-type>13</sys-type>
  <sys-id>20138</sys-id>
  <sys-name>If_7_in_rate</sys-name>
  <typeID>8</typeID>
  <functionAvailable>If_7_in_rate() > -1</functionAvailable>
  <functionError>if(If_7_in_rate() = -1,"SNMP Read Error",if(If_7_in_rate() > 1000000,"",concatenate("Warning Low inbound traffic rate on interface 7 the current rate = ",If_7_in_rate()," Bits per second")))</functionError>
  <functionValue>If_7_in_rate()</functionValue>
  <functionUnit>Bits/s</functionUnit>
 </Probe>
</dude>
<?xml version="1.0" ?>
<dude version="3.6">
 <Probe>
  <sys-type>13</sys-type>
  <sys-id>20437</sys-id>
  <sys-name>If_7_out_rate</sys-name>
  <typeID>8</typeID>
  <functionAvailable>If_7_out_rate() > -1</functionAvailable>
  <functionError>if(If_7_out_rate() = -1,"SNMP Read Error",if(If_7_out_rate() > 1000000,"",concatenate("Warning Low inbound traffic rate on interface 7 the current rate = ",If_7_out_rate()," Bits per second")))</functionError>
  <functionValue>If_7_out_rate()</functionValue>
  <functionUnit>Bits/s</functionUnit>
 </Probe>
</dude>
go to the next post
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: Norification if speed on a link drops

Thu Jul 15, 2010 6:14 pm

Now add services to the device and have a look what happens when

the rate is slow
8_probes.JPG
The device is not accessible
9_probes.JPG
\

Do you see the magic? :)
Hope it was helpful :)
You do not have the required permissions to view the files attached to this post.
 
adrianatkins
Long time Member
Long time Member
Posts: 556
Joined: Wed Sep 05, 2007 10:34 am
Location: Spain
Contact:

Re: Norification if speed on a link drops

Thu Jul 15, 2010 10:03 pm

Kor ! Genius !
 
lebowski
Forum Guru
Forum Guru
Posts: 1619
Joined: Wed Aug 27, 2008 5:17 pm

Re: Norification if speed on a link drops

Thu Jul 15, 2010 11:32 pm

gsandul is the man!

Quick question though, in the past if you built an IF statement with "-1" for false the dude would consider it a value instead of NULL.
Simple just use 0 instead of -1 in your if...

bad
if(oid("1.3.6.1.2.1.2.2.1.10.7"),round(rate(oid("1.3.6.1.2.1.2.2.1.10.7")*8)),-1)

good
if(oid("1.3.6.1.2.1.2.2.1.10.7"),round(rate(oid("1.3.6.1.2.1.2.2.1.10.7")*8)),0)

BUT I have not tested this in beta4.
 
User avatar
gsandul
Member Candidate
Member Candidate
Posts: 154
Joined: Mon Oct 19, 2009 1:42 pm

Re: Norification if speed on a link drops

Fri Jul 16, 2010 11:24 am

1) Had found 1 issue in probes.
<?xml version="1.0" ?>
<dude version="3.6">
<Probe>
  <sys-type>13</sys-type>
  <sys-id>20437</sys-id>
  <sys-name>If_7_out_rate</sys-name>
  <typeID>8</typeID>
  <functionAvailable>If_7_out_rate() > -1</functionAvailable>
  <functionError>if(If_7_out_rate() = -1,"SNMP Read Error",if(If_7_out_rate() > 1000000,"",concatenate("Warning Low inbound traffic rate on interface 7 the current rate = ",If_7_out_rate()," Bits per second")))</functionError>
  <functionValue>If_7_out_rate()</functionValue>
  <functionUnit>Bits/s</functionUnit>
</Probe>
</dude>
Need to change description in function error from inbound to outbound (copy/paste issue)
must be
<?xml version="1.0" ?>
<dude version="3.6">
<Probe>
  <sys-type>13</sys-type>
  <sys-id>20437</sys-id>
  <sys-name>If_7_out_rate</sys-name>
  <typeID>8</typeID>
  <functionAvailable>If_7_out_rate() > -1</functionAvailable>
  <functionError>if(If_7_out_rate() = -1,"SNMP Read Error",if(If_7_out_rate() > 1000000,"",concatenate("Warning Low outbound traffic rate on interface 7 the current rate = ",If_7_out_rate()," Bits per second")))</functionError>
  <functionValue>If_7_out_rate()</functionValue>
  <functionUnit>Bits/s</functionUnit>
</Probe>
</dude>
2) lebowski
good
if(oid("1.3.6.1.2.1.2.2.1.10.7"),round(rate(oid("1.3.6.1.2.1.2.2.1.10.7")*8)),0)
is not rely good, when traffic is very low the system may say "SNMP error" instead of Low traffic rate = 0. And, also rate function returns 0 while establishing baseline, so probe will return SNMP error instead 0.

3) When using Dude 4.0 you must change functions in order it to work because rate function had changed it's behavior.
<?xml version="1.0" ?>
<dude version="4.0beta2">
 <Function>
  <sys-type>57</sys-type>
  <sys-id>7765875</sys-id>
  <sys-name>If_7_in_rate</sys-name>
  <code>if(oid("1.3.6.1.2.1.2.2.1.10.7"),round(rate(diff32(oid("1.3.6.1.2.1.2.2.1.10.7"))*8)),-1)</code>
  <descr>**** The inbound rate on interface number 7</descr>
 </Function>
</dude>
<?xml version="1.0" ?>
<dude version="4.0beta2">
 <Function>
  <sys-type>57</sys-type>
  <sys-id>7765878</sys-id>
  <sys-name>If_7_out_rate</sys-name>
  <code>if(oid("1.3.6.1.2.1.2.2.1.16.7"),round(rate(diff32(oid("1.3.6.1.2.1.2.2.1.16.7"))*8)),-1)</code>
  <descr>**** The outbound rate on interface number 7</descr>
 </Function>
</dude>
NOTE: we use diff32 function because 1.3.6.1.2.1.2.2.1.10.7 is 32 bit counter, we should use diff64 when working with 64 bit counters.
 
User avatar
eben
Member
Member
Topic Author
Posts: 479
Joined: Mon Feb 16, 2009 8:37 pm
Location: Somerset West, South Africa
Contact:

Re: Norification if speed on a link drops

Fri Jul 16, 2010 12:50 pm

Thanks guys!

I've not looked at this yet as running the business has come between me and this project : :(
 
lebowski
Forum Guru
Forum Guru
Posts: 1619
Joined: Wed Aug 27, 2008 5:17 pm

Re: Norification if speed on a link drops

Fri Jul 16, 2010 6:39 pm

Thanks gsandul - you always make the nicest stuff.
 
n21roadie
Forum Guru
Forum Guru
Posts: 1949
Joined: Fri Aug 07, 2009 10:36 pm
Location: Limerick,Ireland

Re: Norification if speed on a link drops

Tue Jul 20, 2010 9:08 pm

I tried to setup dude v3.6 for wlan speed notification, but two problems
(1) I have missed where to select Wlan interface as it appears to monitor the eth interface
(2) "parse failed" when i tried to add service to device

attached are screenshots
You do not have the required permissions to view the files attached to this post.
 
tagno25
newbie
Posts: 38
Joined: Wed Feb 25, 2009 11:24 pm
Location: Kansas City, MO

Re: Norification if speed on a link drops

Tue Mar 20, 2012 4:20 am

I am trying to get this working without SNMP, is that possible? Or do I need to enable SNMP?
 
lebowski
Forum Guru
Forum Guru
Posts: 1619
Joined: Wed Aug 27, 2008 5:17 pm

Re: Norification if speed on a link drops

Wed Mar 21, 2012 5:07 pm

I am trying to get this working without SNMP, is that possible? Or do I need to enable SNMP?
No
 
mrasti
just joined
Posts: 1
Joined: Sat Sep 28, 2013 10:30 am

Re: Norification if speed on a link drops

Sat Sep 28, 2013 10:33 am

hello, thanks for you useful and complete answer to questions, i have a problem like this topic,

i want see throughput of my cisco switch interfaces on dude map, near the device icon, is it possible ? and how ?
i want see ethernet 1 to 24 tx/rx rate on map.

please show me how.

thanks.
 
gilbertoandrade
just joined
Posts: 21
Joined: Thu Aug 24, 2006 10:52 pm

Re: Norification if speed on a link drops

Wed Dec 02, 2015 8:34 pm

Hello!

Very nice post!
A doubt, Why sometimes it's returns value negative on interface ex. current rate = -784576104 Bits per second ?
 
kenjix
just joined
Posts: 13
Joined: Wed Aug 28, 2019 5:31 pm

Re: Norification if speed on a link drops

Wed Aug 28, 2019 6:13 pm

Is this functional on ver 6.45.2 of the Dude?

Who is online

Users browsing this forum: No registered users and 34 guests