2
0
mirror of https://github.com/munin-monitoring/contrib.git synced 2018-11-08 00:59:34 +01:00

Merge pull request #738 from mittyorz/lxc

Ubuntu 14.04 support, new graph option
This commit is contained in:
sumpfralle 2018-06-10 14:29:33 +02:00 committed by GitHub
commit 76ddb809a5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 36 additions and 5 deletions

View File

@ -41,6 +41,7 @@ Unknown license
# Ubuntu 12.04 with fstab: /sys/fs/cgroup/lxc/<container>/tasks
# Ubuntu 12.04 with cgroup-lite: /sys/fs/cgroup/cpuacct/lxc/<container>/tasks
# Ubuntu 12.04 with cgroup-bin: /sys/fs/cgroup/cpuacct/sysdefault/lxc/<container>/tasks
# Ubuntu 14.04: /sys/fs/cgroup/systemd/lxc/<container>/tasks
count_processes () {
[ -z "$1" ] && return 0
@ -54,6 +55,7 @@ count_processes () {
for SYSFS in \
/sys/fs/cgroup/$1/tasks \
/sys/fs/cgroup/lxc/$1/tasks \
/sys/fs/cgroup/systemd/lxc/$1/tasks \
/sys/fs/cgroup/cpuacct/lxc/$1/tasks \
/sys/fs/cgroup/cpuacct/sysdefault/lxc/$1/tasks \
; do

View File

@ -12,10 +12,18 @@ lxc_ram - Plugin to monitor LXC memory usage.
[lxc_*]
user root
[lxc_ram]
env.areastack true
=head1 INTERPRETATION
This plugin needs root privilege.
If env.areastack is set to true, all memory usages of containers will be
drawn as stacked area charts.
This option changes graph order, all of 'Mem usage' comes first and then others.
(default: false)
=head1 AUTHOR
vajtsz vajtsz@gmail.com
@ -62,7 +70,27 @@ if [ "$1" = "config" ]; then
echo 'graph_vlabel byte'
echo 'graph_category memory'
if [ "$areastack" = "true" ]; then
for guest_name in $guest_names; do
guest="$(clean_fieldname $guest_name)"
echo 'mem_usage_'$guest'.label '$guest_name': Mem usage'
echo 'mem_usage_'$guest'.type GAUGE'
echo 'mem_usage_'$guest'.draw AREASTACK'
done
for guest_name in $guest_names; do
guest="$(clean_fieldname $guest_name)"
echo 'mem_cache_'$guest'.label '$guest_name': Cache'
echo 'mem_cache_'$guest'.type GAUGE'
echo 'mem_active_'$guest'.label '$guest_name': Active'
echo 'mem_active_'$guest'.type GAUGE'
echo 'mem_inactive_'$guest'.label '$guest_name': Inactive'
echo 'mem_inactive_'$guest'.type GAUGE'
done
else
for guest_name in $guest_names;
do
guest="$(clean_fieldname $guest_name)"
@ -77,6 +105,7 @@ if [ "$1" = "config" ]; then
echo 'mem_inactive_'$guest'.type GAUGE'
done
fi
exit 0
fi