ZenDMD Tip - Audit Triggers and Notifications

From Zenoss Wiki
This is the approved revision of this page; it is not the most recent. View the most recent revision.
Jump to: navigation, search

su zenoss, then zendmd

Trigger list...

facade = getFacade('triggers')
 
print 'Triggers: '
for trig in facade.getTriggerList():
    print '-'*80
    print 'Name: ' + str(trig['name'])
    trigData = facade.getTrigger(trig['uuid'])
    print ' Enabled: ' + str(trigData['enabled'])
    print ' Rule: ' + str(trigData['rule']['source'])
    print ' Subscriptions: '
    if len(trigData['subscriptions']) == 0: 
        print '  None'
    for sub in range(0,len(trigData['subscriptions'])):
        print '  UUID: ' + str(trigData['subscriptions'][sub]['uuid'])
        print '    Delay: ' + str(trigData['subscriptions'][sub]['delay_seconds'])
        print '    Repeat: ' + str(trigData['subscriptions'][sub]['repeat_seconds'])
        print '    Send Initial Occurance: ' + str(trigData['subscriptions'][sub]['send_initial_occurrence'])
        print '  -' + '-'*25

Notification list...

facade = getFacade('triggers')
 
print 'Notifications: '
for note in facade.getNotifications():
    print '-'*80
    print 'Name: ' + str(note.name)
    print ' Enabled: ' + str(note.enabled)
    print ' Description: ' + str(note.description)
    print ' Delay: ' + str(note.delay_seconds)
    print ' Recpients: '
    if len(note.recipients) == 0: 
        print '  None'
    for recip in range(0,len(note.recipients)):
        print '  Label: ' + str(note.recipients[recip]['label'])
        print '    Type: ' + str(note.recipients[recip]['type'])
        print '    Manage: ' + str(note.recipients[recip]['manage'])
        print '    Write: ' + str(note.recipients[recip]['write'])
        print '  -' + '-'*25