#!/bin/bash # # Munin plugin using the munin_api module and submodules to log Drupal info. # # (c) 2011 Ouest Systèmes Informatiques (OSInet) # # Licensed under the General Public License version 2 or later. # # This plugin uses CURL to access the Drupal instance over HTTP. For most # plugin modules, this could also work in CLI mode using Drush, and a Drush # plugin implementation is a no-brainer. However, in most cases, this will be a # lower performance option, because CLI code is not cached in APC, causing # extra I/O load to fetch the files from disk everytime, whereas they will # normally be cached in APC when using HTTP access. SUB=$(basename $0 | sed s/drupal_/munin_/) # The timeout needs to be "not too short", because on # system reboot, munin will often send probes before # Apache is ready and, if they timeout, will not register # the Munin plugins invoking this scripts for further # probes, and it will have to be restarted manually. # # In addition, if you encounter "Connection refused" errors after system # reboot, you may want to force a munin-node restart. In Ubuntu 10.10, # for example, this can be done by adding: # # @reboot /bin/sleep 60 ; /usr/sbin/restart munin-node # # in /etc/cron.d/munin to force a munin restart 1 minute after cron restart. # CURL="/usr/bin/env curl --connect-timeout 60" echo $CURL case $1 in config) $CURL http://$HOST/munin_api/$SUB/config exit 0;; esac $CURL http://$HOST/munin_api/$SUB