Stephen Hille [http://community.zenoss.org/people/shille] created the discussion
"Re: Unauthorized: You are not allowed to access 'zProperty' in this context - causing getDeviceCommands() exception"
To view the discussion, visit: http://community.zenoss.org/message/73567#73567
--------------------------------------------------------------
During the last failure event after many zencommand and zenjmx data sources had spontaneously dropped from the usual schedule at multiple collectors I was able to recreate the zencommand "ERROR zen.hub: getDeviceCommands() exception for device device_name" stack trace above at will by running from the applicable collector:
zemcommand -v10 -d device_name
with debug output:
2013-06-10 19:41:26,724 DEBUG zen.zencommand: Starting PBDaemon initialization
2013-06-10 19:41:26,731 INFO zen.zencommand: Connecting to central_zenoss.mydomain.com:8789
2013-06-10 19:41:26,732 DEBUG zen.zencommand: Logging in as admin
2013-06-10 19:41:26,836 INFO zen.zencommand: Connected to ZenHub
2013-06-10 19:41:26,836 DEBUG zen.zencommand: Setting up initial services: EventService, CommandConfig
2013-06-10 19:41:26,837 DEBUG zen.zencommand: Chaining getInitialServices with d2
2013-06-10 19:41:26,865 DEBUG zen.zencommand: Loaded service EventService from zenhub
2013-06-10 19:41:26,865 DEBUG zen.zencommand: Loaded service CommandConfig from zenhub
2013-06-10 19:41:26,865 DEBUG zen.zencommand: Queueing event {'severity': 0, 'component': 'zencommand', 'agent': 'zencommand', 'summary': 'started', 'manager': 'collector_hostname.corporate.transgrid.local', 'device': 'collector_hostname', 'eventClass': '/App/Start', 'monitor': 'collector_hostname'}
2013-06-10 19:41:26,865 DEBUG zen.zencommand: Total of 1 queued events
2013-06-10 19:41:26,866 DEBUG zen.zencommand: pushEventsLoop : after rrdstatsGauge()
2013-06-10 19:41:26,866 DEBUG zen.zencommand: pushEventsLoop : currently sending time = 1370857286.866498 curTimeThreshold = 1370857346.865970
2013-06-10 19:41:26,866 DEBUG zen.zencommand: Calling connected.
2013-06-10 19:41:26,866 DEBUG zen.zencommand: Fetching configuration from zenhub
2013-06-10 19:41:26,920 DEBUG zen.zencommand: Updated configCycleInterval config to 360
2013-06-10 19:41:27,040 DEBUG zen.zencommand: Loading classes ['Products.ZenModel.MinMaxThreshold', 'ZenPacks.community.PointThreshold.thresholds.PointThreshold', 'ZenPacks.community.deviceAdvDetail.thresholds.StatusThreshold']
2013-06-10 19:41:27,112 DEBUG zen.thresholds: Updating threshold ('high event queue', ('collector_hostname', ''))
2013-06-10 19:41:27,112 DEBUG zen.thresholds: Updating threshold ('zenmodeler cycle time', ('collector_hostname', ''))
2013-06-10 19:41:27,112 DEBUG zen.thresholds: Updating threshold ('zenperfsnmp cycle time', ('collector_hostname', ''))
2013-06-10 19:41:27,112 DEBUG zen.thresholds: Updating threshold ('zenping cycle time', ('collector_hostname', ''))
2013-06-10 19:41:27,113 DEBUG zen.thresholds: Updating threshold ('zenprocess cycle time', ('collector_hostname', ''))
2013-06-10 19:41:27,152 DEBUG zen.zencommand: Sent a 'stop' event
2013-06-10 19:41:27,153 DEBUG zen.zencommand: stop() called when not running
2013-06-10 19:41:27,153 INFO zen.zencommand: Daemon zencommand shutting down
2013-06-10 19:41:27,153 DEBUG zen.zencommand: Removing service EventService
2013-06-10 19:41:27,153 DEBUG zen.zencommand: Removing service CommandConfig
2013-06-10 19:41:27,154 DEBUG zen.zencommand: Finished config fetch
2013-06-10 19:41:27,154 DEBUG zen.zencommand: stop() called when not running
The collector would evidently trigger the same sequence and stop short from zencommand's point of view at "Sent a 'stop' event"
where nomally when it is working we would get a list of thresholds related to the device_name and then the command with zProperties in the command expanded.
At the same time though I could execute the following zendmd script without any error from the central zenoss server:

from Products.ZenHub.services.CommandConfig import getDeviceCommands
cmds = getDeviceCommands(find("device_name"))
for c in cmds.commands:Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â
  print c.command
And a nice list of the expected commands for device_name would output.
This tells me zenhub was behaving differenty for a locally connected client than a remote collector zencommand client. Again, restarting zenhub was all that was required to get the remote zencommand to be able to fetch commands again. Had to restart zencommand and zenjmx at the collectors to trigger them to load their complete schedule of commands/data sources after that and get to full operation though.
Why would zenhub start doing this after many hours of happy operation? What else could I look for when the failure at zenhub is occuring to isolate the cause of this issue?
--------------------------------------------------------------
Reply to this message by replying to this email -or- go to the discussion on Zenoss Community
[http://community.zenoss.org/message/73567#73567]
Start a new discussion in zenoss-users at Zenoss Community
[http://community.zenoss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2003]