mirror of
https://github.com/munin-monitoring/contrib.git
synced 2025-07-22 14:16:00 +00:00
systemd_units: avoid use of temporary file
This commit is contained in:
parent
b31b861f1c
commit
a2f1592fe5
1 changed files with 3 additions and 5 deletions
|
@ -60,14 +60,12 @@ EOF
|
||||||
}
|
}
|
||||||
|
|
||||||
fetch () {
|
fetch () {
|
||||||
tmp=$(mktemp -t munin-systemd_units.XXXXXX)
|
tmp=$(systemctl --no-pager --no-legend --all | awk '{print $1, $3}')
|
||||||
trap "rm \"$tmp\"" EXIT
|
|
||||||
systemctl --no-pager --no-legend --all | awk '{print $1, $3}' > "$tmp"
|
|
||||||
for state in \
|
for state in \
|
||||||
$states ; do
|
$states ; do
|
||||||
echo -n "$state.value "
|
echo -n "$state.value "
|
||||||
grep -c "$state$" "$tmp"
|
echo "$tmp" | grep -c "$state$"
|
||||||
extinfo=$(grep "$state$" "$tmp" | cut -d " " -f 1)
|
extinfo=$(echo "$tmp" | grep "$state$" | cut -d " " -f 1)
|
||||||
if [ -n "$extinfo" ]; then
|
if [ -n "$extinfo" ]; then
|
||||||
echo "$state.extinfo" $extinfo
|
echo "$state.extinfo" $extinfo
|
||||||
fi
|
fi
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue