Check_MK_Agent Installation Windows without GUI

CMK version: 1.6
OS version: Centos7

Hi,

I has some OS Version Windows Server 2016 Standard.
There’s no gui, only command and Powershell. We have 3 hosts that need the agent installed on them.

Can some one can explain me how to install the Agent.msi on Windows without the GUI?

Thank you

Hi,

I’m really no Windows expert, but maybe you can try running the msiexec /i from the command line and then pointing to the .msi package that you wish to install.

Louis

I would try unattended installation:

UP(C:\Users\hhirsch\Downloads>):msiexec /i check_mk_agent.msi /qn

See

regards

MF

5 Likes

Hello, which checkmk agent specific commandline options do we have?
E.g. i’m looking for an option to make the installer instruct to “Remove Legacy Agent” (Which is normally disabled when using the gui)

Ps.: I hoped to find this on the page The agent for Windows in detail but it’s not there.

The options i found are here inside this file.

They start all with “WIXUI_…”

Hi,

This is the process that i follow to install the Agent:

Windows provides the ability to automate installations of MSI packages via msiexec.
First, we are going to download the .msi on our server, this can do it by connecting to the server from another machine by UNC with \servername\c$\ and copying the file.

And then we need to execute:

e.g.
UP(C:\Users\hhirsch\Downloads>):msiexec /i check_mk_agent.msi /qn

or if we already have the msi on the machine, we can just simply install, using:

e.g.
msiexec.exe /i check_mk.msi /quiet /norestart

In this case the agent will be installed under the default path, and then immediately started as a Windows service.

Checking the configuration

To check if the configuration was read in as you expected, call the agent with the showconfig option. With this option you not only get an output of the configuration as it is currently being used by the agent — the environment variables in use, as well as the configuration files will always be shown.
If only a certain part of the configuration is of interest, restrict the output to a specific part. Here, for example, it is checked whether the options for the ‘ps’ section have been set correctly:

In this way you can get a quick overview of how the three different configuration files are merged and used by the agent. Errors are thus immediately visible.

Testing the agent

Use the test option to directly run the agent locally and see immediately if an output can be generated without errors. To save space only the first lines of output are shown in the example here:

Hi Ivan,

the option “Remove Legacy Agent” can be activated by appending WIXUI_REMOVELEGACY= to the msiexec command. Like this:

msiexec /i check-mk-agent.msi /qn WIXUI_REMOVELEGACY=

If somebody would want to disable the default option “Migrate from Legacy Windows Agent” you would have to append WIXUI_MIGRATELEGACY="".

msiexec /i check-mk-agent.msi /qn WIXUI_MIGRATELEGACY=""

I will try to find the time this afternoon to add this to our official guide.

2 Likes

I have added the option to our official Checkmk user guide.

They will be visible tomorrow morning: Monitoring Windows - The agent for Windows in detail

If you are impatient you can read my commit:

3 Likes

Hello

Chaining multiple options together on the command line does not seem to achieve the desired options when installing CheckMK agent using MSI on Windows (in my case, Server 2016 - note I’m running without /qn to make sure it’s selecting the options as I wanted to automate this):
MsiExec.exe /I .\check-mk-agent-2.0.0p32-231d80b5763e04c6.msi WIXUI_CLEANINSTALL= WIXUI_REMOVELEGACY= WIXUI_MIGRATELEGACY=“”
Results in Remove Legacy and Migrate from Legacy being selected
but
MsiExec.exe /I .\check-mk-agent-2.0.0p32-231d80b5763e04c6.msi WIXUI_CLEANINSTALL= WIXUI_CLEANLEGACY= WIXUI_MIGRATELEGACY=“” results in only “Migrate Legacy” being selected, which is not what the wiki for 2.0.0 says should happen

Best regards

If you try to set and remove more than one checkbox the following syntax works on my systems.

Start-Process msiexec -Wait -ArgumentList '/I .\check-mk-agent-2.1.0pXX-abcdef.msi WIXUI_REMOVELEGACY="1" WIXUI_CLEANINSTALL="1" WIXUI_MIGRATELEGACY=""'
3 Likes

Cool. Maybe add it to the documentation?

Yes, that’s the documentation in question.
In the below suggestion, it would perhaps make more sense to explicitly specify 1 to enable and 0 to disable, rather than have an empty string.

So something like:
To set multiple install options specify “1” to enable that option, or “” to disable it. For example, to remove the legacy agent and perform a clean install but not migrate the legacy agent:
WIXUI_REMOVELEGACY=“1” WIXUI_CLEANINSTALL=“1” WIXUI_MIGRATELEGACY=“”

You are absolutely right,

this does not work,

msiexec /i "C:\tmp\check_mk_agent.msi" WIXUI_REMOVELEGACY="1" WIXUI_CLEANINSTALL="1" WIXUI_MIGRATELEGACY=""

Clean installation [checked]
Remove legacy [checked]
Migrate from legacy [checked - it should be unchecked]

but this does,

Start-Process msiexec -Wait -ArgumentList '/I C:\tmp\check_mk_agent.msi WIXUI_REMOVELEGACY="1" WIXUI_CLEANINSTALL="1" WIXUI_MIGRATELEGACY=""'

Clean installation [checked]
Remove legacy [checked]
Migrate from legacy [unchecked - as it should]

any thoughts as to why? I mean we can certainly go with the second option, which works, but I have some OCD issues here lol