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

Add comments for evals

This commit is contained in:
K.Cima 2016-11-28 23:55:30 +09:00
parent fe8908c326
commit 289b99d401

View File

@ -495,7 +495,9 @@ config() {
local line t fields field type draw label local line t fields field type draw label
while IFS= read -r line while IFS= read -r line
do do
eval 't=(' "$line" ')' # split line into field,type,draw,label
# eval looks necessary to preserve whitespaces
eval "t=( ${line} )"
field="${t[0]}" field="${t[0]}"
[ -z "$field" ] && continue [ -z "$field" ] && continue
fields+=( $field ) fields+=( $field )
@ -511,13 +513,19 @@ config() {
echo graph_order "${fields[@]}" echo graph_order "${fields[@]}"
} }
# wrapper for getfield_*
getfield() { getfield() {
if [ -n "${getfield_func[$module]:-}" ]; then if [ -n "${getfield_func[$module]:-}" ]; then
# call getfield_* function with args if necessary
# eval looks necessary if args contain whitespaces
eval "${getfield_func[$module]}" eval "${getfield_func[$module]}"
fi fi
} }
# wrapper for getvalue_*
getvalue() { getvalue() {
# call getvalue_* function with args if necessary
# eval looks necessary if args contain whitespaces
eval "${getvalue_func[$module]}" eval "${getvalue_func[$module]}"
} }
@ -525,7 +533,9 @@ getvalue_sysstat() {
local line t field label local line t field label
while IFS= read -r line while IFS= read -r line
do do
eval 't=(' "$line" ')' # split line into field,type,draw,label
# eval looks necessary to preserve whitespaces
eval "t=( ${line} )"
field="${t[0]}" field="${t[0]}"
[ -z "$field" ] && continue [ -z "$field" ] && continue
label="${t[3]}" label="${t[3]}"
@ -550,7 +560,9 @@ getvalue_sgainfo() {
local line t field label local line t field label
while IFS= read -r line while IFS= read -r line
do do
eval 't=(' "$line" ')' # split line into field,type,draw,label
# eval looks necessary to preserve whitespaces
eval "t=( ${line} )"
field="${t[0]}" field="${t[0]}"
[ -z "$field" ] && continue [ -z "$field" ] && continue
label="${t[3]}" label="${t[3]}"
@ -575,7 +587,9 @@ getvalue_pgastat() {
local line t field label local line t field label
while IFS= read -r line while IFS= read -r line
do do
eval 't=(' "$line" ')' # split line into field,type,draw,label
# eval looks necessary to preserve whitespaces
eval "t=( ${line} )"
field="${t[0]}" field="${t[0]}"
[ -z "$field" ] && continue [ -z "$field" ] && continue
label="${t[3]}" label="${t[3]}"