def _get_cali_veth_stat(self):
'''
Check the status of all network interfaces.
Value is 1 if any one of them is DOWN
'''
cali_veth_up = 0
cali_veth_down = 0
cali_veth_total = 0
tmp_veth_up = 0
tmp_veth_down = 0
tmp_veth_total = 0
for name, stat in psutil.net_if_stats().iteritems():
if name.startswith('cali'):
cali_veth_total += 1
if stat.isup:
cali_veth_up += 1
else:
cali_veth_down += 1
elif name.startswith('tmp'):
tmp_veth_total += 1
if stat.isup:
tmp_veth_up += 1
else:
tmp_veth_down += 1
self._result.append(
GraphiteData("lain.cluster.calico.veth.cali.up",
self._endpoint, cali_veth_up, self._step, "val"))
self._result.append(
GraphiteData("lain.cluster.calico.veth.cali.down",
self._endpoint, cali_veth_down, self._step, "val"))
self._result.append(
GraphiteData("lain.cluster.calico.veth.cali.total",
self._endpoint, cali_veth_total, self._step, "val"))
self._result.append(
GraphiteData("lain.cluster.calico.veth.tmp.up",
self._endpoint, tmp_veth_up, self._step, "val"))
self._result.append(
GraphiteData("lain.cluster.calico.veth.tmp.down",
self._endpoint, tmp_veth_down, self._step, "val"))
self._result.append(
GraphiteData("lain.cluster.calico.veth.tmp.total",
self._endpoint, tmp_veth_total, self._step, "val"))
评论列表
文章目录