Projet

Général

Profil

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

root / plugins / netapp / snmp__netapp_cpu2 @ 09b88141

Historique | Voir | Annoter | Télécharger (3,7 ko)

1 de8aa961 Claudius
#!/usr/bin/perl
2
# -*- perl -*-
3
# vim: ft=perl
4
5
=head1 NAME
6
7
snmp__netapp_cifs -  Munin plugin to retrieve cpu information from NetApp storage appliances.
8
9
=head1 APPLICABLE SYSTEMS
10
11
cpu 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 8713eb37 Lars Kruse
Unfortunately, SNMPv3 is not fully supported on all NetApp equipment.
17 de8aa961 Claudius
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 09b88141 Lars Kruse
 [snmp_*]
23
 env.community MyCommunity
24 de8aa961 Claudius
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 cpu busy and idle.
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 cpu OID.
38
39
=head1 MAGIC MARKERS
40
41 09b88141 Lars Kruse
 #%# family=snmpauto
42
 #%# capabilities=snmpconf
43 de8aa961 Claudius
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 09b88141 Lars Kruse
52 de8aa961 Claudius
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
#   cpuUpTime                => 'CPU_UPTIME',
68
#   cpuBusyTime              => 'CPU_BUSYTIME',
69
    cpuBusyTimePerCent       => 'Busy',
70
#   cpuIdleTime              => 'CPU_IDLETIME',
71
    cpuIdleTimePerCent       => 'Idle',
72
#   cpuCount                 => 'CPU_COUNT',
73
#   cpuSwitchInvocations     => 'CPU_SWTICHINVOCATIONS',
74
#   cpuContextSwitches       => 'CPU_CONTEXTSWITCHES',
75
#   cpuInterrupts            => 'CPU_INTERRUPTS',
76
#   cpuNonCPInterrupts       => 'CPU_NONCPINTERRUPTS',
77
#   cpuCPInterruptPercent    => 'CPU_CPINTERRUPTPERCENT',
78
#   cpuNonCPInterruptPercent => 'CPU_NONCPINTERRUPTPERCENT',
79
#   cpuTotalDomainSwitches   => 'CPU_TOTALDOMAINSWITCHES',
80
);
81
82
if (defined $ARGV[0] and $ARGV[0] eq 'snmpconf')
83
{
84
    print "require 1.3.6.1.4.1.789.1.2.1. [0-9]\n";
85
    exit 0;
86
}
87
88
my $session = Munin::Plugin::SNMP->session();
89
90
if (defined $ARGV[0] and $ARGV[0] eq "config")
91
{
92
    my ($host, undef, undef, undef) = Munin::Plugin::SNMP->config_session();
93
    print "host_name $host\n" unless $host eq 'localhost';
94
    print "graph_title $host CPU \n";
95
    print "graph_args --base 1000 -r --lower-limit 0 --upper-limit 100\n";
96
    print "graph_vlabel CPU \n";
97 a4710dc1 dipohl
    print "graph_category cpu\n";
98 de8aa961 Claudius
    print "graph_info This graph shows cpu busy value for the $host in percent.\n";
99
    print "graph_order ";
100
    foreach (sort keys %oids)
101
    {
102
        print "$_ ";
103
    }
104
    print "\n";
105
    foreach my $k (sort keys %oids)
106
    {
107
        print "$k.info The cpu $oids{$k} value in percent\n";
108
        print "$k.label $oids{$k}\n";
109
        print "$k.min 0\n";
110
        print "$k.draw AREASTACK\n";
111
        print "$k.type GAUGE\n";
112
    }
113
    exit 0;
114
}
115
116
my $values = $session->get_hash
117
(
118
    -baseoid => '1.3.6.1.4.1.789.1.2.1',
119
    -cols =>
120
    {
121
#       1  => 'cpuUpTime',
122
#       2  => 'cpuBusyTime',
123
        3  => 'cpuBusyTimePerCent',
124
#       4  => 'cpuIdleTime',
125
        5  => 'cpuIdleTimePerCent',
126
#       6  => 'cpuCount',
127
#       7  => 'cpuSwitchInvocations',
128
#       8  => 'cpuContextSwitches',
129
#       9  => 'cpuInterrupts',
130
#       10 => 'cpuNonCPInterrupts',
131
#       11 => 'cpuCPInterruptPercent',
132
#       12 => 'cpuNonCPInterruptPercent',
133
#       13 => 'cpuTotalDomainSwitches',
134
    },
135
);
136
137
foreach my $k (keys %oids)
138
{
139
    my $v = 'U';
140
    $v = $values->{0}->{$k} if (defined $values);
141
    print "$k.value $v\n";
142
}
143
144
exit 0;
145
146
__END__