diff --git a/checkpoint_soft_raid.mkp b/checkpoint_soft_raid.mkp index 0ce965de97064a5c2fe540dd9d7e7cb894b8b2b3..29497dc04883b520198b3a93a90b8932d8a14a85 100644 Binary files a/checkpoint_soft_raid.mkp and b/checkpoint_soft_raid.mkp differ diff --git a/checks/checkpoint_soft_raid b/checks/checkpoint_soft_raid index 1b084c0e12bcda02924bcb7501389bfa5756e2d0..40eca2346c62e045d754d8debc3f87930245f067 100644 --- a/checks/checkpoint_soft_raid +++ b/checks/checkpoint_soft_raid @@ -11,6 +11,9 @@ # 13.03.2018 : code cleanup # 15.03.2018 : more code cleanup # 08.06.2020 : changed snmp-scan function +# 10.11.2020 : removed perfdata +# added wato option to configure 'ignore disks'. For example on the Smart-1 5150 (Array has 12 Disks, +# but only 6 Disks are in the default hardware # # sample snmpwalk (one volume / two disks) # @@ -57,7 +60,7 @@ # factory_settings['checkpoint_soft_raid_defaults'] = { - + 'ignore_disks': '', } @@ -125,10 +128,10 @@ def inventory_checkpoint_soft_raid(parse): if disk.get('diskvolumeid') == volumeid: disksonvolume.append(disk) disks.remove(disk) - yield item, [volume, disksonvolume] + yield item, None -def check_checkpoint_soft_raid(item, _no_params, parse): +def check_checkpoint_soft_raid(item, params, parse): raidvolumestate = { 0: 'OPTIMAL', 1: 'DEGRADED', @@ -206,6 +209,9 @@ def check_checkpoint_soft_raid(item, _no_params, parse): longoutput = '' perfdata = [] + if params: + ignore_disks = params.get('ignore_disks', '').split(',') + if len(volumes) != 0: for volume in volumes: volumeid = volume.get('volumeid') @@ -234,28 +240,29 @@ def check_checkpoint_soft_raid(item, _no_params, parse): # disk infos for disk in disks: diskid = disk.get('diskid') - syncstate = disk.get('disksyncstate') - if disk.get('diskstate') != 0: - yield 2, 'Disk ID: %d state: %s' % (diskid, raiddiskstate.get(disk.get('diskstate'))) - else: - yield 0, 'Disk ID %d state %s' % (diskid, raiddiskstate.get(disk.get('diskstate'))) + if not str(diskid) in ignore_disks: + syncstate = disk.get('disksyncstate') + if disk.get('diskstate') != 0: + yield 2, 'Disk ID: %d state: %s' % (diskid, raiddiskstate.get(disk.get('diskstate'))) + else: + yield 0, 'Disk ID %d state %s' % (diskid, raiddiskstate.get(disk.get('diskstate'))) - longoutput += '\n%s disk (id %d): ' % (raiddiskid.get(diskid), diskid) - longoutput += 'State: %s, ' % raiddiskstate.get(disk.get('diskstate')) - longoutput += 'Sync: %d%s, ' % (syncstate, '%') - longoutput += 'Size: %d GB, ' % disk.get('disksize') - longoutput += 'max LBA: %d, ' % disk.get('diskmaxlba') - longoutput += 'Vendor: %s, ' % disk.get('diskvendor') - longoutput += 'Product id: %s, ' % disk.get('diskproductid') - longoutput += 'Revision: %s, ' % disk.get('diskrevision') - longoutput += 'Flags: %s' % getflags(disk.get('diskflags'), raiddiskflags) + longoutput += '\n%s disk (id %d): ' % (raiddiskid.get(diskid), diskid) + longoutput += 'State: %s, ' % raiddiskstate.get(disk.get('diskstate')) + longoutput += 'Sync: %d%s, ' % (syncstate, '%') + longoutput += 'Size: %d GB, ' % disk.get('disksize') + longoutput += 'max LBA: %d, ' % disk.get('diskmaxlba') + longoutput += 'Vendor: %s, ' % disk.get('diskvendor') + longoutput += 'Product id: %s, ' % disk.get('diskproductid') + longoutput += 'Revision: %s, ' % disk.get('diskrevision') + longoutput += 'Flags: %s' % getflags(disk.get('diskflags'), raiddiskflags) - perfdata.append(('disk_id_%d' % diskid, syncstate, None, None, 0, 100)) + # perfdata.append(('disk_id_%d' % diskid, syncstate, None, None, 0, 100)) # remove last ', ' # infotext = infotext[:-2] - yield 0, infotext + longoutput, perfdata + yield 0, infotext + longoutput # , perfdata check_info['checkpoint_soft_raid'] = { @@ -265,7 +272,7 @@ check_info['checkpoint_soft_raid'] = { 'default_levels_variable' : 'checkpoint_soft_raid_defaults', 'service_description' : 'Soft RAID %s', 'group' : 'checkpoint_soft_raid', - 'has_perfdata' : True, + # 'has_perfdata' : True, 'snmp_scan_function': lambda oid: (oid('.1.3.6.1.2.1.1.2.0').startswith('.1.3.6.1.4.1.2620.1.6.123.1') or oid('.1.3.6.1.2.1.1.2.0').startswith('.1.3.6.1.4.1.8072.3.2.10')) and oid('.1.3.6.1.4.1.2620.1.6.1.0', '').lower().startswith('svn foundation'), diff --git a/packages/checkpoint_soft_raid b/packages/checkpoint_soft_raid index 992578cc99b42d9d48bb83d6c803b2c6d99dac29..5b568453aeb3b79c0f7e46211eb24adaa1656785 100644 --- a/packages/checkpoint_soft_raid +++ b/packages/checkpoint_soft_raid @@ -2,10 +2,12 @@ 'description': u'monitor Check Point appliance soft RAID\n', 'download_url': 'http://thl-cmk.hopto.org/', 'files': {'checks': ['checkpoint_soft_raid'], - 'web': ['plugins/metrics/checkpoint_soft_raid.py']}, + 'web': ['plugins/metrics/checkpoint_soft_raid.py', + 'plugins/wato/checkpoint_soft_raid.py']}, 'name': 'checkpoint_soft_raid', - 'num_files': 2, + 'num_files': 3, 'title': u'Check Point appliance soft RAID', - 'version': '20200608.v0.2c', + 'version': '20201110.v0.3', 'version.min_required': '1.2.8b8', - 'version.packaged': '1.4.0p38'} \ No newline at end of file + 'version.packaged': '1.6.0p12', + 'version.usable_until': None} \ No newline at end of file diff --git a/web/plugins/wato/checkpoint_soft_raid.py b/web/plugins/wato/checkpoint_soft_raid.py new file mode 100644 index 0000000000000000000000000000000000000000..47c994ef625654c0f3a0b5129c9e8a6726ab249f --- /dev/null +++ b/web/plugins/wato/checkpoint_soft_raid.py @@ -0,0 +1,33 @@ +#!/usr/bin/python +# -*- encoding: utf-8; py-indent-offset: 4 -*- +# +# License: GNU General Public License v2 +# +# Author: thl-cmk[at]outlook[dot]com +# URL : https://thl-cmk.hopto.org +# +# Check_MK checkpoint_soft_rais WATO plugin +# +# +# + +register_check_parameters( + subgroup_networking, + 'checkpoint_soft_raid', + _('Check Point Soft Raid'), + Dictionary( + help=_(''), + elements=[ + ('ignore_disks', + TextUnicode( + title=_('list of comma separated disk IDs to ignore'), + help=_('This is usefull for RAID Arrays with missing disks like on the Smart-1 5150. There the ' + 'array is configured for 12 Disk but in the default Hardware are only 6 Disks.'), + default_value=None, + allow_empty=False, + )), + ], + ), + None, + match_type='dict', +)