1
0
Fork 0
mirror of https://github.com/munin-monitoring/contrib.git synced 2025-07-21 18:41:03 +00:00

Merge pull request #1458 from codeurimpulsif/systemd-units-fix

[systemd_units] fix missing failed units
This commit is contained in:
Kenyon Ralph 2024-10-09 11:02:29 -07:00 committed by GitHub
commit 2d7fdc8152
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -24,7 +24,7 @@ states have default levels set.)
Value calculations for each state are made using the following algorithm (all filters performed using Value calculations for each state are made using the following algorithm (all filters performed using
C<grep -E>): C<grep -E>):
1. Global include rules are applied on the output of C<systemctl list-units --all --no-legend>; 1. Global include rules are applied on the output of C<systemctl list-units --no-pager --no-legend --plain --all>;
2. Global exclude rules are then applied to the result of that; 2. Global exclude rules are then applied to the result of that;
3. Then, for each state, this global output is further filtered by include, then exclude rules for the state; 3. Then, for each state, this global output is further filtered by include, then exclude rules for the state;
4. Then the result is filtered for the given state and the remaining units counted and listed. 4. Then the result is filtered for the given state and the remaining units counted and listed.
@ -108,7 +108,7 @@ EOF
fetch () { fetch () {
# Get all units, filtering by global include/exclude rules # Get all units, filtering by global include/exclude rules
local state_include_var state_include state_exclude_var state_exclude global_unit_list state_unit_list local state_include_var state_include state_exclude_var state_exclude global_unit_list state_unit_list
global_unit_list=$(systemctl --no-pager --no-legend --all | grep -E "$include" | grep -Ev "$exclude" | awk '{print $1, $3}') global_unit_list=$(systemctl --no-pager --no-legend --plain --all | grep -E "$include" | grep -Ev "$exclude" | awk '{print $1, $3}')
# For each state, echo the number of units and some extra info, filtering for state-specific include/excludes # For each state, echo the number of units and some extra info, filtering for state-specific include/excludes
for state in $states ; do for state in $states ; do