2
0
mirror of https://github.com/munin-monitoring/contrib.git synced 2018-11-08 00:59:34 +01:00

Munin doesn't like special chars in the VM-name. This fix replaces all chars except a-z, A-Z and 0-9, with underscore.

This commit is contained in:
Joachim Tingvold 2010-09-10 21:32:03 +02:00 committed by Steve Schnepp
parent 940c49f363
commit 724072e729

View File

@ -1,7 +1,7 @@
#!/bin/bash #!/bin/bash
GREP="/usr/bin/grep" GREP="/bin/grep"
SED="/usr/bin/sed" SED="/bin/sed"
TAIL="/usr/bin/tail" TAIL="/usr/bin/tail"
SSH="/usr/bin/ssh" SSH="/usr/bin/ssh"
BASENAME="/usr/bin/basename" BASENAME="/usr/bin/basename"
@ -254,9 +254,10 @@ if [ -n "$vmlist" ]; then
n=0 n=0
while [ -n "${id[$n]}" ]; do while [ -n "${id[$n]}" ]; do
#echo ${id[$n]} ${name[$n]} ${vmcpu[$n]} ${vmmem[$n]} #echo ${id[$n]} ${name[$n]} ${vmcpu[$n]} ${vmmem[$n]}
nicename=`echo ${name[$n]} | sed 's/[^a-z|A-Z|0-9]/\_/g'`
case $which_info in case $which_info in
"cpu" ) echo "${name[$n]}".value "${vmcpu[$n]}";; "cpu" ) echo "$nicename".value "${vmcpu[$n]}";;
"mem" | "gmem" | "hmem" ) echo "${name[$n]}".value "$((${vmmem[$n]}))";; "mem" | "gmem" | "hmem" ) echo "$nicename".value "$((${vmmem[$n]}))";;
esac esac
(( n++ )) (( n++ ))
done done