#!/bin/sh # # Plugin to monitor the number of installed Drupal instances # # Parameters: # # config # autoconf # # #%# family=contrib #%# capabilities=autoconf CACHEFILE="/root/.cache-cms-info/drupal.txt" if [ "$1" = "autoconf" ]; then if [ -f $CACHEFILE ]; then echo yes exit 0 else echo "no (could not find cache file)" fi exit 1 fi if [ "$1" = "config" ]; then echo 'graph_title Drupal - number of installations' echo 'graph_vlabel quantity' echo 'graph_category cms' # echo 'graph_scale no' # echo 'graph_args --base 1024 -l 0' cat $CACHEFILE | awk '{print $2}' \ | sed 's/\([4-7]\)\.\([0-9]*\)[^ ]*/ \1v\2 /' \ | awk ' {foo[$1]++} END { for (f in foo ) { print "v" f ".label", f }}' \ | sed 's/ \([0-9]\)v\([0-9]\)/ \1.\2/' \ | sed 's/^v-.label -/unknown.label unknown/' \ | egrep -v "^vde.label de" \ | sort -n exit 0 fi cat $CACHEFILE | awk '{print $2}' | sed 's/\([4-7]\)\.\([0-9]*\)[^ ]*/ \1v\2 /' | awk ' {foo[$1]++} END { for (f in foo ) { print "v" f ".value", foo[f] }}' | sed 's/^v-.value/unknown.value/' | egrep -v "^vde.value" | sort -n