33# This file is part of Checkmk (https://checkmk.com). It is subject to the terms and
44# conditions defined in the file COPYING, which is part of this source code package.
55
6- # mypy: disable-error-code="no-untyped-def"
7-
6+ from collections . abc import Mapping
7+ from typing import Any
88
99from cmk .agent_based .legacy .v0_unstable import LegacyCheckDefinition
1010from cmk .agent_based .v2 import DiscoveryResult , Service , SNMPTree , StringTable
@@ -18,22 +18,32 @@ def discover_hitachi_hnas_fpga(string_table: StringTable) -> DiscoveryResult:
1818 yield Service (item = clusternode + "." + id_ + " " + name )
1919
2020
21- def check_hitachi_hnas_fpga (item , params , info ):
21+ def check_hitachi_hnas_fpga (
22+ item : str , params : Mapping [str , Any ], info : StringTable
23+ ) -> (
24+ tuple [int , str ]
25+ | tuple [
26+ int ,
27+ str ,
28+ list [tuple [str , float , float | None , float | None , float | None , float | None ]],
29+ ]
30+ ):
31+ warn : float
32+ crit : float
2233 warn , crit = params ["levels" ]
2334 rc = 0
2435
25- for clusternode , id_ , name , util in info :
36+ for clusternode , id_ , name , util_str in info :
2637 if clusternode + "." + id_ + " " + name == item :
27- util = float (util )
38+ util = float (util_str )
2839 if util > warn :
2940 rc = 1
3041 if util > crit :
3142 rc = 2
32- perfdata = [("fpga_util" , str (util ) + "%" , warn , crit , 0 , 100 )]
3343 return (
3444 rc ,
3545 f"PNode { clusternode } FPGA { id_ } { name } utilization is { util } %" ,
36- perfdata ,
46+ [( "fpga_util" , util , warn , crit , 0.0 , 100.0 )] ,
3747 )
3848
3949 return 3 , "No utilization found for FPGA %s" % item
0 commit comments