{"id":241,"date":"2020-03-10T01:00:13","date_gmt":"2020-03-10T00:00:13","guid":{"rendered":"http:\/\/linuxboxen2.dk\/?p=241"},"modified":"2020-03-10T01:00:13","modified_gmt":"2020-03-10T00:00:13","slug":"vmstat","status":"publish","type":"post","link":"https:\/\/www.linuxboxen.dk\/?p=241","title":{"rendered":"vmstat"},"content":{"rendered":"<p><strong>vmstat<\/strong> og <strong>iostat<\/strong> begge kommandoer er tilg\u00e6ngelige p\u00e5 alle st\u00f8rre Unix-lignende (Linux \/ Unix \/ FreeBSD \/ Solaris) operativsystemer.<\/p>\n<p>Hvis vmstat og iostat kommandoerne ikke er tilg\u00e6ngelige p\u00e5 din boks, skal du installere sysstat pakke. Den vmstat, sar og iostat kommandoer er indsamlingen af \u200b\u200bpakken indg\u00e5r i sysstat &#8211; Systemet overv\u00e5gningsv\u00e6rkt\u00f8jer. Den iostat genererer rapporter om CPU &amp; alle enhedens statistik. Du kan downloade og installere sysstat hj\u00e6lp kilde tarball fra link sysstat, men vi anbefaler at installere igennem YUM kommando.<\/p>\n<h4>Installere Sysstat i Linux<\/h4>\n<pre>$ apt install sysstat<\/pre>\n<ol>\n<li><strong>vmstat<\/strong> \u2013 Sammenfattende oplysninger om <strong>Memory<\/strong>, <strong>Processes<\/strong>, <strong>Paging<\/strong> etc.<\/li>\n<li><strong>iostat<\/strong> \u2013 Central Processing Unit (<strong>CPU<\/strong>)\u00a0 og <strong>input\/output<\/strong> statistik for\u00a0<strong>devices<\/strong> og <strong>partitioner<\/strong>.<\/li>\n<\/ol>\n<h4>1. Liste aktiv og inaktiv hukommelse<\/h4>\n<p>I nedenst\u00e5ende eksempel er der seks kolonner. Den vigtigste af s\u00f8jlerne er forklaret i mennesket side vmstat i detaljer. De fleste vigtige omr\u00e5der er fri under hukommelse og si, s\u00e5 under swap kolonne.<\/p>\n<pre>$ vmstat -a\nprocs -----------memory---------- ---swap-- -----io---- -system-- ------cpu-----\n r  b   swpd   free  inact active      si   so    bi    bo   in   cs us sy id wa st\n 0  0      0 1182688 1426028 1145128    0    0     2     5   19   14  0  0 100  0  0\n\n<\/pre>\n<ol>\n<li>\n<ol>\n<li><strong>Free<\/strong> \u2013 Amount of free\/idle memory spaces.<\/li>\n<li><strong>si<\/strong> \u2013 Swaped in every second from disk in Kilo Bytes.<\/li>\n<li><strong>si<\/strong> \u2013 Swaped out every second to disk in Kilo Bytes.<\/li>\n<\/ol>\n<\/li>\n<\/ol>\n<p><strong>Bem\u00e6rk<\/strong>: Hvis du k\u00f8rer vmstat uden parametre Det vil displays sammenfattende rapport siden systemet boot.<\/p>\n<h4>2. Execute vmstat \u2018X\u2019 seconds and (\u2018N\u2019number of times)<\/h4>\n<p>Med denne kommando, udf\u00f8re vmstat hvert andet sekund og stoppe automatisk efter udf\u00f8relsen seks intervaller.<\/p>\n<pre><strong>$ vmstat 2 6<\/strong>\nprocs -----------memory---------- ---swap-- -----io---- -system-- ------cpu-----\n r  b   swpd   free   buff  cache   si   so    bi    bo   in   cs us sy id wa st\n 1  0      0 1184624 143392 2201848    0    0     2     5   19   14  0  0 100  0  0\n 0  0      0 1184408 143392 2201848    0    0     0    18   59  130  0  0 100  0  0\n 0  0      0 1185284 143392 2201848    0    0     0   132   58  137  0  0 100  0  0\n 0  0      0 1185284 143392 2201848    0    0     0     0   50  109  0  0 100  0  0\n 1  0      0 1185316 143392 2201860    0    0     0    42   83  184  2  1 97  0  0\n 0  0      0 1185316 143392 2201860    0    0     0     0   38   99  0  0 100  0  0\n\n<\/pre>\n<h4>3. Vmstat med tidsstempler<\/h4>\n<p><strong>vmstat<\/strong> kommando med <strong>-t<\/strong> parameter viser tidsstempler med hver linje udskrives som vist nedenfor.<\/p>\n<pre><strong>$ <\/strong>vmstat -t 1 5\nprocs -----------memory---------- ---swap-- -----io---- -system-- ------cpu----- -----timestamp-----\n r  b   swpd   free   buff  cache   si   so    bi    bo   in   cs us sy id wa st                 UTC\n 0  0      0 1185588 143392 2201856    0    0     2     5   19   14  0  0 100  0  0 2018-12-29 15:07:39\n 0  0      0 1185596 143392 2201856    0    0     0     0   51  101  0  0 100  0  0 2018-12-29 15:07:40\n 0  0      0 1185596 143392 2201856    0    0     0     0   33   63  0  0 100  0  0 2018-12-29 15:07:41\n 0  0      0 1185596 143392 2201856    0    0     0     0   29   60  0  0 100  0  0 2018-12-29 15:07:42\n 0  0      0 1185628 143392 2201856    0    0     0     0   33   66  0  0 100  0  0 2018-12-29 15:07:43\n<\/pre>\n<p>4. Statistik over Various Counter<\/p>\n<p><strong>vmstat<\/strong> kommando med <strong>-s<\/strong> switch viser sammendrag af diverse event t\u00e6llere og hukommelse statistik.<\/p>\n<pre><strong>$ vmstat -s<\/strong>\n      4024420 K total memory\n       491636 K used memory\n      1141428 K active memory\n      1426040 K inactive memory\n      1187560 K free memory\n       143392 K buffer memory\n      2201832 K swap cache\n       262140 K total swap\n            0 K used swap\n       262140 K free swap\n       206075 non-nice user cpu ticks\n         6111 nice user cpu ticks\n       129918 system cpu ticks\n    136561119 idle cpu ticks\n        10271 IO-wait cpu ticks\n        33214 IRQ cpu ticks\n        29457 softirq cpu ticks\n         8113 stolen cpu ticks\n      2084183 pages paged in\n      7374708 pages paged out\n            0 pages swapped in\n            0 pages swapped out\n     26359816 interrupts\n     62452836 CPU context switches\n   1545410958 boot time\n       196198 forks\n\n<\/pre>\n<h4>5. Disk statistik<\/h4>\n<p><strong>vmstat<\/strong> med <strong>-d<\/strong> vises alt disk statistik.<\/p>\n<pre><strong>$ vmstat -d<\/strong>\n\ndisk- ------------reads------------ ------------writes----------- -----IO------\n       total merged sectors      ms  total merged sectors      ms    cur    sec\nram0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 0\u00a0\u00a0\u00a0\u00a0\u00a0 0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 0\u00a0\u00a0\u00a0\u00a0\u00a0 0\u00a0\u00a0\u00a0\u00a0\u00a0 0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 0\u00a0\u00a0\u00a0\u00a0\u00a0 0\u00a0\u00a0\u00a0\u00a0\u00a0 0\nram1\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 0\u00a0\u00a0\u00a0\u00a0\u00a0 0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 0\u00a0\u00a0\u00a0\u00a0\u00a0 0\u00a0\u00a0\u00a0\u00a0\u00a0 0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 0\u00a0\u00a0\u00a0\u00a0\u00a0 0\u00a0\u00a0\u00a0\u00a0\u00a0 0\nram2\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 0\u00a0\u00a0\u00a0\u00a0\u00a0 0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 0\u00a0\u00a0\u00a0\u00a0\u00a0 0\u00a0\u00a0\u00a0\u00a0\u00a0 0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 0\u00a0\u00a0\u00a0\u00a0\u00a0 0\u00a0\u00a0\u00a0\u00a0\u00a0 0\nsda   127117    217 4165894    8757 530957 262529 104398792   52240      0     77\nsdb       43      0    2344       0      0      0       0       0      0      0\nmd0        0      0       0       0      0      0       0       0      0      0\n\n<\/pre>\n<h4>6. Vis statistik i Megabytes<\/h4>\n<p>Den <strong>vmstat<\/strong> vises i megabyte med parametrene <strong>-S<\/strong> og <strong>-M<\/strong> (Store bogstaver og megabytes). Som standard vmstat viser statistikken i kilobyte.<\/p>\n<pre><strong>$ vmstat -S M 1 5<\/strong>\nprocs -----------memory---------- ---swap-- -----io---- -system-- ------cpu-----\n r  b   swpd   free   buff  cache   si   so    bi    bo   in   cs us sy id wa st\n 1  0      0   1156    140   2150    0    0     2     5   19   14  0  0 100  0  0\n 0  0      0   1156    140   2150    0    0     0     0   43   91  0  0 100  0  0\n 0  0      0   1157    140   2150    0    0     0     0   39  100  0  0 100  0  0\n 0  0      0   1157    140   2150    0    0     0     0   25   63  0  0 100  0  0\n 0  0      0   1157    140   2150    0    0     0     0   25   67  0  0 100  0  0\n<\/pre>\n<p>&nbsp;<\/p>\n<h4>7. Vis CPU and I\/O statistik<\/h4>\n<p><strong>iostat<\/strong> uden argumenter viser\u00a0<strong>CPU<\/strong> og <strong>I\/O<\/strong> statistik af alle parationer som vist her.<\/p>\n<p>&nbsp;<\/p>\n<pre>$iostat\n\nLinux 4.18.16-x86_64-linode118 (li517-215)     2018-12-29     _x86_64_    (2 CPU)\n\navg-cpu:  %user   %nice %system %iowait  %steal   %idle\n           0,15    0,00    0,14    0,01    0,01   99,69\n\nDevice:            tps    kB_read\/s    kB_wrtn\/s    kB_read    kB_wrtn\nsda               0,96         3,04        76,16    2082947   52199784\nsdb               0,00         0,00         0,00       1172          0\n\n<\/pre>\n<p>&nbsp;<\/p>\n<p>8. Vis kun CPU statistik<\/p>\n<p><strong>iostat<\/strong> med <strong>-c<\/strong> argument viser kun\u00a0<strong>CPU<\/strong> statistik som vist nedenfor.<\/p>\n<pre><strong>$ iostat -c<\/strong>\nLinux 4.18.16-x86_64-linode118 (li517-215)     2018-12-29     _x86_64_    (2 CPU)\n\navg-cpu:  %user   %nice %system %iowait  %steal   %idle\n           0,15    0,00    0,14    0,01    0,01   99,69<\/pre>\n<p>&nbsp;<\/p>\n<h4>9. Vis kun Disk I\/O statistik<\/h4>\n<p>&nbsp;<\/p>\n<p><strong>iostat<\/strong> med <strong>-d<\/strong> argument viser kun disk <strong>I\/O<\/strong> statistik for alle partitioner som vist.<\/p>\n<pre><strong>$ iostat -d<\/strong>\nLinux 4.18.16-x86_64-linode118 (li517-215)     2018-12-29     _x86_64_    (2 CPU)\n\nDevice:            tps    kB_read\/s    kB_wrtn\/s    kB_read    kB_wrtn\nsda               0,96         3,04        76,14    2082947   52200080\nsdb               0,00         0,00         0,00       1172          0\n<\/pre>\n<h4>10. Shows I\/O statistics only of a single device.<\/h4>\n<p>Som standard viser den statistik over alle partitioner med <strong>-p<\/strong> og device name argumenter viser kun disk I\/O statistik for specifikke enhed som vist.<\/p>\n<pre><strong>$ iostat -p sda<\/strong>\nLinux 4.18.16-x86_64-linode118 (li517-215)     2018-12-29     _x86_64_    (2 CPU)\n\navg-cpu:  %user   %nice %system %iowait  %steal   %idle\n           0,15    0,00    0,14    0,01    0,01   99,69\n\nDevice:            tps    kB_read\/s    kB_wrtn\/s    kB_read    kB_wrtn\nsda               0,96         3,04        76,13    2082947   52203476<\/pre>\n<p>&nbsp;<\/p>\n<h4>11. Display LVM Statistics<\/h4>\n<p>&nbsp;<\/p>\n<p>Med <strong>-N<\/strong> (Store bogstaver) parameter viser kun <strong>LVM<\/strong> statistik som vist.<\/p>\n<pre><strong>$ iostat -N<\/strong>\nLinux 4.18.16-x86_64-linode118 (li517-215)     2018-12-29     _x86_64_    (2 CPU)\n\navg-cpu:  %user   %nice %system %iowait  %steal   %idle\n           0,15    0,00    0,14    0,01    0,01   99,69\n\nDevice:            tps    kB_read\/s    kB_wrtn\/s    kB_read    kB_wrtn\nsda               0,96         3,04        76,14    2082947   52200276\nsdb               0,00         0,00         0,00       1172          0\n\n<\/pre>\n<p>&nbsp;<\/p>\n<p>12. iostat version.<\/p>\n<p>Med <strong>-V<\/strong> (Store bogstaver) parameter viser versionen af \u200b\u200biostat som vist.<\/p>\n<pre>$ iostat -V<\/pre>\n<p>sysstat version 11.2.0<br \/>\n(C) Sebastien Godard (sysstat &lt;at&gt; orange.fr)<\/p>\n<p>Bem\u00e6rk: vmstat og iostat indeholder antallet af kolonner og flag, som m\u00e5ske ikke er muligt at forklare i detaljer. Hvis du \u00f8nsker at vide mere om det, du kan henvise mennesket side vmstat og iostat. Venligst dele det, hvis du finder denne artikel er nyttigt gennem vores kommentar boksen nedenfor.<\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>vmstat og iostat begge kommandoer er tilg\u00e6ngelige p\u00e5 alle st\u00f8rre Unix-lignende (Linux \/ Unix \/ FreeBSD \/ Solaris) operativsystemer. Hvis vmstat og iostat kommandoerne ikke er tilg\u00e6ngelige p\u00e5 din boks, skal du installere sysstat pakke. Den vmstat, sar og iostat kommandoer er indsamlingen af \u200b\u200bpakken indg\u00e5r i sysstat &#8211; Systemet overv\u00e5gningsv\u00e6rkt\u00f8jer. Den iostat genererer rapporter [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_sitemap_exclude":false,"_sitemap_priority":"","_sitemap_frequency":"","footnotes":""},"categories":[2],"tags":[],"class_list":["post-241","post","type-post","status-publish","format-standard","hentry","category-tips"],"a3_pvc":{"activated":false,"total_views":0,"today_views":0},"_links":{"self":[{"href":"https:\/\/www.linuxboxen.dk\/index.php?rest_route=\/wp\/v2\/posts\/241","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.linuxboxen.dk\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.linuxboxen.dk\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.linuxboxen.dk\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.linuxboxen.dk\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=241"}],"version-history":[{"count":0,"href":"https:\/\/www.linuxboxen.dk\/index.php?rest_route=\/wp\/v2\/posts\/241\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.linuxboxen.dk\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=241"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.linuxboxen.dk\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=241"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.linuxboxen.dk\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=241"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}