Reset Search
 

 

Article

How to create an SNMP trap based on CPU utilization in EXOS?

« Go Back

Information

 
TitleHow to create an SNMP trap based on CPU utilization in EXOS?
Objective
Create an SNMP trap if the CPU utilization goes over a predefined amount
Environment
  • EXOS based switch
  • EXOS 15.6 or higher
  • Switch must have at least an Edge license on it for Universal Port Manager
Procedure
Create a script to check the CPU utilization. The script included below checks for a CPU utilization greater than 50%.

1. At the switch prompt type:
vi cpu-trap.py
2. Go into Insert mode in vi by hitting the 'i' key.
3. Paste in the following script. On line 6, that value can be changed to a different value, based on monitoring requirements
import re
def main_func():
    cu = exsh.clicmd("show snmp get 1.3.6.1.4.1.1916.1.32.1.2.0",capture=True)
    c = re.search(r'extremeSwMonitor.1.2.0\s=\s(.*)',cu)
    cpu = c.group(1)
    if cpu > 50:  #change this value if you want to adjust the threshold
        exsh.clicmd("create snmp trap severity warning event highCPU \"cpu "+str (cpu)+"%\"")
main_func()
4. Exit vi by hitting the Esc key, followed by ':wq'
5. Configure Universal Port Manager to run the script every 5 minutes:
create upm profile chkcpu
run script cpu-trap.py
 
.
create upm timer chkcpu_timer
configure upm timer chkcpu_timer profile chkcpu
configure upm timer chkcpu_timer after 10 every 300

To verify the script is running, use the command:
show upm timers


 
Additional notes

Feedback

 

Was this article helpful?


   

Feedback

Please tell us how we can make this article more useful.

Characters Remaining: 255