LoginSignup
1
1

More than 1 year has passed since last update.

ラズパイの情報取得用コマンド

Last updated at Posted at 2021-07-24

はじめに

ラズパイの情報を取得するためのコマンドをまとめました。
今後、役立ちそうなコマンドを見つけたら追記していく予定です。

検証に使用したOS

以下のOSで検証しました。

pi@raspberrypi:~ $ lsb_release -a
No LSB modules are available.
Distributor ID: Raspbian
Description:    Raspbian GNU/Linux 10 (buster)
Release:        10
Codename:       buster

コマンド

システム起動時刻

pi@raspberrypi:~ $ uptime -s
2021-07-23 21:11:56

※以下のコマンドでは時刻を同期する前の起動時刻しか分からない。

pi@raspberrypi:~ $ who -b
         システム起動 1970-01-01 09:00

カーネルのバージョン

pi@raspberrypi:~ $ uname -a
Linux raspberrypi 5.10.17-v7+ #1421 SMP Thu May 27 13:59:01 BST 2021 armv7l GNU/Linux

sudo apt full-upgradeをした直後では更新結果が反映されないので注意。再起動後に反映される。

Revision、シリアル番号、モデル

[参考]
https://www.raspberrypi.org/documentation/hardware/raspberrypi/revision-codes/README.md
※一部省略および伏字にしています。

pi@raspberrypi:~ $ cat /proc/cpuinfo
Revision        : a32082
Serial          : 00000000********
Model           : Raspberry Pi 3 Model B Rev 1.2

停電等による電源断の有無を判定

以下のコマンドでシステム起動後の経過時間が分かるため、電源断の有無を判定できる。

pi@raspberrypi:~ $ uptime
 22:30:33 up  1:18,  3 users,  load average: 0.30, 0.22, 0.19

温度

pi@raspberrypi:~ $ vcgencmd measure_temp
temp=49.4'C

電圧異常等の有無および内容

[参考]
https://www.raspberrypi.org/documentation/raspbian/applications/vcgencmd.md
https://github.com/raspberrypi/userland/blob/master/host_applications/linux/apps/gencmd/vcgencmd.1
https://www.raspberrypi.org/documentation/hardware/raspberrypi/frequency-management.md

pi@raspberrypi:~ $ vcgencmd get_throttled
throttled=0x0

[戻り値の説明(0x0は正常を意味する)]

Hex value Meaning 説明
0x1 Under-voltage detected 低電圧を現在検知している。
0x2 Arm frequency capped CPUの周波数が現在制限されている。
0x4 Currently throttled 現在、制限を受けている。
0x8 Soft temperature limit active ソフトな制限温度に達している。soft limitは60度、hard limitは85度。
0x10000 Under-voltage has occurred 低電圧が発生したことがある。現在は発生していない。
0x20000 Arm frequency capping has occurred CPUの周波数が制限されたことがある。現在は制限されていない。
0x40000 Throttling has occurred 制限を受けたことがある。現在は制限を受けていない。
0x80000 Soft temperature limit has occurred ソフトな制限温度に達したことがある。現在は制限温度未満。
1
1
3

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1