Versions Compared

Key

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


Table of Contents

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

...

Info

In addition to the extensive documentation in our official guide, we provide some practical information here for convenience. We encourage you to read and understand the following articles nevertheless.

Status
colourGreen
titleLAST TESTED ON CHECKMK 2.2.0P8


Panel
borderColorblack
bgColor#f8f8f8
titleTable of Contents

Table of Contents

Step-by-step guide

Prerequisites

  • 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

...

  • The agent you want to download (i.e., OS & hash or hostname)

...



The easiest way for the latter to find the OS and has, is to navigate to the Agents section in Checkmk agent bakery and hover the cursor over the installation package:

Image RemovedScreenshot of the Windows, linux, solaris section of the agent bakery. Image highlights the location of the linux debian file download.Image 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      d218f24da92c980a.sig   d6379f6fc8945c3d.conf

wget

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

Code Block
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 hash value

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

Create a script with the following content:

code
8107877152463cf2.sig

Download via REST API

httpie (recommended)

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

Download by hash value

The following is an example script, that you can use to download the agent.

Code Block
languagebash
themeRDark
#!/bin/bash
HOST_NAME="$MYCHECKMKSERVER"
SITE_NAME="$MYSITE"
API_URL="http://$HOST_NAME/$SITE_NAME/check_mk/api/1.0"
 
USERNAME="$AUTOMATION_USER"
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

Download by hostname

The following is an example script, that you can use to download the agent.

Code Block
languagebash
themeRDark
#!/bin/bash
HOST_NAME="<checkmk_server>$MYCHECKMKSERVER"
SITE_NAME="<sitename>$MYSITE"
API_URL="http://$HOST_NAME/$SITE_NAME/check_mk/api/1.0"
 
USERNAME="automation$AUTOMATION_USER"
PASSWORD="<automation$AUTOMATION_secret>SECRET"

   http --json GET "$API_URL/domain-types/agent/actions/download_by_hashhost/invoke" \
    "Authorization: Bearer $USERNAME $PASSWORD" \
    "Accept: application/octet-stream" \
    agent    host_hashname=="<hash<localhost"\
    os_type=="linux_deb" \
    --download

httpie, download by hostname

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

...

curl

Download by hash value

The following is an example script, that you can use to download the agent.

Code Block
languagebash
themeRDark
#!/bin/bash
HOST_NAME="<checkmk_server>$MYCHECKMKSERVER"
SITE_NAME="<sitename>$MYSITE"
API_URL="http://$HOST_NAME/$SITE_NAME/check_mk/api/1.0"
 
USERNAME="automation$AUTOMATION_USER"
PASSWORD="<automation$AUTOMATION_secret>SECRET"
 
http --json GET 

curl \
  -G \
  --request GET \
  --write-out "\nxxx-status_code=%{http_code}\n" \
  --header "Authorization: Bearer $USERNAME $PASSWORD" \
  --header "Accept: application/octet-stream" \
  --data-urlencode 'agent_type=host_name' \
  --data-urlencode 'host_name=local' \
  --data-urlencode 'os_type=linux_tgz' \
  -o myagent.tgz \
  "$API_URL/domain-types/agent/actions/download_by_host/invoke"

Download by hostname

The following is an example script, that you can use to download the agent.

Code Block
languagebash
themeRDark
#!/bin/bash
HOST_NAME="$MYCHECKMKSERVER"
SITE_NAME="$MYSITE"
API_URL="http://$HOST_NAME/$SITE_NAME/check_mk/api/1.0"
 
USERNAME="$AUTOMATION_USER"
PASSWORD="$AUTOMATION_SECRET"

curl \
    
  -G \
  --request GET \
  --write-out "\nxxx-status_code=%{http_code}\n" \
  --header "Authorization: Bearer $USERNAME $PASSWORD"  \
      --header "Accept: application/octet-stream" \
    host_name=="localhost"\
    os_type=="linux_deb" \
    --download
Page Properties
hiddentrue
Related issues
 \
  --data-urlencode 'agent_type=host_name' \
  --data-urlencode 'host_name=local' \
  --data-urlencode 'os_type=linux_tgz' \
  -o myagent.tgz \
  "$API_URL/domain-types/agent/actions/download_by_host/invoke"


Filter by label (Content by label)
howto agent
showLabelsfalse
max5
spacesKB
showSpacefalse
sortmodified
reversetrue
typepage
cqllabel in ( "kb-how-to-article" , "howto" , "agent_bakery" ) and type = "page" and space = "KB"
labelskb-how-to-article

Page Properties
hiddentrue


Related issues