Permalink
Browse files

Make df_inode plugin more robust.

Some file systems do not have inodes, which make "df" report a "-"
instead of a number. If the used and available inode field is not
numeric, it does not make sense to try to calculate a percentage.

If that happens, we skip calculating inodes for this filesystem.
  • Loading branch information...
1 parent dd2854e commit ec3cbe473089d3b8c3c2fd005d67a9467aa29f3b @ssm ssm committed Jul 27, 2012
Showing with 2 additions and 0 deletions.
  1. +2 −0 plugins/node.d.linux/df_inode.in
View
2 plugins/node.d.linux/df_inode.in
@@ -150,6 +150,8 @@ while (<DF>) {
next if skip($name, $mountpt);
+ next unless ($used =~ '^\d+' && $avail =~ '^\d+');
+
# Calculate percentage used
my $ps = 0;
$ps = ($used / ($used+$avail)) * 100 if $used;

0 comments on commit ec3cbe4

Please sign in to comment.