Révision b44d8093
systemd_mem: add warning and critical from systemd config
| plugins/systemd/systemd_mem | ||
|---|---|---|
| 59 | 59 |
echo "graph_category memory" |
| 60 | 60 |
for service in ${services:-"munin-node"}; do
|
| 61 | 61 |
clean_name="$(clean_fieldname "$service")" |
| 62 |
description=$(systemctl show "$service" --all | grep ^Description= | cut -d '=' -f 2) |
|
| 62 |
description=$(systemctl show "$service" --property=Description | cut -d '=' -f 2) |
|
| 63 |
warning=$(systemctl show "$service" --property=MemoryHigh | cut -d '=' -f 2) |
|
| 64 |
critical=$(systemctl show "$service" --property=MemoryMax | cut -d '=' -f 2) |
|
| 65 |
if [ "$critical" = "infinity" ] ; then |
|
| 66 |
critical=$(systemctl show "$service" --property=MemoryLimit | cut -d '=' -f 2) |
|
| 67 |
fi |
|
| 63 | 68 |
printf "%s.label %s\n" "$clean_name" "$description" |
| 64 | 69 |
printf "%s.info memory usage\n" "$clean_name" |
| 70 |
if [ "$warning" != "infinity" ] ; then |
|
| 71 |
printf "%s.warning %s\n" "$clean_name" "$warning" |
|
| 72 |
fi |
|
| 73 |
if [ "$critical" != "infinity" ] ; then |
|
| 74 |
printf "%s.critical %s\n" "$clean_name" "$critical" |
|
| 75 |
fi |
|
| 65 | 76 |
done |
| 66 | 77 |
} |
| 67 | 78 |
|
| 68 | 79 |
output_values() {
|
| 69 | 80 |
for service in ${services:-"munin-node"}; do
|
| 70 | 81 |
clean_name="$(clean_fieldname "$service")" |
| 71 |
usage=$(systemctl show "$service" --all | grep ^MemoryCurrent= | cut -d '=' -f 2)
|
|
| 82 |
usage=$(systemctl show "$service" --property=MemoryCurrent | cut -d '=' -f 2)
|
|
| 72 | 83 |
if [ "$usage" = "[not set]" ]; then |
| 73 | 84 |
usage=0 |
| 74 | 85 |
fi |
Formats disponibles : Unified diff