Skip to content

Instantly share code, notes, and snippets.

View jens-maus's full-sized avatar
💻
Busy developing for you!

Jens Maus jens-maus

💻
Busy developing for you!
View GitHub Profile
@jens-maus
jens-maus / lxc_cpu.sh
Created July 28, 2023 16:37
CheckMK LXC container CPU local check script to output CPU utilization in the range of 0-100% (required for ProxmoxVE LXC)
#!/bin/bash
cpu_last_sum=0
while :; do
# get the first line with aggregate of all CPUs
cpu_now=($(head -n1 /proc/stat))
# get all columns but skip the first (which is the "cpu" string)
cpu_sum="${cpu_now[@]:1}"