2011-02-23 17:11:32 +01:00
|
|
|
#!/usr/bin/perl
|
|
|
|
# -*- perl -*-
|
|
|
|
|
|
|
|
=head1 NAME
|
|
|
|
|
|
|
|
lustre_df - Plugin to monitor Lustre 1.8.x (cluster FS) storage objects MDT,OST's
|
|
|
|
usage in percents
|
|
|
|
|
|
|
|
=head1 CONFIGURATION
|
|
|
|
Path to lfs binary. Configuration is done through $lfs_bin variable, for example
|
|
|
|
by default $lfs_bin = "/usr/bin/lfs", see below.
|
|
|
|
|
|
|
|
=head1 NOTES
|
|
|
|
|
|
|
|
Monitoring node - lustre client with mounted lustre
|
|
|
|
|
2011-03-01 11:42:16 +01:00
|
|
|
=head1 VERSION
|
|
|
|
|
|
|
|
$Id: lustre_df,v 1.3 2011/03/01 10:39:58 fenix Exp $
|
|
|
|
|
2011-02-23 17:11:32 +01:00
|
|
|
=head1 AUTHOR
|
|
|
|
|
2011-02-24 10:53:22 +01:00
|
|
|
Ropchan Sergey <fenix.serega@gmail.com>
|
2011-02-23 17:11:32 +01:00
|
|
|
|
|
|
|
=head1 LICENSE
|
|
|
|
|
|
|
|
GPLv2
|
|
|
|
|
|
|
|
=cut
|
|
|
|
|
|
|
|
use Munin::Plugin;
|
|
|
|
|
|
|
|
my $lfs_bin = "/usr/bin/lfs";
|
|
|
|
|
|
|
|
if ($ARGV[0] and $ARGV[0] eq "autoconf") {
|
|
|
|
if (-r $lfs_bin) {
|
|
|
|
print "yes\n";
|
|
|
|
exit 0;
|
|
|
|
} else {
|
|
|
|
print "no ($lfs_bin found)\n";
|
|
|
|
exit 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
my @output = `$lfs_bin df -h`;
|
|
|
|
|
|
|
|
if ($ARGV[0] and $ARGV[0] eq "config") {
|
2011-02-24 10:53:22 +01:00
|
|
|
print "graph_title Lustre cluster storage objects usage in percent\n";
|
2011-02-23 17:11:32 +01:00
|
|
|
print "graph_args --base 1000\n";
|
|
|
|
print "graph_vlabel % usage\n";
|
|
|
|
print "graph_scale no\n";
|
2017-02-22 05:34:14 +01:00
|
|
|
print "graph_category fs\n";
|
2011-02-23 17:11:32 +01:00
|
|
|
|
|
|
|
&print_labels;
|
|
|
|
|
|
|
|
exit 0;
|
|
|
|
}
|
|
|
|
|
2011-03-01 11:42:16 +01:00
|
|
|
&print_values;
|
|
|
|
|
2011-02-23 17:11:32 +01:00
|
|
|
sub print_labels {
|
|
|
|
for $_ (@output) {
|
|
|
|
#storage objects
|
|
|
|
if (/^\S+\s+\S+\s+\S+\s+\S+\s+(\d+)\%\s+\S+\[(.*)\:(\d+)\]/i) {
|
|
|
|
my $name = $2.$3;
|
|
|
|
print $name.".label ", $name, "\n";
|
|
|
|
print $name.".min 0\n";
|
|
|
|
print_thresholds($name,undef,undef,99,100);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
print "summary.label summary", "\n";
|
|
|
|
print "summary.min 0\n";
|
|
|
|
print_thresholds("summary",undef,undef,95,98);
|
|
|
|
}
|
|
|
|
|
|
|
|
sub print_values {
|
|
|
|
for $_ (@output) {
|
|
|
|
#storage objects
|
|
|
|
if (/^\S+\s+\S+\s+\S+\s+\S+\s+(\d+)\%\s+\S+\[(.*)\:(\d+)\]/i) {
|
|
|
|
my $name = $2.$3;
|
|
|
|
print $name.".value ", $1, "\n";
|
|
|
|
}
|
|
|
|
|
|
|
|
#summanary info
|
|
|
|
if (/^filesystem summary\:\s+\S+\s+\S+\s+\S+\s+(\d+)\%\s+\S+\s/i) {
|
|
|
|
print "summary.value ", $1, "\n";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|