pavlovdo / pystormon

Zabbix storage monitoring via CIM/WBEM
16 stars 8 forks source link

script storage_discovery.py gives an error #3

Closed DKarc closed 4 years ago

DKarc commented 5 years ago

Script storage_discovery.py gives an error, but script storage_status.py is work/ Help me find the problem. Thanks.

[root@zabbix pystormon]# ./storage_discovery.py
SVC-V3700
arrays.discovery
{"data": [{"{#DISK_TYPE}": "Array", "{#DISK_NAME}": "mdisk1"}, {"{#DISK_TYPE}": "Array", "{#DISK_NAME}": "mdisk0"}, {"{#DISK_TYPE}": "Array", "{#DISK_NAME}": "mdisk2"}]}
SVC-V3700
physical.disks.discovery
{"data": [{"{#DISK_TYPE}": "DiskDrive", "{#DISK_NAME}": "DiskDrive-0"}, {"{#DISK_TYPE}": "DiskDrive", "{#DISK_NAME}": "DiskDrive-1"}, {"{#DISK_TYPE}": "DiskDrive", "{#DISK_NAME}": "DiskDrive-2"}, {"{#DISK_TYPE}": "DiskDrive", "{#DISK_NAME}": "DiskDrive-3"}, {"{#DISK_TYPE}": "DiskDrive", "{#DISK_NAME}": "DiskDrive-4"}, {"{#DISK_TYPE}": "DiskDrive", "{#DISK_NAME}": "DiskDrive-5"}, {"{#DISK_TYPE}": "DiskDrive", "{#DISK_NAME}": "DiskDrive-6"}, {"{#DISK_TYPE}": "DiskDrive", "{#DISK_NAME}": "DiskDrive-7"}, {"{#DISK_TYPE}": "DiskDrive", "{#DISK_NAME}": "DiskDrive-8"}, {"{#DISK_TYPE}": "DiskDrive", "{#DISK_NAME}": "DiskDrive-9"}, {"{#DISK_TYPE}": "DiskDrive", "{#DISK_NAME}": "DiskDrive-10"}, {"{#DISK_TYPE}": "DiskDrive", "{#DISK_NAME}": "DiskDrive-11"}, {"{#DISK_TYPE}": "DiskDrive", "{#DISK_NAME}": "DiskDrive-12"}, {"{#DISK_TYPE}": "DiskDrive", "{#DISK_NAME}": "DiskDrive-13"}, {"{#DISK_TYPE}": "DiskDrive", "{#DISK_NAME}": "DiskDrive-14"}, {"{#DISK_TYPE}": "DiskDrive", "{#DISK_NAME}": "DiskDrive-15"}, {"{#DISK_TYPE}": "DiskDrive", "{#DISK_NAME}": "DiskDrive-16"}, {"{#DISK_TYPE}": "DiskDrive", "{#DISK_NAME}": "DiskDrive-17"}, {"{#DISK_TYPE}": "DiskDrive", "{#DISK_NAME}": "DiskDrive-18"}, {"{#DISK_TYPE}": "DiskDrive", "{#DISK_NAME}": "DiskDrive-19"}, {"{#DISK_TYPE}": "DiskDrive", "{#DISK_NAME}": "DiskDrive-20"}, {"{#DISK_TYPE}": "DiskDrive", "{#DISK_NAME}": "DiskDrive-21"}, {"{#DISK_TYPE}": "DiskDrive", "{#DISK_NAME}": "DiskDrive-22"}, {"{#DISK_TYPE}": "DiskDrive", "{#DISK_NAME}": "DiskDrive-23"}, {"{#DISK_TYPE}": "DiskDrive", "{#DISK_NAME}": "DiskDrive-24"}, {"{#DISK_TYPE}": "DiskDrive", "{#DISK_NAME}": "DiskDrive-25"}, {"{#DISK_TYPE}": "DiskDrive", "{#DISK_NAME}": "DiskDrive-26"}, {"{#DISK_TYPE}": "DiskDrive", "{#DISK_NAME}": "DiskDrive-27"}, {"{#DISK_TYPE}": "DiskDrive", "{#DISK_NAME}": "DiskDrive-28"}, {"{#DISK_TYPE}": "DiskDrive", "{#DISK_NAME}": "DiskDrive-29"}, {"{#DISK_TYPE}": "DiskDrive", "{#DISK_NAME}": "DiskDrive-30"}, {"{#DISK_TYPE}": "DiskDrive", "{#DISK_NAME}": "DiskDrive-31"}, {"{#DISK_TYPE}": "DiskDrive", "{#DISK_NAME}": "DiskDrive-32"}, {"{#DISK_TYPE}": "DiskDrive", "{#DISK_NAME}": "DiskDrive-33"}, {"{#DISK_TYPE}": "DiskDrive", "{#DISK_NAME}": "DiskDrive-34"}, {"{#DISK_TYPE}": "DiskDrive", "{#DISK_NAME}": "DiskDrive-35"}]}
SVC-V3700
mdisks.discovery
{"data": [{"{#DISK_TYPE}": "Mdisk", "{#DISK_NAME}": "mdisk1"}, {"{#DISK_TYPE}": "Mdisk", "{#DISK_NAME}": "mdisk0"}, {"{#DISK_TYPE}": "Mdisk", "{#DISK_NAME}": "mdisk2"}, {"{#DISK_TYPE}": "Mdisk", "{#DISK_NAME}": "mdisk3"}, {"{#DISK_TYPE}": "Mdisk", "{#DISK_NAME}": "mdisk5"}]}
Traceback (most recent call last):
  File "/usr/local/lib/python3.6/site-packages/pywbem/_nocasedict.py", line 233, in __getitem__
    return self._data[k][1]
KeyError: 'volumename'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "./storage_discovery.py", line 72, in <module>
    disks_names = disks_discovery(conn, disk_types[disk_type][0], disk_types[disk_type][1])
  File "./storage_discovery.py", line 34, in disks_discovery
    disk_name = disk_cim.properties[name].value
  File "/usr/local/lib/python3.6/site-packages/pywbem/_nocasedict.py", line 235, in __getitem__
    raise KeyError(_format("Key {0!A} not found", key))
KeyError: "Key 'VolumeName' not found"
[root@zabbix pystormon]# 
pavlovdo commented 5 years ago

Likely key of CIM property for volumes of your storage distinguish from VolumeName. In order to find out this key, try run new script storage_cim_print.py for view CIM properties of your storage. Then search your logical volumes names (values) and determine key for this.

DKarc commented 5 years ago

Changed the value of 'VolumeName' to 'ElementName' and it worked. The script does not crash. Thanks.