How to download latest version of MK programatically

Hint: The customer wants a real yum repo with server and agent rpms.

But since tribe29 does not provide any yum repos we do do it currently on our own.
This is for our very special use case of downloading CEE for el7 but perhaps still helpful for some users. We run this as cron job twice a day.

#!/bin/bash

for version in $(curl --silent https://download.checkmk.com/stable_downloads.json | jq -r '.checkmk[].version' | grep -v ^1\.6 )
do

  basedir="/var/www/html/checkmk"
  mkdir -p $basedir
  cd $basedir

  # wget with auth options
  wget \
    --no-check-certificate \                                                                                                                                                                  
    --user=<yourusername> \
    --password=<yourpass> \
    --continue \
    https://download.checkmk.com/checkmk/${version}/check-mk-enterprise-${version}-el7-38.x86_64.rpm

  # extract the checkmk agent rpm from the checkmk server rpm
  rpm2cpio check-mk-enterprise-${version}-el7-38.x86_64.rpm \
  | cpio --extract --verbose  --to-stdout ./opt/omd/versions/${version}.cee/share/check_mk/agents/check-mk-agent-${version}-1.noarch.rpm > check-mk-agent-${version}-1.noarch.rpm

  createrepo .

done

1 Like