-
Notifications
You must be signed in to change notification settings - Fork 3
/
cputime
executable file
·63 lines (58 loc) · 1.03 KB
/
cputime
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
#!/usr/bin/bash
# -*- sh -*-
# =head1 NAME
#
# cputime - Plugin to monitor CPU usage
#
# =head1 CONFIGURATION
#
# No configuration
#
# =head1 AUTHOR
#
# Unknown author
#
# =head1 LICENSE
#
# GPLv2
#
# =head1 MAGIC MARKERS
#
# #%# family=auto
# #%# capabilities=autoconf
. $MUNIN_LIBDIR/plugins/plugin.sh
if [ "$1" = "autoconf" ]; then
if [ "$(zonename)" != "global" ]; then
echo yes
exit 0
else
echo no
exit 0
fi
fi
if [ "$1" = "config" ]; then
cat <<EOF
graph_title CPU usage
graph_info cpu time
graph_args --base 1000
graph_category system
graph_order sys user waitrq
graph_vlabel cpu time used (+) / waitrq (-) per \${graph_period}
sys.label sys
sys.min 0
sys.type DERIVE
sys.draw AREA
sys.cdef sys,1000000000,/
user.label user
user.min 0
user.draw STACK
user.type DERIVE
user.cdef user,1000000000,/
waitrq.label waitrq
waitrq.type DERIVE
waitrq.draw LINE1
waitrq.cdef waitrq,1000000000,/,-1,*
EOF
exit 0
fi
kstat -p zones:*:*:nsec_sys zones:*:*:nsec_user zones:*:*:nsec_waitrq | sed 's/.*nsec_//g' | awk '{ print $1 ".value", $2 }'