Monitoring Self-Hosted Gitlab Updates on CentOS

A Check_MK local check for checking the update status of a Gitlab server. This script will ignore small updates (eg 9.2.5 to 9.2.6) but will show a WARN status if there is a big update available (Eg 9.2.5 to 9.3.1).
nano /usr/share/check-mk-agent/local/check-gitlab-update

#!/bin/bash

# Check current version
c=$(cat /opt/gitlab/version-manifest.txt | grep “gitlab-ee” | awk {‘print $2’})
cs=$(echo $c | cut -c1-3)
# Check available version in yum
a=$(yum list available gitlab-ee –showduplicates | tail -n1 | awk {‘print $2’} | sed ‘s/-.*//’)
as=$(echo $a | cut -c1-3)
melt=”Gitlab current version is $c, latest package available via yum is $a”

if [ “$as” = “$cs” ]; then
s=0
else
s=1
fi

echo “$s gitlab-updates varname=2,crit $melt”

chmod +x /usr/share/check-mk-agent/local/check-gitlab-update

Any comments or questions? Get in touch here or Email me at [email protected]