2
0
mirror of https://github.com/munin-monitoring/contrib.git synced 2018-11-08 00:59:34 +01:00
contrib-munin/plugins/other/lustre_abs
2011-12-18 15:10:36 +01:00

88 lines
1.7 KiB
Perl
Executable File

#!/usr/bin/perl
# -*- perl -*-
=head1 NAME
lustre_df_abs - Plugin to monitor Lustre 1.8.x (cluster FS) storage objects MDT,OST's
usage in TB and/or G
=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
=head1 AUTHOR
Ropchan Sergey <fenix.serega@gmail.com>
=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`;
&print_values;
if ($ARGV[0] and $ARGV[0] eq "config") {
print "graph_title Lustre cluster storage objects usage in TB\n";
print "graph_args --base 1024 --lower-limit 0\n";
print "graph_vlabel TB\n";
print "graph_category lustre\n";
&print_labels;
exit 0;
}
sub print_labels {
for $_ (@output) {
#storage objects
if (/^\S+\s+\d+\s+(\d+)\s+\d+\s+\d+\%\s+\S+\[(.*)\:(\d+)\]/i) {
my $name = $2.$3;
print $name.".label ", $name, "\n";
print $name.".min 0\n";
print $name.".cdef ", $name,",1024,*\n";
}
}
print "summary.label summary", "\n";
print "summary.min 0\n";
print "summary.cdef summary,1024,*\n";
}
sub print_values {
for $_ (@output) {
#storage objects
if (/^\S+\s+\d+\s+(\d+)\s+\d+\s+\d+\%\s+\S+\[(.*)\:(\d+)\]/i) {
my $name = $2.$3;
print $name.".value ", $1, "\n";
}
#summanary info
if (/^filesystem summary\:\s+\d+\s+(\d+)\s+\d+\s+\d+\%\s+\S+\s/i) {
print "summary.value ", $1, "\n";
}
}
}