Automate Agent Registration

I’m trying to automate my agent registrations since it cannot be done through checkmk. Does anyone have a script (powershell/bat/bash) that can be sent to a machine to invoke the registration?

I was trying to get it working with %HOSTNAME% via comand line but it hated that.

@r.sander has written a script

and also the topic is discussed in this post (German but I thing Code is a single language)

Greets

Yes, but this is just pseudo code as an example what steps are necessary for the automatic deployment and registration.

If %COMPUTERNAME% does not work it may be the case that this variable contains the hostname in uppercase but your monitoring configuration has the hostnames in lower case. In the registration process you need to put the hostname from the monitoring configuration after -H.

1 Like

Hallo,
lösen lässt sich das auf jeden Fall.
Die Frage ist nur wie.
Erste Frage zum Einstieg:
Die Name des Hosts in checkmk ist = dem Namen des Hostmamen des Systems = DNs Eintrag = ggf. Name der Vm sofern es ein virtuelles System ist?
Gruß

Right, and I tried to make sure I’m not doubling up on efforts, especially since its now looking like it will be easier to do in powershell. I don’t want to manually register every machine. The agent should be smart enough to poll the information needed for the machine and ask for what it can’t get.

This is the purpose of the command line arguments to the register call of the agent updater. If the hostname cannot be derived from -H %COMPUTERNAME% you just let it out completely and the registration process will ask for the hostname interactively.

Here is the Windows command line to register:

“C:\Program Files (x86)\checkmk\service\check_mk_agent.exe” updater register -s checkmk.FQDN -i SITE -H %COMPUTERNAME%.FQDN -p https -U agentreg -S {redacted} -v

1 Like

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed. Contact an admin if you think this should be re-opened.