99
1010from cmk .utils .check_utils import ParametersTypeAlias
1111
12- from cmk .base .plugins .agent_based .agent_based_api .v1 import Metric , Result , Service , State
12+ from cmk .base .plugins .agent_based .agent_based_api .v1 import Result , Service , State
1313from cmk .base .plugins .agent_based .systemd_units import (
1414 _services_split ,
1515 CHECK_DEFAULT_PARAMETERS_SUMMARY ,
@@ -519,7 +519,7 @@ def test_services_split(
519519 "├─4075632 /bin/bash /usr/bin/check_mk_agent" ,
520520 "├─4075634 cat" ,
521521 "├─4075658 systemctl status --all --type service --type socket --no-pager --lines 0" ,
522- "└─4075659 tr -s " ,
522+ "└─4075659 tr -s " "" ,
523523 "● check-mk-agent.socket - Local Checkmk agent socket" ,
524524 "Loaded: loaded (/lib/systemd/system/check-mk-agent.socket; enabled; vendor preset: enabled)" ,
525525 "Active: active (listening) since Tue 2024-11-12 15:58:09 CET; 1 day 15h ago" ,
@@ -903,7 +903,6 @@ def test_discover_systemd_units_services_summary(
903903 "else" : 2 ,
904904 "states" : {"active" : 0 , "failed" : 2 , "inactive" : 0 },
905905 "states_default" : 2 ,
906- "disabled_critical" : False ,
907906 },
908907 SECTION ,
909908 [
@@ -917,7 +916,6 @@ def test_discover_systemd_units_services_summary(
917916 "else" : 2 ,
918917 "states" : {"active" : 0 , "failed" : 2 , "inactive" : 0 },
919918 "states_default" : 2 ,
920- "disabled_critical" : False ,
921919 },
922920 SECTION ,
923921 [
@@ -934,7 +932,6 @@ def test_discover_systemd_units_services_summary(
934932 "else" : 2 ,
935933 "states" : {"active" : 0 , "failed" : 2 , "inactive" : 0 },
936934 "states_default" : 2 ,
937- "disabled_critical" : False ,
938935 },
939936 SECTION ,
940937 [
@@ -951,7 +948,6 @@ def test_discover_systemd_units_services_summary(
951948 "else" : 2 ,
952949 "states" : {"active" : 0 , "failed" : 2 , "inactive" : 0 },
953950 "states_default" : 2 ,
954- "disabled_critical" : False ,
955951 },
956952 Section (services = {}, sockets = {}),
957953 [
@@ -982,7 +978,6 @@ def test_check_systemd_units_services(
982978 "else" : 2 ,
983979 "states" : {"active" : 2 , "failed" : 1 , "inactive" : 0 },
984980 "states_default" : 2 ,
985- "disabled_critical" : False ,
986981 },
987982 Section (
988983 sockets = {
@@ -1022,7 +1017,6 @@ def test_check_systemd_units_sockets(
10221017 "else" : 2 ,
10231018 "states" : {"active" : 0 , "failed" : 2 , "inactive" : 0 },
10241019 "states_default" : 2 ,
1025- "disabled_critical" : False ,
10261020 "ignored" : [],
10271021 "activating_levels" : (30 , 60 ),
10281022 "deactivating_levels" : (30 , 60 ),
@@ -1042,7 +1036,6 @@ def test_check_systemd_units_sockets(
10421036 "else" : 2 ,
10431037 "states" : {"active" : 0 , "failed" : 1 , "inactive" : 0 },
10441038 "states_default" : 2 ,
1045- "disabled_critical" : False ,
10461039 "ignored" : [],
10471040 "activating_levels" : (30 , 60 ),
10481041 "deactivating_levels" : (30 , 60 ),
@@ -1091,7 +1084,6 @@ def test_check_systemd_units_sockets(
10911084 "activating_levels" : (30 , 60 ),
10921085 "deactivating_levels" : (30 , 60 ),
10931086 "reloading_levels" : (30 , 60 ),
1094- "disabled_critical" : False ,
10951087 },
10961088 Section (
10971089 sockets = {},
@@ -1137,7 +1129,6 @@ def test_check_systemd_units_sockets(
11371129 "activating_levels" : (30 , 60 ),
11381130 "deactivating_levels" : (30 , 60 ),
11391131 "reloading_levels" : (30 , 60 ),
1140- "disabled_critical" : False ,
11411132 },
11421133 Section (
11431134 sockets = {},
@@ -1170,7 +1161,6 @@ def test_check_systemd_units_sockets(
11701161 "activating_levels" : (30 , 60 ),
11711162 "deactivating_levels" : (30 , 60 ),
11721163 "reloading_levels" : (30 , 60 ),
1173- "disabled_critical" : False ,
11741164 },
11751165 Section (
11761166 sockets = {},
@@ -1203,7 +1193,6 @@ def test_check_systemd_units_sockets(
12031193 "activating_levels" : (30 , 60 ),
12041194 "deactivating_levels" : (30 , 60 ),
12051195 "reloading_levels" : (30 , 60 ),
1206- "disabled_critical" : False ,
12071196 },
12081197 Section (
12091198 sockets = {},
@@ -1230,7 +1219,6 @@ def test_check_systemd_units_sockets(
12301219 "else" : 2 ,
12311220 "states" : {"active" : 0 , "failed" : 2 , "inactive" : 0 },
12321221 "states_default" : 2 ,
1233- "disabled_critical" : False ,
12341222 "ignored" : [],
12351223 "activating_levels" : (30 , 60 ),
12361224 "deactivating_levels" : (30 , 60 ),
@@ -1262,7 +1250,6 @@ def test_check_systemd_units_sockets(
12621250 "else" : 2 ,
12631251 "states" : {"active" : 0 , "failed" : 2 , "inactive" : 0 },
12641252 "states_default" : 2 ,
1265- "disabled_critical" : False ,
12661253 "ignored" : [
12671254 "systemd-timesyncd.service" ,
12681255 "systemd-ask-password-console" ,
@@ -1298,7 +1285,6 @@ def test_check_systemd_units_sockets(
12981285 "else" : 2 ,
12991286 "states" : {"active" : 0 , "failed" : 2 , "inactive" : 0 },
13001287 "states_default" : 2 ,
1301- "disabled_critical" : False ,
13021288 "ignored" : [
13031289 "systemd." ,
13041290 ],
@@ -1344,7 +1330,6 @@ def test_check_systemd_units_sockets(
13441330 "else" : 2 ,
13451331 "states" : {"active" : 0 , "failed" : 2 , "inactive" : 0 },
13461332 "states_default" : 2 ,
1347- "disabled_critical" : False ,
13481333 "ignored" : [],
13491334 "activating_levels" : (30 , 60 ),
13501335 "deactivating_levels" : (30 , 60 ),
@@ -1370,43 +1355,11 @@ def test_check_systemd_units_sockets(
13701355 ],
13711356 id = "One failed, but disabled" ,
13721357 ),
1373- pytest .param (
1374- {
1375- "disabled_critical" : True ,
1376- "else" : 2 ,
1377- "states" : {"active" : 0 , "failed" : 2 , "inactive" : 0 },
1378- "states_default" : 2 ,
1379- "ignored" : [],
1380- "activating_levels" : (30 , 60 ),
1381- "deactivating_levels" : (30 , 60 ),
1382- "reloading_levels" : (30 , 60 ),
1383- },
1384- Section (
1385- sockets = {},
1386- services = {
1387- "systemd-timesyncd.service" : UnitEntry (
1388- name = "systemd-timesyncd.service" ,
1389- loaded_status = "loaded" ,
1390- active_status = "failed" ,
1391- current_state = "failed" ,
1392- description = "Import ZFS pool fgprs\\ x2dpbs02\\ x2dpool1\\ x2d100" ,
1393- enabled_status = "disabled" ,
1394- ),
1395- },
1396- ),
1397- [
1398- Result (state = State .OK , summary = "Total: 1" ),
1399- Result (state = State .OK , summary = "Disabled: 1" ),
1400- Result (state = State .CRIT , summary = "Failed: 1" ),
1401- ],
1402- id = "One disabled, but critical state configured in params -> CRIT" ,
1403- ),
14041358 pytest .param (
14051359 {
14061360 "else" : 2 ,
14071361 "states" : {"active" : 0 , "failed" : 0 , "inactive" : 0 },
14081362 "states_default" : 2 ,
1409- "disabled_critical" : False ,
14101363 "ignored" : [],
14111364 "activating_levels" : (30 , 60 ),
14121365 "deactivating_levels" : (30 , 60 ),
0 commit comments