From 03c515fa55657dafa41a6a0fe7bf806bd7521e87 Mon Sep 17 00:00:00 2001 From: Gregor Kleen Date: Sun, 30 Nov 2025 14:02:39 +0100 Subject: ... --- .../zte-prometheus-exporter/zte-prometheus-exporter.py | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) (limited to 'overlays/zte-prometheus-exporter/zte-prometheus-exporter.py') diff --git a/overlays/zte-prometheus-exporter/zte-prometheus-exporter.py b/overlays/zte-prometheus-exporter/zte-prometheus-exporter.py index bc8326ff..1d150eda 100644 --- a/overlays/zte-prometheus-exporter/zte-prometheus-exporter.py +++ b/overlays/zte-prometheus-exporter/zte-prometheus-exporter.py @@ -127,6 +127,16 @@ class ZTEMetrics: def prometheus(self): metrics = '' + metrics += _format_prom_metrics('info', 'gauge', [({ + "version_date": self.attrs['DEVINFO']['IGD']['VerDate'], + "software_version": self.attrs['DEVINFO']['IGD']['SoftwareVer'], + "model_name": self.attrs['DEVINFO']['IGD']['ModelName'], + "model_firmware_version": self.attrs['DEVINFO']['IGD']['ModelFirmwareVer'], + "hardware_version": self.attrs['DEVINFO']['IGD']['HardwareVer'], + "serial_number": self.attrs['DEVINFO']['IGD']['SerialNumber'], + "boot_version": self.attrs['DEVINFO']['IGD']['BootVer'], + }, 1)], 'Metadata about a given ZTE device') + uptime_seconds = timeparse(self.attrs['SYSTEMYIME']['IGD']['systemTime']) metrics += _format_prom_metrics('uptime_seconds', 'gauge', [({}, uptime_seconds)], 'Seconds device has been running') @@ -163,13 +173,16 @@ class ZTEMetrics: link_metrics['current_rate_kbps']['metrics'] += [({"direction": "up", "link": link_number}, int(self.attrs['DSLINTERFACE'][link]['Upstream_current_rate']))] link_metrics['current_rate_kbps']['metrics'] += [({"direction": "down", "link": link_number}, int(self.attrs['DSLINTERFACE'][link]['Downstream_current_rate']))] - if 'dsl_uptime_seconds' not in link_metrics: + if 'uptime_seconds' not in link_metrics: link_metrics['uptime_seconds'] = {'type': 'gauge', 'metrics': []} link_metrics['uptime_seconds']['metrics'] += [({"link": link_number}, int(self.attrs['DSLINTERFACE'][link]['Showtime_start']) if link_is_up else 0)] if 'status' not in link_metrics: link_metrics['status'] = {'type': 'gauge', 'metrics': []} - link_metrics['status']['metrics'] += [({"link": link_number, "status": self.attrs['DSLINTERFACE'][link]['Status']}, 1)] + up_status, *status = self.attrs['DSLINTERFACE'][link]['Status'].split(',') + down_status = up_status if not status else status[0] + link_metrics['status']['metrics'] += [({"link": link_number, "direction": "up", "status": up_status}, 1)] + link_metrics['status']['metrics'] += [({"link": link_number, "direction": "down", "status": down_status}, 1)] if link_metrics: for metric_name in link_metrics: metrics += _format_prom_metrics(f'dsl_{metric_name}', link_metrics[metric_name]['type'], link_metrics[metric_name]['metrics']) -- cgit v1.2.3