From a85a827ff03e08e6de20dc8134e3974c87a8186b Mon Sep 17 00:00:00 2001 From: Trygve Laugstøl Date: Thu, 1 Oct 2020 10:35:02 +0200 Subject: unifi: SNMP setup. --- ansible/plays/templates/ops-server/telegraf.conf | 495 +++++++++++++++++------ 1 file changed, 382 insertions(+), 113 deletions(-) (limited to 'ansible/plays/templates/ops-server/telegraf.conf') diff --git a/ansible/plays/templates/ops-server/telegraf.conf b/ansible/plays/templates/ops-server/telegraf.conf index 18a858b..4567e34 100644 --- a/ansible/plays/templates/ops-server/telegraf.conf +++ b/ansible/plays/templates/ops-server/telegraf.conf @@ -2,237 +2,506 @@ urls = ["$INFLUX_URL"] skip_database_creation = false -# Access point: Over stue +# snmpget -v 3 -u $username -a SHA -A $password -l authPriv -x AES -X $password 192.168.10.21 RFC1213-MIB::sysName.0 + +# Device: SW oppe, type: switch [[inputs.snmp]] - agents = [ "192.168.10.20" ] + agents = [ "192.168.10.10" ] version = 2 community = "public" - interval = "60s" - timeout = "30s" -# meta information -# this will be added automatically as a tag to the next snmp.table [[inputs.snmp.field]] oid = "RFC1213-MIB::sysName.0" - name = "ap_name" + name = "name" is_tag = true [[inputs.snmp.field]] oid = "RFC1213-MIB::sysLocation.0" - name = "ap_location" + name = "location" is_tag = true -# table [[inputs.snmp.table]] -# Using the oid here will query all fields automatically! -# Be careful when using the oid on inputs.snmp.table as this will -# produce a lot of information -# oid = "IF-MIB::ifXTable" - name = "unifi_ap_if" - inherit_tags = ["ap_name", "ap_location"] + oid = "IF-MIB::ifXTable" + name = "snmp_if_iftable" + inherit_tags = ["name", "location"] -# fields + +# SNMP Fields that should be tags [[inputs.snmp.table.field]] oid = "IF-MIB::ifName" - name = "name" is_tag = true - [[inputs.snmp.table.field]] - oid = "IF-MIB::ifOperStatus" - name = "status" + oid = "IF-MIB::ifLinkUpDownTrapEnable" is_tag = true - [[inputs.snmp.table.field]] - oid = "IF-MIB::ifAlias" - name = "ifAlias" + oid = "IF-MIB::ifHighSpeed" is_tag = true - [[inputs.snmp.table.field]] oid = "IF-MIB::ifPromiscuousMode" - name = "promiscuous_mode" is_tag = true - [[inputs.snmp.table.field]] oid = "IF-MIB::ifConnectorPresent" - name = "has_connector" + is_tag = true +[[inputs.snmp.table.field]] + oid = "IF-MIB::ifAlias" + is_tag = true +[[inputs.snmp.table.field]] + oid = "IF-MIB::ifCounterDiscontinuityTime" is_tag = true [[inputs.snmp.table.field]] - oid = "IF-MIB::ifPhysAddress" - name = "mac" - conversion = "hwaddr" + oid = "UBNT-UniFi-MIB::unifiRadioName" + is_tag = true +[[inputs.snmp.table.field]] + oid = "UBNT-UniFi-MIB::unifiRadioRadio" + is_tag = true +[[inputs.snmp.table.field]] + oid = "UBNT-UniFi-MIB::unifiRadioOtherBss" is_tag = true [[inputs.snmp.table.field]] - oid = "IF-MIB::ifHCInOctets" - name = "rx_bytes" + oid = "UBNT-UniFi-MIB::unifiVapBssId" + is_tag = true +[[inputs.snmp.table.field]] + oid = "UBNT-UniFi-MIB::unifiVapCcq" + is_tag = true +[[inputs.snmp.table.field]] + oid = "UBNT-UniFi-MIB::unifiVapEssId" + is_tag = true +[[inputs.snmp.table.field]] + oid = "UBNT-UniFi-MIB::unifiVapName" + is_tag = true +[[inputs.snmp.table.field]] + oid = "UBNT-UniFi-MIB::unifiVapRadio" + is_tag = true +[[inputs.snmp.table.field]] + oid = "UBNT-UniFi-MIB::unifiVapUp" + is_tag = true +[[inputs.snmp.table.field]] + oid = "UBNT-UniFi-MIB::unifiVapUsage" + is_tag = true + +# Device: SW nede, type: switch +[[inputs.snmp]] + agents = [ "192.168.10.11" ] + version = 2 + community = "public" + +[[inputs.snmp.field]] + oid = "RFC1213-MIB::sysName.0" + name = "name" + is_tag = true + +[[inputs.snmp.field]] + oid = "RFC1213-MIB::sysLocation.0" + name = "location" + is_tag = true + +[[inputs.snmp.table]] + oid = "IF-MIB::ifXTable" + name = "snmp_if_iftable" + inherit_tags = ["name", "location"] + + +# SNMP Fields that should be tags +[[inputs.snmp.table.field]] + oid = "IF-MIB::ifName" + is_tag = true +[[inputs.snmp.table.field]] + oid = "IF-MIB::ifLinkUpDownTrapEnable" + is_tag = true +[[inputs.snmp.table.field]] + oid = "IF-MIB::ifHighSpeed" + is_tag = true +[[inputs.snmp.table.field]] + oid = "IF-MIB::ifPromiscuousMode" + is_tag = true +[[inputs.snmp.table.field]] + oid = "IF-MIB::ifConnectorPresent" + is_tag = true +[[inputs.snmp.table.field]] + oid = "IF-MIB::ifAlias" + is_tag = true [[inputs.snmp.table.field]] - oid = "IF-MIB::ifHCInUcastPkts" - name = "rx_ucast_pkt" + oid = "IF-MIB::ifCounterDiscontinuityTime" + is_tag = true [[inputs.snmp.table.field]] - oid = "IF-MIB::ifHCOutOctets" - name = "tx_bytes" + oid = "UBNT-UniFi-MIB::unifiRadioName" + is_tag = true +[[inputs.snmp.table.field]] + oid = "UBNT-UniFi-MIB::unifiRadioRadio" + is_tag = true +[[inputs.snmp.table.field]] + oid = "UBNT-UniFi-MIB::unifiRadioOtherBss" + is_tag = true [[inputs.snmp.table.field]] - oid = "IF-MIB::ifHCOutUcastPkts" - name = "tx_ucast_pkt" + oid = "UBNT-UniFi-MIB::unifiVapBssId" + is_tag = true +[[inputs.snmp.table.field]] + oid = "UBNT-UniFi-MIB::unifiVapCcq" + is_tag = true +[[inputs.snmp.table.field]] + oid = "UBNT-UniFi-MIB::unifiVapEssId" + is_tag = true +[[inputs.snmp.table.field]] + oid = "UBNT-UniFi-MIB::unifiVapName" + is_tag = true +[[inputs.snmp.table.field]] + oid = "UBNT-UniFi-MIB::unifiVapRadio" + is_tag = true +[[inputs.snmp.table.field]] + oid = "UBNT-UniFi-MIB::unifiVapUp" + is_tag = true +[[inputs.snmp.table.field]] + oid = "UBNT-UniFi-MIB::unifiVapUsage" + is_tag = true -# Access point: Over kjøkken +# Device: SW cloud, type: switch [[inputs.snmp]] - agents = [ "192.168.10.21" ] + agents = [ "192.168.10.12" ] version = 2 community = "public" - interval = "60s" - timeout = "30s" -# meta information -# this will be added automatically as a tag to the next snmp.table [[inputs.snmp.field]] oid = "RFC1213-MIB::sysName.0" - name = "ap_name" + name = "name" is_tag = true [[inputs.snmp.field]] oid = "RFC1213-MIB::sysLocation.0" - name = "ap_location" + name = "location" is_tag = true -# table [[inputs.snmp.table]] -# Using the oid here will query all fields automatically! -# Be careful when using the oid on inputs.snmp.table as this will -# produce a lot of information -# oid = "IF-MIB::ifXTable" - name = "unifi_ap_if" - inherit_tags = ["ap_name", "ap_location"] + oid = "IF-MIB::ifXTable" + name = "snmp_if_iftable" + inherit_tags = ["name", "location"] -# fields + +# SNMP Fields that should be tags [[inputs.snmp.table.field]] oid = "IF-MIB::ifName" - name = "name" + is_tag = true +[[inputs.snmp.table.field]] + oid = "IF-MIB::ifLinkUpDownTrapEnable" + is_tag = true +[[inputs.snmp.table.field]] + oid = "IF-MIB::ifHighSpeed" + is_tag = true +[[inputs.snmp.table.field]] + oid = "IF-MIB::ifPromiscuousMode" + is_tag = true +[[inputs.snmp.table.field]] + oid = "IF-MIB::ifConnectorPresent" + is_tag = true +[[inputs.snmp.table.field]] + oid = "IF-MIB::ifAlias" + is_tag = true +[[inputs.snmp.table.field]] + oid = "IF-MIB::ifCounterDiscontinuityTime" is_tag = true [[inputs.snmp.table.field]] - oid = "IF-MIB::ifOperStatus" - name = "status" + oid = "UBNT-UniFi-MIB::unifiRadioName" + is_tag = true +[[inputs.snmp.table.field]] + oid = "UBNT-UniFi-MIB::unifiRadioRadio" + is_tag = true +[[inputs.snmp.table.field]] + oid = "UBNT-UniFi-MIB::unifiRadioOtherBss" is_tag = true [[inputs.snmp.table.field]] - oid = "IF-MIB::ifAlias" - name = "ifAlias" + oid = "UBNT-UniFi-MIB::unifiVapBssId" + is_tag = true +[[inputs.snmp.table.field]] + oid = "UBNT-UniFi-MIB::unifiVapCcq" + is_tag = true +[[inputs.snmp.table.field]] + oid = "UBNT-UniFi-MIB::unifiVapEssId" + is_tag = true +[[inputs.snmp.table.field]] + oid = "UBNT-UniFi-MIB::unifiVapName" + is_tag = true +[[inputs.snmp.table.field]] + oid = "UBNT-UniFi-MIB::unifiVapRadio" + is_tag = true +[[inputs.snmp.table.field]] + oid = "UBNT-UniFi-MIB::unifiVapUp" + is_tag = true +[[inputs.snmp.table.field]] + oid = "UBNT-UniFi-MIB::unifiVapUsage" + is_tag = true + +# Device: Over stue, type: ap + +[[inputs.snmp]] + agents = [ "192.168.10.20" ] + version = 2 + community = "public" + +[[inputs.snmp.field]] + oid = "RFC1213-MIB::sysName.0" + name = "name" + is_tag = true + +[[inputs.snmp.field]] + oid = "RFC1213-MIB::sysLocation.0" + name = "location" is_tag = true +[[inputs.snmp.table]] + oid = "IF-MIB::ifXTable" + name = "snmp_if_iftable" + inherit_tags = ["name", "location"] + +[[inputs.snmp.table]] + oid = "UBNT-UniFi-MIB::unifiRadioTable" + name = "unifi_radio" + index_as_tag = true + inherit_tags = ["name", "location"] + +[[inputs.snmp.table]] + oid = "UBNT-UniFi-MIB::unifiVapTable" + name = "unifi_vap" + index_as_tag = true + inherit_tags = ["name", "location"] + +# SNMP Fields that should be tags +[[inputs.snmp.table.field]] + oid = "IF-MIB::ifName" + is_tag = true +[[inputs.snmp.table.field]] + oid = "IF-MIB::ifLinkUpDownTrapEnable" + is_tag = true +[[inputs.snmp.table.field]] + oid = "IF-MIB::ifHighSpeed" + is_tag = true [[inputs.snmp.table.field]] oid = "IF-MIB::ifPromiscuousMode" - name = "promiscuous_mode" is_tag = true - [[inputs.snmp.table.field]] oid = "IF-MIB::ifConnectorPresent" - name = "has_connector" + is_tag = true +[[inputs.snmp.table.field]] + oid = "IF-MIB::ifAlias" + is_tag = true +[[inputs.snmp.table.field]] + oid = "IF-MIB::ifCounterDiscontinuityTime" is_tag = true [[inputs.snmp.table.field]] - oid = "IF-MIB::ifPhysAddress" - name = "mac" - conversion = "hwaddr" + oid = "UBNT-UniFi-MIB::unifiRadioName" + is_tag = true +[[inputs.snmp.table.field]] + oid = "UBNT-UniFi-MIB::unifiRadioRadio" + is_tag = true +[[inputs.snmp.table.field]] + oid = "UBNT-UniFi-MIB::unifiRadioOtherBss" is_tag = true [[inputs.snmp.table.field]] - oid = "IF-MIB::ifHCInOctets" - name = "rx_bytes" + oid = "UBNT-UniFi-MIB::unifiVapBssId" + is_tag = true +[[inputs.snmp.table.field]] + oid = "UBNT-UniFi-MIB::unifiVapCcq" + is_tag = true +[[inputs.snmp.table.field]] + oid = "UBNT-UniFi-MIB::unifiVapEssId" + is_tag = true +[[inputs.snmp.table.field]] + oid = "UBNT-UniFi-MIB::unifiVapName" + is_tag = true +[[inputs.snmp.table.field]] + oid = "UBNT-UniFi-MIB::unifiVapRadio" + is_tag = true +[[inputs.snmp.table.field]] + oid = "UBNT-UniFi-MIB::unifiVapUp" + is_tag = true +[[inputs.snmp.table.field]] + oid = "UBNT-UniFi-MIB::unifiVapUsage" + is_tag = true + +# Device: Over kjøkken, type: ap + +[[inputs.snmp]] + agents = [ "192.168.10.21" ] + version = 2 + community = "public" + +[[inputs.snmp.field]] + oid = "RFC1213-MIB::sysName.0" + name = "name" + is_tag = true + +[[inputs.snmp.field]] + oid = "RFC1213-MIB::sysLocation.0" + name = "location" + is_tag = true + +[[inputs.snmp.table]] + oid = "IF-MIB::ifXTable" + name = "snmp_if_iftable" + inherit_tags = ["name", "location"] + +[[inputs.snmp.table]] + oid = "UBNT-UniFi-MIB::unifiRadioTable" + name = "unifi_radio" + index_as_tag = true + inherit_tags = ["name", "location"] + +[[inputs.snmp.table]] + oid = "UBNT-UniFi-MIB::unifiVapTable" + name = "unifi_vap" + index_as_tag = true + inherit_tags = ["name", "location"] +# SNMP Fields that should be tags +[[inputs.snmp.table.field]] + oid = "IF-MIB::ifName" + is_tag = true [[inputs.snmp.table.field]] - oid = "IF-MIB::ifHCInUcastPkts" - name = "rx_ucast_pkt" + oid = "IF-MIB::ifLinkUpDownTrapEnable" + is_tag = true +[[inputs.snmp.table.field]] + oid = "IF-MIB::ifHighSpeed" + is_tag = true +[[inputs.snmp.table.field]] + oid = "IF-MIB::ifPromiscuousMode" + is_tag = true +[[inputs.snmp.table.field]] + oid = "IF-MIB::ifConnectorPresent" + is_tag = true +[[inputs.snmp.table.field]] + oid = "IF-MIB::ifAlias" + is_tag = true +[[inputs.snmp.table.field]] + oid = "IF-MIB::ifCounterDiscontinuityTime" + is_tag = true [[inputs.snmp.table.field]] - oid = "IF-MIB::ifHCOutOctets" - name = "tx_bytes" + oid = "UBNT-UniFi-MIB::unifiRadioName" + is_tag = true +[[inputs.snmp.table.field]] + oid = "UBNT-UniFi-MIB::unifiRadioRadio" + is_tag = true +[[inputs.snmp.table.field]] + oid = "UBNT-UniFi-MIB::unifiRadioOtherBss" + is_tag = true [[inputs.snmp.table.field]] - oid = "IF-MIB::ifHCOutUcastPkts" - name = "tx_ucast_pkt" + oid = "UBNT-UniFi-MIB::unifiVapBssId" + is_tag = true +[[inputs.snmp.table.field]] + oid = "UBNT-UniFi-MIB::unifiVapCcq" + is_tag = true +[[inputs.snmp.table.field]] + oid = "UBNT-UniFi-MIB::unifiVapEssId" + is_tag = true +[[inputs.snmp.table.field]] + oid = "UBNT-UniFi-MIB::unifiVapName" + is_tag = true +[[inputs.snmp.table.field]] + oid = "UBNT-UniFi-MIB::unifiVapRadio" + is_tag = true +[[inputs.snmp.table.field]] + oid = "UBNT-UniFi-MIB::unifiVapUp" + is_tag = true +[[inputs.snmp.table.field]] + oid = "UBNT-UniFi-MIB::unifiVapUsage" + is_tag = true -# Access point: Kontor +# Device: Kontor, type: ap [[inputs.snmp]] agents = [ "192.168.10.22" ] version = 2 community = "public" - interval = "60s" - timeout = "30s" -# meta information -# this will be added automatically as a tag to the next snmp.table [[inputs.snmp.field]] oid = "RFC1213-MIB::sysName.0" - name = "ap_name" + name = "name" is_tag = true [[inputs.snmp.field]] oid = "RFC1213-MIB::sysLocation.0" - name = "ap_location" + name = "location" is_tag = true -# table [[inputs.snmp.table]] -# Using the oid here will query all fields automatically! -# Be careful when using the oid on inputs.snmp.table as this will -# produce a lot of information -# oid = "IF-MIB::ifXTable" - name = "unifi_ap_if" - inherit_tags = ["ap_name", "ap_location"] + oid = "IF-MIB::ifXTable" + name = "snmp_if_iftable" + inherit_tags = ["name", "location"] -# fields +[[inputs.snmp.table]] + oid = "UBNT-UniFi-MIB::unifiRadioTable" + name = "unifi_radio" + index_as_tag = true + inherit_tags = ["name", "location"] + +[[inputs.snmp.table]] + oid = "UBNT-UniFi-MIB::unifiVapTable" + name = "unifi_vap" + index_as_tag = true + inherit_tags = ["name", "location"] + +# SNMP Fields that should be tags [[inputs.snmp.table.field]] oid = "IF-MIB::ifName" - name = "name" is_tag = true - [[inputs.snmp.table.field]] - oid = "IF-MIB::ifOperStatus" - name = "status" + oid = "IF-MIB::ifLinkUpDownTrapEnable" is_tag = true - [[inputs.snmp.table.field]] - oid = "IF-MIB::ifAlias" - name = "ifAlias" + oid = "IF-MIB::ifHighSpeed" is_tag = true - [[inputs.snmp.table.field]] oid = "IF-MIB::ifPromiscuousMode" - name = "promiscuous_mode" is_tag = true - [[inputs.snmp.table.field]] oid = "IF-MIB::ifConnectorPresent" - name = "has_connector" is_tag = true - [[inputs.snmp.table.field]] - oid = "IF-MIB::ifPhysAddress" - name = "mac" - conversion = "hwaddr" + oid = "IF-MIB::ifAlias" is_tag = true - [[inputs.snmp.table.field]] - oid = "IF-MIB::ifHCInOctets" - name = "rx_bytes" + oid = "IF-MIB::ifCounterDiscontinuityTime" + is_tag = true [[inputs.snmp.table.field]] - oid = "IF-MIB::ifHCInUcastPkts" - name = "rx_ucast_pkt" - + oid = "UBNT-UniFi-MIB::unifiRadioName" + is_tag = true [[inputs.snmp.table.field]] - oid = "IF-MIB::ifHCOutOctets" - name = "tx_bytes" + oid = "UBNT-UniFi-MIB::unifiRadioRadio" + is_tag = true +[[inputs.snmp.table.field]] + oid = "UBNT-UniFi-MIB::unifiRadioOtherBss" + is_tag = true [[inputs.snmp.table.field]] - oid = "IF-MIB::ifHCOutUcastPkts" - name = "tx_ucast_pkt" + oid = "UBNT-UniFi-MIB::unifiVapBssId" + is_tag = true +[[inputs.snmp.table.field]] + oid = "UBNT-UniFi-MIB::unifiVapCcq" + is_tag = true +[[inputs.snmp.table.field]] + oid = "UBNT-UniFi-MIB::unifiVapEssId" + is_tag = true +[[inputs.snmp.table.field]] + oid = "UBNT-UniFi-MIB::unifiVapName" + is_tag = true +[[inputs.snmp.table.field]] + oid = "UBNT-UniFi-MIB::unifiVapRadio" + is_tag = true +[[inputs.snmp.table.field]] + oid = "UBNT-UniFi-MIB::unifiVapUp" + is_tag = true +[[inputs.snmp.table.field]] + oid = "UBNT-UniFi-MIB::unifiVapUsage" + is_tag = true -- cgit v1.2.3