Community discussions

MikroTik App
 
pcpolo
just joined
Topic Author
Posts: 21
Joined: Wed Jul 15, 2009 8:41 pm

How to setup alert for CPU % monitoring?

Mon Apr 19, 2010 6:50 pm

Could someone help me out with setting it up so anytime the CPU % on my cisco switches goes over 50% that I get an alert?
 
lebowski
Forum Guru
Forum Guru
Posts: 1619
Joined: Wed Aug 27, 2008 5:17 pm

Re: How to setup alert for CPU % monitoring?

Mon Apr 19, 2010 8:01 pm

Most of this is covered in the probe thread. Create a function to read the cpu and a probe to graph and notify...
ciscofunction.PNG
ciscoprobe.PNG
Function
Cisco_CPU_available
array_size(oid_column("1.3.6.1.4.1.9.2.1.57", 10, 29))

Probe
Cisco_CPU_available()
if(or(Cisco_CPU_available()<>"", Cisco_CPU_available()>95), "","CPU Problem")
oid("1.3.6.1.4.1.9.2.1.57.0", 10, 29)

These have been updated to cache the value for 10 seconds and negative cache the value for 29 seconds (Negative cache default is 300 seconds, Negative cache gets set if SNMP fails to read the value). Which means if your probe fails it will stay failed for 5 minutes. This works correctly with 30 second polling intervals.

The OID I use is for the 1 minute average. Since I am polling every 30 seconds might as well get the 1 minute instead of 5 minute or 5 seconds..
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: How to setup alert for CPU % monitoring?

Tue Apr 20, 2010 10:03 am

Hi, lebowski.

does it alerts you?
Cisco_CPU_available
array_size(oid_column("1.3.6.1.4.1.9.2.1.57", 10, 29))

if(or(Cisco_CPU_available()<>"", Cisco_CPU_available()>95), "","CPU Problem")

Cisco_CPU_available always will return 1.

The correct solution should be

<?xml version="1.0" ?>
<dude version="3.5">
<Function>
<sys-type>57</sys-type>
<sys-id>52242</sys-id>
<sys-name>Cisco_CPU</sys-name>
<code>if(array_size(oid_column("1.3.6.1.4.1.9.2.1.58")) > 0, oid("1.3.6.1.4.1.9.2.1.58.0"),"False")</code>
<descr>**Cisco cpu 5 minutes average</descr>
</Function>
</dude>

<?xml version="1.0" ?>
<dude version="3.5">
<Probe>
<sys-type>13</sys-type>
<sys-id>41288</sys-id>
<sys-name>Cisco_Cpu_5</sys-name>
<typeID>8</typeID>
<functionAvailable>Cisco_CPU() <> "False"</functionAvailable>
<functionError>if(Cisco_CPU() <> "False",if(Cisco_CPU() < 80, "", concatenate("Warning: hi CPU usage. Current CPU_5_Min_Average_Usage=", Cisco_CPU(), "%")),"Not a cisco device or SNMP access timeout")</functionError>
<functionValue>oid("1.3.6.1.4.1.9.2.1.58.0")</functionValue>
<functionUnit>%</functionUnit>
</Probe>
</dude>
 
lebowski
Forum Guru
Forum Guru
Posts: 1619
Joined: Wed Aug 27, 2008 5:17 pm

Re: How to setup alert for CPU % monitoring?

Tue Apr 20, 2010 4:36 pm

Oh, that is great all this time, Yes you are correct sir, it doesn't report high CPU. Oh well THANKS for the fix.

On another note pasting XLM into the dude can break your maps.
You should only paste the lines of your probe/function and not the XML.

Thanks gsandul, I'll fix up my probe and repost it in the Probe thread...

I am trying to get your probe to work but I get a Parse Failed,
Lebowski
 
lebowski
Forum Guru
Forum Guru
Posts: 1619
Joined: Wed Aug 27, 2008 5:17 pm

Re: How to setup alert for CPU % monitoring?

Tue Apr 20, 2010 4:49 pm

Alright that is great, Fixed my probe up with your code everything working.

Gsandul you should post more often :)
ciscoCPUa.png
CiscoCPU.png
Thanks, Every time I have seen one of your solutions they have always been great.

Lebowski
You do not have the required permissions to view the files attached to this post.
 
lebowski
Forum Guru
Forum Guru
Posts: 1619
Joined: Wed Aug 27, 2008 5:17 pm

Re: How to setup alert for CPU % monitoring?

Tue Apr 20, 2010 5:13 pm

Well we are back to square one, The probe fails if the cpu average is 0%. Tried a few things but no luck. I will report if I find a way to fix it.
 
lebowski
Forum Guru
Forum Guru
Posts: 1619
Joined: Wed Aug 27, 2008 5:17 pm

Re: How to setup alert for CPU % monitoring?

Tue Apr 20, 2010 5:53 pm

I decided to cheat and add one, this will never report as 0 as well but it will report False and not fail when the cpu average is 0...
The graph is the actual value so this should solve all the issues.
I am also modifying cache and negative cache as usual.

if(array_size(oid_column("1.3.6.1.4.1.9.2.1.57", 10 ,29)), oid("1.3.6.1.4.1.9.2.1.57.0", 10, 29)+1 ,"False")
ciscoCPUa1.png
And the probe...
if(Cisco_CPU_a()<>"False",if(Cisco_CPU_a() < 50, "", concatenate("Warning: high CPU =", Cisco_CPU_a(), "%")), "Failed read")
CiscoCPU1.png
If you want to use the function in a label you can just subtract 1 from it.
CPU: [Cisco_CPU_a()-1]

FINALLY :)
You do not have the required permissions to view the files attached to this post.