本文整理汇总了Python中checks.check_status.ForwarderStatus类的典型用法代码示例。如果您正苦于以下问题:Python ForwarderStatus类的具体用法?Python ForwarderStatus怎么用?Python ForwarderStatus使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了ForwarderStatus类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: main
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':
return ForwarderStatus.print_latest_status()
elif command == 'help':
print usage
else:
print "Unknown command: %s" % command
print usage
return -1
return 0
示例2: main
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
示例3: main
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
示例4: main
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
示例5: get
def get(self):
dogstatsd_status = DogstatsdStatus.load_latest_status()
forwarder_status = ForwarderStatus.load_latest_status()
collector_status = CollectorStatus.load_latest_status()
self.render(os.path.join(agent_root, "pup", "status.html"),
port=port,
platform=platform.platform(),
agent_version=get_version(),
python_version=platform.python_version(),
logger_info=logger_info(),
dogstatsd=dogstatsd_status.to_dict(),
forwarder=forwarder_status.to_dict(),
collector=collector_status.to_dict(),
)
示例6: latest_status
def latest_status(self):
try:
loaded_template = template.Loader(".")
dogstatsd_status = DogstatsdStatus.load_latest_status()
forwarder_status = ForwarderStatus.load_latest_status()
collector_status = CollectorStatus.load_latest_status()
generated_template = loaded_template.load("status.html").generate(
port=22,
platform=platform.platform(),
agent_version=get_version(),
python_version=platform.python_version(),
logger_info=logger_info(),
dogstatsd=dogstatsd_status.to_dict(),
forwarder=forwarder_status.to_dict(),
collector=collector_status.to_dict(),
)
return generated_template
except Exception:
return "Unable to fetch latest status"
示例7: _info_all
def _info_all(self):
CollectorStatus.print_latest_status(verbose=True)
DogstatsdStatus.print_latest_status(verbose=True)
ForwarderStatus.print_latest_status(verbose=True)