Also you don't have to write this in python. You can use XML-RPC or REST to modify objects. Here is the URL to an alert rule.

http://tilde:8080/zport/dmd/ZenUsers/edahl/alertrule

You can set its enable state using REST like this

http://localhost:8080/zport/dmd/ZenUsers/edahl/alertrule/ manage_changeProperties?enabled=True

You can do the same thing from XML-RPC which I will leave as an exercise to the reader. :)

-EAD

On Jan 30, 2007, at 2:25 PM, Marc Irlandez wrote:

Chris,

Here are a some pointers to get you started:

You'll probably be creating some new ActionRule objects. Look in $ZENHOME/Products/ZenEvents/ActionRule.py for available methods. You could use the manage_addActionRule to create a bunch of rules then set the enabled flag depending on situation. Or you could create similar rules and set them to different users depending on situation.

To help with development, run zendmd, which is the zenoss dmd command shell.

You can call these very same methods in the zendmd. To retrieve some of the objects you'll be using in the zendmd, use these commands:

user = zport.dmd.ZenUsers.MY_USERNAME
alertingRule = user.MY_ALERTING_RULE

To enable/disable your alerting rule:

alertingRule.enabled=True

Hope this helps.

Regards,
Marc Irlandez

On Jan 30, 2007, at 1:31 PM, Chris Beauchamp wrote:

Duncan McGreggor wrote:

On Jan 25, 2007, at 3:26 PM, Chris Beauchamp wrote:

Hi Marc,

hmmm - it has possibilities, however that's 36 rules in theory with 6
people, and the trouble is that its quite inflexible - you know how
these things are in real life: someone's on holiday, so they need to not
get any alerts, someone else has swapped, so their priorities must
change, but not in the normal schedule.

I'm really thinking of a script with a list of names, and you just
supply the order of people on the command line, and it changes the
delays to match that order.

I'm just gonna jump in here quickly :-)

The answer is, yes -- this is very possible. You can write pretty much any python code you want to manipulate the data in Zenoss. This is one
of (in my opinion) Zenoss' killer features.

Indeed, likewise, as I'm learning :) I do love that all the objects are exposed and can be manipulated easily from scripts etc. Nothing's hidden
away.

But the thing is, this is *custom* code you want, for a special workflow you want to provide. It will depend on the format of your config file
(if that's where you put your users and escalation data) and how you
define data such as escalation level, priority, etc. You can map all of that to what Marc was talking about, thanks to the power of python and
Zenoss.

I absolutely agree - I'm completely expecting this to be a custom bit, which I should hopefully be able to write - I don't expect it to become part of Zenoss as a whole (though I suppose it might) - I'm just a bit of a python newbie (I can write perl 'til the cows come home), so after
some pointers to get me started.

Many thanks

Chris

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

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

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

Reply via email to