From f35527494aeb8033f53fc6d7823eea49f2e71e87 Mon Sep 17 00:00:00 2001 From: Michael Grote Date: Wed, 15 Sep 2021 23:52:17 +0200 Subject: [PATCH] proxmox_lxc_count angelegt --- proxmox_lxc_count | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 proxmox_lxc_count diff --git a/proxmox_lxc_count b/proxmox_lxc_count new file mode 100644 index 0000000..c696e51 --- /dev/null +++ b/proxmox_lxc_count @@ -0,0 +1,40 @@ +#!/bin/bash +#%# family=auto +#%# capabilities=autoconf + +# Michael Grote +# michael.grote ät posteo.de +# Outputs the running, stopped and total counts of ProxMox LXCs. +# needs to be run as user: root AND group: root +# [kvm_vm_count] +# user root +# group root + +wpct=$(which pct) +total=$($wpct list | sed 1d | wc -l) +running=$($wpct list | sed 1d | grep running | wc -l) +stopped=$($wpct list | sed 1d | grep stopped | wc -l) + +# wenn parameter = ... +if [ "$1" = "autoconf" ]; then + echo yes + exit 0 +fi + +if [ "$1" = "config" ]; then + # setze label + echo total.label total + echo running.label running + echo stopped.label stopped + # setze optionen + echo 'graph_title Number of LXCs' + echo 'graph_vlabel Count' + echo 'graph_category virtualization' + echo 'graph_args -l 0' + exit 0 +fi + +echo total.value $total +echo running.value $running +echo stopped.value $stopped +exit 0