#!/bin/sh # # Plugin to monitor the number of Mailman mailing lists in AlternC. # Of course, alternc-mailman needs to be installed. # # Parameters: # # config # autoconf # # Configuration variables # # mysqlopts - Options to pass to mysql which should include the # username, password, host and alternc database. # # Example of the entry in plugin-conf.d/munin-node # [alternc*] # user root # env.mysqlopts --defaults-file=/etc/mysql/alternc.cnf # # $Log$ # Revision 0.1 Sat Aug 4 15:55:27 ART 2007 sebas # On part! Ce plugin est base sur mysql_thread. # # #%# family=auto #%# capabilities=autoconf MYSQLOPTS="$mysqlopts" MYSQL=${mysql:-mysql} if [ "$1" = "autoconf" ]; then $MYSQL --version 2>/dev/null >/dev/null if [ $? -eq 0 ] then $MYSQL $MYSQLOPTS -B -N -e 'SELECT COUNT(*) FROM mailman' 2>/dev/null >/dev/null if [ $? -eq 0 ] then echo yes exit 0 else echo "no (could not connect to mysql)" fi else echo "no (mysql client not found)" fi exit 1 fi if [ "$1" = "config" ]; then echo 'graph_title AlternC - Mailman lists' echo 'graph_vlabel quantity' echo 'graph_category alternc' echo 'mailmanlists.label Mailman lists' echo 'graph_args --base 1000 -l 0' exit 0 fi /usr/bin/printf "mailmanlists.value " ($MYSQL $MYSQLOPTS -N -B -e "SELECT COUNT( * ) FROM mailman " 2>/dev/null || echo 'U') | awk '{print $1}'