1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66
|
#!@@PERL@@ -w
#
# (c) 2004 Michael Kaiser
# tools (at) micha (dot) de
#
# Plugin to monitor the number users logged in to a unix box.
# Based on an idea of a hotsanic script.
# Never tested for any other class than pts users. Until now,
# I've only tested on various Linux boxen, but it might work
# on other Un*x-alike systems as well. I'd like to hear from
# you, if you can report this script running on any other
# platform than Linux.
#
#
# Usage: copy or link into /etc/munin/node.d/
#
# Parameters:
#
# config (required)
#
# $Id: users.in 860 2005-03-29 20:32:59Z ilmari $
#
# $Log$
# Revision 1.1.2.1 2005/01/11 13:48:33 ilmari
# Fix linux/users #! line.
#
# Revision 1.1 2004/12/20 13:43:36 jimmyo
# Added plugin linux/users, created by Michael Kaiser.
#
#
#%# family=contrib
if ( $ARGV[0] and $ARGV[0] eq "config" )
{
print "graph_title Logged in users\n";
print "graph_args --base 1000 -l 0\n";
print "graph_vlabel Count/min\n";
print "graph_scale no\n";
print "tty.label tty\n";
print "tty.draw AREA\n";
print "pty.label pty\n";
print "pty.draw STACK\n";
print "pts.label pts\n";
print "pts.draw STACK\n";
exit 0;
}
open (WHO,"who|tr -s ' '|cut -d' ' -f2|cut -d'/' -f1|");
@who = <WHO>;
close (WHO);
$tty =0;
$pty =0;
$pts =0;
foreach $tt (@who) {
$tty++ if ($tt =~ /ttyv?/);
$pty++ if ($tt =~ /pty|ttyp/);
$pts++ if ($tt =~ /pts/);
}
print "tty.value $tty\n";
print "pty.value $pty\n";
print "pts.value $pts\n";
# vim:syntax=perl
|