本文整理汇总了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()
示例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
示例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(),
)
示例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
示例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"
示例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)
示例7: info
def info(self):
logging.getLogger().setLevel(logging.ERROR)
return DogstatsdStatus.print_latest_status()