munin-drupal_ 1.4 KB

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