Projet

Général

Profil

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

root / plugins / netapp / snmp__netapp_cifs2 @ 09b88141

Historique | Voir | Annoter | Télécharger (2,81 ko)

1
#!/usr/bin/perl
2
# -*- perl -*-
3
# vim: ft=perl
4

    
5
=head1 NAME
6

    
7
snmp__netapp_cifs -  Munin plugin to retrieve general cifs information from NetApp storage appliances.
8

    
9
=head1 APPLICABLE SYSTEMS
10

    
11
cifs should be reported by any NetApp storage appliance
12
with SNMP agent daemon activated. See na_snmp(8) for details.
13

    
14
=head1 CONFIGURATION
15

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

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

    
22
 [snmp_*]
23
 env.community MyCommunity
24

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

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

    
30
=head1 INTERPRETATION
31

    
32
The plugin reports various cifs connections, users and open files.
33

    
34
=head1 MIB INFORMATION
35

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

    
39
=head1 MAGIC MARKERS
40

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

    
44
=head1 BUGS
45

    
46
This plugin wasn't tested on many hardware and only on Ontap 7.3.x.
47

    
48
=head1 AUTHOR
49

    
50
2013, Claudius Herder
51

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

    
55
=head1 LICENSE
56

    
57
GPLv2.
58

    
59
=cut
60

    
61
use strict;
62
use warnings;
63
use Munin::Plugin::SNMP;
64

    
65
my %oids =
66
(
67
    cifsConnectedUsers => 'ConnectedUsers',
68
    cifsNSessions      => 'Sesions',
69
    cifsNOpenFiles     => 'OpenFiles',
70
);
71

    
72
if (defined $ARGV[0] and $ARGV[0] eq 'snmpconf')
73
{
74
    print "require 1.3.6.1.4.1.789.1.7.2. [0-9]\n";
75
    exit 0;
76
}
77

    
78
my $session = Munin::Plugin::SNMP->session();
79

    
80
if (defined $ARGV[0] and $ARGV[0] eq "config")
81
{
82
    my ($host, undef, undef, undef) = Munin::Plugin::SNMP->config_session();
83

    
84
    print "host_name $host\n" unless $host eq 'localhost';
85
    print "graph_title $host CIFS sessions\n";
86
    print "graph_args --base 1000 --lower-limit 0 --rigid\n";
87
    print "graph_vlabel CIFS\n";
88
    print "graph_category fs\n";
89
    print "graph_info This graph shows CIFS sessions status for the $host.\n";
90
    print "graph_order ";
91
    foreach (sort keys %oids)
92
    {
93
        print "$_ ";
94
    }
95
    print "\n";
96
    foreach my $k (sort keys %oids)
97
    {
98
        print "$k.info The number of CIFS $oids{$k}.\n";
99
        print "$k.label $oids{$k}\n";
100
        print "$k.min 0\n";
101
        print "$k.type GAUGE\n";
102
    }
103
    exit 0;
104
}
105

    
106
my $values = $session->get_hash
107
(
108
    -baseoid => '1.3.6.1.4.1.789.1.7.2',
109
    -cols =>
110
    {
111
         9 => 'cifsConnectedUsers',
112
        12 => 'cifsNSessions',
113
        13 => 'cifsNOpenFiles',
114
    },
115
);
116

    
117
foreach my $k (keys %oids)
118
{
119
    my $v = 'U';
120

    
121
    $v = $values->{0}->{$k} if (defined $values);
122
    print "$k.value $v\n";
123
}
124

    
125
exit 0;
126

    
127
__END__