当前位置: 首页>>代码示例>>Python>>正文


Python ForwarderStatus.print_latest_status方法代码示例

本文整理汇总了Python中checks.check_status.ForwarderStatus.print_latest_status方法的典型用法代码示例。如果您正苦于以下问题:Python ForwarderStatus.print_latest_status方法的具体用法?Python ForwarderStatus.print_latest_status怎么用?Python ForwarderStatus.print_latest_status使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在checks.check_status.ForwarderStatus的用法示例。


在下文中一共展示了ForwarderStatus.print_latest_status方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: main

# 需要导入模块: from checks.check_status import ForwarderStatus [as 别名]
# 或者: from checks.check_status.ForwarderStatus import print_latest_status [as 别名]
def main():
    define("pycurl", default=1, help="Use pycurl")
    args = parse_command_line()

    if options.pycurl == 0 or options.pycurl == "0":
        os.environ['USE_SIMPLE_HTTPCLIENT'] = '1'

    # If we don't have any arguments, run the server.
    if not args:
        import tornado.httpclient
        app = init()
        try:
            app.run()
        finally:
            ForwarderStatus.remove_latest_status()
            
    else:
        usage = "%s [help|info]. Run with no commands to start the server" % (
                                        sys.argv[0])
        command = args[0]
        if command == 'info':
            ForwarderStatus.print_latest_status()
        elif command == 'help':
            print usage
        else:
            print "Unknown command: %s" % command
            print usage
            return -1
    return 0
开发者ID:jkoppe,项目名称:dd-agent,代码行数:31,代码来源:ddagent.py

示例2: main

# 需要导入模块: from checks.check_status import ForwarderStatus [as 别名]
# 或者: from checks.check_status.ForwarderStatus import print_latest_status [as 别名]
def main():
    define("pycurl", default=1, help="Use pycurl")
    define("sslcheck", default=1, help="Verify SSL hostname, on by default")
    args = parse_command_line()
    skip_ssl_validation = False

    if unicode(options.pycurl) == u"0":
        os.environ['USE_SIMPLE_HTTPCLIENT'] = "1"

    if unicode(options.sslcheck) == u"0":
        skip_ssl_validation = True

    # If we don't have any arguments, run the server.
    if not args:
        import tornado.httpclient
        app = init(skip_ssl_validation)
        try:
            app.run()
        finally:
            ForwarderStatus.remove_latest_status()

    else:
        usage = "%s [help|info]. Run with no commands to start the server" % (
                                        sys.argv[0])
        command = args[0]
        if command == 'info':
            logging.getLogger().setLevel(logging.ERROR)
            return ForwarderStatus.print_latest_status()
        elif command == 'help':
            print usage
        else:
            print "Unknown command: %s" % command
            print usage
            return -1
    return 0
开发者ID:ghessler,项目名称:dd-agent,代码行数:37,代码来源:ddagent.py

示例3: main

# 需要导入模块: from checks.check_status import ForwarderStatus [as 别名]
# 或者: from checks.check_status.ForwarderStatus import print_latest_status [as 别名]
def main():
    # Deprecation notice
    from utils.deprecations import deprecate_old_command_line_tools
    deprecate_old_command_line_tools()

    define("sslcheck", default=1, help="Verify SSL hostname, on by default")
    define("use_simple_http_client", default=0, help="Use Tornado SimpleHTTPClient instead of CurlAsyncHTTPClient")
    args = parse_command_line()
    skip_ssl_validation = False
    use_simple_http_client = False

    if unicode(options.sslcheck) == u"0":
        skip_ssl_validation = True

    if unicode(options.use_simple_http_client) == u"1":
        use_simple_http_client = True

    # If we don't have any arguments, run the server.
    if not args:
        import tornado.httpclient
        app = init(skip_ssl_validation, use_simple_http_client=use_simple_http_client)
        try:
            app.run()
        except Exception:
            log.exception("Uncaught exception in the forwarder")
        finally:
            ForwarderStatus.remove_latest_status()

    else:
        usage = "%s [help|info]. Run with no commands to start the server" % (sys.argv[0])
        command = args[0]
        if command == 'info':
            logging.getLogger().setLevel(logging.ERROR)
            return ForwarderStatus.print_latest_status()
        elif command == 'help':
            print usage
        else:
            print "Unknown command: %s" % command
            print usage
            return -1
    return 0
开发者ID:hkaj,项目名称:dd-agent,代码行数:43,代码来源:ddagent.py

示例4: main

# 需要导入模块: from checks.check_status import ForwarderStatus [as 别名]
# 或者: from checks.check_status.ForwarderStatus import print_latest_status [as 别名]
def main():
    define("pycurl", default=1, help="Use pycurl")
    define("sslcheck", default=1, help="Verify SSL hostname, on by default")
    args = parse_command_line()

    if unicode(options.pycurl) == u"0":
        os.environ["USE_SIMPLE_HTTPCLIENT"] = "1"

    if unicode(options.sslcheck) == u"0":
        # monkey-patch the AsyncHTTPClient code
        import tornado.simple_httpclient

        tornado.simple_httpclient.match_hostname = lambda x, y: None
        print ("Skipping SSL hostname validation, useful when using a transparent proxy")

    # If we don't have any arguments, run the server.
    if not args:
        import tornado.httpclient

        app = init()
        try:
            app.run()
        finally:
            ForwarderStatus.remove_latest_status()

    else:
        usage = "%s [help|info]. Run with no commands to start the server" % (sys.argv[0])
        command = args[0]
        if command == "info":
            logging.getLogger().setLevel(logging.ERROR)
            return ForwarderStatus.print_latest_status()
        elif command == "help":
            print usage
        else:
            print "Unknown command: %s" % command
            print usage
            return -1
    return 0
开发者ID:stefan-mees,项目名称:dd-agent,代码行数:40,代码来源:ddagent.py

示例5: _info_all

# 需要导入模块: from checks.check_status import ForwarderStatus [as 别名]
# 或者: from checks.check_status.ForwarderStatus import print_latest_status [as 别名]
 def _info_all(self):
     CollectorStatus.print_latest_status(verbose=True)
     DogstatsdStatus.print_latest_status(verbose=True)
     ForwarderStatus.print_latest_status(verbose=True)
开发者ID:AquaBindi,项目名称:dd-agent,代码行数:6,代码来源:flare.py


注:本文中的checks.check_status.ForwarderStatus.print_latest_status方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。