X-Git-Url: https://git.decadent.org.uk/gitweb/?p=nfs-utils.git;a=blobdiff_plain;f=tools%2Fnfs-iostat%2Fnfs-iostat.py;h=1207674e4ad7c19b95fbddfe0de7931708015856;hp=2d0b1433b948ef4884a987f3bd556376294f413c;hb=38861db18a0687aaf483ea0bf03bf8c928ca0980;hpb=5f06c2b5e18990a2d62987ea06bdf5afb8306a2d diff --git a/tools/nfs-iostat/nfs-iostat.py b/tools/nfs-iostat/nfs-iostat.py index 2d0b143..1207674 100644 --- a/tools/nfs-iostat/nfs-iostat.py +++ b/tools/nfs-iostat/nfs-iostat.py @@ -366,6 +366,12 @@ class DeviceData: sends = float(self.__rpc_data['rpcsends']) if sample_time == 0: sample_time = float(self.__nfs_data['age']) + # sample_time could still be zero if the export was just mounted. + # Set it to 1 to avoid divide by zero errors in this case since we'll + # likely still have relevant mount statistics to show. + # + if sample_time == 0: + sample_time = 1; if sends != 0: backlog = (float(self.__rpc_data['backlogutil']) / sends) / sample_time else: