On Aug 16, 2007, at 9:20 PM, sdtrolley wrote:

Goal: Only trip an event alarm between the hours of 6pm to 6am.

What is the best way to do this?

Here is one way that doesn't work:

How can I manipulate evt.stateChange property in an Event Class Instance Rule Field? I need to convert the time long (epoch) value to localtime for comparing hour strings.

EventClassInst
Rule:

Code:
getattr(evt, 'Field', 0) == "Value" and time.localtime(getattr(evt, 'stateChange', 0))[2] >= "18" or time.localtime(getattr(evt, 'stateChange', 0))[2] <= "6"

If you're only interested in receiving an alert based on these events, simply use the schedule feature that is a part of every alerting rule. The events will still happen, but you won't be alerted. If you want to map events different based on the time they come in, try using Zope's DateTime module instead. It should already be imported and available within your transform.

Code:
hour = DateTime(getattr(evt, 'stateChange', 0)).h_24()
getattr(evt, 'Field', 0) == "Value" and hour >= 18 or hour <= 6

Chet Luther
[EMAIL PROTECTED]
_______________________________________________
zenoss-users mailing list
[email protected]
http://lists.zenoss.org/mailman/listinfo/zenoss-users

Reply via email to