Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 16 Next »

Of course there is a possibility to download the agents for Linux/Windows/etc not only via the browser, but also 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:


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

OMD[mysite]:~$ ls var/check_mk/agents/linux_deb/_PACKAGES/
0f5881c7d6ea8e11       0f5881c7d6ea8e11.sig  d218f24da92c980a.conf  d6379f6fc8945c3d
0f5881c7d6ea8e11.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 browser): "Copy link" and then create the wget link out of it:


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:

#!/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


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):

#!/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



  • No labels