Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Table of Contents

Of course there , it is a possibility possible to download the agents for Linux/Windows/etc, not only via the browser , but also by getting them via wget and the REST API is possible.

Prerequisites needed: a user with sufficient rights (the automation user would do out of the box), Checkmk's server hostname (or IP), the site which holds the agent, and the agent you want to download (i.e., OS & hash).

The easiest way for the latter is to navigate to the Agents section in Checkmk and hover the cursor over the installation package:

Image RemovedImage Added


If you're not able to fetch the hash via the browser, you can access it via cliCLI

Code Block
languagebash
themeRDark
root@linux# su - mysite
OMD[mysite]:~$ ls var/check_mk/agents/linux_deb/_PACKAGESpackages/
0f5881c7d6ea8e111ae46a9ab42f290b  1ae46a9ab42f290b.conf     0f5881c7d6ea8e111ae46a9ab42f290b.sig  d218f24da92c980a.conf8107877152463cf2  d6379f6fc8945c3d
0f5881c7d6ea8e118107877152463cf2.conf  d218f24da92c980a      d218f24da92c980a8107877152463cf2.sig   d6379f6fc8945c3d.conf

wget

As you can see, the HTTP call in the above screenshot is almost complete, sou so you can just right-click on the package and say (depending on the browser): "Copy link" and then create the wget link out of it:


Code Block
languagebash
themeRDark
wget "http(s)://<checkmkhost>/<site>/check_mk/download_agent.py?hostname=<hostname>&hash=c9394c3914cc6982&os=linux_tgz&_username=automation&_secret=<automation_secret>" -O agent.deb


httpie, download by the hash value

Install httpie on the system where you want to download the agent.

Create a script with the following content:

Code Block
languagebash
themeRDark
#!/bin/bash
HOST_NAME="<checkmk_server>"
SITE_NAME="<sitename>"
API_URL="http://$HOST_NAME/$SITE_NAME/check_mk/api/1.0"
 
USERNAME="automation"
PASSWORD="<automation_secret>"
 
http --json GET "$API_URL/domain-types/agent/actions/download_by_hash/invoke" \
    "Authorization: Bearer $USERNAME $PASSWORD" \
    "Accept: application/octet-stream" \
    agent_hash=="<hash<"\
    os_type=="linux_deb" \
    --download

...

Create a script with the following content (host_name in the third section means the host for which the agent is for):

Code Block
languagebash
themeRDark
#!/bin/bash
HOST_NAME="<checkmk_server>"
SITE_NAME="<sitename>"
API_URL="http://$HOST_NAME/$SITE_NAME/check_mk/api/1.0"
 
USERNAME="automation"
PASSWORD="<automation_secret>"
 
http --json GET "$API_URL/domain-types/agent/actions/download_by_host/invoke" \
    "Authorization: Bearer $USERNAME $PASSWORD" \
    "Accept: application/octet-stream" \
    host_name=="localhost"\
    os_type=="linux_deb" \
    --download

...