本文整理汇总了Python中checks.check_status.DogstatsdStatus.print_latest_status方法的典型用法代码示例。如果您正苦于以下问题:Python DogstatsdStatus.print_latest_status方法的具体用法?Python DogstatsdStatus.print_latest_status怎么用?Python DogstatsdStatus.print_latest_status使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类checks.check_status.DogstatsdStatus
的用法示例。
在下文中一共展示了DogstatsdStatus.print_latest_status方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: main
# 需要导入模块: from checks.check_status import DogstatsdStatus [as 别名]
# 或者: from checks.check_status.DogstatsdStatus import print_latest_status [as 别名]
def main(config_path=None):
""" The main entry point for the unix version of dogstatsd. """
parser = optparse.OptionParser("%prog [start|stop|restart|status]")
parser.add_option('-u', '--use-local-forwarder', action='store_true',
dest="use_forwarder", default=False)
opts, args = parser.parse_args()
reporter, server = init(config_path, use_watchdog=True, use_forwarder=opts.use_forwarder)
pid_file = PidFile('dogstatsd')
daemon = Dogstatsd(pid_file.get_path(), server, reporter)
# If no args were passed in, run the server in the foreground.
if not args:
daemon.run()
return 0
# Otherwise, we're process the deamon command.
else:
command = args[0]
if command == 'info':
DogstatsdStatus.print_latest_status()
return 0
if command == 'start':
daemon.start()
elif command == 'stop':
daemon.stop()
elif command == 'restart':
daemon.restart()
elif command == 'status':
pid = pid_file.get_pid()
if pid:
message = 'dogstatsd is running with pid %s' % pid
else:
message = 'dogstatsd is not running'
logger.info(message)
sys.stdout.write(message + "\n")
else:
sys.stderr.write("Unknown command: %s\n\n" % command)
parser.print_help()
return 1
return 0
示例2: main
# 需要导入模块: from checks.check_status import DogstatsdStatus [as 别名]
# 或者: from checks.check_status.DogstatsdStatus import print_latest_status [as 别名]
def main(config_path=None):
""" The main entry point for the unix version of dogstatsd. """
parser = optparse.OptionParser("%prog [start|stop|restart|status]")
parser.add_option("-u", "--use-local-forwarder", action="store_true", dest="use_forwarder", default=False)
opts, args = parser.parse_args()
# commands that don't need the daemon
if args and args[0] in ["info", "status"]:
command = args[0]
if command == "info":
logging.getLogger().setLevel(logging.ERROR)
return DogstatsdStatus.print_latest_status()
elif command == "status":
pid = pid_file.get_pid()
if pid:
message = "dogstatsd is running with pid %s" % pid
else:
message = "dogstatsd is not running"
log.info(message)
sys.stdout.write(message + "\n")
return 0
reporter, server = init(config_path, use_watchdog=True, use_forwarder=opts.use_forwarder)
pid_file = PidFile("dogstatsd")
daemon = Dogstatsd(pid_file.get_path(), server, reporter)
# If no args were passed in, run the server in the foreground.
if not args:
daemon.run()
return 0
# Otherwise, we're process the deamon command.
else:
command = args[0]
if command == "start":
daemon.start()
elif command == "stop":
daemon.stop()
elif command == "restart":
daemon.restart()
else:
sys.stderr.write("Unknown command: %s\n\n" % command)
parser.print_help()
return 1
return 0
示例3: _info_all
# 需要导入模块: from checks.check_status import DogstatsdStatus [as 别名]
# 或者: from checks.check_status.DogstatsdStatus 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)
示例4: info
# 需要导入模块: from checks.check_status import DogstatsdStatus [as 别名]
# 或者: from checks.check_status.DogstatsdStatus import print_latest_status [as 别名]
def info(self):
logging.getLogger().setLevel(logging.ERROR)
return DogstatsdStatus.print_latest_status()