File: paging_in.in

package info (click to toggle)
munin 2.0.76-6
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 7,068 kB
  • sloc: perl: 11,684; java: 1,924; sh: 1,632; makefile: 636; javascript: 365; python: 267
file content (84 lines) | stat: -rw-r--r-- 1,415 bytes parent folder | download | duplicates (6)
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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
#!@@GOODSH@@
# -*- sh -*-

: << =cut

=head1 NAME

paging_in - Plugin to monitor CPU usage

=head1 CONFIGURATION

No configuration

=head1 AUTHOR

Unknown author

=head1 LICENSE

GPLv2

=head1 MAGIC MARKERS

 #%# family=auto
 #%# capabilities=autoconf

=cut

. "$MUNIN_LIBDIR/plugins/plugin.sh"

if [ "$1" = "autoconf" ]; then
	if [ -x /usr/bin/kstat ]; then
		echo yes
		exit 0
	else
		echo no
		exit 0
	fi
fi

if [ "$1" = "config" ]; then
	echo 'graph_title Paging In'
	echo 'graph_order pgin pgpgin reclaim'
	echo "graph_args --base 1000"
	echo 'graph_category system'
	echo 'pgin.label pgin'
	echo 'pgin.draw LINE2'
	echo 'pgin.type DERIVE'
	echo 'pgin.min 0'
	echo 'pgin.max 1000000000'
	print_warning pgin
	print_critical pgin
	echo 'pgpgin.label pgpgin'
	echo 'pgpgin.draw LINE2'
	echo 'pgpgin.type DERIVE'
	echo 'pgpgin.min 0'
	echo 'pgpgin.max 1000000000'
	print_warning pgpgin
	print_critical pgpgin
	echo 'reclaim.label reclaim'
	echo 'reclaim.draw LINE2'
	echo 'reclaim.type DERIVE'
	echo 'reclaim.min 0'
	echo 'reclaim.max 1000000000'
	print_warning reclaim
	print_critical reclaim
	exit 0
fi

kstat -p -c misc -m cpu_stat -s '/^(pgin|pgpgin|pgf?rec)$/' | sed -e 's/.*://' | awk '
BEGIN {
	map["pgin"] = "pgin"
	map["pgpgin"] = "pgpgin"
	map["pgrec"] = "reclaim"
	map["pgfrec"] = "reclaim"
}
length(map[$1]) > 0 {
	sum[map[$1]] += $2
}
END {
	for (item in sum) {
		print item ".value", sum[item]
	}
}'