Skip to content
Snippets Groups Projects
Commit d39a0850 authored by Johannes Schilling's avatar Johannes Schilling
Browse files

initial commit; add check_remote_wp_latest and README

parents
No related branches found
No related tags found
No related merge requests found
README 0 → 100644
# monitoring plugins -- README
## what's this?
some monitoring plugins which i've needed, and thought i'd share with all of
you. a lot of them exist in a similar form, but were either too complicated or
not quite what i needed, so i rolled my own.
### check_remote_wp_latest
checks remote wordpress installations for being the latest version against
https://api.wordpress.org/core/version-check/1.2/?version= and reports states
fitting for $monitoring-system. works remotely, and doesn't require php on the
monitoring server.
#!/bin/sh
set -eu
WP_UPDATE_API="http://api.wordpress.org/core/version-check/1.2/?version="
OK=0
WARNING=1
CRITICAL=2
UNKNOWN=3
cur_vers=$(curl -s "$1" | grep -E '^<meta name="generator" content="WordPress ' | grep -Eo '([0-9.]+)')
latest_vers=$(curl -s "${WP_UPDATE_API}${cur_vers}" | tr '\n' ' ' | cut -d ' ' -f 4)
if [ "$cur_vers" = "$latest_vers" ]; then
echo "OK: has latest version ($latest_vers)"
exit $OK
else
echo "CRITICAL: has $cur_vers, but latest is $latest_vers"
exit $CRITICAL
fi
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment