samples: add prometheus text file collector mustach template

Because prometheus needs timestamp information add that to mustach, and
update manual page what tags are available.

Reference: https://prometheus.io/docs/instrumenting/exposition_formats/
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
This commit is contained in:
Sami Kerola 2017-11-13 14:16:35 +00:00
parent eabaa8adc2
commit e4f7259cf6
No known key found for this signature in database
GPG key ID: A9553245FDE9B739
6 changed files with 78 additions and 6 deletions

View file

@ -1,4 +1,5 @@
dist_doc_DATA = \
samples/dhcpd.conf \
samples/dhcpd.leases \
samples/mustach.template
samples/mustach.template \
samples/prometheus.template

View file

@ -13,6 +13,8 @@ Subnets:{{#subnets}}
backup_count: {{backup_count}}
backup_percent: {{backup_percent}}
status: {{status}}
gettimeofday: {{gettimeofday}}
lease_file_mtime: {{lease_file_mtime}}
{{/subnets}}
Shared-networks:{{#shared-networks}}
@ -27,6 +29,8 @@ Shared-networks:{{#shared-networks}}
backup_count: {{backup_count}}
backup_percent: {{backup_percent}}
status: {{status}}
gettimeofday: {{gettimeofday}}
lease_file_mtime: {{lease_file_mtime}}
{{/shared-networks}}
Summary:{{#summary}}
@ -41,4 +45,6 @@ Summary:{{#summary}}
backup_count: {{backup_count}}
backup_percent: {{backup_percent}}
status: {{status}}
gettimeofday: {{gettimeofday}}
lease_file_mtime: {{lease_file_mtime}}
{{/summary}}

View file

@ -0,0 +1,30 @@
# This mustach template can be used as Prometheus text file.
# https://prometheus.io/
# HELP dhcpd_pools_ranges The range statistics.
# TYPE dhcpd_pools_ranges gauge
{{#subnets}}dhcpd_pools_ranges{range="{{first_ip}}",used="1"} {{used}} {{gettimeofday}}000
dhcpd_pools_ranges{range="{{first_ip}}",touched="1"} {{touched}} {{gettimeofday}}000
dhcpd_pools_ranges{range="{{first_ip}}",defined="1"} {{defined}} {{gettimeofday}}000
dhcpd_pools_ranges{range="{{first_ip}}",free="1"} {{free}} {{gettimeofday}}000
dhcpd_pools_ranges{range="{{first_ip}}",touch_count="1"} {{touch_count}} {{gettimeofday}}000
dhcpd_pools_ranges{range="{{first_ip}}",status="1"} {{status}} {{gettimeofday}}000
{{/subnets}}
# HELP dhcpd_pools_shared_nets The shared networks statistics.
# TYPE dhcpd_pools_shared_nets gauge
{{#shared-networks}}dhcpd_pools_shared_nets{location="{{location}}",defined="1"} {{defined}} {{gettimeofday}}000
dhcpd_pools_shared_nets{location="{{location}}",used="1"} {{used}} {{gettimeofday}}000
dhcpd_pools_shared_nets{location="{{location}}",touched="1"} {{touched}} {{gettimeofday}}000
dhcpd_pools_shared_nets{location="{{location}}",free="1"} {{free}} {{gettimeofday}}000
dhcpd_pools_shared_nets{location="{{location}}",touch_count="1"} {{touch_count}} {{gettimeofday}}000
dhcpd_pools_shared_nets{location="{{location}}",status="1"} {{status}} {{gettimeofday}}000
{{/shared-networks}}
# HELP dhcpd_pools_summary Statistics of the all networks.
# TYPE dhcpd_pools_summary gauge
{{#summary}}dhcpd_pools_summary{location="{{location}}",defined="1"} {{defined}} {{gettimeofday}}000
dhcpd_pools_summary{location="{{location}}",used="1"} {{used}} {{gettimeofday}}000
dhcpd_pools_summary{location="{{location}}",touched="1"} {{touched}} {{gettimeofday}}000
dhcpd_pools_summary{location="{{location}}",free="1"} {{free}} {{gettimeofday}}000
dhcpd_pools_summary{location="{{location}}",touch_count="1"} {{touch_count}} {{gettimeofday}}000
dhcpd_pools_summary{location="{{location}}",status="1"} {{status}} {{gettimeofday}}000
{{/summary}}