mirror of
https://github.com/munin-monitoring/contrib.git
synced 2025-07-21 18:41:03 +00:00
Initial version
This commit is contained in:
parent
d5bdf2dfb1
commit
2578e75471
1 changed files with 30 additions and 0 deletions
30
plugins/other/users
Executable file
30
plugins/other/users
Executable 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`
|
Loading…
Add table
Add a link
Reference in a new issue