Skip to content

Repository files navigation

Prometheus Zabbix Template Generator

This is a proof-of-concept that converts the output of a Prometheus exporter into a Zabbix template with generated items.

A conversion can be performed in the following way:

  1. Gather the prometheus output (alternatively use the --url parameter in step 4)
    curl http://kube-prometheus-stack-prometheus.umon:9090/metrics > example/prometheus_exporter_dump.txt
    
  2. Create an example template in zabbix
  3. Download it in JSON and add replacement markers to it, see zabbix_template_prometheus_exporter.json
    • PROM2ZABBIX_TEMPLATE_NAME: The name of the template
    • PROM2ZABBIX_ITEM_NAME: The displayed name of the template
    • PROM2ZABBIX_ITEM_KEY: The item key, adapted label to comply to zabbix item name restrictions
    • PROM2ZABBIX_ITEM_LABEL: The prometheus label
  4. Execute the conversion, this selects only items which match to the specified filter regex
    ./prom2zabbix \
       --template example/zabbix_template_prometheus_exporter.json \
       --dump example/prometheus_exporter_dump.txt \
       --target_template example/zabbix_template_prometheus_exporter_generated.json \
       --filter "promhttp_metric_handler_requests_total" \
       --name "Prometheus"
    
  5. Upload the generated template to zabbix and check the result
  6. Repeat the process for other items and select the option "Delete missing" of the existing items

About

This project generates zabbix templates from prometheus exporters

Resources

Stars

2 stars

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages