Discussion:
Zenoss 4.2.4 SP71 - Import/Export Triggers/Notifications?
jshardlow
2013-10-01 12:01:44 UTC
Permalink
jshardlow [http://community.zenoss.org/people/jshardlow] created the discussion

"Zenoss 4.2.4 SP71 - Import/Export Triggers/Notifications?"

To view the discussion, visit: http://community.zenoss.org/message/74770#74770

--------------------------------------------------------------
Hi,

I've just upgraded some of my test servers to 4.2.4 SP71 via ZenUp. Whilst having a look through the changes I saw this:

[ZEN-7618] Add import/export capability for triggers/notifications

I've had a look around the front end, and I can't see anything obvious as to how to do this. Also I can't find any mention of 7618 at all on JIRA. Can anyone point me in the right direction?

Cheers,

Jamie
--------------------------------------------------------------

Reply to this message by replying to this email -or- go to the discussion on Zenoss Community
[http://community.zenoss.org/message/74770#74770]

Start a new discussion in zenoss-users at Zenoss Community
[http://community.zenoss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2003]
jcurry
2013-10-07 11:23:57 UTC
Permalink
jcurry [http://community.zenoss.org/people/jcurry] created the discussion

"Re: Zenoss 4.2.4 SP71 - Import/Export Triggers/Notifications?"

To view the discussion, visit: http://community.zenoss.org/message/74852#74852

--------------------------------------------------------------
I have just had a go with this stuff and written a tip on the Zenoss wiki - http://wiki.zenoss.org/Triggers_Notifications_in_ZenPack http://wiki.zenoss.org/Triggers_Notifications_in_ZenPack .

I would be very interested in feedback on this and any further insights in to this mechanism would be welcome and added to the tip.

Cheers,
Jane
--------------------------------------------------------------

Reply to this message by replying to this email -or- go to the discussion on Zenoss Community
[http://community.zenoss.org/message/74852#74852]

Start a new discussion in zenoss-users at Zenoss Community
[http://community.zenoss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2003]
j053ph4
2013-10-07 15:42:10 UTC
Permalink
j053ph4 [http://community.zenoss.org/people/j053ph4] created the discussion

"Re: Zenoss 4.2.4 SP71 - Import/Export Triggers/Notifications?"

To view the discussion, visit: http://community.zenoss.org/message/74855#74855

--------------------------------------------------------------
I was messing around with this a while back and wrote the following convenience method:

The output is intended to be written to an "actions.json" file that would then be read during a ZenPack install.

*def exportTrigsNotifs():*
*    ''' create a JSON export of triggers and notifs for import from actions.json file'''*
*    import json*
*    from uuid import uuid4*
*    facade = getFacade('triggers')*
*    export = {'triggers': [],'notifications': [],}*
*    for trig in facade.getTriggerList():*
*        trigData = facade.getTrigger(trig['uuid'])*
*        trigDict = {*
*                    'name' : trig['name'],*
*                    'uuid' : trig['uuid'],*
*                    'enabled' : trigData['enabled'],*
*                    'rule': trigData['rule'],*
*                }*
*        export['triggers'].append(trigDict)*
*    for notif in facade.getNotifications():*
*        notifDict = {*
*                    'id' : notif.id,*
*                    'name' : notif.name,*
*                    'guid' : str(uuid4()),*
*                    'description' : notif.description,*
*                    'action' : notif.action,*
*                    'enabled' : notif.enabled,*
*                    'delay_seconds' : notif.delay_seconds,*
*                    'repeat_seconds' : notif.repeat_seconds,*
*                    'send_initial_occurrence' : notif.send_initial_occurrence,*
*                    'send_clear' : notif.send_clear,*
*                    'subscriptions': [],*
*                    'recipients' : notif.recipients*
*                    }*
*        for item in notif.content['items'][0]['items']:*
*            key = item['name']*
*            value = item['value']*
*            notifDict[key] = value*
*        export['notifications'].append(notifDict)*

*    print json.dumps(export, indent=4)*

Hope this helps,
Joseph
--------------------------------------------------------------

Reply to this message by replying to this email -or- go to the discussion on Zenoss Community
[http://community.zenoss.org/message/74855#74855]

Start a new discussion in zenoss-users at Zenoss Community
[http://community.zenoss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2003]
Loading...