From 2c078c033a8e86e764fcebe021a2957e3fc035a7 Mon Sep 17 00:00:00 2001 From: Gregor Kleen Date: Sat, 11 Mar 2023 12:54:14 +0100 Subject: ... --- overlays/cake-prometheus-exporter/cake-prometheus-exporter.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) 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 from urllib.parse import urlparse +from textwrap import dedent + def _format_prom_attrs(**attrs): if not attrs: @@ -67,6 +69,9 @@ class CAKEMetrics: attrs[qdisc['dev']] = { 'bytes': qdisc['bytes'], 'packets': qdisc['packets'], + 'drops': qdisc['drops'], + 'overlimits': qdisc['overlimits'], + 'requeues': qdisc['requeues'], 'tins': tins } @@ -79,7 +84,8 @@ class CAKEMetrics: metrics = '' metrics += _format_prom_metrics('cake_bytes', 'counter', [({'dev': dev}, self.attrs[dev]['bytes']) for dev in self.attrs]) - metrics += _format_prom_metrics('cake_packets', 'counter', [({'dev': dev}, self.attrs[dev]['packets']) for dev in self.attrs]) + for packet_counter in ['packets', 'overlimits', 'requeues', 'drops']: + metrics += _format_prom_metrics(f'cake_{packet_counter}', 'counter', [({'dev': dev}, self.attrs[dev][packet_counter]) for dev in self.attrs]) 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]) 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]) -- cgit v1.2.3