The Challenge
A customer wanted to retrieve information from their Cisco Access Points to be available in Zabbix. After some research, one implementation approach is:
Cisco Access Point → Telegraf → Zabbix
Telegraf supports Cisco Model-Driven Telemetry via the Cisco Model-Driven Telemetry (MDT) Input Plugin and Zabbix via the Zabbix Output Plugin.
But there was one little piece missing: Cisco MDT outputs extensive data, but not all messages include the hostname required for our Zabbix setup. A small tool was needed to bridge this gap. It searches incoming Cisco messages for entries containing both the MAC address and the hostname, stores this mapping, and enriches messages destined for Zabbix with the missing hostname information.
How It Works
One message containing mac and hostname:
Cisco-IOS-XE-wireless-access-point-oper:access-point-oper-data/capwap-data,host=myhost1,path=Cisco-IOS-XE-wireless-access-point-oper:access-point-oper-data/capwap-data,ap_mac=wifi-cat9800-01,subscription=290,wtp_mac=00:11:22:33:44:55 name="AP-Floor1-Room101",...
From this message we get the mapping mac=00:11:22:33:44:55 → name=AP-Floor1-Room101.
If after this a message with our wanted data comes in, we enrich it:
Incoming:
Cisco-IOS-XE-process-cpu-oper:cpu-usage,ap_mac=00:11:22:33:44:55,subscription=100 cpu_utilization=45.2 1733913600000000000
Transformed:
Cisco-IOS-XE-process-cpu-oper:cpu-usage,ap_mac=00:11:22:33:44:55,hostname=AP-Floor1-Room101,subscription=100,zabbix_export=true cpu_utilization=45.2 1733913600000000000
The enriched message will be used by the Zabbix Output Plugin as it contains the
tag zabbix_export=true and the hostname=AP-Floor1-Room101 will be used to
match the host in Zabbix.
Telegraf Configuration
The relevant parts of the configuration:
telegraf.conf:
[[inputs.cisco_telemetry_mdt]]
transport = "grpc"
service_address = ":57501"
# Lookup MAC to Hostname
[[processors.execd]]
command = [
"/opt/mit-cisco-telegraf-zabbix/.venv/bin/python",
"/opt/mit-cisco-telegraf-zabbix/bin/mac_to_hostname.py",
"/var/lib/telegraf/mac_to_hostname.csv",
"/var/log/telegraf/mac_to_hostname.log"
]
restart_delay = "10s"
data_format = "influx"
[[outputs.zabbix]]
## Only output to Zabbix if tag is found
tagpass = { zabbix_export = ["true"] }
taginclude = ["hostname"]
address = "zabbix.example.com:10051"
# Zabbix trapper
agent_active = false
host_tag = "hostname"
key_prefix = ""
skip_measurement_prefix = true
You can find the script here: meissnerIT/cisco-mdt-zabbix.