nagios: QnD script pour Gitea version
This commit is contained in:
parent
45955ef85e
commit
67044d45c8
2 changed files with 20 additions and 0 deletions
19
nagios/check_gitea_version.sh
Executable file
19
nagios/check_gitea_version.sh
Executable file
|
@ -0,0 +1,19 @@
|
||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
# Quick and dirty NRPE script to check if
|
||||||
|
# the local version of Gitea is up to date.
|
||||||
|
|
||||||
|
# Stop at first uncatched error
|
||||||
|
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 -- '<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)"
|
||||||
|
exit 0
|
||||||
|
else
|
||||||
|
echo "WARNING ($LOCAL_VERSION / $UPSTREAM_VERSION)"
|
||||||
|
exit 1
|
||||||
|
fi
|
1
nagios/etc/84_check-gitea.cfg
Normal file
1
nagios/etc/84_check-gitea.cfg
Normal file
|
@ -0,0 +1 @@
|
||||||
|
command[check_gitea_version_up_to_date]=/usr/local/share/scripts-admin/nagios/check_gitea_version.sh
|
Loading…
Reference in a new issue