diff options
-rw-r--r-- | overlays/cake-prometheus-exporter/cake-prometheus-exporter.py | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/overlays/cake-prometheus-exporter/cake-prometheus-exporter.py b/overlays/cake-prometheus-exporter/cake-prometheus-exporter.py index 5d07c279..06e03469 100644 --- a/overlays/cake-prometheus-exporter/cake-prometheus-exporter.py +++ b/overlays/cake-prometheus-exporter/cake-prometheus-exporter.py | |||
@@ -10,6 +10,8 @@ import json | |||
10 | 10 | ||
11 | from urllib.parse import urlparse | 11 | from urllib.parse import urlparse |
12 | 12 | ||
13 | from textwrap import dedent | ||
14 | |||
13 | 15 | ||
14 | def _format_prom_attrs(**attrs): | 16 | def _format_prom_attrs(**attrs): |
15 | if not attrs: | 17 | if not attrs: |
@@ -67,6 +69,9 @@ class CAKEMetrics: | |||
67 | attrs[qdisc['dev']] = { | 69 | attrs[qdisc['dev']] = { |
68 | 'bytes': qdisc['bytes'], | 70 | 'bytes': qdisc['bytes'], |
69 | 'packets': qdisc['packets'], | 71 | 'packets': qdisc['packets'], |
72 | 'drops': qdisc['drops'], | ||
73 | 'overlimits': qdisc['overlimits'], | ||
74 | 'requeues': qdisc['requeues'], | ||
70 | 'tins': tins | 75 | 'tins': tins |
71 | } | 76 | } |
72 | 77 | ||
@@ -79,7 +84,8 @@ class CAKEMetrics: | |||
79 | metrics = '' | 84 | metrics = '' |
80 | 85 | ||
81 | metrics += _format_prom_metrics('cake_bytes', 'counter', [({'dev': dev}, self.attrs[dev]['bytes']) for dev in self.attrs]) | 86 | metrics += _format_prom_metrics('cake_bytes', 'counter', [({'dev': dev}, self.attrs[dev]['bytes']) for dev in self.attrs]) |
82 | metrics += _format_prom_metrics('cake_packets', 'counter', [({'dev': dev}, self.attrs[dev]['packets']) for dev in self.attrs]) | 87 | for packet_counter in ['packets', 'overlimits', 'requeues', 'drops']: |
88 | metrics += _format_prom_metrics(f'cake_{packet_counter}', 'counter', [({'dev': dev}, self.attrs[dev][packet_counter]) for dev in self.attrs]) | ||
83 | 89 | ||
84 | metrics += _format_prom_metrics('cake_tin_bytes', 'counter', [({'dev': dev, 'tin': tin}, self.attrs[dev]['tins'][tin]['bytes']) for tin in self.attrs[dev]['tins'] for dev in self.attrs]) | 90 | metrics += _format_prom_metrics('cake_tin_bytes', 'counter', [({'dev': dev, 'tin': tin}, self.attrs[dev]['tins'][tin]['bytes']) for tin in self.attrs[dev]['tins'] for dev in self.attrs]) |
85 | metrics += _format_prom_metrics('cake_tin_packets', 'counter', [({'dev': dev, 'tin': tin}, self.attrs[dev]['tins'][tin]['packets']) for tin in self.attrs[dev]['tins'] for dev in self.attrs]) | 91 | metrics += _format_prom_metrics('cake_tin_packets', 'counter', [({'dev': dev, 'tin': tin}, self.attrs[dev]['tins'][tin]['packets']) for tin in self.attrs[dev]['tins'] for dev in self.attrs]) |