2
0
mirror of https://github.com/munin-monitoring/contrib.git synced 2018-11-08 00:59:34 +01:00

Merge pull request #955 from kael-shipman/patch-1

Added print_{warning,critical} for greater flexibility
This commit is contained in:
Lars Kruse 2018-10-18 23:45:51 +02:00 committed by GitHub
commit c4d7d834ab
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -13,7 +13,17 @@ Linux systems with systemd installed.
=head1 CONFIGURATION =head1 CONFIGURATION
None needed. None needed. You may optionally pass warning and critical values for any of the possible states (active,
reloading, inactive, failed, activating, deactivating) like so:
[systemd_units]
env.failed_warning 0
env.failed_critical 5
env.inactive_warning 10
env.inactive_critical 20
Note that for failed units, default warning and critical values are set to 0 and 10, respectively. No other
states have default levels set.
=head1 AUTHOR =head1 AUTHOR
@ -30,6 +40,11 @@ GPLv2
=cut =cut
. "$MUNIN_LIBDIR/plugins/plugin.sh"
failed_warning="${failed_warning:-0}"
failed_critical="${failed_critical:-10}"
states="active \ states="active \
reloading \ reloading \
inactive \ inactive \
@ -52,10 +67,8 @@ EOF
for state in $states; do for state in $states; do
echo "$state.label $state" echo "$state.label $state"
echo "$state.draw AREASTACK" echo "$state.draw AREASTACK"
if [ "$state" = "failed" ]; then print_warning $state
echo "$state.warning 0" print_critical $state
echo "$state.critical 10"
fi
done done
} }