「glances」の版間の差分

提供: FreeBSD入門
移動: 案内検索
 
行7: 行7:
  
 
== 概要 ==
 
== 概要 ==
[[glances]] は、[[top]]や[[df]]、[[iostat]] などをコンビネーションしたようなコマンドです。
+
[[glances]] は、[[top]]やdf、iostat などをコンビネーションしたようなコマンドです。
  
 
<syntaxhighlight lang="bash">
 
<syntaxhighlight lang="bash">
行154: 行154:
 
   -1, --percpu          start Glances in per CPU mode
 
   -1, --percpu          start Glances in per CPU mode
 
</syntaxhighlight>
 
</syntaxhighlight>
 
 
=== サーバ・クライアントモード ===
 
=== サーバ・クライアントモード ===
 
監視したいノードで、サーバモードで起動します。
 
監視したいノードで、サーバモードで起動します。
行165: 行164:
 
192.168.0.2$ glances -c 10.0.0.2
 
192.168.0.2$ glances -c 10.0.0.2
 
</syntaxhighlight>
 
</syntaxhighlight>
 
 
== 関連項目 ==
 
== 関連項目 ==
 
* [[システムモニタリングコマンド]]
 
* [[システムモニタリングコマンド]]
 
<!-- vim: fileencoding=utf-8 filetype=mediawiki
 
<!-- vim: fileencoding=utf-8 filetype=mediawiki
 
-->
 
-->

2015年9月27日 (日) 22:05時点における最新版

glances とは、CPU、メモリ、ネットワーク、ディスクI/O、ファイルシステムの利用状況が確認できるコマンドです。サーバモードとクライアントモードがあり、サーバモードで起動したglancesにほかのノードからクライアントモードで起動したglancesに接続し、モニタリングできます。

読み方

glances
ぐらんすず

概要

glances は、topやdf、iostat などをコンビネーションしたようなコマンドです。

a1.local (FreeBSD 10.0-RELEASE 64bit)                                                                            Uptime: 2 days, 17:54:01
 
CPU       1.3%  nice:     0.0%LOAD    2-core                MEM     36.1%  active:    62.5M                SWAP      2.3%
user:     0.1%  irq:      0.0%1 min:    0.18                total:   476M  inactive:   276M                total:   4.00G
system:   1.1%                5 min:    0.18                used:    172M  buffers:   58.8M                used:    94.7M
idle:    98.7%                15 min:   0.21                free:    304M  cached:    6.83M                free:    3.91G
 
NETWORK     Rx/s   Tx/s   TASKS 59 (99 thr), 1 run, 54 slp, 4 oth sorted automatically by cpu_percent
em0          1Kb    3Kb
lo0         504b   504b     CPU%  MEM%  VIRT   RES   PID USER        NI S    TIME+ IOR/s IOW/s Command
                             1.5   3.5  103M 16.8M 32693 kaworu       0 R  0:00.36     0     0 /usr/local/bin/python2.7 /usr/local/bin/gl
DISK I/O     R/s    W/s      0.7   6.9 58.9M 33.1M  6941 kaworu       0 S 17:42.21     0     0 tmux: server (/tmp/tmux-1002/default)
cd0            0      0      0.1   0.0     0   16K     6 root         0 S  0:45.68     0     0 pagedaemon
da0            0      0      0.1   0.2 14.1M  980K   751 root         0 S  5:20.37     0     0 /usr/sbin/powerd
pass0          0      0      0.1   0.3 19.3M 1.55M 20783 kaworu       0 S  2:13.53     0     0 top
pass1          0      0      0.0   0.0     0  144K     0 root         0 S  0:17.98     0     0 kernel
                             0.0   0.0 9.21M  224K     1 root         0 S  0:00.38     0     0 /sbin/init --
FILE SYS    Used  Total      0.0   0.0     0   16K     2 root         0 S  0:00.00     0     0 mpt_recovery0
/ (da0p2)  13.2G  73.6G      0.0   0.0     0   16K     3 root         0 S  0:01.29     0     0 fdc0
                             0.0   0.0     0   16K     4 root         0 S  0:00.21     0     0 sctp_iterator
                             0.0   0.0     0   16K     5 root         0 S  0:00.00     0     0 xpt_thrd
                             0.0   0.0     0   16K     7 root         0 S  0:05.50     0     0 vmdaemon
                             0.0   0.0     0   16K     8 root         0 S  0:00.11     0     0 pagezero
                             0.0   0.0     0   16K     9 root         0 S  0:04.22     0     0 bufdaemon
                             0.0   0.0     0   16K    10 root         0 S  0:00.00     0     0 audit
                             0.0   0.1     0  272K    12 root         0 W  0:00.00     0     0 intr
                             0.0   0.0     0   48K    13 root         0 S  2:12.21     0     0 geom
                             0.0   0.0     0   16K    14 root         0 S  0:27.76     0     0 rand_harvestq
                             0.0   0.0     0  128K    15 root         0 S  0:20.90     0     0 usb
                             0.0   0.0     0   16K    16 root         0 S  0:02.98     0     0 vnlru
                             0.0   0.0     0   16K    17 root         0 S  0:49.53     0     0 syncer
 
2014-08-14 21:39:36       No warning or critical alert detected

パッケージの探し方

$ pkg search glances
py27-glances-2.0

インストール

pkgコマンドでインストールする場合

sudo pkg install py27-glances
$ sudo pkg install py27-glances
Updating repository catalogue
Fetching meta.txz: 100% of 944 B
Fetching digests.txz: 100% of 2 MB
Fetching packagesite.txz: 100% of 5 MB
Removing expired entries: 100%
Adding new entries: 100%
Incremental update completed, 23436 packages processed:
23277 packages updated, 36 removed and 159 added.
New version of pkg detected; it needs to be installed first.
The following 1 packages will be affected (of 0 checked):
 
Installed packages to be UPGRADED:
        pkg: 1.3.5.1 -> 1.3.6
 
The process will require 312 KB more space
2 MB to be downloaded
 
Proceed with this action [y/N]: y
Fetching pkg-1.3.6.txz: 100% of 2 MB
Checking integrity... done (0 conflicting)
[1/1] Upgrading pkg from 1.3.5.1 to 1.3.6: 100%
Updating repository catalogue
FreeBSD repository is up-to-date
All repositories are up-to-date
The following 2 packages will be affected (of 0 checked):
 
New packages to be INSTALLED:
        py27-glances: 2.0
        py27-psutil: 2.1.1
 
The process will require 3 MB more space
2 MB to be downloaded
 
Proceed with this action [y/N]: y
Fetching py27-glances-2.0.txz: 100% of 2 MB
Fetching py27-psutil-2.1.1.txz: 100% of 95 KB
Checking integrity... done (0 conflicting)
[1/2] Installing py27-psutil-2.1.1: 100%
[2/2] Installing py27-glances-2.0: 100%

設定

サンプルの設定ファイルは、

/usr/local/etc/glances/glances.conf.sample

です。

使い方

コマンドラインオプション

usage: glances [-h] [-V] [-b] [-B BIND_ADDRESS] [-c CLIENT] [-C CONF_FILE]
               [--disable-bold] [--disable-diskio] [--disable-fs]
               [--disable-network] [--disable-sensors] [--disable-process]
               [--disable-log] [--output-csv OUTPUT_CSV] [-p PORT]
               [--password-badidea PASSWORD_ARG] [--password] [-s]
               [--snmp-community SNMP_COMMUNITY] [--snmp-port SNMP_PORT]
               [--snmp-version SNMP_VERSION] [--snmp-user SNMP_USER]
               [--snmp-auth SNMP_AUTH] [-t TIME] [-w] [-1]
 
optional arguments:
  -h, --help            show this help message and exit
  -V, --version         show program's version number and exit
  -b, --byte            display network rate in byte per second
  -B BIND_ADDRESS, --bind BIND_ADDRESS
                        bind server to the given IPv4/IPv6 address or hostname
  -c CLIENT, --client CLIENT
                        connect to a Glances server by IPv4/IPv6 address or
                        hostname
  -C CONF_FILE, --config CONF_FILE
                        path to the configuration file
  --disable-bold        disable bold mode in the terminal
  --disable-diskio      disable disk I/O module
  --disable-fs          disable filesystem module
  --disable-network     disable network module
  --disable-sensors     disable sensors module
  --disable-process     disable process module
  --disable-log         disable log module
  --output-csv OUTPUT_CSV
                        export stats to a CSV file
  -p PORT, --port PORT  define the client/server TCP port [default: 61209]
  --password-badidea PASSWORD_ARG
                        define password from the command line
  --password            define a client/server password from the prompt or
                        file
  -s, --server          run Glances in server mode
  --snmp-community SNMP_COMMUNITY
                        SNMP community
  --snmp-port SNMP_PORT
                        SNMP port
  --snmp-version SNMP_VERSION
                        SNMP version (1, 2c or 3)
  --snmp-user SNMP_USER
                        SNMP username (only for SNMPv3)
  --snmp-auth SNMP_AUTH
                        SNMP authentication key (only for SNMPv3)
  -t TIME, --time TIME  set refresh time in seconds [default: 3 sec]
  -w, --webserver       run Glances in web server mode
  -1, --percpu          start Glances in per CPU mode

サーバ・クライアントモード

監視したいノードで、サーバモードで起動します。

10.0.0.2$ glances -s

監視もとのノードで、glancesをクライアントモードで起動します。このとき、リモートのノードのホスト名(もしくは、IPアドレス)を指定します。

192.168.0.2$ glances -c 10.0.0.2

関連項目