Local check with Powershell to monitor Omnissa Pools (multiple checks)

CMK version: 2.4.0
OS version: Windows 2022

Hi Team,

Am starting trying local checks with Powershell scripts onto Check_mk.
More specifically, I am trying to monitor our Omnissa cluster in a simple way. The objective is to monitor our Pools states.

The script seem to be working perfectly and I do get the general situation in checkMK through :

    # Set the overall message based on the status
    if ($overallStatus -eq 0) {
        $overallMessage = "All pools are OK."
    } else {
        $overallMessage = "One or more pools have a CRITICAL status."
    }

    # Print a summary line for the entire check
    Write-Host "$overallStatus horizon_pools_summary - $overallMessage"

Output CheckMK :
CheckMK_Status

But I have also for each pool the following :

        # Print the detailed CheckMK output for each service
        Write-Host "$poolEnabledCheckMKStatus horizon_pool_`"$poolName`"_enabled - $poolEnabledMessage"
        Write-Host "$provisioningCheckMKStatus horizon_pool_`"$poolName`"_provisioning - Provisioning status is '$provisioningEnabledMessage'"
        Write-Host "0 horizon_pool_`"$poolName`"_availability - $availabilityMessage"
        Write-Host "0 horizon_pool_`"$poolName`"_goldenimage - $goldenImageMessage"

See output :

0 horizon_pool_“T-C-METIER"enabled - Enabled
0 horizon_pool
"T-C-METIER"provisioning - Provisioning status is ‘Enabled’
0 horizon_pool
"T-C-METIER"availability - 3 available, 0 used. (0% utilization)
0 horizon_pool
"T-C-METIER"goldenimage - Golden Image: //vm/M-C-METIER-
0 horizon_pool
"T-C-RHUMAN"enabled - Enabled
0 horizon_pool
"T-C-RHUMAN"provisioning - Provisioning status is ‘Enabled’
0 horizon_pool
"T-C-RHUMAN"availability - 3 available, 0 used. (0% utilization)
0 horizon_pool
"T-C-RHUMAN”_goldenimage - Golden Image: //vm/M-C-RHUMAN-
0 horizon_pools_summary - All pools are OK.

I tried following CheckMk documentation, but seem stuck. Hope you can help.

try to remove the qutation marks (") that your output looks more like this:

0 horizon_pool_T-C-METIER_enabled - Enabled
0 horizon_pool_T-C-METIER_provisioning - Provisioning status is ‘Enabled’
0 horizon_pool_T-C-METIER_availability - 3 available, 0 used. (0% utilization)
0 horizon_pool_T-C-METIER_goldenimage - Golden Image: //vm/M-C-METIER-
0 horizon_pool_T-C-RHUMAN_enabled - Enabled
0 horizon_pool_T-C-RHUMAN_provisioning - Provisioning status is ‘Enabled’
0 horizon_pool_T-C-RHUMAN_availability - 3 available, 0 used. (0% utilization)
0 horizon_pool_T-C-RHUMAN_goldenimage - Golden Image: //vm/M-C-RHUMAN-
0 horizon_pools_summary - All pools are OK.

Hi,

Thank you sooo much.

To make it simple on me, I just declared the content as variable to not have

      # Print the detailed CheckMK output for each service
        $PrepareOutputEnabled = "Horizon_Pool_" + $poolName + "_enabled"
        $PrepareOutputProvision = "Horizon_Pool_" + $poolName + "_provisioning"
        $PrepareOutputEnabled = "Horizon_Pool_" + $poolName + "_Availibility"
        $PrepareOutputGolden = "Horizon_Pool_" + $poolName + "_GoldenImage"


        Write-Output "$poolEnabledCheckMKStatus $PrepareOutputEnabled - $poolEnabledMessage"
        Write-Output "$provisioningCheckMKStatus $PrepareOutputProvision - $provisioningEnabledMessage"
        Write-Output "0 $PrepareOutputEnabled - $availabilityMessage"
        Write-Output "0 $PrepareOutputGolden - $goldenImageMessage"

Lost so much time because of a "…
Thank you again.