root / plugins / lustre / lustre_abs @ d112f623
Historique | Voir | Annoter | Télécharger (1,77 ko)
| 1 | 1f4aa890 | Ropchan Sergey | #!/usr/bin/perl |
|---|---|---|---|
| 2 | # -*- perl -*- |
||
| 3 | |||
| 4 | =head1 NAME |
||
| 5 | |||
| 6 | lustre_df_abs - Plugin to monitor Lustre 1.8.x (cluster FS) storage objects MDT,OST's |
||
| 7 | usage in TB and/or G |
||
| 8 | |||
| 9 | =head1 CONFIGURATION |
||
| 10 | Path to lfs binary. Configuration is done through $lfs_bin variable, for example |
||
| 11 | by default $lfs_bin = "/usr/bin/lfs", see below. |
||
| 12 | |||
| 13 | =head1 NOTES |
||
| 14 | |||
| 15 | Monitoring node - lustre client with mounted lustre |
||
| 16 | |||
| 17 | 3179fb1f | Ropchan Sergey | =head1 VERSION |
| 18 | |||
| 19 | $Id: lustre_df_abs,v 1.3 2011/03/01 10:39:58 fenix Exp $ |
||
| 20 | |||
| 21 | 1f4aa890 | Ropchan Sergey | =head1 AUTHOR |
| 22 | |||
| 23 | 970a0c35 | Ropchan Sergey | Ropchan Sergey <fenix.serega@gmail.com> |
| 24 | 1f4aa890 | Ropchan Sergey | |
| 25 | =head1 LICENSE |
||
| 26 | |||
| 27 | GPLv2 |
||
| 28 | |||
| 29 | =cut |
||
| 30 | |||
| 31 | |||
| 32 | use Munin::Plugin; |
||
| 33 | |||
| 34 | my $lfs_bin = "/usr/bin/lfs"; |
||
| 35 | |||
| 36 | if ($ARGV[0] and $ARGV[0] eq "autoconf") {
|
||
| 37 | if (-r $lfs_bin) {
|
||
| 38 | print "yes\n"; |
||
| 39 | exit 0; |
||
| 40 | } else {
|
||
| 41 | print "no ($lfs_bin found)\n"; |
||
| 42 | exit 0; |
||
| 43 | } |
||
| 44 | } |
||
| 45 | |||
| 46 | my @output = `$lfs_bin df`; |
||
| 47 | |||
| 48 | if ($ARGV[0] and $ARGV[0] eq "config") {
|
||
| 49 | print "graph_title Lustre cluster storage objects usage in TB\n"; |
||
| 50 | print "graph_args --base 1024 --lower-limit 0\n"; |
||
| 51 | print "graph_vlabel TB\n"; |
||
| 52 | print "graph_category lustre\n"; |
||
| 53 | |||
| 54 | &print_labels; |
||
| 55 | |||
| 56 | exit 0; |
||
| 57 | } |
||
| 58 | |||
| 59 | 3179fb1f | Ropchan Sergey | &print_values; |
| 60 | |||
| 61 | 1f4aa890 | Ropchan Sergey | sub print_labels {
|
| 62 | for $_ (@output) {
|
||
| 63 | #storage objects |
||
| 64 | if (/^\S+\s+\d+\s+(\d+)\s+\d+\s+\d+\%\s+\S+\[(.*)\:(\d+)\]/i) {
|
||
| 65 | my $name = $2.$3; |
||
| 66 | print $name.".label ", $name, "\n"; |
||
| 67 | print $name.".min 0\n"; |
||
| 68 | print $name.".cdef ", $name,",1024,*\n"; |
||
| 69 | } |
||
| 70 | |||
| 71 | } |
||
| 72 | print "summary.label summary", "\n"; |
||
| 73 | print "summary.min 0\n"; |
||
| 74 | print "summary.cdef summary,1024,*\n"; |
||
| 75 | } |
||
| 76 | |||
| 77 | sub print_values {
|
||
| 78 | for $_ (@output) {
|
||
| 79 | #storage objects |
||
| 80 | if (/^\S+\s+\d+\s+(\d+)\s+\d+\s+\d+\%\s+\S+\[(.*)\:(\d+)\]/i) {
|
||
| 81 | my $name = $2.$3; |
||
| 82 | print $name.".value ", $1, "\n"; |
||
| 83 | } |
||
| 84 | |||
| 85 | #summanary info |
||
| 86 | if (/^filesystem summary\:\s+\d+\s+(\d+)\s+\d+\s+\d+\%\s+\S+\s/i) {
|
||
| 87 | print "summary.value ", $1, "\n"; |
||
| 88 | } |
||
| 89 | } |
||
| 90 | } |
