自动抓取服务器功耗

以下脚本为linux系统内通过ipmitool工具自动抓取服务器当前功耗,每隔5分钟抓取一次,累计抓取20次

脚本如下:

bash 复制代码
#!/bin/bash

current_dir=`pwd`
node_list=${current_dir}/nodelistbmc      #BMC IP
username=Administrator                   #BMC用户
password=Admin@9000                      #BMC用户密码
sum=20									 #抓取次数

readarray -t ip_address < ${node_list}
count=${#ip_address[@]}

echo -e "\n>>> Start to grab power consumption>>>"
echo -e "--------------------------------------------------------------------------"
while (($sum>0));
do
   for (( i=0; i<$count; i++ ))
   do
      echo -e "\n>>> This is the $ith time of grabbing "
      echo -n ${ip_address[$i]}, >> ${current_dir}/consumption.log
      ipmitool -H ${ip_address[$i]}  -I lanplus -U ${username} -P ${password} sdr elist | awk -F"|" '/^Power  /{print $5}'  >> ${current_dir}/consumption.log

   done
sum=`expr $sum - 1`
sleep 300            #每隔5分钟抓取一次
done

echo -e "--------------------------------------------------------------------------"
echo -e "\n>>>Grabbing finished>>>"
[root@linux ~]#

日常总结,一起学习进步

相关推荐
MrSYJ4 分钟前
Netty异常传播机制
java·服务器·netty
REDcker23 分钟前
Linux Core Dump 配置与分析指南
linux·运维·服务器
IMPYLH33 分钟前
Linux 的 chcon 命令
linux·运维·服务器
苦逼IT运维1 小时前
SVN 仓库目录迁移,仓库 “降级” 成子目录实战
linux·运维·ci/cd·svn·运维开发
阿拉斯攀登1 小时前
第 13 篇 输入设备驱动(触摸屏 / 按键)开发详解,Linux input 子系统全解析
android·linux·运维·驱动开发·rk3568·瑞芯微·rk安卓驱动
ego.iblacat1 小时前
Nginx 性能优化与深度监控
运维·nginx·性能优化
爱丽_1 小时前
TCP 三次握手与四次挥手
服务器·网络·tcp/ip
智能工业品检测-奇妙智能1 小时前
金属矿山安全智能AI视觉识别
服务器·人工智能·安全·openclaw·奇妙智能
bukeyiwanshui1 小时前
【无标题】
linux·运维·服务器
疯狂吧小飞牛1 小时前
Linux 多网卡同网段配置冲突问题
linux·运维·服务器