Skip to content

Commit

Permalink
Fix wrong metric in Prometheus exporter
Browse files Browse the repository at this point in the history
  • Loading branch information
nook24 committed Aug 17, 2023
1 parent bd00489 commit 42b5b38
Showing 1 changed file with 25 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down Expand Up @@ -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(
Expand Down Expand Up @@ -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(
Expand Down Expand Up @@ -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',
Expand Down

0 comments on commit 42b5b38

Please sign in to comment.