Windows agent - Install PS plugins and service

I’m setting up Director self service and it works good, but I don’t see any way of parsing to the install script to also include installing the PS Plugins and the service? I’m using this install string (from Director):

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

& $ScriptFile -ModuleDirectory 'C:\Program Files\WindowsPowerShell\Modules\'
-InstallCommand ‘{“IfW-DirectorSelfServiceKey”:{“Values”:[“”]},“IfW-DirectorUrl”:{“Values”:[“https://<myDirectorURL/director/”]},“IfW-StableRepository”:{“Values”:[“Index of /IcingaForWindows/stable”]}}’ `
-IcingaRepository ‘https://packages.icinga.com/IcingaForWindows/stable/ifw.repo.json

I would like to have the installer script also incude “Icinga PowerShell Service” and the Plugins for “Invoke-IcingaCheckXXXX” modules.
Can I add some in the -InstallCommand to get that?

If I run the Get-IcingaDirectorSelfServiceConfig against the API I get this respons:

image

How can I alter the install options for service/plugins ?

Just successfully testet to change file “/usr/share/icingaweb2/modules/director/application/controllers/SelfServiceController.php” line 271 and 274–>for me installation work complettly unattended afterwards

Yes! Thanks for finding it. It works… Just need to remember to change those options when a new version is applied probably :slight_smile:

@NiclasE good point and to make shure we get this monitored why not using icinga:-)

download checksum check file:

curl -o /usr/lib/nagios/plugins/check_checksum https://raw.githubusercontent.com/NETWAYS/check_checksum/master/check_checksum

make file executable:

chmod +x /usr/lib/nagios/plugins/check_checksum

import attached director basket for command defintion and service Template definitions(2 as i have seperated the interval)…or create it manually:-)

Create Apply rule like this in director:

zones.d/director-global/service_apply.conf
apply Service "monitor file SelfServiceController.php" {
    import "check_checksum template"

    notes = "Check the file due to changes for self-service in Line 270 and 274\r\nsee this Thread: https://community.icinga.com/t/windows-agent-install-ps-plugins-and-service/13401\r\n270             'install_framework_service' => '1',\r\n271             // ServiceDirectory    => framework_service_directory\r\n272             // FrameworkServiceUrl => framework_service_url\r\n273             // InstallFrameworkPlugins:\r\n274             'install_framework_plugins' => '1',\r\n"
    assign where host.name == "Your HOST"
    vars.checksum = "a15cacefbd5a1d22a8c02319cde133b27f0e0d31eb876a0408a75c5d5db0ec48e3bde1df4bbbe6e46fe3675b9c97b858c79ff5a57ce8dbddc69ca877704d151b"
    vars.filename = "/usr/share/icingaweb2/modules/director/application/controllers/SelfServiceController.php"

    import DirectorOverrideTemplate
}

Create checksum:
sha512sum /usr/share/icingaweb2/modules/director/application/controllers/SelfServiceController.php

Director-Basket_checksum_basket_33b4bb4.json.txt (3.0 KB)

1 Like