diff options
author | Gregor Kleen <gkleen@yggdrasil.li> | 2023-03-11 12:54:14 +0100 |
---|---|---|
committer | Gregor Kleen <gkleen@yggdrasil.li> | 2023-03-11 12:54:14 +0100 |
commit | 2c078c033a8e86e764fcebe021a2957e3fc035a7 (patch) | |
tree | 146b877e31d353a4ea1a939c2ba374ec73db86e4 /overlays/cake-prometheus-exporter/cake-prometheus-exporter.py | |
parent | ce76b34a81193254a6d3af715dba567040c12975 (diff) | |
download | nixos-2c078c033a8e86e764fcebe021a2957e3fc035a7.tar nixos-2c078c033a8e86e764fcebe021a2957e3fc035a7.tar.gz nixos-2c078c033a8e86e764fcebe021a2957e3fc035a7.tar.bz2 nixos-2c078c033a8e86e764fcebe021a2957e3fc035a7.tar.xz nixos-2c078c033a8e86e764fcebe021a2957e3fc035a7.zip |
...
Diffstat (limited to 'overlays/cake-prometheus-exporter/cake-prometheus-exporter.py')
-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]) |