Xfsstat.sh

From Ye Ole Stash
Jump to: navigation, search
!/bin/bash
echo "Read more on these Stats at http://xfs.org/index.php/Runtime_Stats"
 
echo "XFS Transaction Stats"
for i in `cat /proc/fs/xfs/stat | grep trans | awk '{print $2,$3,$4}'`;do
    echo $i
done
 
#This is the LONG version of the for loop above. This gives info on each variable if you like having tons of info in SNMP.
#echo "xs_trans_sync - This is the number of meta-data transactions which waited to be committed to the on-disk log before allowing the process performing the transaction to continue. These transactions are slower and more expensive than asynchronous transactions, because they force the in memory log buffers to be forced to disk more often and they wait for the completion of the log buffer writes. Synchronous transactions include file truncations and all directory updates when the file system is mounted with the 'wsync' option."
#cat /proc/fs/xfs/stat | grep trans | awk '{print $2}'
#echo "xs_trans_async - This is the number of meta-data transactions which did not wait to be committed to the on-disk log before allowing the process performing the transaction to continue. These transactions are faster and more efficient than synchronous transactions, because they commit their data to the in memory log buffers without forcing those buffers to be written to disk. This allows multiple asynchronous transactions to be committed to disk in a single log buffer write. Most transactions used in XFS file systems are asynchronous."
#cat /proc/fs/xfs/stat | grep trans | awk '{print $3}'
#echo "xs_trans_empty - This is the number of meta-data transactions which did not actually change anything. These are transactions which were started for some purpose, but in the end it turned out that no change was necessary."
#cat /proc/fs/xfs/stat | grep trans | awk '{print $4}'
 
echo "XFS Inode Operations"
for i in `cat /proc/fs/xfs/stat | grep ig |  awk '{print $2,$3,$4,$5,$6,$7,$8}'`;do
    echo $i
done
echo "Inodes not found in cache"
expr `cat /proc/fs/xfs/stat | grep ig |  awk '{print $3}'` - `cat /proc/fs/xfs/stat | grep ig |  awk '{print $5}'`
 
echo "XFS IoMap Write Convert"
for i in `cat /proc/fs/xfs/stat | grep xstrat |  awk '{print $2,$3}'`;do
    echo $i
done
 
 
echo "XFS Log Stats"
for i in `cat /proc/fs/xfs/stat | grep log | awk '{print $2,$3,$4,$5,$6}'`;do
    echo $i
done
 
#This is the LONG version of the for loop above. This gives info on each variable if you like having tons of info in SNMP.
 
#echo "xs_log_writes - This variable counts the number of log buffer writes going to the physical log partitions of all XFS filesystems. Log data traffic is proportional to the level of meta-data updating. Log buffer writes get generated when they fill up or external syncs occur.
#cat /proc/fs/xfs/stat | grep log | awk '{print $2}'
#echo "xs_log_blocks - This variable counts (in 512-byte units) the information being written to the physical log partitions of all XFS filesystems. Log data traffic is proportional to the level of meta-data updating. The rate with which log data gets written depends on the size of internal log buffers and disk write speed. Therefore, filesystems with very high meta-data updating may need to stripe the log partition or put the log partition on a separate drive.
#cat /proc/fs/xfs/stat | grep log | awk '{print $3}'
#echo "xs_log_noiclogs - This variable keeps track of times when a logged transaction can not get any log buffer space. When this occurs, all of the internal log buffers are busy flushing their data to the physical on-disk log."
#cat /proc/fs/xfs/stat | grep log | awk '{print $4}'
#echo "xs_log_force - The number of times the in-core log is forced to disk. It is equivalent to the number of successful calls to the function xfs_log_force()."
#cat /proc/fs/xfs/stat | grep log | awk '{print $5}'
#echo "xs_log_force_sleep - Value exported from the xs_log_force_sleep field of struct xfsstats."
#cat /proc/fs/xfs/stat | grep log | awk '{print $6}'
 
echo "XFS R/W Stats"
cat /proc/fs/xfs/stat | grep rw | awk '{print $2}'
 
cat /proc/fs/xfs/stat | grep rw | awk '{print $3}'
 
echo "Average KB per Read"
expr `cat /proc/fs/xfs/stat | grep xpc | awk '{print $4}'` /  `cat /proc/fs/xfs/stat | grep rw | awk '{print $3}'` / 1024
echo "Average KB per write"
expr `cat /proc/fs/xfs/stat | grep xpc | awk '{print $3}'` / `cat /proc/fs/xfs/stat | grep rw | awk '{print $2}'` / 1024
Personal tools