diff --git a/checkpoint_raid.mkp b/checkpoint_raid.mkp index 22f498f239d229041f6dfdb9a320678a48857df6..b1c036349e8dbccd317b74201e8e6779db9347dc 100644 Binary files a/checkpoint_raid.mkp and b/checkpoint_raid.mkp differ diff --git a/checks/checkpoint_raid b/checks/checkpoint_raid index 9293e032cdd888dca1a32ef5d7c972e28d17f729..38bbd07ff7f048e5db85d5bc4f063e1d8e8fbbad 100644 --- a/checks/checkpoint_raid +++ b/checks/checkpoint_raid @@ -67,15 +67,15 @@ factory_settings['checkpoint_raid_defaults'] = { def parse_checkpoint_raid(info): raidvolumetype = { - 0 : 'RAID-0', - 1 : 'RAID-1E', - 2 : 'RAID-1', - 3 : 'RAID_10', - 4 : 'RAID-4', - 5 : 'RAID-5', - 6 : 'RAID-6', - 7 : 'RAID-60', - 8 : 'RAID-50', + 0: 'RAID-0', + 1: 'RAID-1E', + 2: 'RAID-1', + 3: 'RAID_10', + 4: 'RAID-4', + 5: 'RAID-5', + 6: 'RAID-6', + 7: 'RAID-60', + 8: 'RAID-50', } raw_volumes, raw_disks = info @@ -86,14 +86,14 @@ def parse_checkpoint_raid(info): volumeindex, volumeid, volumetype, numofdisksonraid, volumemaxlba, volumestate, volumeflags, volumesize = volume if volumeindex.isdigit(): - volumes.append({'volumeindex' : int(volumeindex), - 'volumeid' : int(volumeid), - 'volumetype' : raidvolumetype.get(int(volumetype)), + volumes.append({'volumeindex': int(volumeindex), + 'volumeid': int(volumeid), + 'volumetype': raidvolumetype.get(int(volumetype)), 'numofdisksonraid': int(numofdisksonraid), - 'volumemaxlba' : int(volumemaxlba), - 'volumestate' : int(volumestate), - 'volumeflags' : volumeflags, - 'volumesize' : int(volumesize), + 'volumemaxlba': int(volumemaxlba), + 'volumestate': int(volumestate), + 'volumeflags': volumeflags, + 'volumesize': int(volumesize), }) for disk in raw_disks: @@ -101,17 +101,17 @@ def parse_checkpoint_raid(info): diskflags, disksyncstate, disksize = disk if diskindex.isdigit(): - disks.append({'diskindex' : int(diskindex), - 'diskvolumeid' : int(diskvolumeid), - 'diskid' : int(disknumber), - 'diskvendor' : diskvendor, + disks.append({'diskindex': int(diskindex), + 'diskvolumeid': int(diskvolumeid), + 'diskid': int(disknumber), + 'diskvendor': diskvendor, 'diskproductid': diskproductid, - 'diskrevision' : diskrevision, - 'diskmaxlba' : int(diskmaxlba), - 'diskstate' : int(diskstate), - 'diskflags' : diskflags, + 'diskrevision': diskrevision, + 'diskmaxlba': int(diskmaxlba), + 'diskstate': int(diskstate), + 'diskflags': diskflags, 'disksyncstate': int(disksyncstate), - 'disksize' : int(disksize) + 'disksize': int(disksize) }) parse = [volumes, disks] @@ -140,16 +140,16 @@ def check_checkpoint_raid(item, params, parse): } raidvolumeflags = { - 0 : 'NONE', - 1 : 'ENABLED', - 2 : 'QUIESCED', - 3 : 'RESYNC IN PROGRESS', - 4 : 'VOLUME INACTIVE', - 5 : 'NOT CONFIGURED', - 6 : 'USING INTERIM RECOVERY MODE', - 7 : 'READY FOR RECOVERY OPERATION', - 8 : 'WRONG PHYSICAL DRIVE WAS REPLACED', - 9 : 'A PHYSICAL DRIVE IS NOT PROPERLY CONNECTED', + 0: 'NONE', + 1: 'ENABLED', + 2: 'QUIESCED', + 3: 'RESYNC IN PROGRESS', + 4: 'VOLUME INACTIVE', + 5: 'NOT CONFIGURED', + 6: 'USING INTERIM RECOVERY MODE', + 7: 'READY FOR RECOVERY OPERATION', + 8: 'WRONG PHYSICAL DRIVE WAS REPLACED', + 9: 'A PHYSICAL DRIVE IS NOT PROPERLY CONNECTED', 10: 'HARDWARE IS OVER HEATING', 11: 'HARDWARE WAS OVERHEATED', 12: 'CURRENTLY EXPENDING', @@ -162,21 +162,21 @@ def check_checkpoint_raid(item, params, parse): } raiddiskstate = { - 0 : 'ONLINE', - 1 : 'MISSING', - 2 : 'NOT COMPATIBLE', - 3 : 'DISC FAILED', - 4 : 'INITIALIZING', - 5 : 'OFFLINE REQUESTED', - 6 : 'FAILED REQUESTED', - 7 : 'UNCONFIGURED GOOD SPUN UP', - 8 : 'UNCONFIGURED GOOD SPUN DOWN', - 9 : 'UNCONFIGURED BAD', - 10 : 'HOTSPARE', - 11 : 'DRIVE OFFLINE', - 12 : 'REBUILD', - 13 : 'FAILED', - 14 : 'COPYBACK', + 0: 'ONLINE', + 1: 'MISSING', + 2: 'NOT COMPATIBLE', + 3: 'DISC FAILED', + 4: 'INITIALIZING', + 5: 'OFFLINE REQUESTED', + 6: 'FAILED REQUESTED', + 7: 'UNCONFIGURED GOOD SPUN UP', + 8: 'UNCONFIGURED GOOD SPUN DOWN', + 9: 'UNCONFIGURED BAD', + 10: 'HOTSPARE', + 11: 'DRIVE OFFLINE', + 12: 'REBUILD', + 13: 'FAILED', + 14: 'COPYBACK', 255: 'OTHER OFFLINE', } @@ -208,7 +208,6 @@ def check_checkpoint_raid(item, params, parse): volumes, disks = parse infotext = '' longoutput = '' - perfdata = [] ignore_disks = [] if params: @@ -228,16 +227,16 @@ def check_checkpoint_raid(item, params, parse): else: yield 0, 'Volume state: %s' % raidvolumestate.get(volume.get('volumestate')) - infotext += '%s, ' % volume.get('volumetype') + infotext += '%s, ' % volume.get('volumetype') infotext += '%d disks, ' % volume.get('numofdisksonraid') - infotext += '%d GB, ' % volume.get('volumesize') + infotext += '%d GB, ' % volume.get('volumesize') longoutput += '\nVolume state: %s, ' % raidvolumestate.get(volume.get('volumestate')) - longoutput += 'Type: %s, ' % volume.get('volumetype') - longoutput += '# of disks: %d , ' % volume.get('numofdisksonraid') - longoutput += 'Size: %d GB, ' % volume.get('volumesize') - longoutput += 'max LBA: %d, ' % volume.get('volumemaxlba') - longoutput += 'Flags: %s' % getflags(volume.get('volumeflags'), raidvolumeflags) + longoutput += 'Type: %s, ' % volume.get('volumetype') + longoutput += '# of disks: %d , ' % volume.get('numofdisksonraid') + longoutput += 'Size: %d GB, ' % volume.get('volumesize') + longoutput += 'max LBA: %d, ' % volume.get('volumemaxlba') + longoutput += 'Flags: %s' % getflags(volume.get('volumeflags'), raidvolumeflags) # disk infos disks_in_array = 0 @@ -255,22 +254,17 @@ def check_checkpoint_raid(item, params, parse): disks_online += 1 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)) + 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) else: disks_ignored += 1 - # remove last ', ' - # infotext = infotext[:-2] - if disks_in_array == disks_online: yield 0, '%d/%d Disks online' % (disks_online, disks_in_array) else: @@ -279,42 +273,41 @@ def check_checkpoint_raid(item, params, parse): if disks_ignored > 0: yield 0, '%d Disks ignored' % disks_ignored - yield 0, infotext + longoutput # , perfdata + yield 0, infotext + longoutput check_info['checkpoint_raid'] = { - 'check_function' : check_checkpoint_raid, - 'inventory_function' : inventory_checkpoint_raid, - 'parse_function' : parse_checkpoint_raid, - 'default_levels_variable' : 'checkpoint_raid_defaults', - 'service_description' : 'Soft RAID %s', - 'group' : 'checkpoint_raid', - # 'has_perfdata' : True, + 'check_function': check_checkpoint_raid, + 'inventory_function': inventory_checkpoint_raid, + 'parse_function': parse_checkpoint_raid, + 'default_levels_variable': 'checkpoint_raid_defaults', + 'service_description': 'Soft RAID %s', + 'group': 'checkpoint_raid', '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'), - 'snmp_info' : [('.1.3.6.1.4.1.2620.1.6.7.7.1.1', [ # CHECKPOINT-MIB::raidVolumeEntry - '1', # raidVolumeIndex - '2', # raidVolumeID - '3', # raidVolumeType - '4', # numOfDisksOnRaid - '5', # raidVolumeMaxLBA - '6', # raidVolumeState - '7', # raidVolumeFlags - '8', # raidVolumeSize - ]), - ('.1.3.6.1.4.1.2620.1.6.7.7.2.1', [ # CHECKPOINT-MIB::raidDiskEntry - '1', # raidDiskIndex - '2', # raidDiskVolumeID - '3', # raidDiskID - '4', # raidDiskNumber - '5', # raidDiskVendor - '6', # raidDiskProductID - '7', # raidDiskRevision - '8', # raidDiskMaxLBA - '9', # raidDiskState - '10', # raidDiskFlags - '11', # raidDiskSyncState - '12', # raidDiskSize - ])], -} \ No newline at end of file + 'snmp_info': [('.1.3.6.1.4.1.2620.1.6.7.7.1.1', [ # CHECKPOINT-MIB::raidVolumeEntry + '1', # raidVolumeIndex + '2', # raidVolumeID + '3', # raidVolumeType + '4', # numOfDisksOnRaid + '5', # raidVolumeMaxLBA + '6', # raidVolumeState + '7', # raidVolumeFlags + '8', # raidVolumeSize + ]), + ('.1.3.6.1.4.1.2620.1.6.7.7.2.1', [ # CHECKPOINT-MIB::raidDiskEntry + '1', # raidDiskIndex + '2', # raidDiskVolumeID + '3', # raidDiskID + '4', # raidDiskNumber + '5', # raidDiskVendor + '6', # raidDiskProductID + '7', # raidDiskRevision + '8', # raidDiskMaxLBA + '9', # raidDiskState + '10', # raidDiskFlags + '11', # raidDiskSyncState + '12', # raidDiskSize + ])], +}