ansible-role-server/templates/telegraf-UniFi.conf.j2

387 lines
10 KiB
Django/Jinja

{# Telegraf config snippet for UniFi devices #}
{# Variables: #}
{# - telegraf_unifi_usg_ips: List of IPs of EdgeRouter/ USG #}
{# - telegraf_unifi_ap_ips: List of IPs of Access Points #}
{% if telegraf_unifi_ap_ips is defined %}
##
## SNMP Input For Unifi APs (Gen 2/Gen 3)
##
[[inputs.snmp]]
agents = [ "{{ telegraf_unifi_ap_ips | join('", "') }}" ]
interval = "5m"
timeout = "10s"
retries = 3
# SNMP version, UAP only supports v1
version = 2
community = "public"
max_repetitions = 10
name = "snmp.UAP"
##
## System Details
##
# System name (hostname)
[[inputs.snmp.field]]
is_tag = true
name = "sysName"
oid = "RFC1213-MIB::sysName.0"
# System vendor OID
[[inputs.snmp.field]]
name = "sysObjectID"
oid = "RFC1213-MIB::sysObjectID.0"
# System description
[[inputs.snmp.field]]
name = "sysDescr"
oid = "RFC1213-MIB::sysDescr.0"
# System contact
[[inputs.snmp.field]]
name = "sysContact"
oid = "RFC1213-MIB::sysContact.0"
# System location
[[inputs.snmp.field]]
name = "sysLocation"
oid = "RFC1213-MIB::sysLocation.0"
# UAP model
[[inputs.snmp.field]]
name = "unifiApSystemModel"
oid = "UBNT-UniFi-MIB::unifiApSystemModel.0"
# UAP firmware version
[[inputs.snmp.field]]
name = "unifiApSystemVersion"
oid = "UBNT-UniFi-MIB::unifiApSystemVersion.0"
# System uptime
[[inputs.snmp.field]]
name = "sysUpTime"
oid = "RFC1213-MIB::sysUpTime.0"
##
## Interface Details & Metrics
##
# Wireless interfaces
[[inputs.snmp.table]]
oid = "UBNT-UniFi-MIB::unifiRadioTable"
[[inputs.snmp.table.field]]
is_tag = true
oid = "UBNT-UniFi-MIB::unifiRadioName"
[[inputs.snmp.table.field]]
is_tag = true
oid = "UBNT-UniFi-MIB::unifiRadioRadio"
# BSS instances
[[inputs.snmp.table]]
oid = "UBNT-UniFi-MIB::unifiVapTable"
[[inputs.snmp.table.field]]
is_tag = true
oid = "UBNT-UniFi-MIB::unifiVapName"
[[inputs.snmp.table.field]]
is_tag = true
oid = "UBNT-UniFi-MIB::unifiVapRadio"
# Ethernet interfaces
[[inputs.snmp.table]]
oid = "UBNT-UniFi-MIB::unifiIfTable"
[[inputs.snmp.table.field]]
is_tag = true
oid = "UBNT-UniFi-MIB::unifiIfName"
##
## Host performance metrics
##
# System Load Average
[[inputs.snmp.table]]
oid = "UCD-SNMP-MIB::laTable"
[[inputs.snmp.table.field]]
oid = "UCD-SNMP-MIB::laNames"
is_tag = true
##
## System Memory (physical/virtual)
## TODO: just reads 0
# Size of swap sapce configured
[[inputs.snmp.field]]
name = "memTotalSwap"
oid = "UCD-SNMP-MIB::memTotalSwap.0"
# Size of swap sapce unused/avail
[[inputs.snmp.field]]
name = "memAvailSwap"
oid = "UCD-SNMP-MIB::memAvailSwap.0"
# Size of real/phys mem installed
[[inputs.snmp.field]]
name = "memTotalReal"
oid = "UCD-SNMP-MIB::memTotalReal.0"
# Size of real/phys mem unused/avail
[[inputs.snmp.field]]
name = "memAvailReal"
oid = "UCD-SNMP-MIB::memAvailReal.0"
# Total amount of mem unused/avail
[[inputs.snmp.field]]
name = "memTotalFree"
oid = "UCD-SNMP-MIB::memTotalFree.0"
# Size of mem used as shared memory
[[inputs.snmp.field]]
name = "memShared"
oid = "UCD-SNMP-MIB::memShared.0"
# Size of mem used for buffers
[[inputs.snmp.field]]
name = "memBuffer"
oid = "UCD-SNMP-MIB::memBuffer.0"
# Size of mem used for cache
[[inputs.snmp.field]]
name = "memCached"
oid = "UCD-SNMP-MIB::memCached.0"
{% endif %}
{% if telegraf_unifi_usg_ips is defined %}
##
## SNMP Input For EdgeRouter/ Unifi USG
##
[[inputs.snmp]]
agents = [ "{{ telegraf_unifi_usg_ips | join('", "') }}" ]
interval = "5m"
timeout = "5s"
retries = 3
# SNMP version, values can be 1, 2, or 3
version = 2
community = "public"
max_repetitions = 10
name = "snmp.EdgeOS"
##
## Exclusions
##
# Don't want these columns from UCD-SNMP-MIB::laTable
fielddrop = [ "laErrorFlag", "laErrMessage" ]
# Don't want these rows from UCD-DISKIO-MIB::diskIOTable
[inputs.snmp.tagdrop]
diskIODevice = [ "loop*", "ram*" ]
##
## System details
##
# System name (hostname)
[[inputs.snmp.field]]
name = "sysName"
oid = "SNMPv2-MIB::sysName.0"
is_tag = true
# System vendor OID
[[inputs.snmp.field]]
name = "sysObjectID"
oid = "SNMPv2-MIB::sysObjectID.0"
# System description
[[inputs.snmp.field]]
name = "sysDescr"
oid = "SNMPv2-MIB::sysDescr.0"
# System uptime
[[inputs.snmp.field]]
name = "sysUpTime"
oid = "HOST-RESOURCES-MIB::hrSystemUptime.0"
# Device Listing
[[inputs.snmp.table]]
oid = "HOST-RESOURCES-MIB::hrDeviceTable"
[[inputs.snmp.table.field]]
oid = "HOST-RESOURCES-MIB::hrDeviceIndex"
is_tag = true
##
## Host performance metrics
##
# System Load Average
[[inputs.snmp.table]]
oid = "UCD-SNMP-MIB::laTable"
[[inputs.snmp.table.field]]
oid = "UCD-SNMP-MIB::laNames"
is_tag = true
##
## CPU utilization
##
# Number of 'ticks' spent on user-level
[[inputs.snmp.field]]
name = "ssCpuRawUser"
oid = "UCD-SNMP-MIB::ssCpuRawUser.0"
# Number of 'ticks' spent on reduced-priority
[[inputs.snmp.field]]
name = "ssCpuRawNice"
oid = "UCD-SNMP-MIB::ssCpuRawNice.0"
# Number of 'ticks' spent on system-level
[[inputs.snmp.field]]
name = "ssCpuRawSystem"
oid = "UCD-SNMP-MIB::ssCpuRawSystem.0"
# Number of 'ticks' spent idle
[[inputs.snmp.field]]
name = "ssCpuRawIdle"
oid = "UCD-SNMP-MIB::ssCpuRawIdle.0"
# Number of 'ticks' spent waiting on I/O
[[inputs.snmp.field]]
name = "ssCpuRawWait"
oid = "UCD-SNMP-MIB::ssCpuRawWait.0"
# Number of 'ticks' spent in kernel
[[inputs.snmp.field]]
name = "ssCpuRawKernel"
oid = "UCD-SNMP-MIB::ssCpuRawKernel.0"
# Number of 'ticks' spent on hardware interrupts
[[inputs.snmp.field]]
name = "ssCpuRawInterrupt"
oid = "UCD-SNMP-MIB::ssCpuRawInterrupt.0"
# Number of 'ticks' spent on software interrupts
[[inputs.snmp.field]]
name = "ssCpuRawSoftIRQ"
oid = "UCD-SNMP-MIB::ssCpuRawSoftIRQ.0"
##
## System Memory (physical/virtual)
##
# Size of phsyical memory (RAM)
[[inputs.snmp.field]]
name = "hrMemorySize"
oid = "HOST-RESOURCES-MIB::hrMemorySize.0"
# Size of real/phys mem installed
[[inputs.snmp.field]]
name = "memTotalReal"
oid = "UCD-SNMP-MIB::memTotalReal.0"
# Size of real/phys mem unused/avail
[[inputs.snmp.field]]
name = "memAvailReal"
oid = "UCD-SNMP-MIB::memAvailReal.0"
# Total amount of mem unused/avail
[[inputs.snmp.field]]
name = "memTotalFree"
oid = "UCD-SNMP-MIB::memTotalFree.0"
# Size of mem used as shared memory
[[inputs.snmp.field]]
name = "memShared"
oid = "UCD-SNMP-MIB::memShared.0"
# Size of mem used for buffers
[[inputs.snmp.field]]
name = "memBuffer"
oid = "UCD-SNMP-MIB::memBuffer.0"
# Size of mem used for cache
[[inputs.snmp.field]]
name = "memCached"
oid = "UCD-SNMP-MIB::memCached.0"
##
## Interface metrics
##
# Per-interface traffic, errors, drops
[[inputs.snmp.table]]
oid = "IF-MIB::ifTable"
[[inputs.snmp.table.field]]
oid = "IF-MIB::ifName"
is_tag = true
# Per-interface high-capacity (HC) counters
[[inputs.snmp.table]]
oid = "IF-MIB::ifXTable"
[[inputs.snmp.table.field]]
oid = "IF-MIB::ifName"
is_tag = true
##
## IP metrics
##
# System-wide IP metrics
[[inputs.snmp.table]]
index_as_tag = true
oid = "IP-MIB::ipSystemStatsTable"
##
## ICMP Metrics
##
# ICMP statistics
[[inputs.snmp.table]]
index_as_tag = true
oid = "IP-MIB::icmpStatsTable"
# ICMP per-type statistics
[[inputs.snmp.table]]
index_as_tag = true
oid = "IP-MIB::icmpMsgStatsTable"
##
## UDP statistics
##
# Datagrams delivered to app
[[inputs.snmp.field]]
name = "udpInDatagrams"
oid = "UDP-MIB::udpInDatagrams.0"
# Datagrams received with no app
[[inputs.snmp.field]]
name = "udpNoPorts"
oid = "UDP-MIB::udpNoPorts.0"
# Datagrams received with error
[[inputs.snmp.field]]
name = "udpInErrors"
oid = "UDP-MIB::udpInErrors.0"
# Datagrams sent
[[inputs.snmp.field]]
name = "udpOutDatagrams"
oid = "UDP-MIB::udpOutDatagrams.0"
##
## TCP statistics
##
# Number of CLOSED -> SYN-SENT transitions
[[inputs.snmp.field]]
name = "tcpActiveOpens"
oid = "TCP-MIB::tcpActiveOpens.0"
# Number of SYN-RCVD -> LISTEN transitions
[[inputs.snmp.field]]
name = "tcpPassiveOpens"
oid = "TCP-MIB::tcpPassiveOpens.0"
# Number of SYN-SENT/RCVD -> CLOSED transitions
[[inputs.snmp.field]]
name = "tcpAttemptFails"
oid = "TCP-MIB::tcpAttemptFails.0"
# Number of ESTABLISHED/CLOSE-WAIT -> CLOSED transitions
[[inputs.snmp.field]]
name = "tcpEstabResets"
oid = "TCP-MIB::tcpEstabResets.0"
# Number of ESTABLISHED or CLOSE-WAIT
[[inputs.snmp.field]]
name = "tcpCurrEstab"
oid = "TCP-MIB::tcpCurrEstab.0"
# Number of segments received
[[inputs.snmp.field]]
name = "tcpInSegs"
oid = "TCP-MIB::tcpInSegs.0"
# Number of segments sent
[[inputs.snmp.field]]
name = "tcpOutSegs"
oid = "TCP-MIB::tcpOutSegs.0"
# Number of segments retransmitted
[[inputs.snmp.field]]
name = "tcpRetransSegs"
oid = "TCP-MIB::tcpRetransSegs.0"
# Number of segments received with error
[[inputs.snmp.field]]
name = "tcpInErrs"
oid = "TCP-MIB::tcpInErrs.0"
# Number of segments sent w/RST
[[inputs.snmp.field]]
name = "tcpOutRsts"
oid = "TCP-MIB::tcpOutRsts.0"
##
## IP routing statistics
##
# Number of valid routing entries
[[inputs.snmp.field]]
name = "inetCidrRouteNumber"
oid = "IP-FORWARD-MIB::inetCidrRouteNumber.0"
# Number of valid entries discarded
[[inputs.snmp.field]]
name = "inetCidrRouteDiscards"
oid = "IP-FORWARD-MIB::inetCidrRouteDiscards.0"
# Number of valid forwarding entries
[[inputs.snmp.field]]
name = "ipForwardNumber"
oid = "IP-FORWARD-MIB::ipForwardNumber.0"
##
## IP routing statistics
##
# Number of valid routes discarded
[[inputs.snmp.field]]
name = "ipRoutingDiscards"
oid = "RFC1213-MIB::ipRoutingDiscards.0"
{% endif %}