44# conditions defined in the file COPYING, which is part of this source code package.
55
66# mypy: disable-error-code="no-untyped-call"
7- # mypy: disable-error-code="no-untyped-def"
87
8+ from __future__ import annotations
99
10- from cmk .agent_based .legacy .v0_unstable import LegacyCheckDefinition
11- from cmk .agent_based .v2 import SNMPTree , startswith
10+ from collections .abc import Mapping
11+ from typing import Any
12+
13+ from cmk .agent_based .legacy .v0_unstable import (
14+ LegacyCheckDefinition ,
15+ LegacyDiscoveryResult ,
16+ LegacyResult ,
17+ )
18+ from cmk .agent_based .v2 import SNMPTree , startswith , StringTable
1219from cmk .base .check_legacy_includes .fan import check_fan
13- from cmk .base .check_legacy_includes .temperature import check_temperature
20+ from cmk .base .check_legacy_includes .temperature import check_temperature , TempParamType
1421
1522check_info = {}
1623
3542# .1.3.6.1.4.1.232.167.2.4.5.2.1.7.3 0
3643
3744
38- def parse_hp_mcs_sensors (string_table ) :
39- parsed = {}
45+ def parse_hp_mcs_sensors (string_table : StringTable ) -> Mapping [ str , Mapping [ str , Any ]] :
46+ parsed : dict [ str , dict [ str , Any ]] = {}
4047
4148 for line in string_table :
4249 parsed [line [0 ]] = {
@@ -51,13 +58,15 @@ def parse_hp_mcs_sensors(string_table):
5158 return parsed
5259
5360
54- def discover_hp_mcs_sensors (parsed ) :
61+ def discover_hp_mcs_sensors (parsed : Mapping [ str , Mapping [ str , Any ]]) -> LegacyDiscoveryResult :
5562 for entry in parsed .values ():
5663 if int (entry ["type" ]) in [4 , 5 , 13 , 14 , 15 , 16 , 17 , 18 , 19 , 20 ]:
5764 yield (entry ["name" ], {})
5865
5966
60- def check_hp_mcs_sensors (item , params , parsed ):
67+ def check_hp_mcs_sensors (
68+ item : str , params : TempParamType , parsed : Mapping [str , Mapping [str , Any ]]
69+ ) -> LegacyResult | None :
6170 for key , entry in parsed .items ():
6271 if entry ["name" ] == item :
6372 return check_temperature (entry ["value" ], params , "hp_mcs_sensors_%s" % key )
@@ -79,13 +88,17 @@ def check_hp_mcs_sensors(item, params, parsed):
7988)
8089
8190
82- def discover_hp_mcs_sensors_fan (parsed ) :
91+ def discover_hp_mcs_sensors_fan (parsed : Mapping [ str , Mapping [ str , Any ]]) -> LegacyDiscoveryResult :
8392 for entry in parsed .values ():
8493 if entry ["type" ] in [9 , 10 , 11 , 26 , 27 , 28 ]:
8594 yield (entry ["name" ], {})
8695
8796
88- def check_hp_mcs_sensors_fan (item , params , parsed ):
97+ def check_hp_mcs_sensors_fan (
98+ item : str ,
99+ params : Mapping [str , Any ] | tuple [float , float ],
100+ parsed : Mapping [str , Mapping [str , Any ]],
101+ ) -> LegacyResult | None :
89102 for entry in parsed .values ():
90103 if entry ["name" ] == item :
91104 return check_fan (entry ["value" ], params )
0 commit comments