mirror of
https://github.com/munin-monitoring/contrib.git
synced 2025-07-22 14:16:00 +00:00
Plugin lxc: separate function for title beautification
This avoids a bashism.
This commit is contained in:
parent
8b1d537602
commit
6bb4719881
1 changed files with 8 additions and 1 deletions
|
@ -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
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue