monitor.py
def run(verbose, config):
    """Parse indicator values and alert if needed"""
    hosts, indicators, alerters = setup(config)
    for host in hosts:
        for indicator in indicators:
            alert = False
            value = indicator.get_value(host)
            if value and indicator.is_alert(host, value=value):
                alert = True
                for alerter in alerters:
                    alerter.send(indicator, host, value)

            if verbose:
                prefix = '[%s](%s)' % (indicator.name.upper(), host)
                value_str = 'Value: %s' % value
                alert_str = 'Alert: %s' % ('on' if alert else 'off')
                click.echo(prefix.ljust(40) + value_str.ljust(30) + alert_str.ljust(30))
Parse indicator values and alert if needed
Parse indicator values and alert if needed
Parse indicator values and alert if needed
def run(verbose, config):
    hosts, indicators, alerters = setup(config)
    for host in hosts:
        for indicator in indicators:
            alert = False
            value = indicator.get_value(host)
            if value and indicator.is_alert(host, value=value):
                alert = True
                for alerter in alerters:
                    alerter.send(indicator, host, value)
            if verbose:
                prefix = '[%s](%s)' % (indicator.name.upper(), host)
                value_str = 'Value: %s' % value
                alert_str = 'Alert: %s' % ('on' if alert else 'off')
                click.echo(prefix.ljust(40) + value_str.ljust(30) + alert_str.ljust(30))
def run ( verbose , config ) : hosts , indicators , alerters = setup ( config ) for host in hosts : for indicator in indicators : alert = False value = indicator . get_value ( host ) if value and indicator . is_alert ( host , value = value ) : alert = True for alerter in alerters : alerter . send ( indicator , host , value ) if verbose : prefix = '[%s](%s)' % ( indicator . name . upper ( ) , host ) value_str = 'Value: %s' % value alert_str = 'Alert: %s' % ( 'on' if alert else 'off' ) click . echo ( prefix . ljust ( 40 ) + value_str . ljust ( 30 ) + alert_str . ljust ( 30 ) )
Parse indicator values and alert if needed
Parse indicator values and alert if needed
"""Parse indicator values and alert if needed"""
verbose
config