Um einen Überblick der Softwarestände meiner Anwendungen zu haben, werden diese jetzt auch mit Checkmk überwacht. (check_appl)
Mit den verschiedenen Skripten vergleiche ich die installierte Version auf dem Server mit der aktuellen Version von der Website der Anwendung.
MediaWiki
#!/bin/bash # get MediaWiki download page wget -q https://www.mediawiki.org/wiki/Download -O /tmp/mediawiki-version-online.html # get versions version_online=$(grep "Download MediaWiki 1." /tmp/mediawiki-version-online.html | sed 's/>/\n/g;s/</ /g' | awk '/Download/ {print $3}') # bis 1.34.0 # version_installed=$(grep "wgVersion" /var/www/html/includes/DefaultSettings.php | cut -d "'" -f 2) # ab 1.34.1 version_installed=$(grep "MW_VERSION" /var/www/html/includes/Defines.php | cut -d "'" -f 4) # check if a newer version is online available if [[ $version_online = $version_installed ]]; then echo MediaWiki $version_installed echo "mrpe check every 12 hours" exit 0 else echo MediaWiki $version_installed - update to $version_online available echo "https://www.mediawiki.org/wiki/Download" "MediaWiki downloads" exit 1 fi
BackupPC
#!/bin/bash # get versions version_online=$(curl --silent "https://api.github.com/repos/backuppc/backuppc/releases/latest" | grep '"tag_name":' | sed -E 's/.*"([^"]+)".*/\1/') version_installed=$(grep "Version" /var/log/BackupPC/status.pl | sed 's/,//;s/"//g;s/\x27//g' | awk '{print $3}') # check if a newer version is online available if [[ $version_online = $version_installed ]]; then echo BackupPC $version_installed echo "mrpe check every 12 hours" exit 0 else echo BackupPC $version_installed - update to $version_online available echo "https://backuppc.github.io/backuppc" "BackupPC downloads" exit 1 fi
Webmin
#!/bin/bash # get versions version_online=$(curl --silent "https://api.github.com/repos/webmin/webmin/releases/latest" | grep '"tag_name":' | sed -E 's/.*"([^"]+)".*/\1/') version_installed=$(dpkg -l |grep webmin | awk '{print $3}') # check if a newer version is online available if [[ $version_online = $version_installed ]]; then echo Webmin $version_installed echo "mrpe check every 12 hours" exit 0 else echo Webmin $version_installed - update to $version_online available echo "http://www.webmin.com/download.html" "Webmin downloads" exit 1 fi
RaspberryMatic
#!/bin/sh # get versions version_online=$(curl --silent "https://api.github.com/repos/jens-maus/RaspberryMatic/releases/latest" | grep '"tag_name":' | sed -E 's/.*"([^"]+)".*/\1/') version_installed=$(grep "VERSION" /VERSION | cut -d "=" -f 2) # check if a newer version is online available if [[ $version_online = $version_installed ]]; then echo RaspberryMatic $version_installed echo "mrpe check every 12 hours" exit 0 else echo RaspberryMatic $version_installed - update to $version_online available echo "https://github.com/jens-maus/RaspberryMatic/releases/latest" "RaspberryMatic downloads" exit 1 fi
Pi-hole
#!/bin/bash # 02.01.2021 - output format changed, installed jq and modified version_online command # get versions version_online=$(curl --silent "https://api.github.com/repos/pi-hole/pi-hole/releases/latest" | jq . | grep '"tag_name":' | sed -E 's/.*"([^"]+)".*/\1/;s/v//') version_installed=$(pihole -v | awk '/Pi-hole/ {print $4}' | sed 's/v//') # check if a newer version is online available if [[ $version_online = $version_installed ]]; then echo Pi-hole $version_installed echo "mrpe check every 12 hours" exit 0 else echo Pi-hole $version_installed - update to $version_online available echo "https://github.com/pi-hole/pi-hole/releases" "Pi-hole downloads" exit 1 fi
Gitea
#!/bin/bash # get versions version_online=$(curl --silent "https://api.github.com/repos/go-gitea/gitea/releases/latest" | grep '"tag_name":' | sed -E 's/.*"([^"]+)".*/\1/;s/v//') version_installed=$(gitea --version | awk '{print $3}') # check if a newer version is online available if [[ $version_online = $version_installed ]]; then echo Gitea $version_installed echo "mrpe check every 12 hours" exit 0 else echo Gitea $version_installed - update to $version_online available echo "https://github.com/go-gitea/gitea/releases" "Gitea downloads" exit 1 fi
Check Intervall
Wenn man die api.github.com alle 60 Sekunden abfragt, wird man geblockt. Das Abfrageintervall MUSS höher gesetzt werden!
curl "https://api.github.com/repos/jens-maus/RaspberryMatic/releases/latest" {"message":"API rate limit exceeded for 212.7.169.xxx.
Die Checks lasse ich nur alle 12 Stunden laufen. (siehe Checkmk Intervall für bestimmte service checks anpassen)
# /etc/check_mk/mrpe.cfg check_appl (interval=43200:appendage=1) /etc/check_mk/check_appl