6
6
from collections .abc import Mapping
7
7
from typing import NamedTuple
8
8
9
- from .agent_based_api .v1 import Attributes , exists , register , Result , Service , SNMPTree , State
10
- from .agent_based_api .v1 .type_defs import CheckResult , DiscoveryResult , InventoryResult , StringTable
9
+ from cmk .agent_based .v2 import (
10
+ Attributes ,
11
+ CheckPlugin ,
12
+ CheckResult ,
13
+ DiscoveryResult ,
14
+ exists ,
15
+ InventoryPlugin ,
16
+ InventoryResult ,
17
+ Result ,
18
+ Service ,
19
+ SimpleSNMPSection ,
20
+ SNMPTree ,
21
+ State ,
22
+ StringTable ,
23
+ )
11
24
12
25
13
26
class Section (NamedTuple ):
@@ -22,7 +35,7 @@ def parse_quantum_storage_info(string_table: StringTable) -> Section | None:
22
35
return Section (* string_table [0 ]) if string_table else None
23
36
24
37
25
- register . snmp_section (
38
+ snmp_section_snmp_quantum_storage_info = SimpleSNMPSection (
26
39
name = "snmp_quantum_storage_info" ,
27
40
parse_function = parse_quantum_storage_info ,
28
41
fetch = SNMPTree (
@@ -62,7 +75,7 @@ def check_quantum_storage_status( # type: ignore[no-untyped-def]
62
75
)
63
76
64
77
65
- register . check_plugin (
78
+ check_plugin_quantum_storage_status = CheckPlugin (
66
79
name = "quantum_storage_status" ,
67
80
sections = ["snmp_quantum_storage_info" ],
68
81
service_name = "Device status" ,
@@ -94,7 +107,7 @@ def inv_snmp_quantum_storage_info(section: Section) -> InventoryResult:
94
107
)
95
108
96
109
97
- register . inventory_plugin (
110
+ inventory_plugin_snmp_quantum_storage_info = InventoryPlugin (
98
111
name = "snmp_quantum_storage_info" ,
99
112
inventory_function = inv_snmp_quantum_storage_info ,
100
113
)
0 commit comments