Plugin for spanning tree on cisco switches


Hi all,

I am searching a plugin for Cisco spanning tree. It should eg. give me the possibility to check, if the switch is the root brdige for a given VLAN (and if not give a warn/crit).
Does anybody know sth. useful for this?


(Dmytro Prokhorenkov) #2

I think there is no ready solution for this task. How about use default snmp script with STP community and check for output status?

(Isma399) #3

If you can SSH your switch since Icinga, you could test this Python script:

# coding: utf-8

import sys
import re
from optparse import OptionParser
import subprocess

argv = (sys.argv[1:])
parser = OptionParser()
parser.add_option("-u", "--user",
                  help="Enabled user.")
parser.add_option("-H", "--hostname",
                  help="The switch checked for root brige.")
parser.add_option("-n", "--vlan_number",
                  help="The vlan number which the switch is root bridge.")
(options, args) = parser.parse_args()

switch = options.switch
vlan = options.vlan
user = options.user 

cmd = 'ssh ' + user + '@' + switch + ' -C show spanning-tree vlan ' + vlan
ps = subprocess.Popen(cmd,shell=True,stdout=subprocess.PIPE,stderr=subprocess.STDOUT)
result = ps.communicate()[0]

if'This bridge is the root', result):
    print 'OK. ' + switch + ' is root bridge for vlan ' + vlan
    print 'ALERT! ' + switch + ' is NOT root bridge for vlan ' + vlan