Merge pull request #955 from kael-shipman/patch-1
Added print_{warning,critical} for greater flexibility
This commit is contained in:
commit
c4d7d834ab
|
@ -13,7 +13,17 @@ Linux systems with systemd installed.
|
|||
|
||||
=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
|
||||
|
||||
|
@ -30,6 +40,11 @@ GPLv2
|
|||
|
||||
=cut
|
||||
|
||||
. "$MUNIN_LIBDIR/plugins/plugin.sh"
|
||||
|
||||
failed_warning="${failed_warning:-0}"
|
||||
failed_critical="${failed_critical:-10}"
|
||||
|
||||
states="active \
|
||||
reloading \
|
||||
inactive \
|
||||
|
@ -52,10 +67,8 @@ EOF
|
|||
for state in $states; do
|
||||
echo "$state.label $state"
|
||||
echo "$state.draw AREASTACK"
|
||||
if [ "$state" = "failed" ]; then
|
||||
echo "$state.warning 0"
|
||||
echo "$state.critical 10"
|
||||
fi
|
||||
print_warning $state
|
||||
print_critical $state
|
||||
done
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue