1
0
Fork 0
mirror of https://github.com/munin-monitoring/contrib.git synced 2025-07-22 02:51:03 +00:00

Initial version

This commit is contained in:
Stephen 2007-05-24 03:37:26 +02:00 committed by Steve Schnepp
parent d5bdf2dfb1
commit 2578e75471

30
plugins/other/users Executable file
View file

@ -0,0 +1,30 @@
#!/bin/sh
#Plugin created by:
# Stephen Hodgson
# Malone College - CPSC
#This script is provided as-is with no warranty or guarantee of any kind.
#-This simple plugin figures out how many users are logged into the linux box and writes it to a simple Gauge-style graph.
#-The plugin takes advantage of the linux 'who' command.
# -The who command is cut into the first field (to the first space).
# -This is the username field.
# -Unfortunately this will log multiples for the same user if multiple terminals are open.
# -Then we need to sort the results since uniq only deals with unique elements next in line to each other.
# -We find the uniqe usernames logged on.
# -Then wc -l counts how many lines (users) we're left with.
if [ "$1" = "config" ]; then
echo 'graph_title Users Online'
echo 'graph_args --base 1000 -l 0 '
echo 'graph_vlabel Number of users'
echo 'graph_category system'
echo 'users.label users'
echo 'graph_args --base 1000 -l 0'
echo 'graph_scale no'
exit 0
fi
echo -n "users.value "
echo `who | cut -f -1 -d ' ' | sort | uniq | wc -l`