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 10 Next »

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.

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 over the installation package:

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:


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 (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_hash/invoke" \
    "Authorization: Bearer $USERNAME $PASSWORD" \
    "Accept: application/octet-stream" \
    agent_hash=="<hash<"\
    os_type=="linux_deb" \
    --download


httpie, download by hostname


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