ipmitool sdr |grep -i Fan |grep Speed
时间: 2023-08-15 15:09:07 浏览: 75
根据提供的引用内容,使用ipmitool命令可以获取服务器风扇的数量和转速。可以使用以下命令来获取风扇信息:ipmitool sdr |grep -i Fan |grep Speed。
#### 引用[.reference_title]
- *1* *2* *3* *4* *5* [ipmitool管理工具](https://blog.csdn.net/weixin_39713841/article/details/112052774)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^insertT0,239^v3^insert_chatgpt"}} ] [.reference_item]
[ .reference_list ]
相关问题
python 脚本:长跑之前检查 linux下获取”cat /proc/cpuinfo | grep -i 'Model name' | awk -F: '{$1="";sub("^ *","");$2="";sub(" *$","");print}' dmidecode -t processor | grep -c Version dmidecode -t memory | grep -i 'Part Number' | grep -v 'NO DIMM' | awk -F: '{$1="";sub("^ *","");$2="";sub(" *$","");print}' dmidecode -t memory | grep -i size | grep -cvi no lspci | grep Eth | awk -F ': ' '{$1="";sub("^ *","");$2="";sub(" *$","");print}'“并保存结果,执行ipmitool power cycle,进入系统后继续检查”cat /proc/cpuinfo | grep -i 'Model name' | awk -F: '{$1="";sub("^ *","");$2="";sub(" *$","");print}' dmidecode -t processor | grep -c Version dmidecode -t memory | grep -i 'Part Number' | grep -v 'NO DIMM' | awk -F: '{$1="";sub("^ *","");$2="";sub(" *$","");print}' dmidecode -t memory | grep -i size | grep -cvi no lspci | grep Eth | awk -F ': ' '{$1="";sub("^ *","");$2="";sub(" *$","");print}' 脚本循环20次。
这是一个检查 Linux 系统硬件信息的 Python 脚本,执行过程如下:
1. 使用命令 `cat /proc/cpuinfo | grep -i 'Model name' | awk -F: '{$1="";sub("^ *","");$2="";sub(" *$","");print}'` 获取 CPU 型号信息;
2. 使用命令 `dmidecode -t processor | grep -c Version` 获取 CPU 版本信息;
3. 使用命令 `dmidecode -t memory | grep -i 'Part Number' | grep -v 'NO DIMM' | awk -F: '{$1="";sub("^ *","");$2="";sub(" *$","");print}'` 获取内存型号信息;
4. 使用命令 `dmidecode -t memory | grep -i size | grep -cvi no` 获取内存大小信息;
5. 使用命令 `lspci | grep Eth | awk -F ': ' '{$1="";sub("^ *","");$2="";sub(" *$","");print}'` 获取网卡型号信息;
6. 将上述信息保存到文件中;
7. 执行 `ipmitool power cycle` 命令重启系统;
8. 进入系统后重复执行步骤 1-5;
9. 循环执行上述步骤 20 次。
下面是实现这个脚本的 Python 代码:
```python
import os
count = 20
for i in range(count):
# 获取 CPU 型号信息
cpu_model = os.popen("cat /proc/cpuinfo | grep -i 'Model name' | awk -F: '{$1=\"\";sub(\"^ *\",\"\",$2);$2=\"\";sub(\" *$\",\"\",$2);print}'").read().strip()
# 获取 CPU 版本信息
cpu_version = os.popen("dmidecode -t processor | grep -c Version").read().strip()
# 获取内存型号信息
memory_model = os.popen("dmidecode -t memory | grep -i 'Part Number' | grep -v 'NO DIMM' | awk -F: '{$1=\"\";sub(\"^ *\",\"\",$2);$2=\"\";sub(\" *$\",\"\",$2);print}'").read().strip()
# 获取内存大小信息
memory_size = os.popen("dmidecode -t memory | grep -i size | grep -cvi no").read().strip()
# 获取网卡型号信息
nic_model = os.popen("lspci | grep Eth | awk -F ': ' '{$1=\"\";sub(\"^ *\",\"\",$2);$2=\"\";sub(\" *$\",\"\",$2);print}'").read().strip()
# 将信息保存到文件中
with open("hardware_info.txt", "a") as f:
f.write(f"CPU 型号: {cpu_model}\n")
f.write(f"CPU 版本: {cpu_version}\n")
f.write(f"内存型号: {memory_model}\n")
f.write(f"内存大小: {memory_size}\n")
f.write(f"网卡型号: {nic_model}\n")
f.write("\n")
# 重启系统
os.system("ipmitool power cycle")
# 等待系统重启完成
time.sleep(60)
# 再次获取硬件信息
cpu_model = os.popen("cat /proc/cpuinfo | grep -i 'Model name' | awk -F: '{$1=\"\";sub(\"^ *\",\"\",$2);$2=\"\";sub(\" *$\",\"\",$2);print}'").read().strip()
cpu_version = os.popen("dmidecode -t processor | grep -c Version").read().strip()
memory_model = os.popen("dmidecode -t memory | grep -i 'Part Number' | grep -v 'NO DIMM' | awk -F: '{$1=\"\";sub(\"^ *\",\"\",$2);$2=\"\";sub(\" *$\",\"\",$2);print}'").read().strip()
memory_size = os.popen("dmidecode -t memory | grep -i size | grep -cvi no").read().strip()
nic_model = os.popen("lspci | grep Eth | awk -F ': ' '{$1=\"\";sub(\"^ *\",\"\",$2);$2=\"\";sub(\" *$\",\"\",$2);print}'").read().strip()
# 将信息保存到文件中
with open("hardware_info.txt", "a") as f:
f.write(f"重启后 CPU 型号: {cpu_model}\n")
f.write(f"重启后 CPU 版本: {cpu_version}\n")
f.write(f"重启后 内存型号: {memory_model}\n")
f.write(f"重启后 内存大小: {memory_size}\n")
f.write(f"重启后 网卡型号: {nic_model}\n")
f.write("\n")
```
注意,如果要执行 `ipmitool power cycle` 命令需要使用 root 权限。此外,为了防止重启过程中文件写入失败,最好将文件名改为绝对路径。
ipmitool sdr type输出的详细信息
ipmitool sdr type命令可以用于显示特定传感器数据记录器类型的详细信息。以下是该命令输出的示例:
```bash
[root@localhost ~]# ipmitool sdr type temperature
Temp | 0C | ok | -5.000 | -2.000 | -1.000 | 1.000 | 2.000
Temp | 67h | ok | -127.000 | -124.000 | -123.000 | -121.000 | -120.000
```
这里输出了两个传感器数据记录器,其类型为“temperature”。每个记录器都包含以下信息:
- “Temp”:传感器的名称
- “0C”和“67h”:传感器的ID
- “ok”:传感器状态,如果传感器正常工作,则显示“ok”
- “-5.000”和“-127.000”:传感器的最小值
- “2.000”和“-120.000”:传感器的最大值
此外,还有一些其他的信息,例如传感器的阈值和事件控制。