mirror of
https://github.com/munin-monitoring/contrib.git
synced 2025-07-21 18:41:03 +00:00
Added print_{warning,critical} for greater flexibility
Updated to allow admin to set custom values for warning and critical levels for all `$state` fields.
This commit is contained in:
parent
34cb2b5071
commit
161f2bb534
1 changed files with 16 additions and 3 deletions
|
@ -13,7 +13,14 @@ 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
|
||||
|
||||
=head1 AUTHOR
|
||||
|
||||
|
@ -30,6 +37,8 @@ GPLv2
|
|||
|
||||
=cut
|
||||
|
||||
. $MUNIN_LIBDIR/plugins/plugin.sh
|
||||
|
||||
states="active \
|
||||
reloading \
|
||||
inactive \
|
||||
|
@ -52,9 +61,13 @@ EOF
|
|||
for state in $states; do
|
||||
echo "$state.label $state"
|
||||
echo "$state.draw AREASTACK"
|
||||
# Set default alert levels for failed units
|
||||
if [ "$state" = "failed" ]; then
|
||||
echo "$state.warning 0"
|
||||
echo "$state.critical 10"
|
||||
failed_warning="${failed_warning:-0}" print_warning $state
|
||||
failed_critical="${failed_critical:-10}" print_critical $state
|
||||
else
|
||||
print_warning $state
|
||||
print_critical $state
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue