-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathaxe_effect.py
93 lines (67 loc) · 1.79 KB
/
axe_effect.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
from .agent_based_api.v1 import (
register,
Result,
Service,
startswith,
SNMPTree,
State,
Metric,
ServiceLabel,
)
from .agent_based_api.v1.type_defs import (
CheckResult,
DiscoveryResult,
)
from .utils.temperature import (
check_temperature,
)
from .utils.humidity import (
check_humidity,
)
def parse_axe(string_table):
result = {}
result['temperature'] = float(string_table[0][0]) / 100
result['humidity'] = float(string_table[0][1]) / 1000
return result
def discover_axe(section, params, sfunc) -> DiscoveryResult:
yield Service(
item='Temperature',
parameters={},
# labels=[ ServiceLabel('test3', "test4") ]
)
yield Service(
item='Humidity',
parameters={},
# labels=[ ServiceLabel('test3', "test4") ]
)
def check_axe_effect(item='', params=None, section=None):
if (item == 'Temperature'):
yield from check_temperature(
section['temperature'],
params,
dev_levels=(31, 37),
dev_levels_lower=(10, 10),
dev_status=State.OK,
)
if (item == 'Humidity'):
yield from check_humidity(
section['humidity'],
params,
)
register.snmp_section(
name = 'axe_effect_snmp',
parse_function = parse_axe,
detect = startswith('.1.3.6.1.2.1.1.1.0', 'AxeEffect'),
fetch = SNMPTree(base='.1.3.6.1.2.1.99.1.1', oids=['1.4', '2.4']),
)
register.check_plugin(
name = 'axe_effect',
sections = ['axe_effect_snmp'],
service_name = 'Axe Effect %s',
discovery_function=lambda section: (
yield from discover_axe(section, {}, 'temp')
),
check_function = check_axe_effect,
check_ruleset_name='temperature',
check_default_parameters={},
)