summaryrefslogtreecommitdiff
path: root/ansible/plays/templates/ops-server/telegraf.conf.j2
diff options
context:
space:
mode:
Diffstat (limited to 'ansible/plays/templates/ops-server/telegraf.conf.j2')
-rw-r--r--ansible/plays/templates/ops-server/telegraf.conf.j296
1 files changed, 44 insertions, 52 deletions
diff --git a/ansible/plays/templates/ops-server/telegraf.conf.j2 b/ansible/plays/templates/ops-server/telegraf.conf.j2
index e973358..61f9279 100644
--- a/ansible/plays/templates/ops-server/telegraf.conf.j2
+++ b/ansible/plays/templates/ops-server/telegraf.conf.j2
@@ -2,83 +2,75 @@
urls = ["$INFLUX_URL"]
skip_database_creation = false
-{% for ap in aps %}
-# Access point: {{ ap.name }}
+# snmpget -v 3 -u $username -a SHA -A $password -l authPriv -x AES -X $password 192.168.10.21 RFC1213-MIB::sysName.0
+
+{% for device in devices %}
+# Device: {{ device.name }}, type: {{ device.type }}
[[inputs.snmp]]
- agents = [ "{{ ap.ip }}" ]
+ agents = [ "{{ device.ip }}" ]
+{# Some MIBs are missing over v3 #}
+{% if true %}
version = 2
community = "public"
+{% else %}
+ version = 3
+ sec_name = "{{ '{{' }} unifi_snmp_username }}"
+ auth_protocol = "SHA"
+ auth_password = "{{ '{{' }} unifi_snmp_password }}"
+ sec_level = "authPriv"
+ priv_protocol = "AES"
+ priv_password = "{{ '{{' }} unifi_snmp_password }}"
interval = "60s"
timeout = "30s"
+{% endif %}
-# 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"]
-
-# fields
-[[inputs.snmp.table.field]]
- oid = "IF-MIB::ifName"
- name = "name"
- is_tag = true
+ oid = "IF-MIB::ifXTable"
+ name = "snmp_if_iftable"
+ inherit_tags = ["name", "location"]
-[[inputs.snmp.table.field]]
- oid = "IF-MIB::ifOperStatus"
- name = "status"
- is_tag = true
-
-[[inputs.snmp.table.field]]
- oid = "IF-MIB::ifAlias"
- name = "ifAlias"
- is_tag = true
+{% if device.type == "ap" %}
+[[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"]
+{% endif %}
+
+# SNMP Fields that should be tags
+{% for f in [ "ifName", "ifLinkUpDownTrapEnable", "ifHighSpeed", "ifPromiscuousMode", "ifConnectorPresent", "ifAlias", "ifCounterDiscontinuityTime" ] %}
[[inputs.snmp.table.field]]
- oid = "IF-MIB::ifPromiscuousMode"
- name = "promiscuous_mode"
+ oid = "IF-MIB::{{ f }}"
is_tag = true
+{% endfor %}
+{% for f in [ "unifiRadioName", "unifiRadioRadio", "unifiRadioOtherBss" ] %}
[[inputs.snmp.table.field]]
- oid = "IF-MIB::ifConnectorPresent"
- name = "has_connector"
+ oid = "UBNT-UniFi-MIB::{{ f }}"
is_tag = true
+{% endfor %}
+{% for f in [ "unifiVapBssId", "unifiVapCcq", "unifiVapEssId", "unifiVapName", "unifiVapRadio", "unifiVapUp", "unifiVapUsage" ] %}
[[inputs.snmp.table.field]]
- oid = "IF-MIB::ifPhysAddress"
- name = "mac"
- conversion = "hwaddr"
+ oid = "UBNT-UniFi-MIB::{{ f }}"
is_tag = true
-
-[[inputs.snmp.table.field]]
- oid = "IF-MIB::ifHCInOctets"
- name = "rx_bytes"
-
-[[inputs.snmp.table.field]]
- oid = "IF-MIB::ifHCInUcastPkts"
- name = "rx_ucast_pkt"
-
-[[inputs.snmp.table.field]]
- oid = "IF-MIB::ifHCOutOctets"
- name = "tx_bytes"
-
-[[inputs.snmp.table.field]]
- oid = "IF-MIB::ifHCOutUcastPkts"
- name = "tx_ucast_pkt"
+{% endfor %}
{% endfor %}