dstat_vmk_nic.py (dstat-0.7.3) | : | dstat_vmk_nic.py (dstat-0.7.4) | ||
---|---|---|---|---|
skipping to change at line 25 | skipping to change at line 25 | |||
def __init__(self): | def __init__(self): | |||
self.name = 'vmknic' | self.name = 'vmknic' | |||
self.nick = ('recv', 'send') | self.nick = ('recv', 'send') | |||
self.open('/proc/vmware/net/tcpip/ifconfig') | self.open('/proc/vmware/net/tcpip/ifconfig') | |||
self.cols = 2 | self.cols = 2 | |||
def check(self): | def check(self): | |||
try: | try: | |||
os.listdir('/proc/vmware') | os.listdir('/proc/vmware') | |||
except: | except: | |||
raise Exception, 'Needs VMware ESX' | raise Exception('Needs VMware ESX') | |||
info(1, 'The vmknic module is an EXPERIMENTAL module.') | info(1, 'The vmknic module is an EXPERIMENTAL module.') | |||
def discover(self, *list): | def discover(self, *list): | |||
ret = [] | ret = [] | |||
for l in self.fd[0].splitlines(replace=' /', delim='/'): | for l in self.fd[0].splitlines(replace=' /', delim='/'): | |||
if len(l) != 12: continue | if len(l) != 12: continue | |||
if l[2][:5] == '<Link': continue | if l[2][:5] == '<Link': continue | |||
if ','.join(l) == 'Name,Mtu/TSO,Network,Address,Ipkts,Ierrs,Ibytes,O pkts,Oerrs,Obytes,Coll,Time': continue | if ','.join(l) == 'Name,Mtu/TSO,Network,Address,Ipkts,Ierrs,Ibytes,O pkts,Oerrs,Obytes,Coll,Time': continue | |||
if l[0] == 'lo0': continue | if l[0] == 'lo0': continue | |||
if l[0] == 'Usage:': continue | if l[0] == 'Usage:': continue | |||
skipping to change at line 66 | skipping to change at line 66 | |||
def extract(self): | def extract(self): | |||
self.set2['total'] = [0, 0] | self.set2['total'] = [0, 0] | |||
for line in self.fd[0].readlines(): | for line in self.fd[0].readlines(): | |||
l = line.replace(' /','/').split() | l = line.replace(' /','/').split() | |||
if len(l) != 12: continue | if len(l) != 12: continue | |||
if l[2][:5] == '<Link': continue | if l[2][:5] == '<Link': continue | |||
if ','.join(l) == 'Name,Mtu/TSO,Network,Address,Ipkts,Ierrs,Ibytes,O pkts,Oerrs,Obytes,Coll,Time': continue | if ','.join(l) == 'Name,Mtu/TSO,Network,Address,Ipkts,Ierrs,Ibytes,O pkts,Oerrs,Obytes,Coll,Time': continue | |||
if l[0] == 'Usage:': continue | if l[0] == 'Usage:': continue | |||
name = l[0] | name = l[0] | |||
if name in self.vars: | if name in self.vars: | |||
self.set2[name] = ( long(l[6]), long(l[9]) ) | self.set2[name] = ( int(l[6]), int(l[9]) ) | |||
if name != 'lo0': | if name != 'lo0': | |||
self.set2['total'] = ( self.set2['total'][0] + long(l[6]), self. set2['total'][1] + long(l[9]) ) | self.set2['total'] = ( self.set2['total'][0] + int(l[6]), self.s et2['total'][1] + int(l[9]) ) | |||
if update: | if update: | |||
for name in self.set2.keys(): | for name in self.set2: | |||
self.val[name] = map(lambda x, y: (y - x) * 1.0 / elapsed, self. | self.val[name] = list(map(lambda x, y: (y - x) * 1.0 / elapsed, | |||
set1[name], self.set2[name]) | self.set1[name], self.set2[name])) | |||
if step == op.delay: | if step == op.delay: | |||
self.set1.update(self.set2) | self.set1.update(self.set2) | |||
# vim:ts=4:sw=4 | # vim:ts=4:sw=4 | |||
End of changes. 4 change blocks. | ||||
6 lines changed or deleted | 6 lines changed or added |