centreon-plugins
centreon-plugins copied to clipboard
[network::cisco::standard::snmp::plugin] - new mode VTP (VLAN Trunking Port)
Could you create a new mode to monitor in Cisco switches VTP state? The SNMP mib for VTP is defined in CISCO-VTP-MIB, if you need we can also provide a SNMP walk, further informations about VTP are available here:
- https://www.cisco.com/c/en/us/td/docs/switches/lan/catalyst2960/software/release/12-2_40_se/configuration/guide/scg/swvtp.pdf
- https://www.cisco.com/c/en/us/support/docs/ip/simple-network-management-protocol-snmp/41003-catalystVLANinfo.html
-
1.3.6.1.4.1.9.9.46.1.3.1.1.1 (vtpVlanIndex)
-
1.3.6.1.4.1.9.9.46.1.3.1.1.2 (vtpVlanState)
-
1.3.6.1.4.1.9.9.46.1.3.1.1.3 (vtpVlanType)
-
1.3.6.1.4.1.9.9.46.1.3.1.1.4 (vtpVlanName)
-
1.3.6.1.4.1.9.9.46.1.3.1.1.5 (vtpVlanMtu)
-
1.3.6.1.4.1.9.9.46.1.3.1.1.6 (vtpVlanDot10Said)
-
1.3.6.1.4.1.9.9.46.1.3.1.1.7 (vtpVlanRingNumber)
-
1.3.6.1.4.1.9.9.46.1.3.1.1.8 (vtpVlanBridgeNumber)
-
1.3.6.1.4.1.9.9.46.1.3.1.1.9 (vtpVlanStpType)
-
1.3.6.1.4.1.9.9.46.1.3.1.1.10 (vtpVlanParentVlan)
-
1.3.6.1.4.1.9.9.46.1.3.1.1.11 (vtpVlanTranslationalVlan1)
-
1.3.6.1.4.1.9.9.46.1.3.1.1.12 (vtpVlanTranslationalVlan2)
-
1.3.6.1.4.1.9.9.46.1.3.1.1.13 (vtpVlanBridgeType)
-
1.3.6.1.4.1.9.9.46.1.3.1.1.14 (vtpVlanAreHopCount)
-
1.3.6.1.4.1.9.9.46.1.3.1.1.15 (vtpVlanSteHopCount)
-
1.3.6.1.4.1.9.9.46.1.3.1.1.16 (vtpVlanIsCRFBackup)
-
1.3.6.1.4.1.9.9.46.1.3.1.1.17 (vtpVlanTypeExt)
-
1.3.6.1.4.1.9.9.46.1.3.1.1.18 (vtpVlanIfIndex)
VLAN State: 1.3.6.1.4.1.9.9.46.1.3.1.1.2
1 = Operational, 2 = Suspended, 3 = mtuTooBigForDevice, 4 = mtuTooBigForTrunk
VLAN Type: 1.3.6.1.4.1.9.9.46.1.3.1.1.3
1 = Ethernet, 2 = FDDI, 3= TokenRing, 4 = FDDI, 5 = rtNet, 6 = Depreciated
Could you provide a snmpwalk ?
Could you test with following mode:
$ centreon_plugins.pl --plugin=apps::protocols::snmp::plugin --mode=collection --hostname=IP --config=ciscovtp.config --verbose
The config:
{
"constants": {
"critical": "1"
},
"mapping": {
"vtpState": {
"1": "operational",
"2": "suspended",
"3": "mtuTooBigForDevice",
"4": "mtuTooBigForTrunk"
},
"vtpType": {
"1": "ethernet",
"2": "fddi",
"3": "tokenRing",
"4": "fddiNet",
"5": "trNet",
"6": "deprecated"
}
},
"snmp": {
"cache": {
"enable": false,
"reload": 5
},
"tables": [
{
"name": "vtpVlans",
"oid": ".1.3.6.1.4.1.9.9.46.1.3.1.1",
"used_instance": "\\.(\\d+\\.\\d+)$",
"entries": [
{ "name": "state", "oid": ".1.3.6.1.4.1.9.9.46.1.3.1.1.2", "map": "vtpState" },
{ "name": "type", "oid": ".1.3.6.1.4.1.9.9.46.1.3.1.1.3", "map": "vtpType" },
{ "name": "name", "oid": ".1.3.6.1.4.1.9.9.46.1.3.1.1.4" }
]
}
]
},
"selection": [
{
"name": "operational",
"functions": [
{ "type": "count", "src": "%(snmp.tables.vtpVlans)", "filter": "%(src.state) eq %(name)", "save": "%(numVlan)" }
],
"perfdatas": [
{ "nlabel": "vlan.%(name).count", "value": "%(numVlan)", "min": 0 }
],
"formatting": {
"printf_msg":"number of %s vlan: %s",
"printf_var":[
"%(name)",
"%(numVlan)"
],
"display_ok": false
}
},
{
"name": "suspended",
"functions": [
{ "type": "count", "src": "%(snmp.tables.vtpVlans)", "filter": "%(src.state) eq %(name)", "save": "%(numVlan)" }
],
"perfdatas": [
{ "nlabel": "vlan.%(name).count", "value": "%(numVlan)", "min": 0 }
],
"formatting": {
"printf_msg":"number of %s vlan: %s",
"printf_var":[
"%(name)",
"%(numVlan)"
],
"display_ok": false
}
},
{
"name": "mtuTooBigForDevice",
"functions": [
{ "type": "count", "src": "%(snmp.tables.vtpVlans)", "filter": "%(src.state) eq %(name)", "save": "%(numVlan)" }
],
"perfdatas": [
{ "nlabel": "vlan.%(name).count", "value": "%(numVlan)", "min": 0 }
],
"formatting": {
"printf_msg":"number of %s vlan: %s",
"printf_var":[
"%(name)",
"%(numVlan)"
],
"display_ok": false
}
},
{
"name": "mtuTooBigForTrunk",
"functions": [
{ "type": "count", "src": "%(snmp.tables.vtpVlans)", "filter": "%(src.state) eq %(name)", "save": "%(numVlan)" }
],
"perfdatas": [
{ "nlabel": "vlan.%(name).count", "value": "%(numVlan)", "min": 0 }
],
"formatting": {
"printf_msg":"number of %s vlan: %s",
"printf_var":[
"%(name)",
"%(numVlan)"
],
"display_ok": false
}
}
],
"selection_loop": [
{
"name": "vtp vlan",
"source": "%(snmp.tables.vtpVlans)",
"expand_table": {
"vtpVlan": "%(snmp.tables.vtpVlans.[%(vtpVlans.instance)])"
},
"critical": "%(vtpVlan.state) !~ /operational/",
"formatting": {
"printf_msg":"vlan %s [type: %s] state is %s",
"printf_var":[
"%(vtpVlan.name)",
"%(vtpVlan.type)",
"%(vtpVlan.state)"
]
}
}
],
"formatting":{
"custom_message_global": "All VLAN trunking protocol are ok",
"separator": "-"
}
}
Hi @garnier-quentin, have done some test:
./apps-protocols-snmp.pl --plugin=apps::protocols::snmp::plugin --mode=collection --hostname=x.x.x.x --snmp-community=public --config=/tmp/ciscovtp.config --verbose
OK: All VLAN trunking protocol are ok |
vlan default [type: ethernet] state is operational
vlan Wireless [type: ethernet] state is operational
vlan Management [type: ethernet] state is operational
Seems working. Do you integrate this in the cisco plugin? It should be possible to have some option for
- filter vlan
- threshold-overload ???
- warning-status, critical-status
Please use the last git version. Command example:
$ centreon_plugins.pl --plugin=apps::protocols::snmp::plugin --mode=collection --hostname=IP --config=ciscovtp.config --verbose --constant='filterVlan=Dummy' --constant='warningStatus=' --constant='criticalStatus=operational'
{
"constants": {
"criticalStatus": "mtuTooBigForDevice|mtuTooBigForTrunk"
},
"mapping": {
"vtpState": {
"1": "operational",
"2": "suspended",
"3": "mtuTooBigForDevice",
"4": "mtuTooBigForTrunk"
},
"vtpType": {
"1": "ethernet",
"2": "fddi",
"3": "tokenRing",
"4": "fddiNet",
"5": "trNet",
"6": "deprecated"
}
},
"snmp": {
"cache": {
"enable": false,
"reload": 5
},
"tables": [
{
"name": "vtpVlans",
"oid": ".1.3.6.1.4.1.9.9.46.1.3.1.1",
"used_instance": "\\.(\\d+\\.\\d+)$",
"entries": [
{ "name": "state", "oid": ".1.3.6.1.4.1.9.9.46.1.3.1.1.2", "map": "vtpState" },
{ "name": "type", "oid": ".1.3.6.1.4.1.9.9.46.1.3.1.1.3", "map": "vtpType" },
{ "name": "name", "oid": ".1.3.6.1.4.1.9.9.46.1.3.1.1.4" }
]
}
]
},
"selection": [
{
"name": "operational",
"functions": [
{ "type": "count", "src": "%(snmp.tables.vtpVlans)", "filter": "%(src.state) eq %(name)", "save": "%(numVlan)" }
],
"perfdatas": [
{ "nlabel": "vlan.%(name).count", "value": "%(numVlan)", "min": 0 }
],
"formatting": {
"printf_msg":"number of %s vlan: %s",
"printf_var":[
"%(name)",
"%(numVlan)"
],
"display_ok": false
}
},
{
"name": "suspended",
"functions": [
{ "type": "count", "src": "%(snmp.tables.vtpVlans)", "filter": "%(src.state) eq %(name)", "save": "%(numVlan)" }
],
"perfdatas": [
{ "nlabel": "vlan.%(name).count", "value": "%(numVlan)", "min": 0 }
],
"formatting": {
"printf_msg":"number of %s vlan: %s",
"printf_var":[
"%(name)",
"%(numVlan)"
],
"display_ok": false
}
},
{
"name": "mtuTooBigForDevice",
"functions": [
{ "type": "count", "src": "%(snmp.tables.vtpVlans)", "filter": "%(src.state) eq %(name)", "save": "%(numVlan)" }
],
"perfdatas": [
{ "nlabel": "vlan.%(name).count", "value": "%(numVlan)", "min": 0 }
],
"formatting": {
"printf_msg":"number of %s vlan: %s",
"printf_var":[
"%(name)",
"%(numVlan)"
],
"display_ok": false
}
},
{
"name": "mtuTooBigForTrunk",
"functions": [
{ "type": "count", "src": "%(snmp.tables.vtpVlans)", "filter": "%(src.state) eq %(name)", "save": "%(numVlan)" }
],
"perfdatas": [
{ "nlabel": "vlan.%(name).count", "value": "%(numVlan)", "min": 0 }
],
"formatting": {
"printf_msg":"number of %s vlan: %s",
"printf_var":[
"%(name)",
"%(numVlan)"
],
"display_ok": false
}
}
],
"selection_loop": [
{
"name": "vtp vlan",
"source": "%(snmp.tables.vtpVlans)",
"expand_table": {
"vtpVlan": "%(snmp.tables.vtpVlans.[%(vtpVlans.instance)])"
},
"filter": "!defined(%(constants.filterVlan)) or %(constants.filterVlan) eq '' or %(vtpVlan.name) =~ /%(constants.filterVlan)/",
"warning": "defined(%(constants.warningStatus)) and %(constants.warningStatus) ne '' and %(vtpVlan.state) =~ /%(constants.warningStatus)/",
"critical": "defined(%(constants.criticalStatus)) and %(constants.criticalStatus) ne '' and %(vtpVlan.state) =~ /%(constants.criticalStatus)/",
"formatting": {
"printf_msg":"vlan %s [type: %s] state is %s",
"printf_var":[
"%(vtpVlan.name)",
"%(vtpVlan.type)",
"%(vtpVlan.state)"
]
}
}
],
"formatting":{
"custom_message_global": "All VLAN trunking protocol are ok",
"separator": "-"
}
}
Hi @garnier-quentin, works like a charm :-)
Do you plan to integrate this into the cisco standard plugin?
With that json, you have a quick way to integrate. Maybe we could do in a mode with Perl (because it's quite the same number of lines).
For a quick integration it's perfect
Hi @garnier-quentin, monitoring VTP with this extension should work. Could you add this feature as a new mode in the plugin?