#!/usr/bin/perl # # Copyright (C) 2005 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. # # Plugin to monitor the number of local and remote users # # Parameters supported: # # config # autoconf # # $Log$ # Revision 1.1 2005/10/17 11:58:00 rodo # Initial revision # # # Magic markers: #%# family=auto #%# capabilities=autoconf if ( exists $ARGV[0] and $ARGV[0] eq "config" ) { print "graph_title Connected users\n"; print "graph_args --base 1000 -l 0\n"; print "graph_category system\n"; print "graph_order remote local\n"; print "graph_vlabel users\n"; print "graph_total total\n"; print "remote.label remote\n"; print "remote.draw AREA\n"; print "local.label local\n"; print "local.draw STACK\n"; exit 0; } my $who = `which who`; my ($urem, $uloc) = (0,0); open(IN, "$who|") or exit 4; while() { if(/.* pts\/.*$/) { $urem = $urem + 1; } else { $uloc = $uloc + 1; } } close(IN); print "remote.value ".$urem."\n"; print "local.value ".$uloc."\n"; # vim:syntax=perl