"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "plugins/dstat_utmp.py" between
dstat-0.7.3.tar.gz and dstat-0.7.4.tar.gz

About: dstat is a versatile resource statistic tool and a replacement for vmstat, iostat and ifstat (using Python).

dstat_utmp.py  (dstat-0.7.3):dstat_utmp.py  (dstat-0.7.4)
skipping to change at line 17 skipping to change at line 17
self.vars = ('sessions', 'users', 'root') self.vars = ('sessions', 'users', 'root')
self.type = 'd' self.type = 'd'
self.width = 3 self.width = 3
self.scale = 10 self.scale = 10
def check(self): def check(self):
try: try:
global utmp global utmp
import utmp import utmp
except: except:
raise Exception, 'Needs python-utmp module' raise Exception('Needs python-utmp module')
def extract(self): def extract(self):
for name in self.vars: self.val[name] = 0 for name in self.vars: self.val[name] = 0
for u in utmp.UtmpRecord(): for u in utmp.UtmpRecord():
# print '# type:%s pid:%s line:%s id:%s user:%s host:%s session:%s' % (i.ut_type, i.ut_pid, i.ut_line, i.ut_id, i.ut_user, i.ut_host, i.ut_session) # print('# type:%s pid:%s line:%s id:%s user:%s host:%s session:%s' % (i.ut_type, i.ut_pid, i.ut_line, i.ut_id, i.ut_user, i.ut_host, i.ut_session))
if u.ut_type == utmp.USER_PROCESS: if u.ut_type == utmp.USER_PROCESS:
self.val['users'] = self.val['users'] + 1 self.val['users'] = self.val['users'] + 1
if u.ut_user == 'root': if u.ut_user == 'root':
self.val['root'] = self.val['root'] + 1 self.val['root'] = self.val['root'] + 1
self.val['sessions'] = self.val['sessions'] + 1 self.val['sessions'] = self.val['sessions'] + 1
# vim:ts=4:sw=4:et # vim:ts=4:sw=4:et
 End of changes. 2 change blocks. 
2 lines changed or deleted 2 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)