zenoss / ZenPacks.zenoss.ZenPackLib

This is a helper library for zenpacks.
http://zenpacklib.zenoss.com/
GNU General Public License v2.0
15 stars 17 forks source link

threshold error: no minimum or maximum defined #506

Open jstanley23 opened 6 years ago

jstanley23 commented 6 years ago

When setting minval and maxval on a threshold (Duration for example), if the value is set to 0 in the yaml the method getMinval and getMaxval will return None. If 0 is set to both min and max, you will get an event "threshold error: no minimum or maximum defined".

To work around this, you need to set the value to '0' in the yaml, so that the property is a string instead of int.

>>> th = dmd.unrestrictedTraverse('/zport/dmd/Devices/Network/Viptela/VEdge/PNC/rrdTemplates/VipPS/thresholds/Power Supply State')
>>> th.getMinval(th)
>>> th.getMaxval(th)
>>> th.maxval
0
>>> th.minval
0
>>> t = dmd.unrestrictedTraverse('/zport/dmd/Devices/Network/Viptela/VEdge/PNC/rrdTemplates/VipTemperature/thresholds/Temperature State')
>>> t.getMinval(t)
0
>>> t.getMaxval(t)
0
>>> t.minval
'0'
>>> t.maxval
'0'
>>>