TECHZEN Zenoss User Community ARCHIVE  

POSKeyError when trying to delete a device in ZenOSS 4.2.3

Subject: POSKeyError when trying to delete a device in ZenOSS 4.2.3
Author: David Whiteside
Posted: 2015-04-27 19:15

We tried using zentoolbox to delete the corrupt device, but it failed. We also attempted using zendmd and various examples seen on the forums.

>>> find('hostname').deleteDevice()
Traceback (most recent call last):
File "", line 1, in
File "/opt/zenoss/Products/ZenModel/Device.py", line 1825, in deleteDevice
parent._delObject(self.getId())
File "/opt/zenoss/Products/ZenRelations/ToManyRelationshipBase.py", line 87, in _delObject
self.removeRelation(obj, suppress_events)
File "/opt/zenoss/Products/ZenRelations/RelationshipBase.py", line 106, in removeRelation
self._remoteRemove(obj)
File "/opt/zenoss/Products/ZenRelations/ToManyContRelationship.py", line 198, in _remoteRemove
message = log_tb(sys.exc_info())
File "/opt/zenoss/Products/ZenUtils/tbdetail.py", line 25, in log_tb
os.makedirs(hook.logdir)
File "/opt/zenoss/lib/python2.7/os.py", line 157, in makedirs
mkdir(name, mode)
OSError: [Errno 17] File exists: '/opt/zenoss/log/tracebacks'

How can I delete this corrupt device

-David



Subject: Just to be clear on the issue
Author: David Whiteside
Posted: 2015-04-28 14:14

Just to be clear on the issue, I get the POSKey error when trying to delete the device. I have tried the zentoolbox tools and they were unable to fix the issue.

[zenoss@zenoss ~]$ zenchkrels -r -x1
INFO:zen.CheckRelations:Checking relations...
ERROR:zen.Relations:remote relation /zport/dmd/Devices/Server/Linux/nosnmp/devices/solardatasystem.hpc.nrel.gov/deviceClass doesn't point back to /zport/dmd/Devices/Server/Linux/nosnmp/devices
WARNING:zen.Relations:reconnecting relation /zport/dmd/Devices/Server/Linux/nosnmp/devices/solardatasystem.hpc.nrel.gov/deviceClass to relation /zport/dmd/Devices/Server/Linux/nosnmp/devices
ERROR:ZODB.Connection:Couldn't load state for 0x0d1e59
Traceback (most recent call last):
File "/opt/zenoss/lib/python/ZODB/Connection.py", line 860, in setstate
self._setstate(obj)
File "/opt/zenoss/lib/python/ZODB/Connection.py", line 901, in _setstate
p, serial = self._storage.load(obj._p_oid, '')
File "/opt/zenoss/lib/python/ZODB/Connection.py", line 1270, in load
return self._storage.load(oid, '')
File "/opt/zenoss/lib/python/relstorage/storage.py", line 476, in load
raise POSKeyError(oid)
POSKeyError: 0x0d1e59
Traceback (most recent call last):
File "/opt/zenoss/Products/ZenUtils/CheckRelations.py", line 70, in
tmbk.rebuild()
File "/opt/zenoss/Products/ZenUtils/CheckRelations.py", line 34, in rebuild
for object in getAllConfmonObjects(self.dmd):
File "/opt/zenoss/Products/ZenUtils/Utils.py", line 509, in getSubObjectsMemo
for x in getSubObjectsMemo(obj, filter, descend, memo):
File "/opt/zenoss/Products/ZenUtils/Utils.py", line 509, in getSubObjectsMemo
for x in getSubObjectsMemo(obj, filter, descend, memo):
File "/opt/zenoss/Products/ZenUtils/Utils.py", line 509, in getSubObjectsMemo
for x in getSubObjectsMemo(obj, filter, descend, memo):
File "/opt/zenoss/Products/ZenUtils/Utils.py", line 509, in getSubObjectsMemo
for x in getSubObjectsMemo(obj, filter, descend, memo):
File "/opt/zenoss/Products/ZenUtils/Utils.py", line 509, in getSubObjectsMemo
for x in getSubObjectsMemo(obj, filter, descend, memo):
File "/opt/zenoss/Products/ZenUtils/Utils.py", line 509, in getSubObjectsMemo
for x in getSubObjectsMemo(obj, filter, descend, memo):
File "/opt/zenoss/Products/ZenUtils/Utils.py", line 504, in getSubObjectsMemo
not obj.getPrimaryDmdId().startswith(base.getPrimaryDmdId())):
File "/opt/zenoss/lib/python/ZODB/Connection.py", line 860, in setstate
self._setstate(obj)
File "/opt/zenoss/lib/python/ZODB/Connection.py", line 901, in _setstate
p, serial = self._storage.load(obj._p_oid, '')
File "/opt/zenoss/lib/python/ZODB/Connection.py", line 1270, in load
return self._storage.load(oid, '')
File "/opt/zenoss/lib/python/relstorage/storage.py", line 476, in load
raise POSKeyError(oid)
ZODB.POSException.POSKeyError: 0x0d1e59



Subject: I was able to find a solution
Author: David Whiteside
Posted: 2015-04-28 14:59

I was able to find a solution. Use at your own risk.

[zenoss@zenoss ~]$ zendmd
>>>a = find('devicename')
>>> a.os = None
>>> a.hw = None
>>> commit()
>>> quit()

[zenoss@zenoss ~]$ zenchkrels -r -x1
INFO:zen.CheckRelations:Checking relations...

ERROR:zen.Relations:remote relation /zport/dmd/Devices/Server/Linux/nosnmp/devices/solardatasystem.hpc.nrel.gov/deviceClass doesn't point back to /zport/dmd/Devices/Server/Linux/nosnmp/devices
WARNING:zen.Relations:reconnecting relation /zport/dmd/Devices/Server/Linux/nosnmp/devices/solardatasystem.hpc.nrel.gov/deviceClass to relation /zport/dmd/Devices/Server/Linux/nosnmp/devices

ERROR:zen.Relations:remote relation /zport/dmd/Devices/Server/Linux/nosnmp/devices/solardatasystem.hpc.nrel.gov/groups doesn't point back to /zport/dmd/Groups/sysadmin/jshelby/devices
WARNING:zen.Relations:reconnecting relation /zport/dmd/Devices/Server/Linux/nosnmp/devices/solardatasystem.hpc.nrel.gov/groups to relation /zport/dmd/Groups/sysadmin/jshelby/devices

I was then able to delete the device using the GUI.



< Previous
Zenoss Core 5 - how to change snmp polling interval
  Next
WInRM Support
>