From 71b4f6d7e4c02e491531495db728f8d43428d22d Mon Sep 17 00:00:00 2001 From: Alexander Noack Date: Mon, 6 Nov 2023 11:44:33 +0100 Subject: [PATCH 1/3] Fix NVME disk counter --- .../PerformanceCounterLookup/VmDiskCounterLookup.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/library/Vspheredb/Polling/PerformanceCounterLookup/VmDiskCounterLookup.php b/library/Vspheredb/Polling/PerformanceCounterLookup/VmDiskCounterLookup.php index 65c07d87..422ab591 100644 --- a/library/Vspheredb/Polling/PerformanceCounterLookup/VmDiskCounterLookup.php +++ b/library/Vspheredb/Polling/PerformanceCounterLookup/VmDiskCounterLookup.php @@ -14,7 +14,7 @@ class VmDiskCounterLookup extends DefaultCounterLookup 'vm_name' => 'o.object_name', 'vm_guest_host_name' => 'vm.guest_host_name', 'vm_moref' => 'o.moref', - 'disk_hardware_key' => "(CASE WHEN vmhw.label LIKE 'IDE %' THEN 'ide' ELSE 'scsi' END" + 'disk_hardware_key' => "(CASE WHEN vmhc.label LIKE 'IDE %' THEN 'ide' WHEN vmhc.label LIKE 'NVME %' then 'nvme' ELSE 'scsi' END" . " || vmhc.bus_number || ':' || vmhw.unit_number)", 'disk_hardware_label' => 'vmhw.label', ]; @@ -24,7 +24,7 @@ protected function prepareInstancesQuery(UuidInterface $vCenterUuid = null) return $this->prepareBaseQuery($vCenterUuid) ->columns([ 'o.moref', - "GROUP_CONCAT(CASE WHEN vmhw.label LIKE 'IDE %' THEN 'ide' ELSE 'scsi' END" + "GROUP_CONCAT(CASE WHEN vmhc.label LIKE 'IDE %' THEN 'ide' WHEN vmhc.label LIKE 'NVME %' then 'nvme' ELSE 'scsi' END" . " || vmhc.bus_number || ':' || vmhw.unit_number SEPARATOR ',')", ]) ->group('vm.uuid'); @@ -45,7 +45,7 @@ protected function prepareBaseQuery(UuidInterface $vCenterUuid = null) 'vmhw.vm_uuid = vmhc.vm_uuid AND vmhw.controller_key = vmhc.hardware_key', [] ) - ->where("vmhc.label LIKE 'SCSI controller %' OR vmhc.label LIKE 'IDE %'") + ->where("vmhc.label LIKE 'SCSI controller %' OR vmhc.label LIKE 'IDE %' OR vmhc.label LIKE 'NVME %'") ->order('vm.runtime_host_uuid') ->order('vmd.hardware_key'); From 5b3ac5e1a465224441cb87f3d9aa95459d47b093 Mon Sep 17 00:00:00 2001 From: Alex Date: Mon, 25 Mar 2024 21:47:42 +0100 Subject: [PATCH 2/3] Best wins was only evaluated when both cases were already "worst" --- .../Vspheredb/Monitoring/Rule/Definition/MemoryUsageHelper.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/library/Vspheredb/Monitoring/Rule/Definition/MemoryUsageHelper.php b/library/Vspheredb/Monitoring/Rule/Definition/MemoryUsageHelper.php index 3bd9dd80..6cc0b59e 100644 --- a/library/Vspheredb/Monitoring/Rule/Definition/MemoryUsageHelper.php +++ b/library/Vspheredb/Monitoring/Rule/Definition/MemoryUsageHelper.php @@ -60,7 +60,7 @@ public static function prepareState( $mbState->raiseState(State::CRITICAL); } - if ($mbState->isProblem() && $percentState->isProblem()) { + if ($mbState->isProblem() || $percentState->isProblem()) { if ($settings->get('threshold_precedence') === 'worst') { $state->raiseState(State::getWorst($percentState, $mbState)); } else { From f170dd0f141649654f4225d5a262e60259ddf51f Mon Sep 17 00:00:00 2001 From: Alex Date: Tue, 23 Apr 2024 16:09:14 +0200 Subject: [PATCH 3/3] worst vs. worst_wins --- .../Vspheredb/Monitoring/Rule/Definition/MemoryUsageHelper.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/library/Vspheredb/Monitoring/Rule/Definition/MemoryUsageHelper.php b/library/Vspheredb/Monitoring/Rule/Definition/MemoryUsageHelper.php index 6cc0b59e..65a5f6b9 100644 --- a/library/Vspheredb/Monitoring/Rule/Definition/MemoryUsageHelper.php +++ b/library/Vspheredb/Monitoring/Rule/Definition/MemoryUsageHelper.php @@ -61,7 +61,7 @@ public static function prepareState( } if ($mbState->isProblem() || $percentState->isProblem()) { - if ($settings->get('threshold_precedence') === 'worst') { + if ($settings->get('threshold_precedence') === 'worst_wins') { $state->raiseState(State::getWorst($percentState, $mbState)); } else { $state->raiseState(State::getBest($percentState, $mbState));