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


Python check_status.DogstatsdStatus类代码示例

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


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

示例1: run

    def run(self):
        logger.info("Reporting to %s every %ss" % (self.api_host, self.interval))
        logger.debug("Watchdog enabled: %s" % bool(self.watchdog))

        # Persist a start-up message.
        DogstatsdStatus().persist()

        while not self.finished.isSet(): # Use camel case isSet for 2.4 support.
            self.finished.wait(self.interval)
            self.metrics_aggregator.send_packet_count('datadog.dogstatsd.packet.count')
            self.flush()
            if self.watchdog:
                self.watchdog.reset()

        # Clean up the status messages.
        logger.debug("Stopped reporter")
        DogstatsdStatus.remove_latest_status()
开发者ID:jkoppe,项目名称:dd-agent,代码行数:17,代码来源:dogstatsd.py

示例2: main

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,代码行数:42,代码来源:dogstatsd.py

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

示例4: main

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,代码行数:46,代码来源:dogstatsd.py

示例5: 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"
开发者ID:hutchic,项目名称:dd-agent,代码行数:19,代码来源:gui.py

示例6: _info_all

 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,代码行数:4,代码来源:flare.py

示例7: info

 def info(self):
     logging.getLogger().setLevel(logging.ERROR)
     return DogstatsdStatus.print_latest_status()
开发者ID:dhapgood4thscreen,项目名称:dd-agent,代码行数:3,代码来源:dogstatsd.py


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