#!/usr/bin/perl -w # # Copyright (C) 2006 Rodolphe Quiedeville # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License # as published by the Free Software Foundation; version 2 dated June, # 1991. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. # # If you improve this script please send your version to my email address # with the copyright notice upgrade with your name. # # Monitor the jabber's account number # # $Log$ # Revision 1.1 2006/03/31 14:17:01 rodo # Created by Rodolphe Quiedeville # # Must run under user jabber or root # #%# family=jabber #%# capabilities=autoconf use strict; my @servers; my $store = "/var/lib/jabber/*"; open (STR,"find $store -type d |"); my @virtuals = ; close(STR); foreach my $dir (@virtuals){ my @names = (split '/', $dir); push (@servers,pop(@names)); } chomp(@servers); if ($ARGV[0] and $ARGV[0] eq "config") { my $first = 1; print "graph_title Jabber accounts\n"; print "graph_args --base 1000 -l 0\n"; print "graph_category jabber\n"; print "graph_vlabel files\n"; print "graph_total Total\n"; print 'graph_info Plugin available at http://rodolphe.quiedeville.org/hack/munin/munin/'."\n"; foreach my $server (@servers){ my $servsn = (split '\.',$server)[0]; print "$servsn.label $server\n"; print "$servsn.info Virtual server $server\n"; if ( $first == 1 ) { print "$servsn.draw AREA\n"; $first=0; } else { print "$servsn.draw STACK\n"; } } exit 0; } foreach my $server (@servers){ open (STR,"find $store$server -type f | wc -l |"); my $accounts = ; close(STR); chomp($accounts); my $servsn = (split '\.',$server)[0]; print "$servsn.value $accounts\n"; } # vim:syntax=perl