Projet

Général

Profil

Paste
Télécharger au format
Statistiques
| Branche: | Révision:

root / plugins / snmp / snmp__netapp_nfs3calls @ 81db94e2

Historique | Voir | Annoter | Télécharger (5,45 ko)

1
#!/usr/bin/perl
2

    
3
=head1 NAME
4

    
5
snmp__netapp_nfs3calls - Munin plugin to retrieve NFSv3 calls types
6
stats from NetApp storage appliances.
7

    
8
=head1 APPLICABLE SYSTEMS
9

    
10
NFSv3 calls stats should be reported by any NetApp storage appliance
11
with SNMP agent daemon activated. See na_snmp(8) for details.
12

    
13
=head1 CONFIGURATION
14

    
15
Unfortunately, SNMPv3 is not fully supported on all NetApp equipments.
16
For this reason, this plugin will use SNMPv2 by default, which is
17
insecure because it doesn't encrypt the community string. 
18

    
19
The following parameters will help you get this plugin working :
20

    
21
[snmp_*]
22
env.community MyCommunity
23

    
24
If your community name is 'public', you should really worry about
25
security and immediately reconfigure your appliance.
26

    
27
Please see 'perldoc Munin::Plugin::SNMP' for further configuration.
28

    
29
=head1 INTERPRETATION
30

    
31
The plugin reports various NFSv3 calls by type. This can help you
32
determine what calls types are killing your appliance under heavy
33
loads.
34

    
35
=head1 MIB INFORMATION
36

    
37
This plugin requires support for the NETWORK-APPLIANCE-MIB issued by
38
Network Appliance. It reports the content of the v3Calls OID.
39

    
40
=head1 MAGIC MARKERS
41

    
42
#%# family=snmpauto
43
#%# capabilities=snmpconf
44

    
45
=head1 VERSION
46

    
47
v1.0 - 06/19/2009 18:36:02 CEST
48
Initial revision
49

    
50
=head1 AUTHOR
51

    
52
This plugin is copyright (c) 2009 by Guillaume Blairon.
53

    
54
NetApp is a registered trademark and Network Appliance is a trademark
55
of Network Appliance, Inc. in the U.S. and other countries.
56

    
57
=head1 BUGS
58

    
59
This plugin wasn't tested on many hardware. If you encounter bugs,
60
please report any to Guillaume Blairon E<lt>L<g@yom.be>E<gt>.
61

    
62
=head1 LICENSE
63

    
64
GPLv2 or (at your option) any later version.
65

    
66
=cut
67

    
68
use strict;
69
use warnings;
70
use Munin::Plugin::SNMP;
71
use vars qw($DEBUG);
72

    
73
$DEBUG = $ENV{'MUNIN_DEBUG'};
74

    
75
my @palette =
76
   #Better colours from munin 1.3.x
77
   #Greens Blues Oranges Dk yel Dk blu Purple Lime   Reds   Gray
78
 qw(00CC00 0066B3 FF8000 FFCC00 330099 990099 CCFF00 FF0000 808080
79
    008F00 00487D B35A00 B38F00        6B006B 8FB300 B30000 BEBEBE
80
    80FF80 80C9FF FFC080 FFE680 AA80FF EE00CC FF8080
81
    666600 FFBFFF 00FFCC CC6699 999900);
82

    
83
my %oids = (
84
    nulls        => 'NFSPROC3_NULL (Do Nothing)',
85
    getattrs     => 'NFSPROC3_GETATTR (Get File Attributes)',
86
    setattrs     => 'NFSPROC3_SETATTR (Set File Attributes)',
87
    lookups      => 'NFSPROC3_LOOKUP (Lookup Filename)',
88
    accesss      => 'NFSPROC3_ACCESS (Check Access Permission)',
89
    readlinks    => 'NFSPROC3_READLINK (Read from Symbolic Link)',
90
    reads        => 'NFSPROC3_READ (Read from File)',
91
    writes       => 'NFSPROC3_WRITE (Write to File)',
92
    creates      => 'NFSPROC3_CREATE (Create a File)',
93
    mkdirs       => 'NFSPROC3_MKDIR (Create a Directory)',
94
    symlinks     => 'NFSPROC3_SYMLINK (Create a Symbolic Link)',
95
    mknods       => 'NFSPROC3_MKNOD (Create a Special Device)',
96
    removes      => 'NFSPROC3_REMOVE (Remove a File)',
97
    rmdirs       => 'NFSPROC3_RMDIR (Remove a Directory)',
98
    renames      => 'NFSPROC3_RENAME (Rename a File or Directory)',
99
    links        => 'NFSPROC3_LINK (Create Link to an Object)',
100
    readdirs     => 'NFSPROC3_READDIR (Read from Directory)',
101
    readdirpluss => 'NFSPROC3_READDIRPLUS (Extended Read from Directory)',
102
    fsstats      => 'NFSPROC3_FSSTAT (Get Dynamic File System Information)',
103
    fsinfos      => 'NFSPROC3_FSINFO (Get Static File System Information)',
104
    pathconfs    => 'NFSPROC3_PATHCONF (Retrieve POSIX Information)',
105
    commits      => 'NFSPROC3_COMMIT (Commit Cached Data on a Server to Stable Storage)',
106
);
107

    
108
if (defined $ARGV[0] and $ARGV[0] eq 'snmpconf') {
109
    print "require 1.3.6.1.4.1.789.1.3.1.2.4.1.1.0 [0-9]\n";
110
    exit 0;
111
}
112

    
113
my $session = Munin::Plugin::SNMP->session();
114

    
115
if (defined $ARGV[0] and $ARGV[0] eq "config") {
116

    
117
    my ($host, undef, undef, undef) = Munin::Plugin::SNMP->config_session();
118

    
119
    print "host_name $host\n" unless $host eq 'localhost';
120
    print "graph_title $host NFSv3 calls\n";
121
    print "graph_args --base 1000\n";
122
    print "graph_vlabel calls / \${graph_period}\n";
123
    # graph_category netapp # To show plugin in Gallery also in this category
124
    print "graph_category nfs\n";
125
    print "graph_info This graph shows NFSv3 calls for the $host NetApp equipment.\n";
126
    print "graph_order ";
127

    
128
    foreach (sort keys %oids) { print "$_ "; }
129
    print "\n";
130

    
131
    my $c = 0;
132
    foreach my $k (sort keys %oids) {
133
        my $i = $oids{$k};
134
        my $l = $k;
135
        $l =~ s/s$//g;
136
        print "$k.info The number of NFS Version 3 calls received for the $i procedure, since the last time the statistics were cleared.\n";
137
        print "$k.type DERIVE\n";
138
        print "$k.label $l\n";
139
        print "$k.min 0\n";
140
        print "$k.colour $palette[$c]\n";
141
        $c++;
142
    }
143

    
144
    exit 0;
145
}
146

    
147
my $values = $session->get_hash(
148
    -baseoid => '1.3.6.1.4.1.789.1.3.1.2.4.1',
149
    -cols    => {
150
        1  => 'nulls',
151
        2  => 'getattrs',
152
        3  => 'setattrs',
153
        4  => 'lookups',
154
        5  => 'accesss',
155
        6  => 'readlinks',
156
        7  => 'reads',
157
        8  => 'writes',
158
        9  => 'creates',
159
        10 => 'mkdirs',
160
        11 => 'symlinks',
161
        12 => 'mknods',
162
        13 => 'removes',
163
        14 => 'rmdirs',
164
        15 => 'renames',
165
        16 => 'links',
166
        17 => 'readdirs',
167
        18 => 'readdirpluss',
168
        19 => 'fsstats',
169
        20 => 'fsinfos',
170
        21 => 'pathconfs',
171
        22 => 'commits',
172
    },
173
);
174

    
175
foreach my $k (keys %oids) {
176
    my $v = 'U';
177
    $v = $values->{0}->{$k} if (defined $values);
178
    print "$k.value $v\n";
179
}
180

    
181
exit 0;
182

    
183
__END__