Sartuche24 wrote:
> Here's what I have for High Utilization for an Interface.
> 
> 
> Code:
> import re
> 
> fs_id = device.prepId(evt.component)
> for f in device.os.interfaces():
>     if f.id != fs_id: continue
> 
>     # Extract the percent and utilization from the summary
>     m = re.search("threshold of [^:]+: current value ([\d\.]+)", evt.message)
>     if not m: continue
>     currentusage = (float(m.group(1))) * 8
>     p = (currentusage / f.speed) * 100
>     evtKey = evt.eventKey
>     
>     # Whether Input or Output Traffic
>     if evtKey == "ifInOctets_ifInOctets|high utilization":
>         evtNewKey = "Input"
>     elif evtKey == "ifOutOctets_ifOutOctets|high utilization":
>         evtNewKey = "Output"
> 
> 
>     # Check the speed to determine the appropriate conversion
>     # Gbps utilization
>     if currentusage > 1000000000:
>         Usage = currentusage / 1000000000
>         evt.summary = "High " + evtNewKey + " Utilization: Currently (%3.2f 
> Gbps) or %3.2f%% is being used." %  (Usage, p)
> 
>     # Mbps utilization
>     elif currentusage > 1000000:
>         Usage = currentusage / 1000000
>         evt.summary = "High " + evtNewKey + " Utilization: Currently (%3.2f 
> Kbps) or %3.2f%%  is being used." %  (Usage, p)
> 
>     # Kbps utilization
>     elif currentusage > 1000:
>         Usage = currentusage / 1000
>         evt.summary = "High " + evtNewKey + " Utilization: Currently (%3.2f 
> Kbps) or %3.2f%%  is being used." %  (Usage, p)
> 
>     # bps  utilization
>     elif currentusage < 1000:
>         Usage = currentusage
>         evt.summary = "High " + evtNewKey + " Utilization: Currently (%3.2f 
> bps) or %3.2f%%  is being used." %  (Usage, p)
>     break
> 
> 
> 
> This transforms the summary from:
> threshold of high utilization exceeded: current value 13763.32
> To This:
> High Input Utilization: Currently (246.84 Kbps) or 192.84% is being used.


I cannot get this to work!! The message simply will not transform, I have no 
idea what I'm doing wrong or how to troubleshoot it.. can anyone help?




-------------------- m2f --------------------

Read this topic online here:
http://forums.zenoss.com/viewtopic.php?p=29556#29556

-------------------- m2f --------------------



_______________________________________________
zenoss-users mailing list
[email protected]
http://lists.zenoss.org/mailman/listinfo/zenoss-users

Reply via email to