Changes between Initial Version and Version 1 of TipAndDoc/Linux/LXC/munin-plugins


Ignore:
Timestamp:
Apr 23, 2016 4:35:01 PM (8 years ago)
Author:
mitty
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • TipAndDoc/Linux/LXC/munin-plugins

    v1 v1  
     1[[PageOutline]] 
     2 
     3 = munin plugin = 
     4 * github:vajtsz/munin-plugins 
     5 
     6 == lxc_proc == 
     7 * github:vajtsz/munin-plugins/blob/6a426b4bde7addcaf42d72a033e713d0f11776c0/squeeze/lxc_proc#L77 
     8  * Debian Squeezeと異なり、Ubuntu 12.04では{{{lxc-cgroup -t container_name tasks}}}が使えない 
     9 
     10 * https://www.kernel.org/doc/Documentation/cgroups/cgroups.txt 
     11 > Each cgroup is represented by a directory in the cgroup file system 
     12 > containing the following files describing that cgroup: 
     13 >  
     14 >  - tasks: list of tasks (by pid) attached to that cgroup.  This list 
     15 >    is not guaranteed to be sorted.  Writing a thread id into this file 
     16 >    moves the thread into this cgroup. 
     17 >  - cgroup.procs: list of tgids in the cgroup.  This list is not 
     18 >    guaranteed to be sorted or free of duplicate tgids, and userspace 
     19 >    should sort/uniquify the list if this property is required. 
     20 >    Writing a thread group id into this file moves all threads in that 
     21 >    group into this cgroup. 
     22 >  - notify_on_release flag: run the release agent on exit? 
     23 >  - release_agent: the path to use for release notifications (this file 
     24 >    exists in the top cgroup only) 
     25 
     26 * まとめ 
     27  * lxc-cgroupコマンドを使わない場合、以下のsysfsにアクセスすると良い模様 
     28  * Debian 6.0: {{{/sys/fs/cgroup/<container>/tasks}}} 
     29  * Ubuntu 12.04 with fstab: {{{/sys/fs/cgroup/lxc/<container>/tasks}}} 
     30  * Ubuntu 12.04 with cgroup-lite: {{{/sys/fs/cgroup/cpuacct/lxc/<container>/tasks}}} 
     31  * Ubuntu 12.04 with cgroup-bin: {{{/sys/fs/cgroup/cpuacct/sysdefault/lxc/<container>/tasks}}} 
     32 
     33 === Debian 6.0 === 
     34 * http://wiki.debian.org/LXC 
     35 > Add this line to /etc/fstab 
     36 > {{{ 
     37 > cgroup  /sys/fs/cgroup  cgroup  defaults  0   0 
     38 > }}} 
     39 > Try to mount it (a reboot solves an eventual "resource busy problem" in any case) 
     40 > {{{ 
     41 > mount /sys/fs/cgroup 
     42 > }}} 
     43 
     44 * $ sudo lxc-start -d -n lxc-test 
     45 * $ sudo lxc-cgroup -n lxc-test tasks 
     46{{{ 
     471432 
     481569 
     491571 
     501598 
     51}}} 
     52 
     53 * $ ls -1F /sys/fs/cgroup/ 
     54{{{ 
     55cgroup.procs 
     56cpuacct.stat 
     57cpuacct.usage 
     58cpuacct.usage_percpu 
     59cpuset.cpu_exclusive 
     60cpuset.cpus 
     61cpuset.mem_exclusive 
     62cpuset.mem_hardwall 
     63cpuset.memory_migrate 
     64cpuset.memory_pressure 
     65cpuset.memory_pressure_enabled 
     66cpuset.memory_spread_page 
     67cpuset.memory_spread_slab 
     68cpuset.mems 
     69cpuset.sched_load_balance 
     70cpuset.sched_relax_domain_level 
     71cpu.shares 
     72devices.allow 
     73devices.deny 
     74devices.list 
     75lxc-test/ 
     76net_cls.classid 
     77notify_on_release 
     78release_agent 
     79tasks 
     80}}} 
     81  * /sys/fs/cgroup/lxc-test/ も同じ構造 
     82 * $ cat /sys/fs/cgroup/lxc-test/tasks 
     83{{{ 
     841432 
     851569 
     861571 
     871598 
     88}}} 
     89 
     90 === Ubuntu 12.04 === 
     91 * Ubuntu 12.04 with {{{aptitude install -R lxc}}} 
     92  * cgroup関係のパッケージは{{{-R}}}をつけるとインストールされない 
     93 * $ ls -1F /sys/fs/cgroup/ 
     94  * N/A 
     95 * $ sudo lxc-start -n lxc-test 
     96{{{ 
     97lxc-start: failed to spawn 'lxc-test' 
     98}}} 
     99 
     100 ==== /etc/fstab ==== 
     101 * Ubuntu 12.04 with /etc/fstab:{{{cgroup  /sys/fs/cgroup  cgroup  defaults  0   0}}} 
     102  * 起動時に自動でマウントされないため、{{{mount -a}}}する必要がある 
     103 
     104 * $ sudo mount -a 
     105 * $ sudo lxc-start -d -n lxc-test 
     106 * $ sudo lxc-cgroup -n lxc-test tasks 
     107{{{ 
     108lxc-cgroup: cgroup is not mounted 
     109lxc-cgroup: failed to retrieve value of 'tasks' for 'lxc-test' 
     110}}} 
     111 
     112 * $ ls -1F /sys/fs/cgroup/ 
     113{{{ 
     114blkio.io_merged 
     115blkio.io_queued 
     116blkio.io_service_bytes 
     117blkio.io_serviced 
     118blkio.io_service_time 
     119blkio.io_wait_time 
     120blkio.reset_stats 
     121blkio.sectors 
     122blkio.throttle.io_service_bytes 
     123blkio.throttle.io_serviced 
     124blkio.throttle.read_bps_device 
     125blkio.throttle.read_iops_device 
     126blkio.throttle.write_bps_device 
     127blkio.throttle.write_iops_device 
     128mitty@lein:~$ ls -1F /sys/fs/cgroup/ 
     129blkio.io_merged 
     130blkio.io_queued 
     131blkio.io_service_bytes 
     132blkio.io_serviced 
     133blkio.io_service_time 
     134blkio.io_wait_time 
     135blkio.reset_stats 
     136blkio.sectors 
     137blkio.throttle.io_service_bytes 
     138blkio.throttle.io_serviced 
     139blkio.throttle.read_bps_device 
     140blkio.throttle.read_iops_device 
     141blkio.throttle.write_bps_device 
     142blkio.throttle.write_iops_device 
     143blkio.time 
     144blkio.weight 
     145blkio.weight_device 
     146cgroup.clone_children 
     147cgroup.event_control 
     148cgroup.procs 
     149cpuacct.stat 
     150cpuacct.usage 
     151cpuacct.usage_percpu 
     152cpu.cfs_period_us 
     153cpu.cfs_quota_us 
     154cpu.rt_period_us 
     155cpu.rt_runtime_us 
     156cpuset.cpu_exclusive 
     157cpuset.cpus 
     158cpuset.mem_exclusive 
     159cpuset.mem_hardwall 
     160cpuset.memory_migrate 
     161cpuset.memory_pressure 
     162cpuset.memory_pressure_enabled 
     163cpuset.memory_spread_page 
     164cpuset.memory_spread_slab 
     165cpuset.mems 
     166cpuset.sched_load_balance 
     167cpuset.sched_relax_domain_level 
     168cpu.shares 
     169cpu.stat 
     170devices.allow 
     171devices.deny 
     172devices.list 
     173lxc/ 
     174memory.failcnt 
     175memory.force_empty 
     176memory.limit_in_bytes 
     177memory.max_usage_in_bytes 
     178memory.memsw.failcnt 
     179memory.memsw.limit_in_bytes 
     180memory.memsw.max_usage_in_bytes 
     181memory.memsw.usage_in_bytes 
     182memory.move_charge_at_immigrate 
     183memory.numa_stat 
     184memory.oom_control 
     185memory.soft_limit_in_bytes 
     186memory.stat 
     187memory.swappiness 
     188memory.usage_in_bytes 
     189memory.use_hierarchy 
     190notify_on_release 
     191release_agent 
     192tasks 
     193}}} 
     194  * /sys/fs/cgroup/lxc/, /sys/fs/cgroup/lxc/lxc-test/ も同じ構造 
     195 * $ cat /sys/fs/cgroup/lxc/lxc-test/tasks 
     196{{{ 
     1972712 
     1982867 
     1992932 
     2002943 
     2012947 
     2022952 
     2032953 
     2042954 
     2052983 
     2063002 
     2073031 
     2083036 
     2093037 
     2103042 
     2113056 
     2123058 
     213}}} 
     214 
     215 ==== cgroup-lite ==== 
     216 * Ubuntu 12.04 with {{{cgroup-lite}}} 
     217  * aptitude install時に-Rとしない場合、{{{cgroup-lite}}}がRecommendsからインストールされる 
     218  * /bin/cgroups-mount 
     219{{{ 
     220mount -t tmpfs -o uid=0,gid=0,mode=0755 cgroup /sys/fs/cgroup 
     221}}} 
     222 * $ sudo lxc-cgroup -n lxc-test tasks 
     223{{{ 
     224lxc-cgroup: cgroup is not mounted 
     225lxc-cgroup: failed to retrieve value of 'tasks' for 'lxc-test' 
     226}}} 
     227 
     228 * $ ls -1F /sys/fs/cgroup/ 
     229{{{ 
     230blkio/ 
     231cpu/ 
     232cpuacct/ 
     233cpuset/ 
     234devices/ 
     235freezer/ 
     236memory/ 
     237perf_event/ 
     238}}} 
     239  * $ find /sys/fs/cgroup/ | grep lxc-test/tasks | xargs wc 
     240{{{ 
     24117 17 102 /sys/fs/cgroup/perf_event/lxc/lxc-test/tasks 
     24217 17 102 /sys/fs/cgroup/blkio/lxc/lxc-test/tasks 
     24317 17 102 /sys/fs/cgroup/freezer/lxc/lxc-test/tasks 
     24417 17 102 /sys/fs/cgroup/devices/lxc/lxc-test/tasks 
     24517 17 102 /sys/fs/cgroup/memory/lxc/lxc-test/tasks 
     24617 17 102 /sys/fs/cgroup/cpuacct/lxc/lxc-test/tasks 
     24717 17 102 /sys/fs/cgroup/cpu/lxc/lxc-test/tasks 
     24817 17 102 /sys/fs/cgroup/cpuset/lxc/lxc-test/tasks 
     249}}} 
     250 * $ cat /sys/fs/cgroup/perf_event/lxc/lxc-test/tasks 
     251{{{ 
     25217390 
     25317539 
     25417556 
     25517560 
     25617562 
     25717567 
     25817568 
     25917570 
     26017599 
     26117621 
     26217647 
     26317651 
     26417654 
     26517659 
     26617678 
     26717681 
     26817829 
     269}}} 
     270 
     271 ==== cgroup-bin ==== 
     272 * Ubuntu 12.04 with {{{cgroup-bin}}} 
     273  * cgroup-binとcgroup-liteはコンフリクトする 
     274  * /etc/init/cgconfig.conf 
     275{{{ 
     276mount -t tmpfs -o uid=0,gid=0,mode=0755 cgroups /sys/fs/cgroup 
     277}}} 
     278 * $ sudo lxc-cgroup -n lxc-test tasks 
     279{{{ 
     280lxc-cgroup: cgroup is not mounted 
     281lxc-cgroup: failed to retrieve value of 'tasks' for 'lxc-test' 
     282}}} 
     283 
     284 * $ ls -1F /sys/fs/cgroup/ 
     285{{{ 
     286cpu/ 
     287cpuacct/ 
     288devices/ 
     289freezer/ 
     290memory/ 
     291}}} 
     292  * $ find /sys/fs/cgroup/ | grep lxc-test/tasks | xargs wc 
     293{{{ 
     29416 16 80 /sys/fs/cgroup/freezer/sysdefault/lxc/lxc-test/tasks 
     29516 16 80 /sys/fs/cgroup/memory/sysdefault/lxc/lxc-test/tasks 
     29616 16 80 /sys/fs/cgroup/devices/sysdefault/lxc/lxc-test/tasks 
     29716 16 80 /sys/fs/cgroup/cpuacct/sysdefault/lxc/lxc-test/tasks 
     29816 16 80 /sys/fs/cgroup/cpu/sysdefault/lxc/lxc-test/tasks 
     299}}} 
     300 * $ cat /sys/fs/cgroup/freezer/sysdefault/lxc/lxc-test/tasks 
     301{{{ 
     3021296 
     3031390 
     3041434 
     3051461 
     3061470 
     3071471 
     3081473 
     3091474 
     3101502 
     3111524 
     3121552 
     3131562 
     3141563 
     3151566 
     3161580 
     3171582 
     318}}} 
     319