1 <?xml version='1.0' encoding='UTF-8'?>
2 <!-- This document was created with Syntext Serna Free. --><chapter xmlns="http://docbook.org/ns/docbook" xmlns:xl="http://www.w3.org/1999/xlink" version="5.0" xml:lang="en-US" xml:id="lustremonitoring">
3 <title xml:id="lustremonitoring.title">Lustre Monitoring</title>
4 <para>This chapter provides information on monitoring Lustre and includes the following sections:</para>
7 <para><xref linkend="dbdoclet.50438273_18711"/>Lustre Changelogs</para>
10 <para><xref linkend="dbdoclet.jobstats"/>Lustre Jobstats</para>
13 <para><xref linkend="dbdoclet.50438273_81684"/>Lustre Monitoring Tool</para>
16 <para><xref linkend="dbdoclet.50438273_80593"/>CollectL</para>
19 <para><xref linkend="dbdoclet.50438273_44185"/>Other Monitoring Options</para>
22 <section xml:id="dbdoclet.50438273_18711">
23 <title><indexterm><primary>change logs</primary><see>monitoring</see></indexterm>
24 <indexterm><primary>monitoring</primary></indexterm>
25 <indexterm><primary>monitoring</primary><secondary>change logs</secondary></indexterm>
27 Lustre Changelogs</title>
28 <para>The changelogs feature records events that change the file system namespace or file metadata. Changes such as file creation, deletion, renaming, attribute changes, etc. are recorded with the target and parent file identifiers (FIDs), the name of the target, and a timestamp. These records can be used for a variety of purposes:</para>
31 <para>Capture recent changes to feed into an archiving system.</para>
34 <para>Use changelog entries to exactly replicate changes in a file system mirror.</para>
37 <para>Set up "watch scripts" that take action on certain events or directories.</para>
40 <para>Maintain a rough audit trail (file/directory changes with timestamps, but no user information).</para>
43 <para>Changelogs record types are:</para>
44 <informaltable frame="all">
46 <colspec colname="c1" colwidth="50*"/>
47 <colspec colname="c2" colwidth="50*"/>
51 <para><emphasis role="bold">Value</emphasis></para>
54 <para><emphasis role="bold">Description</emphasis></para>
64 <para> Internal recordkeeping</para>
72 <para> Regular file creation</para>
80 <para> Directory creation</para>
88 <para> Hard link</para>
96 <para> Soft link</para>
104 <para> Other file creation</para>
112 <para> Regular file removal</para>
120 <para> Directory removal</para>
128 <para> Rename, original</para>
136 <para> Rename, final</para>
144 <para> ioctl on file or directory</para>
152 <para> Regular file truncated</para>
160 <para> Attribute change</para>
168 <para> Extended attribute change</para>
176 <para> Unknown operation</para>
182 <para>FID-to-full-pathname and pathname-to-FID functions are also included to map target and parent FIDs into the file system namespace.</para>
184 <title><indexterm><primary>monitoring</primary><secondary>change logs</secondary></indexterm>
185 Working with Changelogs</title>
186 <para>Several commands are available to work with changelogs.</para>
189 <literal>lctl changelog_register</literal>
191 <para>Because changelog records take up space on the MDT, the system administration must register changelog users. The registrants specify which records they are "done with", and the system purges up to the greatest common record.</para>
192 <para>To register a new changelog user, run:</para>
193 <screen>lctl --device /dev/<replaceable>mdt_device</replaceable> changelog_register
195 <para>Changelog entries are not purged beyond a registered user's set point (see <literal>lfs changelog_clear</literal>).</para>
199 <literal>lfs changelog</literal>
201 <para>To display the metadata changes on an MDT (the changelog records), run:</para>
202 <screen>lfs changelog <replaceable>fsname</replaceable>-<replaceable>MDTnumber</replaceable> [startrec [endrec]] </screen>
203 <para>It is optional whether to specify the start and end records.</para>
204 <para>These are sample changelog records:</para>
205 <screen>2 02MKDIR 4298396676 0x0 t=[0x200000405:0x15f9:0x0] p=[0x13:0x15e5a7a3:0x0]\
207 3 01CREAT 4298402264 0x0 t=[0x200000405:0x15fa:0x0] p=[0x200000405:0x15f9:0\
209 4 06UNLNK 4298404466 0x0 t=[0x200000405:0x15fa:0x0] p=[0x200000405:0x15f9:0\
211 5 07RMDIR 4298405394 0x0 t=[0x200000405:0x15f9:0x0] p=[0x13:0x15e5a7a3:0x0]\
216 <literal>lfs changelog_clear</literal>
218 <para>To clear old changelog records for a specific user (records that the user no longer needs), run:</para>
219 <screen>lfs changelog_clear <replaceable>mdt_name</replaceable> <replaceable>userid</replaceable> <replaceable>endrec</replaceable></screen>
220 <para>The <literal>changelog_clear</literal> command indicates that changelog records previous to <replaceable>endrec</replaceable> are no longer of interest to a particular user <replaceable>userid</replaceable>, potentially allowing the MDT to free up disk space. An <literal><replaceable>endrec</replaceable></literal> value of 0 indicates the current last record. To run <literal>changelog_clear</literal>, the changelog user must be registered on the MDT node using <literal>lctl</literal>.</para>
221 <para>When all changelog users are done with records < X, the records are deleted.</para>
225 <literal>lctl changelog_deregister</literal>
227 <para>To deregister (unregister) a changelog user, run:</para>
228 <screen>lctl --device <replaceable>mdt_device</replaceable> changelog_deregister <replaceable>userid</replaceable> </screen>
229 <para> <literal>changelog_deregister cl1</literal> effectively does a <literal>changelog_clear cl1 0</literal> as it deregisters.</para>
233 <title>Changelog Examples</title>
234 <para>This section provides examples of different changelog commands.</para>
236 <title>Registering a Changelog User</title>
237 <para>To register a new changelog user for a device (<literal>lustre-MDT0000</literal>):</para>
238 <screen># lctl --device lustre-MDT0000 changelog_register
239 lustre-MDT0000: Registered changelog userid 'cl1'</screen>
242 <title>Displaying Changelog Records</title>
243 <para>To display changelog records on an MDT (<literal>lustre-MDT0000</literal>):</para>
244 <screen>$ lfs changelog lustre-MDT0000
245 1 00MARK 19:08:20.890432813 2010.03.24 0x0 t=[0x10001:0x0:0x0] p=[0:0x0:0x\
246 0] mdd_obd-lustre-MDT0000-0
247 2 02MKDIR 19:10:21.509659173 2010.03.24 0x0 t=[0x200000420:0x3:0x0] p=[0x61\
248 b4:0xca2c7dde:0x0] mydir
249 3 14SATTR 19:10:27.329356533 2010.03.24 0x0 t=[0x200000420:0x3:0x0]
250 4 01CREAT 19:10:37.113847713 2010.03.24 0x0 t=[0x200000420:0x4:0x0] p=[0x20\
251 0000420:0x3:0x0] hosts </screen>
252 <para>Changelog records include this information:</para>
254 operation_type(numerical/text)
261 <para>Displayed in this format:</para>
262 <screen>rec# operation_type(numerical/text) timestamp datestamp flags t=target_FID \
263 p=parent_FID target_name</screen>
264 <para>For example:</para>
265 <screen>4 01CREAT 19:10:37.113847713 2010.03.24 0x0 t=[0x200000420:0x4:0x0] p=[0x20\
266 0000420:0x3:0x0] hosts</screen>
269 <title>Clearing Changelog Records</title>
270 <para>To notify a device that a specific user (<literal>cl1</literal>) no longer needs records (up to and including 3):</para>
271 <screen>$ lfs changelog_clear lustre-MDT0000 cl1 3</screen>
272 <para>To confirm that the <literal>changelog_clear</literal> operation was successful, run <literal>lfs changelog</literal>; only records after id-3 are listed:</para>
273 <screen>$ lfs changelog lustre-MDT0000
274 4 01CREAT 19:10:37.113847713 2010.03.24 0x0 t=[0x200000420:0x4:0x0] p=[0x20\
275 0000420:0x3:0x0] hosts</screen>
278 <title>Deregistering a Changelog User</title>
279 <para>To deregister a changelog user (<literal>cl1</literal>) for a specific device (<literal>lustre-MDT0000</literal>):</para>
280 <screen># lctl --device lustre-MDT0000 changelog_deregister cl1
281 lustre-MDT0000: Deregistered changelog user 'cl1'</screen>
282 <para>The deregistration operation clears all changelog records for the specified user (<literal>cl1</literal>).</para>
283 <screen>$ lfs changelog lustre-MDT0000
284 5 00MARK 19:13:40.858292517 2010.03.24 0x0 t=[0x40001:0x0:0x0] p=[0:0x0:0x\
285 0] mdd_obd-lustre-MDT0000-0
288 <para>MARK records typically indicate changelog recording status changes.</para>
292 <title>Displaying the Changelog Index and Registered Users</title>
293 <para>To display the current, maximum changelog index and registered changelog users for a specific device (<literal>lustre-MDT0000</literal>):</para>
294 <screen># lctl get_param mdd.lustre-MDT0000.changelog_users
295 mdd.lustre-MDT0000.changelog_users=current index: 8
301 <title>Displaying the Changelog Mask</title>
302 <para>To show the current changelog mask on a specific device (<literal>lustre-MDT0000</literal>):</para>
303 <screen># lctl get_param mdd.lustre-MDT0000.changelog_mask
305 mdd.lustre-MDT0000.changelog_mask=
306 MARK CREAT MKDIR HLINK SLINK MKNOD UNLNK RMDIR RNMFM RNMTO OPEN CLOSE IOCTL\
307 TRUNC SATTR XATTR HSM
311 <title>Setting the Changelog Mask</title>
312 <para>To set the current changelog mask on a specific device (<literal>lustre-MDT0000</literal>):</para>
313 <screen># lctl set_param mdd.lustre-MDT0000.changelog_mask=HLINK
314 mdd.lustre-MDT0000.changelog_mask=HLINK
315 $ lfs changelog_clear lustre-MDT0000 cl1 0
316 $ mkdir /mnt/lustre/mydir/foo
317 $ cp /etc/hosts /mnt/lustre/mydir/foo/file
318 $ ln /mnt/lustre/mydir/foo/file /mnt/lustre/mydir/myhardlink
320 <para>Only item types that are in the mask show up in the changelog.</para>
321 <screen>$ lfs changelog lustre-MDT0000
322 9 03HLINK 19:19:35.171867477 2010.03.24 0x0 t=[0x200000420:0x6:0x0] p=[0x20\
323 0000420:0x3:0x0] myhardlink
328 <section xml:id="dbdoclet.jobstats">
329 <title><indexterm><primary>jobstats</primary><see>monitoring</see></indexterm>
330 <indexterm><primary>monitoring</primary></indexterm>
331 <indexterm><primary>monitoring</primary><secondary>jobstats</secondary></indexterm>
333 Lustre Jobstats</title>
334 <para>The Lustre Jobstats feature is available starting in Lustre version 2.3. It collects filesystem operation statistics for the jobs running on Lustre clients, and exposes them via procfs on the server. Job schedulers known to be able to work with jobstats include: SLURM, SGE, LSF, Loadleveler, PBS and Maui/MOAB.</para>
335 <para>Since Jobstats is implemented in a scheduler-agnostic manner, it is likely that it will be able to work with other schedulers also.</para>
337 <title><indexterm><primary>monitoring</primary><secondary>jobstats</secondary></indexterm>
338 Enable/Disable Jobstats</title>
339 <para>Jobstats are disabled by default, the current state of jobstats can be verified by checking <literal>lctl get_param jobid_var</literal> on client:</para>
341 $ lctl get_param jobid_var
344 <para>The Lustre Jobstats code extracts the job identifier from an environment variable set by the scheduler when the job is started. To enable jobstats, specify the <literal>jobid_var</literal> to name the environment variable set by the scheduler. For example, SLURM sets the <literal>SLURM_JOB_ID</literal> environment variable with the unique job ID on each client. To permanently enable Jobstats on the <literal>testfs</literal> filesystem:</para>
345 <screen>$ lctl conf_param testfs.sys.jobid_var=SLURM_JOB_ID</screen>
346 <para>The value of <literal>jobid_var</literal> can be:</para>
347 <informaltable frame="all">
349 <colspec colname="c1" colwidth="50*"/>
350 <colspec colname="c2" colwidth="50*"/>
354 <para><emphasis role="bold">Value</emphasis></para>
357 <para><emphasis role="bold">Job Scheduler</emphasis></para>
364 <para>SLURM_JOB_ID</para>
367 <para>Simple Linux Utility for Resource Management (SLURM)</para>
375 <para>Sun Grid Engine (SGE)</para>
380 <para>LSB_JOBID</para>
383 <para>Load Sharing Facility (LSF)</para>
388 <para>LOADL_STEP_ID</para>
391 <para>Loadleveler</para>
396 <para>PBS_JOBID</para>
399 <para>Portable Batch Scheduler (PBS)/MAUI</para>
404 <para>procname_uid</para>
407 <para>process name and user ID (for debugging, or if no job scheduler is in use)</para>
415 <para>disable jobstats</para>
421 <para>To disable jobstats specify the <literal>jobid_var</literal> as <literal>disable</literal>:</para>
422 <screen>$ lctl conf_param testfs.sys.jobid_var=disable</screen>
425 <title><indexterm><primary>monitoring</primary><secondary>jobstats</secondary></indexterm>
426 Check Job Stats</title>
427 <para>Metadata operation statistics are collected on MDTs. These statistics can be accessed for all filesystems and all jobs on the MDT via the <literal>lctl get_param mdt.*.job_stats</literal>. For example, clients running with <literal>jobid_var=procname_uid</literal>:</para>
429 $ lctl get_param mdt.*.job_stats
432 snapshot_time: 1352084992
433 open: { samples: 2, unit: reqs }
434 close: { samples: 2, unit: reqs }
435 mknod: { samples: 0, unit: reqs }
436 link: { samples: 0, unit: reqs }
437 unlink: { samples: 0, unit: reqs }
438 mkdir: { samples: 0, unit: reqs }
439 rmdir: { samples: 0, unit: reqs }
440 rename: { samples: 0, unit: reqs }
441 getattr: { samples: 3, unit: reqs }
442 setattr: { samples: 0, unit: reqs }
443 getxattr: { samples: 0, unit: reqs }
444 setxattr: { samples: 0, unit: reqs }
445 statfs: { samples: 0, unit: reqs }
446 sync: { samples: 0, unit: reqs }
447 samedir_rename: { samples: 0, unit: reqs }
448 crossdir_rename: { samples: 0, unit: reqs }
450 snapshot_time: 1352085037
451 open: { samples: 1, unit: reqs }
452 close: { samples: 1, unit: reqs }
453 mknod: { samples: 0, unit: reqs }
454 link: { samples: 0, unit: reqs }
455 unlink: { samples: 0, unit: reqs }
456 mkdir: { samples: 0, unit: reqs }
457 rmdir: { samples: 0, unit: reqs }
458 rename: { samples: 0, unit: reqs }
459 getattr: { samples: 0, unit: reqs }
460 setattr: { samples: 0, unit: reqs }
461 getxattr: { samples: 0, unit: reqs }
462 setxattr: { samples: 0, unit: reqs }
463 statfs: { samples: 0, unit: reqs }
464 sync: { samples: 2, unit: reqs }
465 samedir_rename: { samples: 0, unit: reqs }
466 crossdir_rename: { samples: 0, unit: reqs }
468 <para>Data operation statistics are collected on OSTs. Data operations statistics can be accessed via <literal>lctl get_param obdfilter.*.job_stats</literal>, for example:</para>
470 $ lctl get_param obdfilter.*.job_stats
473 snapshot_time: 1352085025
474 read: { samples: 0, unit: bytes, min: 0, max: 0, sum: 0 }
475 write: { samples: 1, unit: bytes, min: 4, max: 4, sum: 4 }
476 setattr: { samples: 0, unit: reqs }
477 punch: { samples: 0, unit: reqs }
478 sync: { samples: 0, unit: reqs }
482 <title><indexterm><primary>monitoring</primary><secondary>jobstats</secondary></indexterm>
483 Clear Job Stats</title>
484 <para>Accumulated job statistics can be reset by writing proc file <literal>job_stats</literal>.</para>
485 <para>Clear statistics for all jobs on the local node:</para>
486 <screen>$ lctl set_param obdfilter.*.job_stats=clear</screen>
487 <para>Clear statistics for job 'dd.0' on lustre-MDT0000:</para>
488 <screen>$ lctl set_param mdt.lustre-MDT0000.job_stats=clear</screen>
491 <title><indexterm><primary>monitoring</primary><secondary>jobstats</secondary></indexterm>
492 Configure Auto-cleanup Interval</title>
493 <para>By default, if a job is inactive for 600 seconds (10 minutes) statistics for this job will be dropped. This expiration value can be changed temporarily via:</para>
494 <screen>$ lctl set_param *.*.job_cleanup_interval={max_age}</screen>
495 <para>It can also be changed permanently, for example to 700 seconds via:</para>
496 <screen>$ lctl conf_param testfs.mdt.job_cleanup_interval=700</screen>
497 <para>The <literal>job_cleanup_interval</literal> can be set as 0 to disable the auto-cleanup. Note that if auto-cleanup of Jobstats is disabled, then all statistics will be kept in memory forever, which may eventually consume all memory on the servers. In this case, any monitoring tool should explicitly clear individual job statistics as they are processed, as shown above.</para>
500 <section xml:id="dbdoclet.50438273_81684">
501 <title><indexterm><primary>monitoring</primary><secondary>Lustre Monitoring Tool</secondary></indexterm>
502 Lustre Monitoring Tool</title>
503 <para>The Lustre Monitoring Tool (LMT) is a Python-based, distributed system developed and maintained by Lawrence Livermore National Lab (LLNL)). It provides a ''top'' like display of activity on server-side nodes (MDS, OSS and portals routers) on one or more Lustre file systems. It does not provide support for monitoring clients. For more information on LMT, including the setup procedure, see:</para>
504 <para><link xl:href="http://code.google.com/p/lmt/">http://code.google.com/p/lmt/</link></para>
505 <para>LMT questions can be directed to:</para>
506 <para><link xl:href="mailto:lmt-discuss@googlegroups.com">lmt-discuss@googlegroups.com</link></para>
508 <section xml:id="dbdoclet.50438273_80593">
510 <literal>CollectL</literal>
512 <para><literal>CollectL</literal> is another tool that can be used to monitor Lustre. You can run <literal>CollectL</literal> on a Lustre system that has any combination of MDSs, OSTs and clients. The collected data can be written to a file for continuous logging and played back at a later time. It can also be converted to a format suitable for plotting.</para>
513 <para>For more information about <literal>CollectL</literal>, see:</para>
514 <para><link xl:href="http://collectl.sourceforge.net">http://collectl.sourceforge.net</link></para>
515 <para>Lustre-specific documentation is also available. See:</para>
516 <para><link xl:href="http://collectl.sourceforge.net/Tutorial-Lustre.html">http://collectl.sourceforge.net/Tutorial-Lustre.html</link></para>
518 <section xml:id="dbdoclet.50438273_44185">
519 <title><indexterm><primary>monitoring</primary><secondary>additional tools</secondary></indexterm>
520 Other Monitoring Options</title>
521 <para>A variety of standard tools are available publically.</para>
522 <para>Another option is to script a simple monitoring solution that looks at various reports from <literal>ipconfig</literal>, as well as the <literal>procfs</literal> files generated by Lustre.</para>