def getPoolTriggers(guid, format, **kwargs):
    """Return a general pool set of triggers."""

    return (
        Trigger(
            guid, format % 'DOWN', PERCENT, AVAILABILITY,
            dict(
                kwargs,
                state='DOWN',
                dependentState='DOWN',
                threshold='100',
            )),
        Trigger(
            guid, format % 'DEGRADED', THRESHOLD, AVAILABILITY,
            dict(
                kwargs,
                state='DEGRADED',
                dependentState='DEGRADED',
                threshold='1',
            )),
        Trigger(
            guid, format % 'ATRISK_1', THRESHOLD, AVAILABILITY,
            dict(
                kwargs,
                state='DEGRADED',
                dependentState='DOWN',
                threshold='1',
            )),
    )
Пример #2
0
    def get_triggers(self):
        '''
        Return list of triggers defined by subclass' triggers property.
        '''
        # Lazy import without incurring import overhead.
        # http://wiki.python.org/moin/PythonSpeed/PerformanceTips#Import_Statement_Overhead
        global Trigger
        if not Trigger:
            from ZenPacks.zenoss.Impact.impactd import Trigger

        for trigger_args in self.triggers:
            yield Trigger(self.guid(), *trigger_args)