Monitor a Windows Service with PowerShell Module

Hello, so I want to monitor a few windows services, like the wsus-service on our wsus.
We use the Icinga2 Director Module!

On all of our windows clients is the Icinga2 Agent installed (also known as PowerShell Module).

Is it possible to monitor a specific service?
I’ve look through the forum and google, some said its possible with nsclient++, some say you can add a command??

Can someone please tell me if it is possible with the standard PowerShell module?
Is there maybe a guide I can follow?

  • Director version (System - About): 1.9.1
  • Icinga Web 2 version and modules (System - About): 2.10.1
  • Icinga 2 version (icinga2 --version): r2.13.3-1
  • Operating System and version: Ubuntu 20.04.4 LTS
1 Like

Thanks for the fast reaction!
How exactly do I import those extended plugins?
Do I need to download them and put them in a special directory?

Please tell me:
How did you install the agent?

1 Like

With following script:

[Net.ServicePointManager]::SecurityProtocol = 'tls12, tls11';
$ProgressPreference                         = 'SilentlyContinue';
[string]$ScriptFile                         = 'C:\Users\Public\IcingaForWindows.ps1';

Invoke-WebRequest `
    -UseBasicParsing `
    -Uri 'https://packages.icinga.com/IcingaForWindows/IcingaForWindows.ps1' `
    -OutFile $ScriptFile;

& $ScriptFile `
    -ModuleDirectory 'C:\Program Files\WindowsPowerShell\Modules\' `
    -SkipWizard;


Remove-Item C:\Users\Public\IcingaForWindows.ps1



Use-Icinga;
Start-IcingaAgentInstallWizard `
    -DirectorUrl            'http://###SERVERNAME###/icingaweb2/director/' `
    -SelfServiceAPIKey      '###GENERATED KEY###' `
    -UseDirectorSelfService 1 `
    -OverrideDirectorVars   0 `
    -Reconfigure `
    -RunInstaller

Open a powershell as adminstrator and insert:

Use-Icinga;
Install-IcingaFrameworkComponent -Name plugins;

after that you have the powershell plugins installed.
after that you read my second post again…

1 Like

Hello, okay, I installed the plugins on the agent server

But on the master - is service-windows the right command?

When I create that service-template I see no way to declare what service I want to check exactly?
Or do I need to install the plugins on the master the same way too?

service-windows is the old monitoring-tools check, this works too but without powershell and only with the real service name, for example wuauserv but not “Windows Update”

if you want to use the powershell plugins you have to import your Icinga Powershell plugins in icinga Director using baskets, see link above

1 Like

Okay, I’ve found out that I can configure the command Invoke-IcingaCheckService.

As from what I understand, baskets are used to apply already configured checkServices?
But at some point I need to configure what exacly I want to monitor, I dont really understand where?

As seen in the screenshot I tried to put value to declare that I want to use the Plugin and what service I want to monitor, is that totally wrong?

I dont know if its just the language barrier for me, but the official documentation from icinga2 do not really clarify how to configure the plugin in practice.

please just import Plugins_Bundle.json
via icinga director baskets

1 Like

Hello thanks again for the reply.

I imported the json File to use it as basket.


In the service template I used “Invoke-IcingaCheckService”, but I still get the syntax error, that it cant find the file. What do I need to do now?

Thanks

did you restore the basket? → under snapshot ->nameof snpshot → restore → restore

1 Like

You are a god damn genius!!!

Finally got it running!

I hope this thread will help out some people in the future too!

Thank you very much!