diff --git a/plugins/system/systemd_units b/plugins/system/systemd_units index 4f9ec61c..34563fd3 100755 --- a/plugins/system/systemd_units +++ b/plugins/system/systemd_units @@ -60,14 +60,12 @@ EOF } fetch () { - tmp=$(mktemp -t munin-systemd_units.XXXXXX) - trap "rm \"$tmp\"" EXIT - systemctl --no-pager --no-legend --all | awk '{print $1, $3}' > "$tmp" + tmp=$(systemctl --no-pager --no-legend --all | awk '{print $1, $3}') for state in \ $states ; do echo -n "$state.value " - grep -c "$state$" "$tmp" - extinfo=$(grep "$state$" "$tmp" | cut -d " " -f 1) + echo "$tmp" | grep -c "$state$" + extinfo=$(echo "$tmp" | grep "$state$" | cut -d " " -f 1) if [ -n "$extinfo" ]; then echo "$state.extinfo" $extinfo fi