dstat_squid.py (dstat-0.7.3) | : | dstat_squid.py (dstat-0.7.4) | ||
---|---|---|---|---|
skipping to change at line 34 | skipping to change at line 34 | |||
'Number of clients accessing cache', | 'Number of clients accessing cache', | |||
'Mean Object Size') | 'Mean Object Size') | |||
self.nick = ('fdesc', | self.nick = ('fdesc', | |||
'cpu5', | 'cpu5', | |||
'mem', | 'mem', | |||
'clnts', | 'clnts', | |||
'objsz') | 'objsz') | |||
def check(self): | def check(self): | |||
if not os.access('/usr/sbin/squidclient', os.X_OK): | if not os.access('/usr/sbin/squidclient', os.X_OK): | |||
raise Exception, 'Needs squidclient binary' | raise Exception('Needs squidclient binary') | |||
cmd_test('/usr/sbin/squidclient %s mgr:info' % squidclient_options) | cmd_test('/usr/sbin/squidclient %s mgr:info' % squidclient_options) | |||
return True | return True | |||
def extract(self): | def extract(self): | |||
try: | try: | |||
for l in cmd_splitlines('/usr/sbin/squidclient %s mgr:info' % squidc lient_options, ':'): | for l in cmd_splitlines('/usr/sbin/squidclient %s mgr:info' % squidc lient_options, ':'): | |||
if l[0].strip() in self.vars: | if l[0].strip() in self.vars: | |||
self.val[l[0].strip()] = l[1].strip() | self.val[l[0].strip()] = l[1].strip() | |||
break | break | |||
except IOError, e: | except IOError as e: | |||
if op.debug > 1: print '%s: lost pipe to squidclient, %s' % (self.fi | if op.debug > 1: print('%s: lost pipe to squidclient, %s' % (self.fi | |||
lename, e) | lename, e)) | |||
for name in self.vars: self.val[name] = -1 | for name in self.vars: self.val[name] = -1 | |||
except Exception, e: | except Exception as e: | |||
if op.debug > 1: print '%s: exception' (self.filename, e) | if op.debug > 1: print('%s: exception' (self.filename, e)) | |||
for name in self.vars: self.val[name] = -1 | for name in self.vars: self.val[name] = -1 | |||
# vim:ts=4:sw=4:et | # vim:ts=4:sw=4:et | |||
End of changes. 3 change blocks. | ||||
6 lines changed or deleted | 6 lines changed or added |