From 42b5b381fa918836c8cb2cbf1d38de1f498bdcf2 Mon Sep 17 00:00:00 2001 From: nook24 Date: Thu, 17 Aug 2023 11:30:26 +0200 Subject: [PATCH] Fix wrong metric in Prometheus exporter --- .../PrometheusExporter/PrometheusExporter.php | 32 +++++++++++++++---- 1 file changed, 25 insertions(+), 7 deletions(-) diff --git a/src/itnovum/openITCOCKPIT/Monitoring/PrometheusExporter/PrometheusExporter.php b/src/itnovum/openITCOCKPIT/Monitoring/PrometheusExporter/PrometheusExporter.php index ea694170ca..275ee7fdf7 100644 --- a/src/itnovum/openITCOCKPIT/Monitoring/PrometheusExporter/PrometheusExporter.php +++ b/src/itnovum/openITCOCKPIT/Monitoring/PrometheusExporter/PrometheusExporter.php @@ -219,7 +219,7 @@ public function getMetrics() { 'services_total', 'Total number of services' ); - $gauge->set($stats['HIGHCMDBUF'] ?? 0); + $gauge->set($stats['NUMSERVICES'] ?? 0); $gauge = $registry->registerGauge( 'naemon', @@ -316,10 +316,10 @@ public function getMetrics() { $gauge = $registry->registerGauge( 'naemon', 'active_host_check_last_' . strtolower($k) . '_minutes_total', - 'Number of total active host checks occurring in last ' . $k . ' minutes' + 'Number of total active host checks in last ' . $k . ' minutes' ); - $v = $stats['NUMACTHSTCHECKS' . $k . 'M'] ?? 0; + $v = $stats['NUMHSTACTCHK' . $k . 'M'] ?? 0; $gauge->set($v); $gauge = $registry->registerGauge( @@ -360,20 +360,29 @@ public function getMetrics() { $gauge = $registry->registerGauge( 'naemon', - 'passive_host_check_last_' . strtolower($k) . '_minutes_total', + 'passive_host_check_occuring_last_' . strtolower($k) . '_minutes_total', 'Number of passive host checks occurring in last ' . $k . ' minutes' ); $v = $stats['NUMPSVHSTCHECKS' . $k . 'M'] ?? 0; $gauge->set($v); + $gauge = $registry->registerGauge( + 'naemon', + 'passive_host_check_last_' . strtolower($k) . '_minutes_total', + 'Number of hosts passively checked in last ' . $k . ' minutes' + ); + + $v = $stats['NUMHSTPSVCHK' . $k . 'M'] ?? 0; + $gauge->set($v); + $gauge = $registry->registerGauge( 'naemon', 'active_service_check_last_' . strtolower($k) . '_minutes_total', - 'Number of total active service checks occurring in last ' . $k . ' minutes' + 'Number of total active service checks in last ' . $k . ' minutes' ); - $v = $stats['NUMACTSVCCHECKS' . $k . 'M'] ?? 0; + $v = $stats['NUMSVCACTCHK' . $k . 'M'] ?? 0; $gauge->set($v); $gauge = $registry->registerGauge( @@ -405,13 +414,22 @@ public function getMetrics() { $gauge = $registry->registerGauge( 'naemon', - 'passive_service_check_last_' . strtolower($k) . '_minutes_total', + 'passive_service_check_occurring_last_' . strtolower($k) . '_minutes_total', 'Number of passive service checks occurring in last ' . $k . ' minutes' ); $v = $stats['NUMPSVSVCCHECKS' . $k . 'M'] ?? 0; $gauge->set($v); + $gauge = $registry->registerGauge( + 'naemon', + 'passive_service_check_last_' . strtolower($k) . '_minutes_total', + 'Number of services passively checked in last ' . $k . ' minutes' + ); + + $v = $stats['NUMSVCPSVCHK' . $k . 'M'] ?? 0; + $gauge->set($v); + $gauge = $registry->registerGauge( 'naemon', 'external_commands_processed_last_' . strtolower($k) . '_minutes_total',