1 ### Author: Vikas Gorur (http://github.com/vikasgorur) 2 3 class dstat_plugin(dstat): 4 """ 5 Waiting calls on mounted FUSE filesystems 6 7 Displays the number of waiting calls on all mounted FUSE filesystems. 8 """ 9 10 def __init__(self): 11 self.name = 'fuse' 12 self.type = 'd' 13 self.fusectl_path = "/sys/fs/fuse/connections/" 14 self.dirs = [] 15 16 def check(self): 17 info(1, "Module %s is still experimental." % self.filename) 18 19 if not os.path.exists(self.fusectl_path): 20 raise Exception('%s not mounted' % self.fusectl_path) 21 if len(os.listdir(self.fusectl_path)) == 0: 22 raise Exception('No fuse filesystems mounted') 23 24 def vars(self): 25 self.dirs = os.listdir(self.fusectl_path) 26 27 atleast_one_ok = False 28 for d in self.dirs: 29 if os.access(self.fusectl_path + d + "/waiting", os.R_OK): 30 atleast_one_ok = True 31 32 if not atleast_one_ok: 33 raise Exception('User is not root or no fuse filesystems mounted') 34 35 return self.dirs 36 37 def extract(self): 38 for d in self.dirs: 39 path = self.fusectl_path + d + "/waiting" 40 if os.path.exists(path): 41 line = dopen(path).readline() 42 self.val[d] = int(line) 43 else: 44 self.val[d] = 0 45 46 # vim:ts=4:sw=4:et