Closed dougsyer closed 11 years ago
doug, I am not exactly sure what your requesting here. Maybe some pseudo code could help describe what your looking for.
Thanks, Eric
Sorry yes that wasnt clear at all.
Ive found it best to try and avoid over-riding templates whenever possible. In some cases I create zprops/crprops per device to set custom thresholds so I dont have to over-ride templates.
In other case (like disks) we sometimes need to over-ride on a component basis(several ways to do this) but also I want to be able to give permissions to our engineers to do it themselves and I dont give them access to transforms and limited access to z/c props...
So I'll add a property that is intended to be a component-level threshold and use the technique I saw on the MSMSQ zenpack.
maybe soeme like a flag to make it a component threshold property?
for example in my cisco voice gateway zenpack:
...stuff.. class CiscoDialPeer(DeviceComponent, ManagedEntity): .....stuff.... siptrunk_in_near_saturation = "100" siptrunk_out_near_saturation = "100" ......stuff.... _properties = ...... {'id': 'siptrunk_in_near_saturation', 'type': 'string'}, {'id': 'siptrunk_out_near_saturation', 'type': 'string'}, ..... @...security decorator?
def manage_editCiscoDialPeer(self, siptrunk_in_near_saturation=None, siptrunk_out_near_saturation = None, monitor=None,
REQUEST=None):
"""
Edit this Cisco Dial Peer from the web.
"""
if siptrunk_in_near_saturation is not None:
self.siptrunk_in_near_saturation = siptrunk_in_near_saturation
if siptrunk_out_near_saturation is not None:
self.siptrunk_in_near_saturation = siptrunk_in_near_saturation
if monitor is not None:
self.monitor = monitor
self.index_object()
if REQUEST:
IMessageSender(self).sendToBrowser('Saved', SaveMessage())
return self.callZenScreen(REQUEST)
def getsiptrunk_in_near_saturation(self):
if self.siptrunk_in_near_saturation == '':
return maxint
else:
return float(self.siptrunk_in_near_saturation)
def getsiptrunk_out_near_saturation(self):
if self.siptrunk_in_near_saturation == '':
return maxint
else:
return float(self.siptrunk_out_near_saturation)
interface.py:
class ICiscoDialPeerInfo(IComponentInfo .....stuff.... siptrunk_in_near_saturation = schema.TextLine(title=_t('siptrunk_in_near_saturation'), alwaysEditable=True) siptrunk_out_near_saturation = schema.TextLine(title=_t('siptrunk_out_near_saturation'), alwaysEditable=True)
We struggle alot with thresholds.. In general we use defaults but for certain very important components (usually drives) or certain one-off devices we need to override our default thresholds. Its rare but usually we need to do it for large customers and on their most important devices.
I was thinking that actually if device level zprops inherited down to the component then you could set a default threshold at the device class or device and if you ever need to over-ride it at the component level you could just edit the zproperty there using the ..
I havent looked to see for sure if zproperties inherit down to the component level but ive never really checked.
If that is the case then what I'd do is just create zprops for the thresholds i'd want then try to set it so you can just override that zproperty at the component level. that would be better than the method used by the MSMQ Zenpack.
so you set your threshold to here.zSuperImportantComponentStat and use the info adapter to allow you to over-ride the value on the component?
https://github.com/zenoss/ZenPackGenerator/commit/c632a3dd4c235e08abdb5a87df2643fd24276abd
Doug, I have added the ability to set the readonly property to False for the component details section for a property. This is currently in the develop branch.
While we do not handle transforms in zpg we can make setting custom properties easier.
Eric
okay i'll give it a shot when i get a change.
tks
I havent kept up with the latest here but I think its great that you guys are working on this,at the very least having a standard for all the 'default' bells and whistles will be great.
One thing that would help is some kind of option to add a zprop for a threshold over-ride at the device or component level, and a dialog to be able to set it at the component level. I wouldnt want a zp/dialog for every data point but having the option to add a threshold override zprop if you want to would be great.