def setUp(self):
     self._warnfile = _MockWarnFile()
     patterns_path = os.path.join(os.path.dirname(__file__),
                                  'console_patterns')
     self._alert_hooks = monitors_util.build_alert_hooks_from_path(
         patterns_path, self._warnfile)
     self._logfile = cStringIO.StringIO()
示例#2
0
 def setUp(self):
     self._warnfile = _MockWarnFile()
     patterns_path = os.path.join(os.path.dirname(__file__),
                                  'console_patterns')
     self._alert_hooks = monitors_util.build_alert_hooks_from_path(
             patterns_path, self._warnfile)
     self._logfile = cStringIO.StringIO()
示例#3
0
def main():
    (options, args) = parser.parse_args()
    if len(args) != 2:
        parser.print_help()
        sys.exit(1)

    logfile = _open_logfile(args[0])
    warnfile = os.fdopen(int(args[1]), 'w', 0)
    # For now we aggregate all the alert_hooks.
    alert_hooks = []
    for patterns_path in options.pattern_paths.split(','):
        alert_hooks.extend(
            monitors_util.build_alert_hooks_from_path(patterns_path, warnfile))

    _set_logfile_close_signal_handler(logfile)
    try:
        monitors_util.process_input(sys.stdin, logfile,
                                    options.log_timestamp_format, alert_hooks)
    finally:
        logfile.close()
        _unset_signal_handler()
示例#4
0
def main():
    (options, args) = parser.parse_args()
    if len(args) != 2:
        parser.print_help()
        sys.exit(1)

    logfile = _open_logfile(args[0])
    warnfile = os.fdopen(int(args[1]), 'w', 0)
    # For now we aggregate all the alert_hooks.
    alert_hooks = []
    for patterns_path in options.pattern_paths.split(','):
        alert_hooks.extend(monitors_util.build_alert_hooks_from_path(
                patterns_path, warnfile))

    _set_logfile_close_signal_handler(logfile)
    try:
        monitors_util.process_input(
            sys.stdin, logfile, options.log_timestamp_format, alert_hooks)
    finally:
        logfile.close()
        _unset_signal_handler()