本文整理汇总了Python中util.Platform.is_bsd方法的典型用法代码示例。如果您正苦于以下问题:Python Platform.is_bsd方法的具体用法?Python Platform.is_bsd怎么用?Python Platform.is_bsd使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类util.Platform
的用法示例。
在下文中一共展示了Platform.is_bsd方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: testNetwork
# 需要导入模块: from util import Platform [as 别名]
# 或者: from util.Platform import is_bsd [as 别名]
def testNetwork(self):
# FIXME: cx_state to true, but needs sysstat installed
config = """
init_config:
instances:
- collect_connection_state: false
excluded_interfaces:
- lo
- lo0
"""
check, instances = get_check("network", config)
check.check(instances[0])
check.get_metrics()
metric_names = [m[0] for m in check.aggregator.metrics]
assert "system.net.bytes_rcvd" in metric_names
assert "system.net.bytes_sent" in metric_names
if Platform.is_linux():
assert "system.net.tcp.retrans_segs" in metric_names
assert "system.net.tcp.in_segs" in metric_names
assert "system.net.tcp.out_segs" in metric_names
elif Platform.is_bsd():
assert "system.net.tcp.retrans_packs" in metric_names
assert "system.net.tcp.sent_packs" in metric_names
assert "system.net.tcp.rcv_packs" in metric_names
示例2: check
# 需要导入模块: from util import Platform [as 别名]
# 或者: from util.Platform import is_bsd [as 别名]
def check(self, instance):
if instance is None:
instance = {}
self._excluded_ifaces = instance.get('excluded_interfaces', [])
self._collect_cx_state = instance.get('collect_connection_state', False)
self._exclude_iface_re = None
exclude_re = instance.get('excluded_interface_re', None)
if exclude_re:
self.log.debug("Excluding network devices matching: %s" % exclude_re)
self._exclude_iface_re = re.compile(exclude_re)
if Platform.is_linux():
self._check_linux(instance)
elif Platform.is_bsd():
self._check_bsd(instance)
elif Platform.is_solaris():
self._check_solaris(instance)