From 8909c7d8b0661b42f68e9079be2b878611671974 Mon Sep 17 00:00:00 2001 From: George Pochiscan Date: Thu, 3 Sep 2020 17:50:23 +0300 Subject: [PATCH] added rest of checks --- .../check_mk/checks/hitachivsp_backup_modules | 73 +++++++++++++++ .../checks/hitachivsp_drive_boxes_dbps | 63 +++++++++++++ .../checks/hitachivsp_drive_boxes_drives | 90 +++++++++++++++++++ .../checks/hitachivsp_drive_boxes_enc | 65 ++++++++++++++ .../share/check_mk/checks/hitachivsp_sfps | 2 +- 5 files changed, 292 insertions(+), 1 deletion(-) create mode 100644 hitachi-vsp/share/check_mk/checks/hitachivsp_backup_modules create mode 100644 hitachi-vsp/share/check_mk/checks/hitachivsp_drive_boxes_dbps create mode 100644 hitachi-vsp/share/check_mk/checks/hitachivsp_drive_boxes_drives create mode 100644 hitachi-vsp/share/check_mk/checks/hitachivsp_drive_boxes_enc diff --git a/hitachi-vsp/share/check_mk/checks/hitachivsp_backup_modules b/hitachi-vsp/share/check_mk/checks/hitachivsp_backup_modules new file mode 100644 index 0000000..bea5bfa --- /dev/null +++ b/hitachi-vsp/share/check_mk/checks/hitachivsp_backup_modules @@ -0,0 +1,73 @@ +#!/usr/bin/python +# -*- encoding: utf-8; py-indent-offset: 4 -*- +# +------------------------------------------------------------------+ +# | ____ _ _ __ __ _ __ | +# | / ___| |__ ___ ___| | __ | \/ | |/ / | +# | | | | '_ \ / _ \/ __| |/ / | |\/| | ' / | +# | | |___| | | | __/ (__| < | | | | . \ | +# | \____|_| |_|\___|\___|_|\_\___|_| |_|_|\_\ | +# | | +# | Copyright Mathias Kettner 2020 mk@mathias-kettner.de | +# +------------------------------------------------------------------+ +# +# This file is part of Check_MK. +# The official homepage is at http://mathias-kettner.de/check_mk. +# +# check_mk is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by +# the Free Software Foundation in version 2. check_mk is distributed +# in the hope that it will be useful, but WITHOUT ANY WARRANTY; with- +# out even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. See the GNU General Public License for more de- +# tails. You should have received a copy of the GNU General Public +# License along with GNU Make; see the file COPYING. If not, write +# to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, +# Boston, MA 02110-1301 USA. + +#example output +#<<>> +#location status bat_location bat_status bat_life +#BKMF-10 Normal +#BKMF-11 Normal BAT-B11 Normal 90 +#BKMF-12 Normal BAT-B12 Normal 90 +#BKMF-13 Normal BAT-B13 Normal 90 +#BKMF-20 Normal +#BKMF-21 Normal BAT-B21 Normal 90 +#BKMF-22 Normal BAT-B22 Normal 90 +#BKMF-23 Normal BAT-B23 Normal 90 + +def inventory_hitachivsp_backup_modules(info): + for line in info: + if "location" not in line: + yield line[0], {} + + +def check_hitachivsp_backup_modules(item, params, info): + for line in info: + if item == line[0]: + if line[1] == "Normal": + yield 0, "Backup Module status is Normal" + elif line[1] == "Warning": + yield 1, "Backup Module status is Warning" + elif line[1] == "Blocked": + yield 2, "Backup Module status is Blocked" + elif line[1] == "Failed": + yield 2, "Backup Module status is Failed" + if len(line) > 2: + if line[3] == "Normal": + yield 0, "Battery status is Normal" + elif line[3] == "Warning": + yield 1, "Battery status is Warning" + elif line[3] == "Blocked": + yield 2, "Battery status is Blocked" + elif line[3] == "Failed": + yield 2, "Battery status is Failed" + + +check_info['hitachivsp_backup_modules'] = { + 'inventory_function': inventory_hitachivsp_backup_modules, + 'check_function': check_hitachivsp_backup_modules, + 'service_description': 'Backup Module %s', + 'has_perfdata': False +} + diff --git a/hitachi-vsp/share/check_mk/checks/hitachivsp_drive_boxes_dbps b/hitachi-vsp/share/check_mk/checks/hitachivsp_drive_boxes_dbps new file mode 100644 index 0000000..95c1033 --- /dev/null +++ b/hitachi-vsp/share/check_mk/checks/hitachivsp_drive_boxes_dbps @@ -0,0 +1,63 @@ +#!/usr/bin/python +# -*- encoding: utf-8; py-indent-offset: 4 -*- +# +------------------------------------------------------------------+ +# | ____ _ _ __ __ _ __ | +# | / ___| |__ ___ ___| | __ | \/ | |/ / | +# | | | | '_ \ / _ \/ __| |/ / | |\/| | ' / | +# | | |___| | | | __/ (__| < | | | | . \ | +# | \____|_| |_|\___|\___|_|\_\___|_| |_|_|\_\ | +# | | +# | Copyright Mathias Kettner 2020 mk@mathias-kettner.de | +# +------------------------------------------------------------------+ +# +# This file is part of Check_MK. +# The official homepage is at http://mathias-kettner.de/check_mk. +# +# check_mk is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by +# the Free Software Foundation in version 2. check_mk is distributed +# in the hope that it will be useful, but WITHOUT ANY WARRANTY; with- +# out even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. See the GNU General Public License for more de- +# tails. You should have received a copy of the GNU General Public +# License along with GNU Make; see the file COPYING. If not, write +# to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, +# Boston, MA 02110-1301 USA. + +#example output +#<<>> +#drivebox_location dbps_location dbps_status +#DB-00 DBPS00-1 Normal +#DB-00 DBPS00-2 Normal +#DB-01 DBPS01-1 Normal +#DB-01 DBPS01-2 Normal +#DB-02 DBPS02-1 Normal +#DB-02 DBPS02-2 Normal +#DB-03 DBPS03-1 Normal +#DB-03 DBPS03-2 Normal + +def inventory_hitachivsp_drive_boxes_dbps(info): + for line in info: + if "dbps_location" not in line: + yield line[1], {} + + +def check_hitachivsp_drive_boxes_dbps(item, params, info): + for line in info: + if "dbps_location" not in line: + if item == line[1]: + if line[2] == "Normal": + yield 0, "DriveBox Power Supply status is Normal" + elif line[2] == "Warning": + yield 1, "DriveBox Power Supply status is Warning" + elif line[2] == "Failed": + yield 2, "DriveBox Power Supply status is Failed" + + +check_info['hitachivsp_drive_boxes_dbps'] = { + 'inventory_function': inventory_hitachivsp_drive_boxes_dbps, + 'check_function': check_hitachivsp_drive_boxes_dbps, + 'service_description': 'DriveBox Power supply %s', + 'has_perfdata': False +} + diff --git a/hitachi-vsp/share/check_mk/checks/hitachivsp_drive_boxes_drives b/hitachi-vsp/share/check_mk/checks/hitachivsp_drive_boxes_drives new file mode 100644 index 0000000..c29a253 --- /dev/null +++ b/hitachi-vsp/share/check_mk/checks/hitachivsp_drive_boxes_drives @@ -0,0 +1,90 @@ +#!/usr/bin/python +# -*- encoding: utf-8; py-indent-offset: 4 -*- +# +------------------------------------------------------------------+ +# | ____ _ _ __ __ _ __ | +# | / ___| |__ ___ ___| | __ | \/ | |/ / | +# | | | | '_ \ / _ \/ __| |/ / | |\/| | ' / | +# | | |___| | | | __/ (__| < | | | | . \ | +# | \____|_| |_|\___|\___|_|\_\___|_| |_|_|\_\ | +# | | +# | Copyright Mathias Kettner 2020 mk@mathias-kettner.de | +# +------------------------------------------------------------------+ +# +# This file is part of Check_MK. +# The official homepage is at http://mathias-kettner.de/check_mk. +# +# check_mk is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by +# the Free Software Foundation in version 2. check_mk is distributed +# in the hope that it will be useful, but WITHOUT ANY WARRANTY; with- +# out even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. See the GNU General Public License for more de- +# tails. You should have received a copy of the GNU General Public +# License along with GNU Make; see the file COPYING. If not, write +# to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, +# Boston, MA 02110-1301 USA. + +#example output +#<<>> +#drivebox_location drive_location drive_status drive_recomend_Replacement +#DB-00 HDD00-00 Normal 0 +#DB-00 HDD00-01 Normal 0 +#DB-00 HDD00-02 Normal 0 +#DB-00 HDD00-03 Normal 0 +#DB-00 HDD00-04 Normal 0 +#DB-00 HDD00-05 Normal 0 +#DB-00 HDD00-11 Normal 0 +#DB-01 HDD01-00 Normal 0 +#DB-01 HDD01-01 Normal 0 +#DB-01 HDD01-02 Normal 0 +#DB-01 HDD01-03 Normal 0 +#DB-01 HDD01-04 Normal 0 +#DB-01 HDD01-05 Normal 0 +#DB-02 HDD02-00 Normal 0 +#DB-02 HDD02-01 Normal 0 +#DB-02 HDD02-02 Normal 0 +#DB-02 HDD02-03 Normal 0 +#DB-02 HDD02-04 Normal 0 +#DB-02 HDD02-05 Normal 0 +#DB-03 HDD03-00 Normal 0 +#DB-03 HDD03-01 Normal 0 +#DB-03 HDD03-02 Normal 0 +#DB-03 HDD03-03 Normal 0 +#DB-03 HDD03-04 Normal 0 +#DB-03 HDD03-05 Normal 0 + + +def inventory_hitachivsp_drive_boxes_drives(info): + for line in info: + if "drive_location" not in line: + yield line[1], {} + + +def check_hitachivsp_drive_boxes_drives(item, params, info): + for line in info: + if item == line[1]: + if line[2] == "Normal": + yield 0, "Drive status is Normal" + elif "Warning" in line[2]: + yield 1, "Drive status is: %s" % line[2] + elif "Copying" in line[2]: + yield 1, "Drive status is: %s" % line[2] + elif "Pending" in line[2]: + yield 1, "Drive status is: %s" % line[2] + elif line[2] == "Copy incomplete": + yield 2, "Drive status is Copy Incomplete" + if line[3] == "1": + yield 1, "Drive replacement is recommended" + else: + yield 0, "Drive replacement is not recommended" + + + + +check_info['hitachivsp_drive_boxes_drives'] = { + 'inventory_function': inventory_hitachivsp_drive_boxes_drives, + 'check_function': check_hitachivsp_drive_boxes_drives, + 'service_description': 'Drive %s', + 'has_perfdata': True +} + diff --git a/hitachi-vsp/share/check_mk/checks/hitachivsp_drive_boxes_enc b/hitachi-vsp/share/check_mk/checks/hitachivsp_drive_boxes_enc new file mode 100644 index 0000000..04d8678 --- /dev/null +++ b/hitachi-vsp/share/check_mk/checks/hitachivsp_drive_boxes_enc @@ -0,0 +1,65 @@ +#!/usr/bin/python +# -*- encoding: utf-8; py-indent-offset: 4 -*- +# +------------------------------------------------------------------+ +# | ____ _ _ __ __ _ __ | +# | / ___| |__ ___ ___| | __ | \/ | |/ / | +# | | | | '_ \ / _ \/ __| |/ / | |\/| | ' / | +# | | |___| | | | __/ (__| < | | | | . \ | +# | \____|_| |_|\___|\___|_|\_\___|_| |_|_|\_\ | +# | | +# | Copyright Mathias Kettner 2020 mk@mathias-kettner.de | +# +------------------------------------------------------------------+ +# +# This file is part of Check_MK. +# The official homepage is at http://mathias-kettner.de/check_mk. +# +# check_mk is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by +# the Free Software Foundation in version 2. check_mk is distributed +# in the hope that it will be useful, but WITHOUT ANY WARRANTY; with- +# out even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. See the GNU General Public License for more de- +# tails. You should have received a copy of the GNU General Public +# License along with GNU Make; see the file COPYING. If not, write +# to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, +# Boston, MA 02110-1301 USA. + +#example output +#<<>> +#drivebox_location enc_location enc_status +#DB-00 ENC00-1 Normal +#DB-00 ENC00-2 Normal +#DB-01 ENC01-1 Normal +#DB-01 ENC01-2 Normal +#DB-02 ENC02-1 Normal +#DB-02 ENC02-2 Normal +#DB-03 ENC03-1 Normal +#DB-03 ENC03-2 Normal + +def inventory_hitachivsp_drive_boxes_encs(info): + for line in info: + if "enc_location" not in line: + yield line[1], {} + + +def check_hitachivsp_drive_boxes_encs(item, params, info): + for line in info: + if "enc_location" not in line: + if item == line[1]: + if line[2] == "Normal": + yield 0, "Drive Enclosure status is Normal" + elif line[2] == "Warning": + yield 1, "Drive Enclosure status is Warning" + elif line[2] == "Blocked": + yield 2, "Drive Enclosure status is Blocked" + elif line[2] == "Failed": + yield 2, "Drive Enclosure status is Failed" + + +check_info['hitachivsp_drive_boxes_encs'] = { + 'inventory_function': inventory_hitachivsp_drive_boxes_encs, + 'check_function': check_hitachivsp_drive_boxes_encs, + 'service_description': 'Drive box enclosure %s', + 'has_perfdata': True +} + diff --git a/hitachi-vsp/share/check_mk/checks/hitachivsp_sfps b/hitachi-vsp/share/check_mk/checks/hitachivsp_sfps index 89687a1..79cee5b 100644 --- a/hitachi-vsp/share/check_mk/checks/hitachivsp_sfps +++ b/hitachi-vsp/share/check_mk/checks/hitachivsp_sfps @@ -46,7 +46,7 @@ def inventory_hitachivsp_sfps(info): for line in info: - if "portID" not in line: + if "portId" not in line: yield line[0], {}