1
0
Fork 0

nagios/check_gitea_version.sh: quick and dirty fix scraper

This commit is contained in:
Chl 2020-05-13 20:07:50 +02:00
parent 4e915e750e
commit 6956971a89

View file

@ -8,7 +8,7 @@ set -e
# note: some local problems with IPv4, the quickest way was to force IPv6.
LOCAL_VERSION="$( wget -6 -O - -q "https://$( hostname -f )/api/v1/version" | sed -n 's/{"version":"\([^"]\+\)"}/\1/p' )"
UPSTREAM_VERSION="$( wget -q -O - "https://dl.gitea.io/gitea/" | egrep -o -- '<a href="/gitea/[0-9]+\.[0-9]+\.[0-9]+/"' | egrep -o "[0-9]+\.[0-9]+\.[0-9]+" | sort --version-sort | tail -n 1 )"
UPSTREAM_VERSION="$( wget -q -O - "https://dl.gitea.io/gitea/" | egrep -- '<a href="/gitea/[0-9]+\.[0-9]+\.[0-9]+/?"' | egrep -o "[0-9]+\.[0-9]+\.[0-9]+" | sort --version-sort | tail -n 1 )"
if [ "$UPSTREAM_VERSION" = "$LOCAL_VERSION" ]; then
echo "OK ($LOCAL_VERSION / $UPSTREAM_VERSION)"