mirror of
https://github.com/munin-monitoring/contrib.git
synced 2025-07-21 18:41:03 +00:00
Plugin-Gallery: Get better 2nd level headings
Review of category "system"
This commit is contained in:
parent
54a91c13a4
commit
7fdb4741fe
27 changed files with 18 additions and 12 deletions
60
plugins/user/membyuser
Executable file
60
plugins/user/membyuser
Executable file
|
@ -0,0 +1,60 @@
|
|||
#!/bin/bash
|
||||
#
|
||||
# Plugin to monitor Memory usage inspired by cpubyuser
|
||||
#
|
||||
# 2012-05-23 Sebastien Campion
|
||||
|
||||
LU=`ps auh | cut -d' ' -f 1 | sort -u`
|
||||
USERS=`echo $LU`
|
||||
|
||||
if [ "$1" = "autoconf" ]; then
|
||||
if [ -n "$USERS" ]; then
|
||||
echo "yes"
|
||||
else
|
||||
echo "\$USERS not defined."
|
||||
fi
|
||||
exit
|
||||
fi
|
||||
|
||||
if [ "$1" = "config" ]; then
|
||||
echo "graph_args --base 1000 -r --lower-limit 0"
|
||||
echo "graph_title Memory usage, by user"
|
||||
echo "graph_category memory"
|
||||
echo "graph_info This graph shows memory usage, for monitored users."
|
||||
echo "graph_vlabel KB"
|
||||
echo "graph_scale no"
|
||||
echo "graph_period second"
|
||||
_USERS=${USERS//[-.]/_}
|
||||
echo "graph_order $_USERS others"
|
||||
FIRSTUSER=1;
|
||||
for USER in $USERS "others"; do
|
||||
_USER=${USER//[-.]/_}
|
||||
echo "${_USER}.label $USER"
|
||||
echo "${_USER}.info Memory used by user $USER"
|
||||
echo "${_USER}.type GAUGE"
|
||||
if [ $FIRSTUSER -eq 1 ]; then
|
||||
echo "${_USER}.draw AREA"
|
||||
FIRSTUSER=0
|
||||
else
|
||||
echo "${_USER}.draw STACK"
|
||||
fi
|
||||
done
|
||||
exit
|
||||
fi
|
||||
|
||||
ps -e -o "%z%U" | \
|
||||
awk -v USERS="$USERS" '
|
||||
{ if ($2 != "USER") MEM_USER[$2]+=$1 }
|
||||
END {
|
||||
others_sum = 0
|
||||
for (user in MEM_USER) {
|
||||
m = match(USERS,user)
|
||||
if (m != 0) {
|
||||
_user=user
|
||||
gsub(/[-.]/,"_", _user);
|
||||
print _user".value", MEM_USER[user]
|
||||
} else
|
||||
others_sum += MEM_USER[user]
|
||||
}
|
||||
print "others.value", others_sum;
|
||||
}'
|
50
plugins/user/system_users
Executable file
50
plugins/user/system_users
Executable file
|
@ -0,0 +1,50 @@
|
|||
#!/bin/sh
|
||||
# Plugin to get the number of logged in users
|
||||
# Written by Henrik Andersén 2010 <code@henrikandersen.se>
|
||||
#
|
||||
# Copyright (c) 2010, Henrik Andersen
|
||||
# All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions are met:
|
||||
# * Redistributions of source code must retain the above copyright
|
||||
# notice, this list of conditions and the following disclaimer.
|
||||
# * Redistributions in binary form must reproduce the above copyright
|
||||
# notice, this list of conditions and the following disclaimer in the
|
||||
# documentation and/or other materials provided with the distribution.
|
||||
# * Neither the name of the copyright holder nor the
|
||||
# names of its contributors may be used to endorse or promote products
|
||||
# derived from this software without specific prior written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
# DISCLAIMED. IN NO EVENT SHALL Henrik Andersen BE LIABLE FOR ANY
|
||||
# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
#
|
||||
|
||||
case $1 in
|
||||
config)
|
||||
cat <<'EOM'
|
||||
graph_args --base 1000 -l 0
|
||||
graph_scale no
|
||||
graph_category system
|
||||
graph_info The number of users currently logged into the system
|
||||
graph_title Logged in users
|
||||
graph_vlabel users
|
||||
user.info Number of users currently logged in
|
||||
user.label users
|
||||
user.min 0
|
||||
EOM
|
||||
exit 0;;
|
||||
esac
|
||||
|
||||
count=$(/usr/bin/who -q )
|
||||
printf "user.value %i\n" ${count#*=}
|
||||
|
||||
exit 0
|
Loading…
Add table
Add a link
Reference in a new issue