From 62db38129f064dc88b028cd2058c67ce577fbe2a Mon Sep 17 00:00:00 2001 From: Trygve Laugstøl Date: Thu, 1 Oct 2020 11:25:42 +0200 Subject: unifi: More SNMP. --- ansible/plays/templates/ops-server/telegraf.conf | 276 +++++++++++++++++++-- .../plays/templates/ops-server/telegraf.conf.j2 | 48 +++- 2 files changed, 305 insertions(+), 19 deletions(-) (limited to 'ansible/plays') diff --git a/ansible/plays/templates/ops-server/telegraf.conf b/ansible/plays/templates/ops-server/telegraf.conf index 4567e34..7b36879 100644 --- a/ansible/plays/templates/ops-server/telegraf.conf +++ b/ansible/plays/templates/ops-server/telegraf.conf @@ -26,8 +26,40 @@ name = "snmp_if_iftable" inherit_tags = ["name", "location"] +[[inputs.snmp.table]] + oid = "UCD-SNMP-MIB::laTable" + name = "snmp_la_table" + inherit_tags = ["name", "location"] +[[inputs.snmp.field]] + name = "memTotalSwap" + oid = "UCD-SNMP-MIB::memTotalSwap.0" +[[inputs.snmp.field]] + name = "memAvailSwap" + oid = "UCD-SNMP-MIB::memAvailSwap.0" +[[inputs.snmp.field]] + name = "memTotalReal" + oid = "UCD-SNMP-MIB::memTotalReal.0" +[[inputs.snmp.field]] + name = "memAvailReal" + oid = "UCD-SNMP-MIB::memAvailReal.0" +[[inputs.snmp.field]] + name = "memTotalFree" + oid = "UCD-SNMP-MIB::memTotalFree.0" +[[inputs.snmp.field]] + name = "memShared" + oid = "UCD-SNMP-MIB::memShared.0" +[[inputs.snmp.field]] + name = "memBuffer" + oid = "UCD-SNMP-MIB::memBuffer.0" +[[inputs.snmp.field]] + name = "memCached" + oid = "UCD-SNMP-MIB::memCached.0" + +# # SNMP Fields that should be tags +# + [[inputs.snmp.table.field]] oid = "IF-MIB::ifName" is_tag = true @@ -51,13 +83,14 @@ is_tag = true [[inputs.snmp.table.field]] - oid = "UBNT-UniFi-MIB::unifiRadioName" + oid = "UCD-SNMP-MIB::laNames" is_tag = true + [[inputs.snmp.table.field]] - oid = "UBNT-UniFi-MIB::unifiRadioRadio" + oid = "UBNT-UniFi-MIB::unifiRadioName" is_tag = true [[inputs.snmp.table.field]] - oid = "UBNT-UniFi-MIB::unifiRadioOtherBss" + oid = "UBNT-UniFi-MIB::unifiRadioRadio" is_tag = true [[inputs.snmp.table.field]] @@ -82,6 +115,10 @@ oid = "UBNT-UniFi-MIB::unifiVapUsage" is_tag = true +[[inputs.snmp.table.field]] + oid = "UBNT-UniFi-MIB::unifiIfName" + is_tag = true + # Device: SW nede, type: switch [[inputs.snmp]] @@ -104,8 +141,40 @@ name = "snmp_if_iftable" inherit_tags = ["name", "location"] +[[inputs.snmp.table]] + oid = "UCD-SNMP-MIB::laTable" + name = "snmp_la_table" + inherit_tags = ["name", "location"] + +[[inputs.snmp.field]] + name = "memTotalSwap" + oid = "UCD-SNMP-MIB::memTotalSwap.0" +[[inputs.snmp.field]] + name = "memAvailSwap" + oid = "UCD-SNMP-MIB::memAvailSwap.0" +[[inputs.snmp.field]] + name = "memTotalReal" + oid = "UCD-SNMP-MIB::memTotalReal.0" +[[inputs.snmp.field]] + name = "memAvailReal" + oid = "UCD-SNMP-MIB::memAvailReal.0" +[[inputs.snmp.field]] + name = "memTotalFree" + oid = "UCD-SNMP-MIB::memTotalFree.0" +[[inputs.snmp.field]] + name = "memShared" + oid = "UCD-SNMP-MIB::memShared.0" +[[inputs.snmp.field]] + name = "memBuffer" + oid = "UCD-SNMP-MIB::memBuffer.0" +[[inputs.snmp.field]] + name = "memCached" + oid = "UCD-SNMP-MIB::memCached.0" +# # SNMP Fields that should be tags +# + [[inputs.snmp.table.field]] oid = "IF-MIB::ifName" is_tag = true @@ -129,13 +198,14 @@ is_tag = true [[inputs.snmp.table.field]] - oid = "UBNT-UniFi-MIB::unifiRadioName" + oid = "UCD-SNMP-MIB::laNames" is_tag = true + [[inputs.snmp.table.field]] - oid = "UBNT-UniFi-MIB::unifiRadioRadio" + oid = "UBNT-UniFi-MIB::unifiRadioName" is_tag = true [[inputs.snmp.table.field]] - oid = "UBNT-UniFi-MIB::unifiRadioOtherBss" + oid = "UBNT-UniFi-MIB::unifiRadioRadio" is_tag = true [[inputs.snmp.table.field]] @@ -160,6 +230,10 @@ oid = "UBNT-UniFi-MIB::unifiVapUsage" is_tag = true +[[inputs.snmp.table.field]] + oid = "UBNT-UniFi-MIB::unifiIfName" + is_tag = true + # Device: SW cloud, type: switch [[inputs.snmp]] @@ -182,8 +256,40 @@ name = "snmp_if_iftable" inherit_tags = ["name", "location"] +[[inputs.snmp.table]] + oid = "UCD-SNMP-MIB::laTable" + name = "snmp_la_table" + inherit_tags = ["name", "location"] +[[inputs.snmp.field]] + name = "memTotalSwap" + oid = "UCD-SNMP-MIB::memTotalSwap.0" +[[inputs.snmp.field]] + name = "memAvailSwap" + oid = "UCD-SNMP-MIB::memAvailSwap.0" +[[inputs.snmp.field]] + name = "memTotalReal" + oid = "UCD-SNMP-MIB::memTotalReal.0" +[[inputs.snmp.field]] + name = "memAvailReal" + oid = "UCD-SNMP-MIB::memAvailReal.0" +[[inputs.snmp.field]] + name = "memTotalFree" + oid = "UCD-SNMP-MIB::memTotalFree.0" +[[inputs.snmp.field]] + name = "memShared" + oid = "UCD-SNMP-MIB::memShared.0" +[[inputs.snmp.field]] + name = "memBuffer" + oid = "UCD-SNMP-MIB::memBuffer.0" +[[inputs.snmp.field]] + name = "memCached" + oid = "UCD-SNMP-MIB::memCached.0" + +# # SNMP Fields that should be tags +# + [[inputs.snmp.table.field]] oid = "IF-MIB::ifName" is_tag = true @@ -207,13 +313,14 @@ is_tag = true [[inputs.snmp.table.field]] - oid = "UBNT-UniFi-MIB::unifiRadioName" + oid = "UCD-SNMP-MIB::laNames" is_tag = true + [[inputs.snmp.table.field]] - oid = "UBNT-UniFi-MIB::unifiRadioRadio" + oid = "UBNT-UniFi-MIB::unifiRadioName" is_tag = true [[inputs.snmp.table.field]] - oid = "UBNT-UniFi-MIB::unifiRadioOtherBss" + oid = "UBNT-UniFi-MIB::unifiRadioRadio" is_tag = true [[inputs.snmp.table.field]] @@ -238,6 +345,10 @@ oid = "UBNT-UniFi-MIB::unifiVapUsage" is_tag = true +[[inputs.snmp.table.field]] + oid = "UBNT-UniFi-MIB::unifiIfName" + is_tag = true + # Device: Over stue, type: ap [[inputs.snmp]] @@ -260,6 +371,36 @@ name = "snmp_if_iftable" inherit_tags = ["name", "location"] +[[inputs.snmp.table]] + oid = "UCD-SNMP-MIB::laTable" + name = "snmp_la_table" + inherit_tags = ["name", "location"] + +[[inputs.snmp.field]] + name = "memTotalSwap" + oid = "UCD-SNMP-MIB::memTotalSwap.0" +[[inputs.snmp.field]] + name = "memAvailSwap" + oid = "UCD-SNMP-MIB::memAvailSwap.0" +[[inputs.snmp.field]] + name = "memTotalReal" + oid = "UCD-SNMP-MIB::memTotalReal.0" +[[inputs.snmp.field]] + name = "memAvailReal" + oid = "UCD-SNMP-MIB::memAvailReal.0" +[[inputs.snmp.field]] + name = "memTotalFree" + oid = "UCD-SNMP-MIB::memTotalFree.0" +[[inputs.snmp.field]] + name = "memShared" + oid = "UCD-SNMP-MIB::memShared.0" +[[inputs.snmp.field]] + name = "memBuffer" + oid = "UCD-SNMP-MIB::memBuffer.0" +[[inputs.snmp.field]] + name = "memCached" + oid = "UCD-SNMP-MIB::memCached.0" + [[inputs.snmp.table]] oid = "UBNT-UniFi-MIB::unifiRadioTable" name = "unifi_radio" @@ -272,7 +413,15 @@ index_as_tag = true inherit_tags = ["name", "location"] +[[inputs.snmp.table]] + oid = "UBNT-UniFi-MIB::unifiIfTable" + name = "unifi_if_table" + inherit_tags = ["name", "location"] + +# # SNMP Fields that should be tags +# + [[inputs.snmp.table.field]] oid = "IF-MIB::ifName" is_tag = true @@ -296,13 +445,14 @@ is_tag = true [[inputs.snmp.table.field]] - oid = "UBNT-UniFi-MIB::unifiRadioName" + oid = "UCD-SNMP-MIB::laNames" is_tag = true + [[inputs.snmp.table.field]] - oid = "UBNT-UniFi-MIB::unifiRadioRadio" + oid = "UBNT-UniFi-MIB::unifiRadioName" is_tag = true [[inputs.snmp.table.field]] - oid = "UBNT-UniFi-MIB::unifiRadioOtherBss" + oid = "UBNT-UniFi-MIB::unifiRadioRadio" is_tag = true [[inputs.snmp.table.field]] @@ -327,6 +477,10 @@ oid = "UBNT-UniFi-MIB::unifiVapUsage" is_tag = true +[[inputs.snmp.table.field]] + oid = "UBNT-UniFi-MIB::unifiIfName" + is_tag = true + # Device: Over kjøkken, type: ap [[inputs.snmp]] @@ -349,6 +503,36 @@ name = "snmp_if_iftable" inherit_tags = ["name", "location"] +[[inputs.snmp.table]] + oid = "UCD-SNMP-MIB::laTable" + name = "snmp_la_table" + inherit_tags = ["name", "location"] + +[[inputs.snmp.field]] + name = "memTotalSwap" + oid = "UCD-SNMP-MIB::memTotalSwap.0" +[[inputs.snmp.field]] + name = "memAvailSwap" + oid = "UCD-SNMP-MIB::memAvailSwap.0" +[[inputs.snmp.field]] + name = "memTotalReal" + oid = "UCD-SNMP-MIB::memTotalReal.0" +[[inputs.snmp.field]] + name = "memAvailReal" + oid = "UCD-SNMP-MIB::memAvailReal.0" +[[inputs.snmp.field]] + name = "memTotalFree" + oid = "UCD-SNMP-MIB::memTotalFree.0" +[[inputs.snmp.field]] + name = "memShared" + oid = "UCD-SNMP-MIB::memShared.0" +[[inputs.snmp.field]] + name = "memBuffer" + oid = "UCD-SNMP-MIB::memBuffer.0" +[[inputs.snmp.field]] + name = "memCached" + oid = "UCD-SNMP-MIB::memCached.0" + [[inputs.snmp.table]] oid = "UBNT-UniFi-MIB::unifiRadioTable" name = "unifi_radio" @@ -361,7 +545,15 @@ index_as_tag = true inherit_tags = ["name", "location"] +[[inputs.snmp.table]] + oid = "UBNT-UniFi-MIB::unifiIfTable" + name = "unifi_if_table" + inherit_tags = ["name", "location"] + +# # SNMP Fields that should be tags +# + [[inputs.snmp.table.field]] oid = "IF-MIB::ifName" is_tag = true @@ -385,13 +577,14 @@ is_tag = true [[inputs.snmp.table.field]] - oid = "UBNT-UniFi-MIB::unifiRadioName" + oid = "UCD-SNMP-MIB::laNames" is_tag = true + [[inputs.snmp.table.field]] - oid = "UBNT-UniFi-MIB::unifiRadioRadio" + oid = "UBNT-UniFi-MIB::unifiRadioName" is_tag = true [[inputs.snmp.table.field]] - oid = "UBNT-UniFi-MIB::unifiRadioOtherBss" + oid = "UBNT-UniFi-MIB::unifiRadioRadio" is_tag = true [[inputs.snmp.table.field]] @@ -416,6 +609,10 @@ oid = "UBNT-UniFi-MIB::unifiVapUsage" is_tag = true +[[inputs.snmp.table.field]] + oid = "UBNT-UniFi-MIB::unifiIfName" + is_tag = true + # Device: Kontor, type: ap [[inputs.snmp]] @@ -438,6 +635,36 @@ name = "snmp_if_iftable" inherit_tags = ["name", "location"] +[[inputs.snmp.table]] + oid = "UCD-SNMP-MIB::laTable" + name = "snmp_la_table" + inherit_tags = ["name", "location"] + +[[inputs.snmp.field]] + name = "memTotalSwap" + oid = "UCD-SNMP-MIB::memTotalSwap.0" +[[inputs.snmp.field]] + name = "memAvailSwap" + oid = "UCD-SNMP-MIB::memAvailSwap.0" +[[inputs.snmp.field]] + name = "memTotalReal" + oid = "UCD-SNMP-MIB::memTotalReal.0" +[[inputs.snmp.field]] + name = "memAvailReal" + oid = "UCD-SNMP-MIB::memAvailReal.0" +[[inputs.snmp.field]] + name = "memTotalFree" + oid = "UCD-SNMP-MIB::memTotalFree.0" +[[inputs.snmp.field]] + name = "memShared" + oid = "UCD-SNMP-MIB::memShared.0" +[[inputs.snmp.field]] + name = "memBuffer" + oid = "UCD-SNMP-MIB::memBuffer.0" +[[inputs.snmp.field]] + name = "memCached" + oid = "UCD-SNMP-MIB::memCached.0" + [[inputs.snmp.table]] oid = "UBNT-UniFi-MIB::unifiRadioTable" name = "unifi_radio" @@ -450,7 +677,15 @@ index_as_tag = true inherit_tags = ["name", "location"] +[[inputs.snmp.table]] + oid = "UBNT-UniFi-MIB::unifiIfTable" + name = "unifi_if_table" + inherit_tags = ["name", "location"] + +# # SNMP Fields that should be tags +# + [[inputs.snmp.table.field]] oid = "IF-MIB::ifName" is_tag = true @@ -474,13 +709,14 @@ is_tag = true [[inputs.snmp.table.field]] - oid = "UBNT-UniFi-MIB::unifiRadioName" + oid = "UCD-SNMP-MIB::laNames" is_tag = true + [[inputs.snmp.table.field]] - oid = "UBNT-UniFi-MIB::unifiRadioRadio" + oid = "UBNT-UniFi-MIB::unifiRadioName" is_tag = true [[inputs.snmp.table.field]] - oid = "UBNT-UniFi-MIB::unifiRadioOtherBss" + oid = "UBNT-UniFi-MIB::unifiRadioRadio" is_tag = true [[inputs.snmp.table.field]] @@ -505,3 +741,7 @@ oid = "UBNT-UniFi-MIB::unifiVapUsage" is_tag = true +[[inputs.snmp.table.field]] + oid = "UBNT-UniFi-MIB::unifiIfName" + is_tag = true + diff --git a/ansible/plays/templates/ops-server/telegraf.conf.j2 b/ansible/plays/templates/ops-server/telegraf.conf.j2 index 61f9279..f6a1c87 100644 --- a/ansible/plays/templates/ops-server/telegraf.conf.j2 +++ b/ansible/plays/templates/ops-server/telegraf.conf.j2 @@ -40,7 +40,37 @@ name = "snmp_if_iftable" inherit_tags = ["name", "location"] +[[inputs.snmp.table]] + oid = "UCD-SNMP-MIB::laTable" + name = "snmp_la_table" + inherit_tags = ["name", "location"] + +[[inputs.snmp.field]] + name = "memTotalSwap" + oid = "UCD-SNMP-MIB::memTotalSwap.0" +[[inputs.snmp.field]] + name = "memAvailSwap" + oid = "UCD-SNMP-MIB::memAvailSwap.0" +[[inputs.snmp.field]] + name = "memTotalReal" + oid = "UCD-SNMP-MIB::memTotalReal.0" +[[inputs.snmp.field]] + name = "memAvailReal" + oid = "UCD-SNMP-MIB::memAvailReal.0" +[[inputs.snmp.field]] + name = "memTotalFree" + oid = "UCD-SNMP-MIB::memTotalFree.0" +[[inputs.snmp.field]] + name = "memShared" + oid = "UCD-SNMP-MIB::memShared.0" +[[inputs.snmp.field]] + name = "memBuffer" + oid = "UCD-SNMP-MIB::memBuffer.0" +[[inputs.snmp.field]] + name = "memCached" + oid = "UCD-SNMP-MIB::memCached.0" {% if device.type == "ap" %} + [[inputs.snmp.table]] oid = "UBNT-UniFi-MIB::unifiRadioTable" name = "unifi_radio" @@ -52,16 +82,28 @@ name = "unifi_vap" index_as_tag = true inherit_tags = ["name", "location"] + +[[inputs.snmp.table]] + oid = "UBNT-UniFi-MIB::unifiIfTable" + name = "unifi_if_table" + inherit_tags = ["name", "location"] {% endif %} +# # SNMP Fields that should be tags +# + {% for f in [ "ifName", "ifLinkUpDownTrapEnable", "ifHighSpeed", "ifPromiscuousMode", "ifConnectorPresent", "ifAlias", "ifCounterDiscontinuityTime" ] %} [[inputs.snmp.table.field]] oid = "IF-MIB::{{ f }}" is_tag = true {% endfor %} -{% for f in [ "unifiRadioName", "unifiRadioRadio", "unifiRadioOtherBss" ] %} +[[inputs.snmp.table.field]] + oid = "UCD-SNMP-MIB::laNames" + is_tag = true + +{% for f in [ "unifiRadioName", "unifiRadioRadio" ] %} [[inputs.snmp.table.field]] oid = "UBNT-UniFi-MIB::{{ f }}" is_tag = true @@ -73,4 +115,8 @@ is_tag = true {% endfor %} +[[inputs.snmp.table.field]] + oid = "UBNT-UniFi-MIB::unifiIfName" + is_tag = true + {% endfor %} -- cgit v1.2.3