New example script: nfstop
David Smith
dsmith@redhat.com
Fri Mar 23 14:57:00 GMT 2012
Back at FUDCon, during the systemtap info session I helped an attendee
with a script. He had been using a dtrace script, called nfstop, from
the following link:
<http://blogs.oracle.com/erickustarz/entry/dscript_to_retrieve_active_nfs>
I made a quick approximation of the script at the conference, but hadn't
had time to get back to it and spiffy it up a bit.
I took some time yesterday and finally made some changes. The script
acts a bit like 'top', listing the NFS clients who made the most NFS
operations every 5 seconds. Current versions of systemtap should have
IPv4 and IPv6 client support.
I'll be incorporating this into the systemtap examples.
Any feedback on the script would be appreciated.
--
David Smith
dsmith@redhat.com
Red Hat
http://www.redhat.com
256.217.0141 (direct)
256.837.0057 (fax)
-------------- next part --------------
#!/usr/bin/stap -v
global nfsops
# Note that this script counts nfsops/client, ignoring the fact
# whether the nfs operation succeeded or not.
probe nfsd.dispatch
{
nfsops[client_ip] <<< 1
}
probe timer.s(5)
{
# Clear the screen and print out the header. Because the
# 'HOST:PORT' can get quite long for IPv6 (the longest the
# host:port combination could be is:
# [0000:0000:0000:0000:0000:0000:0000:0001]:XXXXXX
# or 48 chars), we'll print the 'NFS CALLS' first.
ansi_clear_screen()
ansi_set_color2(37, 40)
printf("NFS CALLS %-48s\n", "HOST:PORT")
ansi_reset_color()
# Print out the sorted stats for the top 20 clients.
foreach ([client_ip] in nfsops- limit 20) {
printf("%9d %s\n", @count(nfsops[client_ip]), client_ip)
}
# Clear out the array for the next iteration.
delete nfsops
}
probe begin
{
printf("gathering NFS data...\n")
}
More information about the Systemtap
mailing list