本文整理汇总了Python中checks.check_status.CollectorStatus.load_latest_status方法的典型用法代码示例。如果您正苦于以下问题:Python CollectorStatus.load_latest_status方法的具体用法?Python CollectorStatus.load_latest_status怎么用?Python CollectorStatus.load_latest_status使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类checks.check_status.CollectorStatus
的用法示例。
在下文中一共展示了CollectorStatus.load_latest_status方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_persistence_fail
# 需要导入模块: from checks.check_status import CollectorStatus [as 别名]
# 或者: from checks.check_status.CollectorStatus import load_latest_status [as 别名]
def test_persistence_fail():
# Assert remove doesn't crap out if a file doesn't exist.
CollectorStatus.remove_latest_status()
CollectorStatus.remove_latest_status()
status = CollectorStatus.load_latest_status()
assert not status
示例2: test_persistence
# 需要导入模块: from checks.check_status import CollectorStatus [as 别名]
# 或者: from checks.check_status.CollectorStatus import load_latest_status [as 别名]
def test_persistence():
i1 = InstanceStatus(1, STATUS_OK)
chk1 = CheckStatus("dummy", [i1], 1, 2)
c1 = CollectorStatus([chk1])
c1.persist()
c2 = CollectorStatus.load_latest_status()
nt.assert_equal(1, len(c2.check_statuses))
chk2 = c2.check_statuses[0]
assert chk2.name == chk1.name
assert chk2.status == chk2.status
assert chk2.metric_count == 1
assert chk2.event_count == 2
示例3: get
# 需要导入模块: from checks.check_status import CollectorStatus [as 别名]
# 或者: from checks.check_status.CollectorStatus import load_latest_status [as 别名]
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: latest_status
# 需要导入模块: from checks.check_status import CollectorStatus [as 别名]
# 或者: from checks.check_status.CollectorStatus import load_latest_status [as 别名]
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"