Community discussions

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

A Cisco Stack probe

Thu Dec 29, 2022 2:13 am

This probe is a bunch of functions to check that the OID of the switch is equal to 4. In other words it tells you when a switch in a stack is down or not well.

Put this in a function called stack_test;
if(oid_column("1.3.6.1.4.1.9.9.500.1.2.1.1.6" , 10, 5),
if(array_size(oid_column("1.3.6.1.4.1.9.9.500.1.2.1.1.6")) = 1 , stk1(),
if(array_size(oid_column("1.3.6.1.4.1.9.9.500.1.2.1.1.6")) = 2 , stk2(),
if(array_size(oid_column("1.3.6.1.4.1.9.9.500.1.2.1.1.6")) = 3 , stk3(),
if(array_size(oid_column("1.3.6.1.4.1.9.9.500.1.2.1.1.6")) = 4 , stk4(),
if(array_size(oid_column("1.3.6.1.4.1.9.9.500.1.2.1.1.6")) = 5 , stk5(),
if(array_size(oid_column("1.3.6.1.4.1.9.9.500.1.2.1.1.6")) = 6 , stk6(),
if(array_size(oid_column("1.3.6.1.4.1.9.9.500.1.2.1.1.6")) = 7 , stk7(),
if(array_size(oid_column("1.3.6.1.4.1.9.9.500.1.2.1.1.6")) = 8 , stk8(),
if(array_size(oid_column("1.3.6.1.4.1.9.9.500.1.2.1.1.6")) = 9 , stk9(),
"False"))))))))), "False")

Then make 9 functions stk1, stk2, stk3...
This one is stk1
if(array_element(oid_column("1.3.6.1.4.1.9.9.500.1.2.1.1.6"),0) = 4 , "1", "Switch 1 trouble")

this one is stk2
if(array_element(oid_column("1.3.6.1.4.1.9.9.500.1.2.1.1.6"),0) = 4 ,
if(array_element(oid_column("1.3.6.1.4.1.9.9.500.1.2.1.1.6"),1) = 4 ,
"2" , "Switch 2 Trouble"), "Switch 1 Trouble")

This one is stk3
if(array_element(oid_column("1.3.6.1.4.1.9.9.500.1.2.1.1.6"),0) = 4 ,
if(array_element(oid_column("1.3.6.1.4.1.9.9.500.1.2.1.1.6"),1) = 4 ,
if(array_element(oid_column("1.3.6.1.4.1.9.9.500.1.2.1.1.6"),2) = 4 ,
"3" , "Switch 3 Trouble"), "Switch 2 Trouble"), "Switch 1 Trouble")

This one is stk4
if(array_element(oid_column("1.3.6.1.4.1.9.9.500.1.2.1.1.6"),0) = 4 ,
if(array_element(oid_column("1.3.6.1.4.1.9.9.500.1.2.1.1.6"),1) = 4 ,
if(array_element(oid_column("1.3.6.1.4.1.9.9.500.1.2.1.1.6"),2) = 4 ,
if(array_element(oid_column("1.3.6.1.4.1.9.9.500.1.2.1.1.6"),3) = 4 ,
"4" , "Switch 4 Trouble"), "Switch 3 Trouble"), "Switch 2 Trouble"), "Switch 1 Trouble")

This one is stk5
if(array_element(oid_column("1.3.6.1.4.1.9.9.500.1.2.1.1.6"),0) = 4 ,
if(array_element(oid_column("1.3.6.1.4.1.9.9.500.1.2.1.1.6"),1) = 4 ,
if(array_element(oid_column("1.3.6.1.4.1.9.9.500.1.2.1.1.6"),2) = 4 ,
if(array_element(oid_column("1.3.6.1.4.1.9.9.500.1.2.1.1.6"),3) = 4 ,
if(array_element(oid_column("1.3.6.1.4.1.9.9.500.1.2.1.1.6"),4) = 4 ,
"5" , "Switch 5 Trouble"), "Switch 4 Trouble"), "Switch 3 Trouble"), "Switch 2 Trouble"), "Switch 1 Trouble")
.
.
.

This one is stk9
if(array_element(oid_column("1.3.6.1.4.1.9.9.500.1.2.1.1.6"),0) = 4 ,
if(array_element(oid_column("1.3.6.1.4.1.9.9.500.1.2.1.1.6"),1) = 4 ,
if(array_element(oid_column("1.3.6.1.4.1.9.9.500.1.2.1.1.6"),2) = 4 ,
if(array_element(oid_column("1.3.6.1.4.1.9.9.500.1.2.1.1.6"),3) = 4 ,
if(array_element(oid_column("1.3.6.1.4.1.9.9.500.1.2.1.1.6"),4) = 4 ,
if(array_element(oid_column("1.3.6.1.4.1.9.9.500.1.2.1.1.6"),5) = 4 ,
if(array_element(oid_column("1.3.6.1.4.1.9.9.500.1.2.1.1.6"),6) = 4 ,
if(array_element(oid_column("1.3.6.1.4.1.9.9.500.1.2.1.1.6"),7) = 4 ,
if(array_element(oid_column("1.3.6.1.4.1.9.9.500.1.2.1.1.6"),8) = 4 ,
"9" , "Switch 9 Trouble"), "Switch 8 Trouble"), "Switch 7 Trouble"), "Switch 6 Trouble"), "Switch 5 Trouble"), "Switch 4 Trouble"), "Switch 3 Trouble"), "Switch 2 Trouble"), "Switch 1 Trouble")

Create a probe and put this in there
available 1
Error: if(stack_test()<>"False", if(stack_test(),"", stack_test()), stack_test())
 
User avatar
jvanhambelgium
Forum Veteran
Forum Veteran
Posts: 985
Joined: Thu Jul 14, 2016 9:29 pm
Location: Belgium

Re: A Cisco Stack probe

Thu Dec 29, 2022 9:52 am

The stack will also report this by itself through SNMP (trap) and/or SYSLOG.

Who is online

Users browsing this forum: fibernetlb and 8 guests