Projet

Général

Profil

Révision 161f2bb5

ID161f2bb534a69be6be336c30d88c1aa0bcccad26
Parent 34cb2b50
Enfant e4e5d363

Ajouté par Kael Shipman il y a environ 7 ans

Added print_{warning,critical} for greater flexibility

Updated to allow admin to set custom values for warning and critical levels for all `$state` fields.

Voir les différences:

plugins/systemd/systemd_units
13 13

  
14 14
=head1 CONFIGURATION
15 15

  
16
None needed.
16
None needed. You may optionally pass warning and critical values for any of the possible states (active,
17
reloading, inactive, failed, activating, deactivating) like so:
18

  
19
 [systemd_units]
20
     env.failed_warning 0
21
     env.failed_critical 5
22
     env.inactive_warning 10
23
     env.inactive_critical 20
17 24

  
18 25
=head1 AUTHOR
19 26

  
......
30 37

  
31 38
=cut
32 39

  
40
. $MUNIN_LIBDIR/plugins/plugin.sh
41

  
33 42
states="active \
34 43
	reloading \
35 44
	inactive \
......
52 61
	for state in $states; do
53 62
		echo "$state.label $state"
54 63
		echo "$state.draw AREASTACK"
64
		# Set default alert levels for failed units
55 65
		if [ "$state" = "failed" ]; then
56
			echo "$state.warning 0"
57
			echo "$state.critical 10"
66
			failed_warning="${failed_warning:-0}" print_warning $state
67
			failed_critical="${failed_critical:-10}" print_critical $state
68
		else
69
			print_warning $state
70
			print_critical $state
58 71
		fi
59 72
	done
60 73
}

Formats disponibles : Unified diff