Linuxシステムに関する情報を収集することは、重要なsysadminタスクです。この点で役立つツールはたくさんあります。ただし、いくつかのオプションとパラメータだけで多くの情報を収集できる1つのコマンドはinxiです。
inxi
ツールは、コンソール/ターミナル/シェルまたはIRCクライアントにあらゆる種類のシステム情報を表示するフル機能のCLIユーティリティです。システムに関するさまざまなソースからこの情報を収集するため、必要な情報を使いやすい形式で確認できます。
[次のこともお勧めします:Linuxツール:dmesgを使用してメッセージを出力する]
inxiのインストール
Red Hat Enterprise Linux(RHEL)システムには、デフォルトでinxiがインストールされていません。 epel-releaseリポジトリから入手できます。 inxi
をインストールするには 、システムで次のコマンドを実行します
RHEL 7で、inxi
をインストールします yum
を使用する コマンド:
# yum install -y epel-release
# yum install -y inxi
RHEL 8では、dnf
コマンドは次のようになります:
# dnf install -y epel-release
# dnf install -y inxi
以下は、すべてのinxi
の概要です。 コマンドオプション:
inxi [-AbBCdDEfFGhiIjJlLmMnNopPrRsSuUVwzZ]
inxi
の場合 オプションなしで実行すると、1行のシステムデータとinxi
が表示されます バージョン:
# inxi
CPU: Single Core Intel Core i5-7360U (-MCP-) speed: 2304 MHz Kernel: 4.18.0-240.22.1.el8_3.x86_64 x86_64 Up: 19h 39m
Mem: 371.9/810.7 MiB (45.9%) Storage: 14.01 GiB (36.3% used) Procs: 118 Shell: Bash inxi: 3.3.03
注 :inxi
通常のユーザー権限で実行できますが、一部のオプションでは追加のアクセスが必要になるため、可能であれば特権アカウントを使用してください。
例
基本的なシステム情報を表示するには、次のオプションを指定してコマンドを実行します。
# inxi -b
仮想マシンからの出力例は次のとおりです(簡潔にするために出力は切り捨てられています):
System: Host: server1 Kernel: 4.18.0-240.22.1.el8_3.x86_64 x86_64 bits: 64 Console: tty pts/0
Distro: Red Hat Enterprise Linux release 8.4 (Ootpa)
Machine: Type: Virtualbox System: innotek product: VirtualBox v: 1.2 serial: N/A
Mobo: Oracle model: VirtualBox v: 1.2 serial: N/A BIOS: innotek v: VirtualBox date: 12/01/2006
Battery: ID-1: BAT0 charge: 50.0 Wh (100.0%) condition: 50.0/50.0 Wh (100.0%) volts: 10.0 min: 10.0
CPU: Info: Single Core Intel Core i5-7360U [MCP] speed: 2304 MHz
Network: Device-1: Intel 82540EM Gigabit Ethernet driver: e1000
Device-2: Intel 82371AB/EB/MB PIIX4 ACPI type: network bridge driver: piix4_smbus
Drives: Local Storage: total: 14.01 GiB used: 5.07 GiB (36.2%)
Info: Processes: 121 Uptime: 18h 34m Memory: 810.7 MiB used: 369.6 MiB (45.6%) Init: systemd runlevel: 3 Shell: Bash
inxi: 3.3.03
システム全体の出力を表示するには、次を使用します:
# inxi -F
<Long list - omitted>
CPU情報のみを表示するには:
# inxi -C
CPU: Info: Single Core model: Intel Core i5-7360U bits: 64 type: MCP cache: L2: 4 MiB
Speed: 2304 MHz min/max: N/A Core speed (MHz): 1: 2304
ネットワークデバイスとドライバーを表示するには:
# inxi -N
Network: Device-1: Intel 82540EM Gigabit Ethernet driver: e1000
Device-2: Intel 82371AB/EB/MB PIIX4 ACPI type: network bridge driver: piix4_smbus
インターフェイス、速度、MAC ID、状態などの高度なネットワークデバイス情報を表示するには、次のコマンドを実行します。
# inxi -n
Network: Device-1: Intel 82540EM Gigabit Ethernet driver: e1000
IF: enp0s3 state: up speed: 1000 Mbps duplex: full mac: 08:00:27:e6:6a:a9
Device-2: Intel 82371AB/EB/MB PIIX4 ACPI type: network bridge driver: piix4_smbus
ハードディスク情報を表示するには:
# inxi -D
Drives: Local Storage: total: 14.01 GiB used: 5.12 GiB (36.6%)
ID-1: /dev/sda vendor: VirtualBox model: VBOX HARDDISK size: 14.01 GiB
システムに設定されているリポジトリを表示するには:
# inxi -r
Repos: No active yum repos in: /etc/yum.conf
Active yum repos in: /etc/yum.repos.d/epel-modular.repo
1: epel-modular ~ https://mirrors.fedoraproject.org/metalink?repo=epel-modular-$releasever&arch=$basearch&infra=$infra&content=$contentdir
No active yum repos in: /etc/yum.repos.d/epel-playground.repo
No active yum repos in: /etc/yum.repos.d/epel-testing-modular.repo
No active yum repos in: /etc/yum.repos.d/epel-testing.repo
Active yum repos in: /etc/yum.repos.d/epel.repo
1: epel ~ https://mirrors.fedoraproject.org/metalink?repo=epel-$releasever&arch=$basearch&infra=$infra&content=$contentdir
Active yum repos in: /etc/yum.repos.d/redhat.repo
1: satellite-tools-6.9-for-rhel-8-x86_64-eus-debug-rpms ~ https://cdn.redhat.com/content/eus/rhel8/$releasever/x86_64/sat-tools/6.9/debug
2: satellite-tools-6.9-for-rhel-8-x86_64-eus-source-rpms ~ https://cdn.redhat.com/content/eus/rhel8/$releasever/x86_64/sat-tools/6.9/source/SRPMS
3: rhel-atomic-7-cdk-3.0-beta-source-rpms ~ https://cdn.redhat.com/content/beta/rhel/atomic/7/$basearch/cdk/3.0/source/SRPMS
サーバーまたはシステムのパーティションを表示するには:
# inxi -p
Partition: ID-1: / size: 12.2 GiB used: 4.75 GiB (38.9%) fs: xfs dev: /dev/dm-0
ID-2: /boot size: 1014 MiB used: 307.5 MiB (30.3%) fs: xfs dev: /dev/sda1
ID-3: [SWAP] raw-size: 820 MiB size: N/A (hidden?) used: N/A (hidden?) fs: swap dev: /dev/rhel-swap
ID-4: swap-1 size: 820 MiB used: 75.8 MiB (9.2%) fs: swap dev: /dev/dm-1
使用可能なすべてのスロットでメモリデータを表示するには:
# inxi -m
Memory: RAM: total: 810.7 MiB used: 373 MiB (46.0%)
RAM Report: message: No RAM data was found.
メモリデータの短いレポートを表示するには:
# inxi --memory-short
Memory: RAM: total: 810.7 MiB used: 373 MiB (46.0%)
RAM Report: message: No RAM data was found.
CPUとRAMの使用量を含むプロセスを表示するには:
# inxi -t
Processes: CPU top: 5 of 118
1: cpu: 0.2% command: pmdaproc pid: 27122
2: cpu: 0.2% command: pmdalinux pid: 27125
3: cpu: 0.1% command: pmdaopenmetrics.python started by: python3 pid: 27132
4: cpu: 0.0% command: systemd pid: 1
5: cpu: 0.0% command: [kthreadd] pid: 2
System RAM: total: 810.7 MiB used: 373 MiB (46.0%)
Memory top: 5 of 118
1: mem: 27.2 MiB (3.3%) command: platform-python pid: 35915
2: mem: 18.5 MiB (2.2%) command: pmdaopenmetrics.python started by: python3 pid: 27132
3: mem: 10.5 MiB (1.2%) command: sssd_nss pid: 78029
4: mem: 10.1 MiB (1.2%) command: pmlogger pid: 124136
5: mem: 10.1 MiB (1.2%) command: sssd_be pid: 7802
CPUとRAMを消費している上位10のプロセスを表示する場合は、次を実行します。
# inxi -t cm10
< Lengthy output omitted >
inxi
コマンドは、さまざまな詳細レベル(0〜8)もサポートしており、データのクエリにも使用できます。例:
# inxi -v 4 - will show Partition(-P) and Disk info(-D).
# inxi -v 3 - will show Advanced CPU (-C), battery (-B), and network (-n)
利用できないリソース
それでは、特定のリソースが利用できない状況とinxi
を見てみましょう。 それに対して実行されます。たとえば、サーバーにUSBデバイスが接続されていません。 -J
を使用して、システム上のUSBデバイスを照会してみましょう。 オプション:
# inxi -J
USB: Message: No USB data was found. Server?
これは、USBが接続されていないことを意味します。 USBが利用可能なサーバーでは、出力は次のようになります。
# inxi -J
USB: Hub-1: 1-0:1 info: Full speed (or root) Hub ports: 12 rev: 1.1
うまくいけば、これらの例がお役に立てば幸いです。詳細と利用可能なオプションについては、以下をお試しください:
# inxi -h
[無料のオンラインコース:Red HatEnterpriseLinuxの技術概要。 ]
そして、ここにボーナスの非システム情報コマンドがあります:
# inxi -w
Weather: Report: temperature: 27.8 C (82 F) conditions: Heavy rain
Locale: current time: Thu 10 Jun 2021 01:50:15 PM EDT (America/New_York) Source: WeatherBit.io
まとめ
システム管理者がサーバーに関する情報を収集するのは難しい場合がありますが、inxi
ユーティリティは、そのプロセスを簡素化するのに役立ちます。 RHELサーバーにインストールして、提供されるすべての優れた情報を調べてください。これで、CPU、メモリ、ストレージ、ネットワーク、さらには天気データを1つの簡単なコマンドで収集できます。