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


Python DogstatsdStatus.print_latest_status方法代码示例

本文整理汇总了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
开发者ID:jkoppe,项目名称:dd-agent,代码行数:44,代码来源:dogstatsd.py

示例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
开发者ID:potto007,项目名称:dd-agent,代码行数:48,代码来源:dogstatsd.py

示例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)
开发者ID:AquaBindi,项目名称:dd-agent,代码行数:6,代码来源:flare.py

示例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()
开发者ID:dhapgood4thscreen,项目名称:dd-agent,代码行数:5,代码来源:dogstatsd.py


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