Skip to content

Commit

Permalink
Merge pull request FlorianHeigl#3 from HeinleinSupport/areca_2.0
Browse files Browse the repository at this point in the history
[areca] compatible for 2.0
  • Loading branch information
FlorianHeigl authored Aug 4, 2022
2 parents 32f6288 + 03bc0c1 commit 62dfeb2
Show file tree
Hide file tree
Showing 7 changed files with 21 additions and 20 deletions.
Binary file added check_mk/areca/areca-1.1.mkp
Binary file not shown.
4 changes: 2 additions & 2 deletions check_mk/areca/checks/areca_hba_fans
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/python
#!/usr/bin/env python3
# -*- encoding: utf-8; py-indent-offset: 4 -*-
# +------------------------------------------------------------------+
# | ____ _ _ __ __ _ __ |
Expand Down Expand Up @@ -51,7 +51,7 @@ def check_areca_hba_fans(item, _no_params, info):
check_info["areca_hba_fans"] = {
"check_function" : check_areca_hba_fans,
"inventory_function" : inventory_areca_hba_fans,
"has_perfdata" : True,
"has_perfdata" : False,
"service_description" : "Fan %s",
# Find Areca SAS MIB
"snmp_scan_function" : lambda oid: oid(".1.3.6.1.2.1.1.2.0").startswith(".1.3.6.1.4.1.18928.1"),
Expand Down
6 changes: 3 additions & 3 deletions check_mk/areca/checks/areca_hba_ldisks
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/python
#!/usr/bin/env python3
# -*- encoding: utf-8; py-indent-offset: 4 -*-
# +------------------------------------------------------------------+
# | ____ _ _ __ __ _ __ |
Expand Down Expand Up @@ -60,15 +60,15 @@ def check_areca_hba_ldisks(item, _no_params, info):
state = 1
else:
msg = msg + " - Unhandled state"
return (state, nagios_state_names[state] + " - " + msg)
return (state, msg)

return (3, "UNKW - Volset not found in agent output")


check_info["areca_hba_ldisks"] = {
"check_function" : check_areca_hba_ldisks,
"inventory_function" : inventory_areca_hba_ldisks,
"has_perfdata" : True,
"has_perfdata" : False,
"service_description" : "Volume set %s",
# Find Areca SAS MIB
"snmp_scan_function" : lambda oid: oid(".1.3.6.1.2.1.1.2.0").startswith(".1.3.6.1.4.1.18928.1"),
Expand Down
4 changes: 2 additions & 2 deletions check_mk/areca/checks/areca_hba_pdisks
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/python
#!/usr/bin/env python3
# -*- encoding: utf-8; py-indent-offset: 4 -*-
# +------------------------------------------------------------------+
# | ____ _ _ __ __ _ __ |
Expand Down Expand Up @@ -91,7 +91,7 @@ def check_areca_hba_pdisks(item, _no_params, info):
check_info["areca_hba_pdisks"] = {
"check_function" : check_areca_hba_pdisks,
"inventory_function" : inventory_areca_hba_pdisks,
"has_perfdata" : True,
"has_perfdata" : False,
"service_description" : "PDisk Enc/Sl %s",
# Find Areca SAS MIB
"snmp_scan_function" : lambda oid: oid(".1.3.6.1.2.1.1.2.0").startswith(".1.3.6.1.4.1.18928.1"),
Expand Down
6 changes: 3 additions & 3 deletions check_mk/areca/checks/areca_hba_raidsets
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/python
#!/usr/bin/env python3
# -*- encoding: utf-8; py-indent-offset: 4 -*-
# +------------------------------------------------------------------+
# | ____ _ _ __ __ _ __ |
Expand Down Expand Up @@ -52,15 +52,15 @@ def check_areca_hba_raidsets(item, _no_params, info):
state = 3

msg = "%s is %s. (members: %s)" % (rs_name, rs_state, rs_mem_names)
return (state, nagios_state_names[state] + " - " + msg)
return (state, msg)

return (3, "UNKW - Raidset not found in agent output")


check_info["areca_hba_raidsets"] = {
"check_function" : check_areca_hba_raidsets,
"inventory_function" : inventory_areca_hba_raidsets,
"has_perfdata" : True,
"has_perfdata" : False,
"service_description" : "Raid set %s",
# Find Areca SAS MIB
"snmp_scan_function" : lambda oid: oid(".1.3.6.1.2.1.1.2.0").startswith(".1.3.6.1.4.1.18928.1"),
Expand Down
8 changes: 4 additions & 4 deletions check_mk/areca/checks/areca_hba_temp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/python
#!/usr/bin/env python3
# -*- encoding: utf-8; py-indent-offset: 4 -*-
# +------------------------------------------------------------------+
# | ____ _ _ __ __ _ __ |
Expand Down Expand Up @@ -83,7 +83,7 @@

# snmp_info : oid(".1.3.6.1.4.1.18928.1.2.2.1.10.1"), [ "1", "2", "3" ]
# default levels will not work well in this check
areca_hba_temp_default_levels = (40, 45)
areca_hba_temp_default_levels = (63, 69)
def inventory_areca_hba_temp(info):
inventory = []
for line in info[0]:
Expand All @@ -109,8 +109,8 @@ def check_areca_hba_temp(item, params, info):
else:
state = 0

perfdata = [ ( item, temp, warn, crit, 0 ) ]
return (state, nagios_state_names[state] + " - Temperature is %dC" % temp, perfdata)
perfdata = [ ( "temp", temp, warn, crit ) ]
return (state, "Temperature is %dC" % temp, perfdata)

return (3, "UNKNOWN - sensor not found in agent output")

Expand Down
13 changes: 7 additions & 6 deletions check_mk/areca/checks/areca_hba_voltages
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/python
#!/usr/bin/env python3
# -*- encoding: utf-8; py-indent-offset: 4 -*-
# +------------------------------------------------------------------+
# | ____ _ _ __ __ _ __ |
Expand Down Expand Up @@ -92,14 +92,15 @@ def inventory_areca_hba_voltages(info):

def check_areca_hba_voltages(item, _no_params, info):
areca_info = parse_areca(info, "voltages")
epsilon = 10
if item in areca_info["voltages"].keys():
# i'm fetching the voltage from the label and try to alert on the difference.
v_cur = float(areca_info["voltages"][item])
v_rated = float(item.split()[-1].replace("V", "")) * 1000
perfdata = [ ( item, v_rated, v_cur, 0, 0 ) ]
v_cur = float(areca_info["voltages"][item]) / 1000.0
v_rated = float(item.split()[-1].replace("V", ""))
perfdata = [ ( "voltage", v_cur ) ]
# this is now just a hardcoded level, could be improved.
if v_cur < v_rated - v_rated / 100*5 or v_cur > v_rated + v_rated / 100*5:
return (1, "WARNING - Voltage is %02fV" % v_cur, perfdata)
if v_cur < v_rated - v_rated / 100*epsilon or v_cur > v_rated + v_rated / 100*epsilon:
return (1, "WARNING - Voltage is %02.3fV" % v_cur, perfdata)
else:
return (0, "OK - Voltage is ok", perfdata)
return (3, "UNKNOWN - Voltage sensor not found in agent output")
Expand Down

0 comments on commit 62dfeb2

Please sign in to comment.