mysql --defaults-extra-file=/etc/mysql/debian.cnf somedatabase -B -e " select someid, perhapssomethingmoredescriptive,SUM(TOTAL) - SUM(FREE) as usedspace from drives join hardware on HARDWARE_ID=hardware.ID group by HARDWARE_ID;" | sed 's/\t/","/g;s/^/"/;s/$/"/;s/\n//g' > /home/scavara/disk_usage.csv
tnx's to joy...
db contains some info about bunch of servers including total/free space on their partitions...this oneliner will sums total and free values of all partitions on a server to get total used space and dump it into a csv file.
25.2.11
Subscribe to:
Post Comments (Atom)




0 comments:
Post a Comment