From 78f4e42d21958963ad893742110a16a292b97ecb Mon Sep 17 00:00:00 2001 From: Lars Kruse Date: Sat, 22 Oct 2016 01:48:36 +0200 Subject: [PATCH] [cpubyuser] use 'clean_fieldname' instead of incomplete substitution (Closes: #757) --- plugins/system/cpubyuser | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/plugins/system/cpubyuser b/plugins/system/cpubyuser index c2522233..d5a42a11 100755 --- a/plugins/system/cpubyuser +++ b/plugins/system/cpubyuser @@ -37,6 +37,8 @@ #%# family=auto #%# capabilities=autoconf +. "$MUNIN_LIBDIR/plugins/plugin.sh" + if [ "$1" = "autoconf" ]; then if [ -n "$USERS" ]; then echo "yes" @@ -54,11 +56,11 @@ if [ "$1" = "config" ]; then echo "graph_vlabel %" echo "graph_scale no" echo "graph_period second" - _USERS=${USERS//[-.]/_} + _USERS="$(for user in $USERS; do clean_fieldname "$user" | tr '\n' ' '; done)" echo "graph_order $_USERS others" FIRSTUSER=1; for USER in $USERS "others"; do - _USER=${USER//[-.]/_} + _USER="$(clean_fieldname "$USER")" echo "${_USER}.label $USER" echo "${_USER}.info CPU used by user $USER" echo "${_USER}.type GAUGE"