• 0

Spanning Tree (STP) - Datasources available?


Question

Hello,

I've been searching for Datasources related with Spanning Tree Protocol monitoring but didn't found one.
Does this mean there's no out-of-box datasources for STP monitoring?

This is extremly useful in terms of monitoring.

Appreciate the feedback.

Link to post
Share on other sites

5 answers to this question

Recommended Posts

  • 0
  • Administrators

What exactly are you looking for? Define some of the metrics you'd like to see and what the instances would look like. Usually that discussion leads to more targeted queries against MIBs and APIs.

Link to post
Share on other sites
  • 0

The main metric you would care about is related to time since last TCN per VLAN. I have a DS that will get this for the default VLAN, but had a lot of trouble with any others due to lack of context support in LM.  I have been told there is context support in the 28.500 collector and later, but have not yet had a chance to test.  I published what I have for now as 969G49, but the new version will have to be done as a Groovy script to leverage the context feature.

Link to post
Share on other sites
  • 0

I was checking on this & we were able to come up with a script that analyzes different VLAN(s) - using the actual VLAN context.
I believe it's working as intended, however, the actual output of the snmp.get (on the TCN OID - .1.3.6.1.2.1.17.2.3.0) it's being automatically converted into a readable date (which I don't want, I want the RAW value in ticks).

Example of how it's been printed within LM groovy:

image.png.065fe86d46f939e642d3623f02616799.png

If I do a get on the same exact OID (outside of LM) it'll output the actual raw value (in time ticks) - example below
image.png.76687d710560272b8b12113b8076bf15.png

This is the script I've so far (I just need to solve this in order to have a working DS - which I can share later, since the AD script changes a little bit):

import com.santaba.agent.groovyapi.expect.Expect;
import com.santaba.agent.groovyapi.snmp.Snmp;
import com.santaba.agent.groovyapi.http.*;
import com.santaba.agent.groovyapi.jmx.*;
import org.xbill.DNS.*;
import com.santaba.agent.groovyapi.snmp.Snmp;

//array to store the interfaces
array_vlans = [];

//OID variables
stpTCN=".1.3.6.1.2.1.17.2.3.0" //get the actual TCN for the STP (for each VLAN)
vlan_indexes = ".1.3.6.1.4.1.9.9.46.1.3.1.1.3" //CISCO VLAN MIB

//device variables
deviceIP = hostProps.get("system.hostname");
snmpCommunity_raw = hostProps.get("snmp.community");
snmpVersion = hostProps.get("snmp.version");

interfaceWalk = Snmp.walk(deviceIP, vlan_indexes)
interfaceWalk.eachLine() {
	line ->
		vlanType= line.minus(vlan_indexes + ".").split(" = ")[1] //get the content of the specific OID
  		vlanNumber_raw= line.minus(vlan_indexes + ".").split(" = ")[0] //get the actual extra OID portion that was added (since that's the actual VLAN ID)
		vlanNumber = vlanNumber_raw.replace("1.", ""); //remove the WEIRD '1.' that get's added to the OID

		if(vlanType != "1"){
			//doNothing (since we only care about type==1 [ethernet])
		}else{
			//DEBUG print
			/*println "####"
			println "VLAN Type -> " +vlanType
			println "VLAN Number -> " +vlanNumber*/ 
			array_vlans.push(vlanNumber); //add VLANS(s) to the array
		}
}

//iterate over the VLAN array & do the SNMP GET per vlan (to retrieve the TopologyChange metric)
array_vlans.each(){
	vlanID=it
	snmpCommunity=snmpCommunity_raw+"@"+vlanID
	getVlan_TCN= Snmp.get(deviceIP, snmpCommunity, snmpVersion, stpTCN);
	println vlanID+".LastTopologyChange="+getVlan_TCN
}


If you guys could help it would be great. I'm pretty sure that groovy is doing some post-processing on the snmp.get result and/or I'm doing something wrong.

Regards,

image.png

Link to post
Share on other sites
  • 0

We were able to surpass this by tweaking the way the output gets processed (on the groovy script):

snmpGet = new SNMPCollector()._convertTime(Snmp.get(host, community, version, oid));

This was found by the user MNagel - thanks a lot man! :) 

From there I've tweaked our DS in order to add context/support to SNMPv3.
Bear in mind that in order to use SNMPv3 (in this STP context) the user/group needs to have view for the 'vlan-' context (tested this only at Cisco devices for now).

Found this on post below:

https://community.cisco.com/t5/network-management/multiple-snmp-v3-command-to-type-at-one-time/td-p/1475609

I've made use of Cisco VLAN MIB, however, in the future we're seeking to use a method that can suit all the manufacturers (if you implement it in the meanwhile - feel free to share).

DataSource (my GitHub, since I didn't shared it in the Exchange yet) -> https://github.com/vitor7santos/LogicMonitor/blob/master/STP_Topology_Change%2Cxml

Thanks!

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.