25 lines
954 B
Bash
Executable File
25 lines
954 B
Bash
Executable File
#!/bin/bash
|
|
for res in /proc/pressure/*; do
|
|
res_name=$(basename $res)
|
|
res_name_nice=${res_name@U}
|
|
res_name_nice=${res_name_nice/MEMORY/Memory}
|
|
while read line; do
|
|
for v in $line; do
|
|
if [[ $v == "some" || $v == "full" ]]; then
|
|
somefull=$v
|
|
elif [[ $v == avg* || $v == total* ]]; then
|
|
timespan=${v%%=*}
|
|
timespan=${timespan#avg}
|
|
val=${v#*=}
|
|
if [[ $timespan == "total" ]]; then
|
|
timespan_nice="Total"
|
|
units="usec"
|
|
else
|
|
timespan_nice="$timespan Second Average"
|
|
units="%"
|
|
fi
|
|
gmetric --name="psi_${somefull}_${res_name}_${timespan}" --title="PSI ${somefull@u} ${res_name_nice} ${timespan_nice}" --value="$val" --type="float" --group="load" --units="$units"
|
|
fi
|
|
done
|
|
done < "$res"
|
|
done |