1
0
Fork 0
mirror of https://github.com/munin-monitoring/contrib.git synced 2025-07-22 02:51:03 +00:00

Plugin lxc: separate function for title beautification

This avoids a bashism.
This commit is contained in:
Lars Kruse 2019-08-12 01:38:16 +02:00
parent 8b1d537602
commit 6bb4719881

View file

@ -171,6 +171,13 @@ lxc_count_processes () {
} }
# change the first character of a string to upper case
title_case() {
local text="$1"
printf "%s%s" "$(echo "$text" | cut -c 1 | tr "[:lower:]" "[:upper:]")" "$(echo "$text" | cut -c 2-)"
}
# --- BASIC DEFINES # --- BASIC DEFINES
active_guests=$(active_guests "$exclude") active_guests=$(active_guests "$exclude")
@ -204,7 +211,7 @@ EOF
for cpu_usage in user system for cpu_usage in user system
do do
cat <<EOF cat <<EOF
$(clean_fieldname "cpu_${cpu_usage}__${guest_name}").label $guest_name: $(echo "${cpu_usage:0:1}" | tr "[:lower:]" "[:upper:]")${cpu_usage:1} $(clean_fieldname "cpu_${cpu_usage}__${guest_name}").label $guest_name: $(title_case "$cpu_usage")
$(clean_fieldname "cpu_${cpu_usage}__${guest_name}").type DERIVE $(clean_fieldname "cpu_${cpu_usage}__${guest_name}").type DERIVE
$(clean_fieldname "cpu_${cpu_usage}__${guest_name}").min 0 $(clean_fieldname "cpu_${cpu_usage}__${guest_name}").min 0
EOF EOF