File: psu_.in

package info (click to toggle)
munin 1.2.3-1
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 1,940 kB
  • ctags: 98
  • sloc: sh: 4,215; makefile: 452; perl: 135
file content (66 lines) | stat: -rwxr-xr-x 1,544 bytes parent folder | download | duplicates (3)
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
#!/bin/sh
#
# Wildcard-script to monitor number of processes running as a given user.
# To monitor a user, link psu_<program> to this file. E.g.
#
#    ln -s /usr/share/munin/node/plugins-auto/psu_ /etc/munin/node.d/psu_munin
#
# ...will monitor number of processes owned by 'munin'.
#
# Parameters:
#
# 	config   (required)
# 	autoconf (optional - used by munin-config)
# 	suggest  (optional - used by munin-config)
#
# $Log$
# Revision 1.4  2004/09/10 23:11:13  jimmyo
# Degraded generic/psu_ from auto to manual.
#
# Revision 1.3  2004/05/20 13:57:12  jimmyo
# Set categories to some of the plugins.
#
# Revision 1.2  2004/01/29 19:39:00  jimmyo
# Generic plugins now use printf instead of echo -n, as this is more portable (SF#885564)
#
# Revision 1.1  2004/01/02 18:50:00  jimmyo
# Renamed occurrances of lrrd -> munin
#
# Revision 1.1.1.1  2004/01/02 15:18:07  jimmyo
# Import of LRRD CVS tree after renaming to Munin
#
# Revision 1.2  2003/11/07 17:43:16  jimmyo
# Cleanups and log entries
#
#
#
# Magic markers (optional):
#%# family=manual
#%# capabilities=autoconf suggest



name=`basename $0 | sed 's/^psu_//g'`

if [ "$1" = "autoconf" ]; then
	echo yes
	exit 0
fi

if [ "$1" = "suggest" ]; then
	exit 0
fi

if [ "$1" = "config" ]; then

	echo graph_title Number of processes owned by $name
	echo 'graph_args --base 1000 --vertical-label processes -l 0'
	echo 'graph_category processes'
	echo "count.label $name"
	echo 'processes.draw LINE2'
	exit 0
fi

printf "count.value "
(pgrep -u "$name"; pgrep -U "$name") | sort -u | wc -l