Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Import Macro Repair

...

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="$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_host/invoke" \
    "Authorization: Bearer $USERNAME $PASSWORD" \
    "Accept: application/octet-stream" \
    host_name=="localhost"\
    os_type=="linux_deb" \
    --download

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="$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" \
  --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.

...