Powershell mdoule "Invoke-IcingaCheckCPU is pending

I am trying to connect my icinga2 to monitor windows host using powershell framework. the connection is all ok . However I still have problem . So let me describe the issue:

Issue:
The Icinga for Windows service check daemon reported a pending status for the icinga_powershell_memory service. CPU Check is also pending. If I apply the commands locally, its all working. api connection is established. However the rest api does is not getting any informatoin.

The daemon encountered an exception during the execution of a PowerShell plugin,
with an error related to the recognition of the term “”. Troubleshooting Steps and Findings:

  1. curl -k -s -u ‘icinga2:API_PASSWORD’ -H ‘Accept: application/json’ ‘https://ICINGA_HOST:5665/v1/objects/services/SERVICE_NAME’
    is working

Investigated API connection warnings and disconnections for the ‘icinga’ identity.
Configuration Update:
Observed the receipt and application of configuration updates from ‘icinga’.

  1. API Client Connection:
    Monitored API client connections and disconnections for ‘icinga’.
  • WinRM Port and Firewall:
    Identified and resolved an issue with WinRM port (5665) connectivity by adding a firewall rule.
    Confirmed successful connectivity using Test-NetConnection.
  • Icinga PowerShell Script Execution:
    Encountered a specific error related to the recognition of “” during the execution of a PowerShell script.
  • Check PowerShell Script/Command:

Investigated the $CheckCommand variable, which is expected to contain a valid PowerShell command or script path.
However I could not find the solution .

  • Event Log error in windows host machine
    In windows Event log file the error is as follwoing
    Icinga for Windows service check daemon exception on plugin execution Icinga for Windows failed to execute a plugin within the background service check daemon with an exception Icinga for Windows exception report: Exception Message: Die Benennung "\" wurde nicht als Name eines Cmdlet, einer Funktion, einer Skriptdatei oder eines ausführbaren Programms erkannt. Überprüfen Sie die Schreibweise des Namens, oder ob der Pfad korrekt ist (sofern enthalten), und wiederholen Sie den Vorgang. Invocation Name: & Command Origin: Internal Script Line Number: 25575 Exact Position: In C:\Program Files\WindowsPowerShell\Modules\icinga-powershell-framework\cache\framework_cache.psm1:25575 Zeichen:15 + & $CheckCommand @Arguments | Out-Null; + ~~~~~~~~~~~~~ StackTrace: bei System.Management.Automation.ExceptionHandlingOps.CheckActionPreference(FunctionContext funcContext, Exception exception) bei lambda_method(Closure , Object[] , StrongBox1 , InterpretedFrame ) Call Stack: Command Arguments ------- --------- Get-IcingaExceptionString {ExceptionObject=Die Benennung “” wurde nicht als Name eines Cmdlet,… Write-IcingaEventMessage {EventId=1451, Namespace=Framework, ExceptionObject=Die Benennung “”… Add-IcingaServiceCheckTask {CheckCommand=, Interval=60, Arguments=System.Collections.Hashtable,… Object details: \ `

  • Version used (icinga2 --version)
    icinga2 - The Icinga 2 network monitoring daemon (version: r2.14.0-1)

Copyright (c) 2012-2023 Icinga GmbH (https://icinga.com/)
License GPLv2+: GNU GPL version 2 or later https://gnu.org/licenses/gpl2.html
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

System information:
Platform: Ubuntu
Platform version: 22.04.3 LTS (Jammy Jellyfish)
Kernel: Linux
Kernel version: 5.15.0-88-generic
Architecture: x86_64

Build information:
Compiler: GNU 11.3.0
Build host: runner-hh8q3bz2-project-575-concurrent-0
OpenSSL version: OpenSSL 3.0.2 15 Mar 2022

Application information:

General paths:
Config directory: /etc/icinga2
Data directory: /var/lib/icinga2
Log directory: /var/log/icinga2
Cache directory: /var/cache/icinga2
Spool directory: /var/spool/icinga2
Run directory: /run/icinga2

Old paths (deprecated):
Installation root: /usr
Sysconf directory: /etc
Run directory (base): /run
Local state directory: /var

Internal paths:
Package data directory: /usr/share/icinga2
State path: /var/lib/icinga2/icinga2.state
Modified attributes path: /var/lib/icinga2/modified-attributes.conf
Objects path: /var/cache/icinga2/icinga2.debug
Vars path: /var/cache/icinga2/icinga2.vars
PID path: /run/icinga2/icinga2.pid

  • Enabled features (icinga2 feature list)
    Disabled features: elasticsearch gelf graphite ido-pgsql influxdb2 journald livestatus opentsdb
    Enabled features: api checker command compatlog debuglog icingadb ido-mysql influxdb mainlog notification perfdata statusdata syslog

  • Icinga Web 2 version and modules (System - About)

  • Config validation (icinga2 daemon -C)
    [2023-12-21 09:43:36 +0100] information/cli: Icinga application loader (version: r2.14.0-1)
    [2023-12-21 09:43:36 +0100] information/cli: Loading configuration file(s).
    [2023-12-21 09:43:37 +0100] information/ConfigItem: Committing config item(s).
    [2023-12-21 09:43:37 +0100] information/ApiListener: My API identity: gin-gr-icinga
    [2023-12-21 09:43:37 +0100] warning/ApplyRule: Apply rule ‘icinga’ (in /etc/icinga2/conf.d/services.conf: 46:1-46:22) for type ‘Service’ does not match anywhere!
    [2023-12-21 09:43:37 +0100] warning/ApplyRule: Apply rule ‘load’ (in /etc/icinga2/conf.d/services.conf: 53:1-53:20) for type ‘Service’ does not match anywhere!
    [2023-12-21 09:43:37 +0100] warning/ApplyRule: Apply rule ‘procs’ (in /etc/icinga2/conf.d/services.conf: 64:1-64:21) for type ‘Service’ does not match anywhere!
    [2023-12-21 09:43:37 +0100] warning/ApplyRule: Apply rule ‘swap’ (in /etc/icinga2/conf.d/services.conf: 75:1-75:20) for type ‘Service’ does not match anywhere!
    [2023-12-21 09:43:37 +0100] warning/ApplyRule: Apply rule ‘users’ (in /etc/icinga2/conf.d/services.conf: 83:1-83:21) for type ‘Service’ does not match anywhere!
    [2023-12-21 09:43:37 +0100] warning/ApplyRule: Apply rule ‘nscp-local-cpu’ (in /etc/icinga2/conf.d/services/windows/windows-services.conf: 2:1-2:30) for type ‘Service’ does not match anywhere!
    [2023-12-21 09:43:37 +0100] warning/ApplyRule: Apply rule ‘nscp-local-memory’ (in /etc/icinga2/conf.d/services/windows/windows-services.conf: 10:1-10:33) for type ‘Service’ does not match anywhere!
    [2023-12-21 09:43:37 +0100] warning/ApplyRule: Apply rule ‘load’ (in /etc/icinga2/zones.d/gin-gr-icinga/linux.conf: 28:1-28:20) for type ‘Service’ does not match anywhere!
    [2023-12-21 09:43:37 +0100] warning/ApplyRule: Apply rule ‘swap’ (in /etc/icinga2/zones.d/gin-gr-icinga/linux.conf: 43:1-43:20) for type ‘Service’ does not match anywhere!
    [2023-12-21 09:43:37 +0100] warning/ApplyRule: Apply rule ‘time’ (in /etc/icinga2/zones.d/gin-gr-icinga/linux.conf: 53:1-53:20) for type ‘Service’ does not match anywhere!
    [2023-12-21 09:43:37 +0100] warning/ApplyRule: Apply rule ‘’ (in /etc/icinga2/zones.d/gin-gr-icinga/linux.conf: 66:1-66:53) for type ‘Service’ does not match anywhere!
    [2023-12-21 09:43:37 +0100] warning/ApplyRule: Apply rule ‘memory’ (in /etc/icinga2/zones.d/gin-gr-icinga/linux.conf: 84:1-84:22) for type ‘Service’ does not match anywhere!
    [2023-12-21 09:43:37 +0100] warning/ApplyRule: Apply rule 'process ’ (in /etc/icinga2/zones.d/gin-gr-icinga/linux.conf: 103:1-103:64) for type ‘Service’ does not match anywhere!
    [2023-12-21 09:43:37 +0100] warning/ApplyRule: Apply rule ‘memory’ (in /etc/icinga2/zones.d/gin-gr-icinga/windows.conf: 85:1-85:22) for type ‘Service’ does not match anywhere!
    [2023-12-21 09:43:37 +0100] warning/ApplyRule: Apply rule ‘’ (in /etc/icinga2/zones.d/gin-gr-icinga/windows.conf: 116:1-116:55) for type ‘Service’ does not match anywhere!
    [2023-12-21 09:43:37 +0100] warning/ApplyRule: Apply rule ‘’ (in /etc/icinga2/zones.d/gin-gr-icinga/windows.conf: 142:1-142:55) for type ‘Service’ does not match anywhere!
    [2023-12-21 09:43:37 +0100] information/ConfigItem: Instantiated 4 NotificationCommands.
    [2023-12-21 09:43:37 +0100] information/ConfigItem: Instantiated 420 Notifications.
    [2023-12-21 09:43:37 +0100] information/ConfigItem: Instantiated 1 IcingaApplication.
    [2023-12-21 09:43:37 +0100] information/ConfigItem: Instantiated 54 Hosts.
    [2023-12-21 09:43:37 +0100] information/ConfigItem: Instantiated 2 HostGroups.
    [2023-12-21 09:43:37 +0100] information/ConfigItem: Instantiated 1 SyslogLogger.
    [2023-12-21 09:43:37 +0100] information/ConfigItem: Instantiated 1 IcingaDB.
    [2023-12-21 09:43:37 +0100] information/ConfigItem: Instantiated 1 Comment.
    [2023-12-21 09:43:37 +0100] information/ConfigItem: Instantiated 1 IdoMysqlConnection.
    [2023-12-21 09:43:37 +0100] information/ConfigItem: Instantiated 2 FileLoggers.
    [2023-12-21 09:43:37 +0100] information/ConfigItem: Instantiated 1 InfluxdbWriter.
    [2023-12-21 09:43:37 +0100] information/ConfigItem: Instantiated 6 Zones.
    [2023-12-21 09:43:37 +0100] information/ConfigItem: Instantiated 1 CheckerComponent.
    [2023-12-21 09:43:37 +0100] information/ConfigItem: Instantiated 1 ExternalCommandListener.
    [2023-12-21 09:43:37 +0100] information/ConfigItem: Instantiated 2 Endpoints.
    [2023-12-21 09:43:37 +0100] information/ConfigItem: Instantiated 1 CompatLogger.
    [2023-12-21 09:43:37 +0100] information/ConfigItem: Instantiated 3 ApiUsers.
    [2023-12-21 09:43:37 +0100] information/ConfigItem: Instantiated 1 NotificationComponent.
    [2023-12-21 09:43:37 +0100] information/ConfigItem: Instantiated 1 ApiListener.
    [2023-12-21 09:43:37 +0100] information/ConfigItem: Instantiated 250 CheckCommands.
    [2023-12-21 09:43:37 +0100] information/ConfigItem: Instantiated 1 PerfdataWriter.
    [2023-12-21 09:43:37 +0100] information/ConfigItem: Instantiated 3 TimePeriods.
    [2023-12-21 09:43:37 +0100] information/ConfigItem: Instantiated 2 UserGroups.
    [2023-12-21 09:43:37 +0100] information/ConfigItem: Instantiated 8 Users.
    [2023-12-21 09:43:37 +0100] information/ConfigItem: Instantiated 114 Services.
    [2023-12-21 09:43:37 +0100] information/ScriptGlobal: Dumping variables to file ‘/var/cache/icinga2/icinga2.vars’
    [2023-12-21 09:43:37 +0100] information/cli: Finished validating the configuration file(s).

  • If you run multiple Icinga 2 instances, the zones.conf file (or icinga2 object list --type Endpoint and icinga2 object list --type Zone) from all affected nodes
    Object ‘global-templates’ of type ‘Zone’:
    % declared in ‘/etc/icinga2/zones.conf’, lines 26:1-26:30

    • __name = “global-templates”
    • endpoints = null
    • global = true
      % = modified in ‘/etc/icinga2/zones.conf’, lines 27:3-27:15
    • name = “global-templates”
    • package = “_etc”
    • parent = “”
    • source_location
      • first_column = 1
      • first_line = 26
      • last_column = 30
      • last_line = 26
      • path = “/etc/icinga2/zones.conf”
    • templates = [ “global-templates” ]
      % = modified in ‘/etc/icinga2/zones.conf’, lines 26:1-26:30
    • type = “Zone”
    • zone = “”

Object ‘linux-commands’ of type ‘Zone’:
% declared in ‘/etc/icinga2/zones.conf’, lines 46:1-46:28

  • __name = “linux-commands”
  • endpoints = null
  • global = true
    % = modified in ‘/etc/icinga2/zones.conf’, lines 47:3-47:15
  • name = “linux-commands”
  • package = “_etc”
  • parent = “”
  • source_location
    • first_column = 1
    • first_line = 46
    • last_column = 28
    • last_line = 46
    • path = “/etc/icinga2/zones.conf”
  • templates = [ “linux-commands” ]
    % = modified in ‘/etc/icinga2/zones.conf’, lines 46:1-46:28
  • type = “Zone”
  • zone = “”

Object ‘director-global’ of type ‘Zone’:
% declared in ‘/etc/icinga2/zones.conf’, lines 38:1-38:29

  • __name = “director-global”
  • endpoints = null
  • global = true
    % = modified in ‘/etc/icinga2/zones.conf’, lines 39:3-39:15
  • name = “director-global”
  • package = “_etc”
  • parent = “”
  • source_location
    • first_column = 1
    • first_line = 38
    • last_column = 29
    • last_line = 38
    • path = “/etc/icinga2/zones.conf”
  • templates = [ “director-global” ]
    % = modified in ‘/etc/icinga2/zones.conf’, lines 38:1-38:29
  • type = “Zone”
  • zone = “”

Object ‘windows-commands’ of type ‘Zone’:
% declared in ‘/etc/icinga2/zones.conf’, lines 54:1-54:30

  • __name = “windows-commands”
  • endpoints = null
  • global = true
    % = modified in ‘/etc/icinga2/zones.conf’, lines 56:2-56:14
  • name = “windows-commands”
  • package = “_etc”
  • parent = “”
  • source_location
    • first_column = 1
    • first_line = 54
    • last_column = 30
    • last_line = 54
    • path = “/etc/icinga2/zones.conf”
  • templates = [ “windows-commands” ]
    % = modified in ‘/etc/icinga2/zones.conf’, lines 54:1-54:30
  • type = “Zone”
  • zone = “”

Object ‘gin-gr-icinga’ of type ‘Zone’:
% declared in ‘/etc/icinga2/zones.conf’, lines 13:1-13:20

  • __name = “gin-gr-icinga”
  • endpoints = [ “gin-gr-icinga” ]
    % = modified in ‘/etc/icinga2/zones.conf’, lines 14:3-14:26
  • global = false
  • name = “gin-gr-icinga”
  • package = “_etc”
  • parent = “”
  • source_location
    • first_column = 1
    • first_line = 13
    • last_column = 20
    • last_line = 13
    • path = “/etc/icinga2/zones.conf”
  • templates = [ “gin-gr-icinga” ]
    % = modified in ‘/etc/icinga2/zones.conf’, lines 13:1-13:20
  • type = “Zone”
  • zone = “”

Object ‘vm-admin-win10’ of type ‘Zone’:
% declared in ‘/etc/icinga2/objects.d//virtualle-machine/windows10_admin_vm.conf’, lines 6:1-6:28

  • __name = “vm-admin-win10”
  • endpoints = [ “vm-admin-win10” ]
    % = modified in ‘/etc/icinga2/objects.d//virtualle-machine/windows10_admin_vm.conf’, lines 8:5-8:36
  • global = false
  • name = “vm-admin-win10”
  • package = “_etc”
  • parent = “gin-gr-icinga”
    % = modified in ‘/etc/icinga2/objects.d//virtualle-machine/windows10_admin_vm.conf’, lines 7:5-7:28
  • source_location
    • first_column = 1
    • first_line = 6
    • last_column = 28
    • last_line = 6
    • path = “/etc/icinga2/objects.d//virtualle-machine/windows10_admin_vm.conf”
  • templates = [ “vm-admin-win10” ]
    % = modified in ‘/etc/icinga2/objects.d//virtualle-machine/windows10_admin_vm.conf’, lines 6:1-6:28
  • type = “Zone”
  • zone = “”
    warning/cli: This data is 5 days, 16 hours, 41 minutes and 57 seconds older than the last Icinga config (re)load. It may be outdated. Consider running ‘icinga2 daemon -C --dump-objects’ first.