mrtg/scripts/lxc-stats.sh
2020-04-18 20:39:12 +02:00

16 lines
317 B
Bash
Executable File

#!/bin/sh
DIR=/var/www/lxc-api/htdocs
lxc-ls -1 --running > "$DIR/index.html"
lxc-ls -1 --running | while read c;
do
[ ! -d "$DIR/$c" ] && mkdir "$DIR/$c";
t="$(lxc-info -H -S -n $c)"
for i in CPU Memory RX TX
do
echo -e "$t" | grep "$i " | awk -F: '{print $2}' | sed 's/^[ ]*//g' > "$DIR/$c/$i"
done
done