Operating System - Linux
1829594 Members
1543 Online
109992 Solutions
New Discussion

Collect disk metric with date stamps ?

 
SOLVED
Go to solution
Thomas Ritter
Respected Contributor

Collect disk metric with date stamps ?


I want to collect disk metrics using a batch process.
Currently I use this command which outputs data as follows:

$ sudo du -bs /mnt/nfs/abc
24677670912 /mnt/nfs/abc


What is the general approach to collecting this data and have the first
field data stamped so it looks something like this ?


18082010, 24677670912, /mnt/nfs/abc


where the 18082010 is the 18th of August, 2010
5 REPLIES 5
Modris Bremze
Esteemed Contributor
Solution

Re: Collect disk metric with date stamps ?

echo $(date +%d%m%Y)","$(sudo du -bs /mnt/nfs/abc)
macosta
Trusted Contributor

Re: Collect disk metric with date stamps ?

Just note that using "du" is going to be expensive for a busy filesystem, as it stat()s each and every directory and file it sees. Don't overdo this one...

Viktor Balogh
Honored Contributor

Re: Collect disk metric with date stamps ?

> ...using "du" is going to be expensive for a busy filesystem...

that's right. For the FS usage statistics I would use bdf.
****
Unix operates with beer.
Hakki Aydin Ucar
Honored Contributor

Re: Collect disk metric with date stamps ?

And besides,
if you use HP-UX 11iv2 OR upper version you can use it:
bdf -s

for a facile way, not sync needed FS s when listed.
Hakki Aydin Ucar
Honored Contributor

Re: Collect disk metric with date stamps ?

oops..
Sorry I entered the Linux area..
bdf is not vaild here..
but, just df

man df;

--sync invoke sync before getting usage info