Hi Brock,

On Wednesday 05 March 2008 05:21:51 pm Brock Palen wrote:
> I have wrote a lustre dstat plugin.  You can find it on my blog:

That's cool! Very useful for my daily work, thanks!

> It only works on clients, and has not been tested on multiple mounts,
> Its very simple just reads /proc/

It indeed doesn't read stats for multiple mounts. I slightly modified it 
so it can display read/write numbers for all the mounts it founds (see 
the attached patch).

Here's a typical output for a rsync transfer from scrath to home:

-- 8< ---------------------------------------------------------------
$ dstat -M lustre

Module dstat_lustre is still experimental.
--scratch-------home---
 read write: read write
 110M    0 :   0   110M
 183M    0 :   0   183M
 184M    0 :   0   184M
-- 8< ---------------------------------------------------------------

Maybe it could be useful to also add the other metrics from the stat 
file, but I'm not sure which ones would be the more relevant. And it 
would probably be wise to do that in a separate module, like 
lustre_stats, to avoid clutter.

Anyway, great job, and thanks for sharing it!
Cheers,
-- 
Kilian
--- dstat_lustre_orig.py	2008-03-07 15:54:10.000000000 -0800
+++ dstat_lustre.py	2008-03-07 15:54:36.000000000 -0800
@@ -5,28 +5,33 @@
 
 class dstat_lustre(dstat):
 	def __init__(self):
-		self.name = 'lustre 1.6 client'
-		for entry in os.listdir("/proc/fs/lustre/llite"):
-			filesystem = '/'.join(['/proc/fs/lustre/llite',entry,'stats'])
-			self.open(filesystem)
+		self.name = []
+		self.vars = []
+		if os.path.exists('/proc/fs/lustre/llite'):
+			for mount in os.listdir('/proc/fs/lustre/llite'):
+				self.vars.append(mount)
+				self.name.append(mount[:mount.rfind('-')])
 		self.format = ('f', 5, 1024)
-		self.vars = ('read', 'write')
-		self.nick = ('read', 'writ')
-		self.init(self.vars, 1)
+		self.nick = ('read', 'write')
+		self.init(self.vars, 2)
 		info(1, 'Module dstat_lustre is still experimental.')
 
 	def extract(self):
-		for line in self.readlines():
-			l = line.split()
-			if not l or l[0] != 'read_bytes': continue
-			self.cn2['read'] = long(l[6])
-		for line in self.readlines():
-			l = line.split()
-			if not l or l[0] != 'write_bytes': continue
-			self.cn2['write'] = long(l[6])
 		for name in self.vars:
-			self.val[name] = (self.cn2[name] - self.cn1[name]) * 1.0 / tick
-		if step == op.delay:
-			self.cn1.update(self.cn2)
+			f = open('/'.join(['/proc/fs/lustre/llite',name,'stats']))
+			lines = f.readlines()
+			for line in lines:
+				l = line.split()
+				if not l or l[0] != 'read_bytes': continue
+				read = long(l[6])
+			for line in lines:
+				l = line.split()
+				if not l or l[0] != 'write_bytes': continue
+				write = long(l[6])
+			self.cn2[name] = (read, write)
+			self.val[name] = ( (self.cn2[name][0] - self.cn1[name][0]) * 1.0 / tick,\
+							   (self.cn2[name][1] - self.cn1[name][1]) * 1.0 / tick ) 
+			if step == op.delay:
+				self.cn1.update(self.cn2)
 
 # vim:ts=4:sw=4
_______________________________________________
Lustre-discuss mailing list
[email protected]
http://lists.lustre.org/mailman/listinfo/lustre-discuss

Reply via email to