Projet

Général

Profil

Révision 0417d476

ID0417d4765b66a73d762422b24b5bbfdfa252fa5b
Parent 72736dae
Enfant 1f4aa890

Ajouté par Ropchan Sergey il y a presque 14 ans

Initial version

Voir les différences:

plugins/other/lustre_df
1
#!/usr/bin/perl
2
# -*- perl -*-
3

  
4
=head1 NAME
5

  
6
lustre_df - Plugin to monitor Lustre 1.8.x (cluster FS) storage objects MDT,OST's 
7
usage in percents
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
=head1 AUTHOR
18

  
19
Ropchan Sergey <fenix.serega@gmai.com>
20

  
21
=head1 LICENSE
22

  
23
GPLv2
24

  
25
=cut
26

  
27
use Munin::Plugin;
28

  
29
my $lfs_bin = "/usr/bin/lfs";
30

  
31
if ($ARGV[0] and $ARGV[0] eq "autoconf") {
32
    if (-r $lfs_bin) {
33
	print "yes\n";
34
	exit 0;
35
    } else {
36
	print "no ($lfs_bin found)\n";
37
	exit 0;
38
    }
39
}
40

  
41
my @output = `$lfs_bin df -h`;
42

  
43
&print_values;
44

  
45
if ($ARGV[0] and $ARGV[0] eq "config") {
46
    print "graph_title Lustre cluster storage objects usage\n";
47
    print "graph_args --base 1000\n";
48
    print "graph_vlabel % usage\n";
49
    print "graph_scale no\n";
50
    print "graph_category lustre\n";
51

  
52
    &print_labels;
53

  
54
    exit 0;
55
}
56

  
57
sub print_labels {
58
    for $_ (@output) {
59
	#storage objects
60
        if (/^\S+\s+\S+\s+\S+\s+\S+\s+(\d+)\%\s+\S+\[(.*)\:(\d+)\]/i) {
61
		my $name = $2.$3;
62
                print $name.".label ", $name, "\n";
63
	        print $name.".min 0\n";
64
		print_thresholds($name,undef,undef,99,100);
65
        }
66
     }
67
                print "summary.label summary", "\n";
68
                print "summary.min 0\n";
69
                print_thresholds("summary",undef,undef,95,98);
70
}
71

  
72
sub print_values {
73
    for $_ (@output) {
74
	#storage objects
75
	if (/^\S+\s+\S+\s+\S+\s+\S+\s+(\d+)\%\s+\S+\[(.*)\:(\d+)\]/i) {
76
		my $name = $2.$3;
77
		print $name.".value ", $1, "\n";
78
        }
79

  
80
	#summanary info
81
	if (/^filesystem summary\:\s+\S+\s+\S+\s+\S+\s+(\d+)\%\s+\S+\s/i) {
82
		print "summary.value ", $1, "\n";
83
	}
84
    }
85
}
86

  

Formats disponibles : Unified diff