#!/bin/bash

cpus=$(cat /proc/cpuinfo  | grep processor | tail -1 | cut -d: -f2)
cpus=$((cpus + 1))
time=$(date +'%m%d %H:%M' --date='1 min ago')
#echo $time
used=$(tail -n 10000 /home/admin/logs/log.log 2>/dev/null | grep "$time" | grep abc | wc -l)

total=$(echo "$cpus * 12 / 10" | bc)

if [ -z "$used" ]; then
    used=0
fi

if [ $used -eq -1 ]; then
    used=$total
fi

#echo "$used $total"
echo "$used"

 

日志滚动,每分钟统计一次对应的数据。

 

待续

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-06-08
  • 2022-12-23
  • 2022-12-23
  • 2022-01-29
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-08-02
相关资源
相似解决方案