1
0
Fork 0
mirror of https://github.com/munin-monitoring/contrib.git synced 2025-07-21 18:41:03 +00:00

Category Tree: Reduce number of categories

netapp -> san
This commit is contained in:
dipohl 2017-02-22 19:44:59 +01:00
parent 7042351e74
commit f523f095f9
18 changed files with 14 additions and 14 deletions

View file

@ -0,0 +1,52 @@
#!/usr/bin/env python
"""Thomas R. N. Jansson (tjansson@tjansson.dk)
16-MAY-2010
"""
# The SNMP traps for the NetApp filer can be found in
# /net/netappfiler/vol0/etc/mib/traps.dat if the filer is
# NFS automounted mounted on server.
# Example: the SNMP id for cpuBusyTimePerCent is
# snmp.1.3.6.1.4.1.789.1.2.1.3.0
# and retrival of this value is done by
# snmpget -v 1 -c public netappfiler 1.3.6.1.4.1.789.1.2.1.3.0
#
# Requires snmpget and assumes public community.
import commands
import sys
# Provided a servername and a snmpid it returns the value stripped of bogus information.
def snmpget(iservername,isnmpid):
runcmd = 'snmpget -v 1 -c public ' + iservername + ' ' + isnmpid
output = commands.getoutput(runcmd)
return output.split()[3]
# The interface number corresponds to vif1 on the tested netapp
servername = sys.argv[0].split('_')[1]
cifsConnectedUsers = '1.3.6.1.4.1.789.1.7.2.9.0'
cifsNSessions = '1.3.6.1.4.1.789.1.7.2.12.0'
cifsNOpenFiles = '1.3.6.1.4.1.789.1.7.2.13.0'
# Using config
if len(sys.argv) == 2 and sys.argv[1] == "config":
print 'graph_title CIFS usage on '+servername
print 'graph_args --base 1000 -l 0'
print 'graph_vlabel number'
print 'graph_category san'
print 'graph_info This graph shows CIFS usage on '+servername
print 'cifsConnectedUsers.label ConnectedUsers'
print 'cifsConnectedUsers.info The current number of CIFS users on the filer'
print 'cifsNSessions.label NumberOfSessions'
print 'cifsNSessions.info The current number of active CIFS session on the filer'
print 'cifsNOpenFiles.label NumberOfOpenfiles'
print 'cifsNOpenFiles.info The number of open CIFS files and directories on the filer'
sys.exit(0)
# Gathers info from the servers and gathers data
print 'cifsConnectedUsers.value '+snmpget(servername,cifsConnectedUsers)
print 'cifsNSessions.value '+snmpget(servername,cifsNSessions)
print 'cifsNOpenFiles.value '+snmpget(servername,cifsNOpenFiles)

126
plugins/netapp/snmp__netapp_cifs2 Executable file
View file

@ -0,0 +1,126 @@
#!/usr/bin/perl
# -*- perl -*-
# vim: ft=perl
=head1 NAME
snmp__netapp_cifs - Munin plugin to retrieve general cifs information from NetApp storage appliances.
=head1 APPLICABLE SYSTEMS
cifs should be reported by any NetApp storage appliance
with SNMP agent daemon activated. See na_snmp(8) for details.
=head1 CONFIGURATION
Unfortunately, SNMPv3 is not fully supported on all NetApp equipments.
For this reason, this plugin will use SNMPv2 by default, which is
insecure because it doesn't encrypt the community string.
The following parameters will help you get this plugin working :
[snmp_*]
env.community MyCommunity
If your community name is 'public', you should really worry about
security and immediately reconfigure your appliance.
Please see 'perldoc Munin::Plugin::SNMP' for further configuration.
=head1 INTERPRETATION
The plugin reports various cifs connections, users and open files.
=head1 MIB INFORMATION
This plugin requires support for the NETWORK-APPLIANCE-MIB issued by
Network Appliance. It reports the content of the cifs OID.
=head1 MAGIC MARKERS
#%# family=snmpauto
#%# capabilities=snmpconf
=head1 BUGS
This plugin wasn't tested on many hardware and only on Ontap 7.3.x.
=head1 AUTHOR
2013, Claudius Herder
NetApp is a registered trademark and Network Appliance is a trademark
of Network Appliance, Inc. in the U.S. and other countries.
=head1 LICENSE
GPLv2.
=cut
use strict;
use warnings;
use Munin::Plugin::SNMP;
my %oids =
(
cifsConnectedUsers => 'ConnectedUsers',
cifsNSessions => 'Sesions',
cifsNOpenFiles => 'OpenFiles',
);
if (defined $ARGV[0] and $ARGV[0] eq 'snmpconf')
{
print "require 1.3.6.1.4.1.789.1.7.2. [0-9]\n";
exit 0;
}
my $session = Munin::Plugin::SNMP->session();
if (defined $ARGV[0] and $ARGV[0] eq "config")
{
my ($host, undef, undef, undef) = Munin::Plugin::SNMP->config_session();
print "host_name $host\n" unless $host eq 'localhost';
print "graph_title $host CIFS sessions\n";
print "graph_args --base 1000 --lower-limit 0 --rigid\n";
print "graph_vlabel CIFS\n";
print "graph_category san\n";
print "graph_info This graph shows CIFS sessions status for the $host.\n";
print "graph_order ";
foreach (sort keys %oids)
{
print "$_ ";
}
print "\n";
foreach my $k (sort keys %oids)
{
print "$k.info The number of CIFS $oids{$k}.\n";
print "$k.label $oids{$k}\n";
print "$k.min 0\n";
print "$k.type GAUGE\n";
}
exit 0;
}
my $values = $session->get_hash
(
-baseoid => '1.3.6.1.4.1.789.1.7.2',
-cols =>
{
9 => 'cifsConnectedUsers',
12 => 'cifsNSessions',
13 => 'cifsNOpenFiles',
},
);
foreach my $k (keys %oids)
{
my $v = 'U';
$v = $values->{0}->{$k} if (defined $values);
print "$k.value $v\n";
}
exit 0;
__END__

View file

@ -0,0 +1,140 @@
#!/usr/bin/perl
# -*- perl -*-
# vim: ft=perl
=head1 NAME
snmp__netapp_cifscalls - Munin plugin to retrieve cifs calls types stats from NetApp storage appliances.
=head1 APPLICABLE SYSTEMS
cifs calls stats should be reported by any NetApp storage appliance
with SNMP agent daemon activated. See na_snmp(8) for details.
=head1 CONFIGURATION
Unfortunately, SNMPv3 is not fully supported on all NetApp equipments.
For this reason, this plugin will use SNMPv2 by default, which is
insecure because it doesn't encrypt the community string.
The following parameters will help you get this plugin working :
[snmp_*]
env.community MyCommunity
If your community name is 'public', you should really worry about
security and immediately reconfigure your appliance.
Please see 'perldoc Munin::Plugin::SNMP' for further configuration.
=head1 INTERPRETATION
The plugin reports various cifs calls by type.
This can help you determine what calls types are killing your appliance under heavy
loads.
=head1 MIB INFORMATION
This plugin requires support for the NETWORK-APPLIANCE-MIB issued by
Network Appliance. It reports the content of the cifs OID.
=head1 MAGIC MARKERS
#%# family=snmpauto
#%# capabilities=snmpconf
=head1 BUGS
This plugin wasn't tested on many hardware and only on Ontap 7.3.x.
=head1 AUTHOR
2013, Claudius Herder
NetApp is a registered trademark and Network Appliance is a trademark
of Network Appliance, Inc. in the U.S. and other countries.
=head1 LICENSE
GPLv2.
=cut
use strict;
use warnings;
use Munin::Plugin::SNMP;
my %oids =
(
cifsBadCalls => 'BadCalls',
cifsGetAttrs => 'GetAttrs',
cifsReads => 'Reads',
cifsWrites => 'Writes',
cifsLocks => 'Locks',
cifsOpens => 'Opens',
cifsDirOps => 'DirOps',
cifsOthers => 'Others',
cifsSetAttrs => 'SetAttr',
);
if (defined $ARGV[0] and $ARGV[0] eq 'snmpconf')
{
print "require 1.3.6.1.4.1.789.1.7.3.1.1. [0-9]\n";
exit 0;
}
my $session = Munin::Plugin::SNMP->session();
if (defined $ARGV[0] and $ARGV[0] eq "config")
{
my ($host, undef, undef, undef) = Munin::Plugin::SNMP->config_session();
print "host_name $host\n" unless $host eq 'localhost';
print "graph_title $host CIFS calls\n";
print "graph_args --base 1000 --lower-limit 0 --rigid\n";
print "graph_vlabel calls / \${graph_period}\n";
print "graph_category san\n";
print "graph_info This graph shows cifs calls for the $host NetApp equipment.\n";
print "graph_order ";
foreach (sort keys %oids)
{
print "$_ ";
}
print "\n";
foreach my $k (sort keys %oids)
{
print "$k.info The number of cifs calls received for the $oids{$k} procedure, since the last time the statistics were cleared.\n";
print "$k.type COUNTER\n";
print "$k.label $oids{$k}\n";
print "$k.min 0\n";
}
exit 0;
}
my $values = $session->get_hash
(
-baseoid => '1.3.6.1.4.1.789.1.7.3.1.1',
-cols =>
{
1 => 'cifsTotalOps',
2 => 'cifsTotalCalls',
3 => 'cifsBadCalls',
4 => 'cifsGetAttrs',
5 => 'cifsReads',
6 => 'cifsWrites',
7 => 'cifsLocks',
8 => 'cifsOpens',
9 => 'cifsDirOps',
10 => 'cifsOthers',
11 => 'cifsSetAttrs',
},
);
foreach my $k (keys %oids)
{
my $v = 'U';
$v = $values->{0}->{$k} if (defined $values);
print "$k.value $v\n";
}
exit 0;
__END__

47
plugins/netapp/snmp__netapp_cpu Executable file
View file

@ -0,0 +1,47 @@
#!/usr/bin/env python
"""Thomas R. N. Jansson (tjansson@tjansson.dk)
16-MAY-2010
"""
# The SNMP traps for the NetApp filer can be found in
# /net/netappfiler/vol0/etc/mib/traps.dat if the filer is
# NFS automounted mounted on server.
# Example: the SNMP id for cpuBusyTimePerCent is
# snmp.1.3.6.1.4.1.789.1.2.1.3.0
# and retrival of this value is done by
# snmpget -v 1 -c public netappfiler 1.3.6.1.4.1.789.1.2.1.3.0
#
# Requires snmpget and assumes public community.
import commands
import sys
# Provided a servername and a snmpid it returns the value stripped of bogus information.
def snmpget(iservername,isnmpid):
runcmd = 'snmpget -v 1 -c public ' + iservername + ' ' + isnmpid
output = commands.getoutput(runcmd)
return output.split()[3]
snmpid = "1.3.6.1.4.1.789.1.2.1.3.0"
warning = 80
critical = 95
servername = sys.argv[0].split('_')[1]
if len(sys.argv) == 2 and sys.argv[1] == "config":
print 'graph_title CPU usage on', servername
print 'graph_args --base 1000 -r --lower-limit 0 --upper-limit 100'
print 'graph_vlabel %'
print 'graph_scale no'
print 'graph_info This graph shows how CPU time is spent.'
print 'graph_period second'
print 'graph_category san'
print 'usage.label cpu_usage '
print 'usage.draw STACK'
print 'usage.warning ', warning
print 'usage.critical ', critical
print 'usage.info CPU time spent by normal programs and daemons'
sys.exit(0)
# Gathers info from the servers and gathers data
print 'usage.value '+snmpget(servername,snmpid)

145
plugins/netapp/snmp__netapp_cpu2 Executable file
View file

@ -0,0 +1,145 @@
#!/usr/bin/perl
# -*- perl -*-
# vim: ft=perl
=head1 NAME
snmp__netapp_cifs - Munin plugin to retrieve cpu information from NetApp storage appliances.
=head1 APPLICABLE SYSTEMS
cpu should be reported by any NetApp storage appliance
with SNMP agent daemon activated. See na_snmp(8) for details.
=head1 CONFIGURATION
Unfortunately, SNMPv3 is not fully supported on all NetApp equipments.
For this reason, this plugin will use SNMPv2 by default, which is
insecure because it doesn't encrypt the community string.
The following parameters will help you get this plugin working :
[snmp_*]
env.community MyCommunity
If your community name is 'public', you should really worry about
security and immediately reconfigure your appliance.
Please see 'perldoc Munin::Plugin::SNMP' for further configuration.
=head1 INTERPRETATION
The plugin reports various cpu busy and idle.
=head1 MIB INFORMATION
This plugin requires support for the NETWORK-APPLIANCE-MIB issued by
Network Appliance. It reports the content of the cpu OID.
=head1 MAGIC MARKERS
#%# family=snmpauto
#%# capabilities=snmpconf
=head1 BUGS
This plugin wasn't tested on many hardware and only on Ontap 7.3.x.
=head1 AUTHOR
2013, Claudius Herder
NetApp is a registered trademark and Network Appliance is a trademark
of Network Appliance, Inc. in the U.S. and other countries.
=head1 LICENSE
GPLv2.
=cut
use strict;
use warnings;
use Munin::Plugin::SNMP;
my %oids =
(
# cpuUpTime => 'CPU_UPTIME',
# cpuBusyTime => 'CPU_BUSYTIME',
cpuBusyTimePerCent => 'Busy',
# cpuIdleTime => 'CPU_IDLETIME',
cpuIdleTimePerCent => 'Idle',
# cpuCount => 'CPU_COUNT',
# cpuSwitchInvocations => 'CPU_SWTICHINVOCATIONS',
# cpuContextSwitches => 'CPU_CONTEXTSWITCHES',
# cpuInterrupts => 'CPU_INTERRUPTS',
# cpuNonCPInterrupts => 'CPU_NONCPINTERRUPTS',
# cpuCPInterruptPercent => 'CPU_CPINTERRUPTPERCENT',
# cpuNonCPInterruptPercent => 'CPU_NONCPINTERRUPTPERCENT',
# cpuTotalDomainSwitches => 'CPU_TOTALDOMAINSWITCHES',
);
if (defined $ARGV[0] and $ARGV[0] eq 'snmpconf')
{
print "require 1.3.6.1.4.1.789.1.2.1. [0-9]\n";
exit 0;
}
my $session = Munin::Plugin::SNMP->session();
if (defined $ARGV[0] and $ARGV[0] eq "config")
{
my ($host, undef, undef, undef) = Munin::Plugin::SNMP->config_session();
print "host_name $host\n" unless $host eq 'localhost';
print "graph_title $host CPU \n";
print "graph_args --base 1000 -r --lower-limit 0 --upper-limit 100\n";
print "graph_vlabel CPU \n";
print "graph_category san\n";
print "graph_info This graph shows cpu busy value for the $host in percent.\n";
print "graph_order ";
foreach (sort keys %oids)
{
print "$_ ";
}
print "\n";
foreach my $k (sort keys %oids)
{
print "$k.info The cpu $oids{$k} value in percent\n";
print "$k.label $oids{$k}\n";
print "$k.min 0\n";
print "$k.draw AREASTACK\n";
print "$k.type GAUGE\n";
}
exit 0;
}
my $values = $session->get_hash
(
-baseoid => '1.3.6.1.4.1.789.1.2.1',
-cols =>
{
# 1 => 'cpuUpTime',
# 2 => 'cpuBusyTime',
3 => 'cpuBusyTimePerCent',
# 4 => 'cpuIdleTime',
5 => 'cpuIdleTimePerCent',
# 6 => 'cpuCount',
# 7 => 'cpuSwitchInvocations',
# 8 => 'cpuContextSwitches',
# 9 => 'cpuInterrupts',
# 10 => 'cpuNonCPInterrupts',
# 11 => 'cpuCPInterruptPercent',
# 12 => 'cpuNonCPInterruptPercent',
# 13 => 'cpuTotalDomainSwitches',
},
);
foreach my $k (keys %oids)
{
my $v = 'U';
$v = $values->{0}->{$k} if (defined $values);
print "$k.value $v\n";
}
exit 0;
__END__

View file

@ -0,0 +1,157 @@
#!/usr/bin/perl -w
# -*- perl -*-
# vim: ft=perl
=head1 NAME
=head1 APPLICABLE SYSTEMS
=head1 CONFIGURATION
You have to setup ssh with public key authentication for this plugin
SNMP is only used for getting the hostname
[snmp_$host_netapp_diskbusy]
env.ssh /usr/bin/ssh (default)
env.sshuser munin (default)
env.sshopts -i /home/munin/.ssh/id_rsa -o UserKnownHostsFile=/home/munin/.ssh/known_hosts (no default)
env.spares 2 (no default)
Number of spares is only used for total diskusage.
=head1 INTERPRETATION
This plugin only prints the disk busy status at check time. There is no
average calculated, but it still gives a goood overview if all disk are
used equally or you have got a single hot disk.
=head1 AUTHOR
2013, Claudius Herder
=head1 LICENSE
GPLv2.
=cut
use strict;
use Munin::Plugin;
use Munin::Plugin::SNMP;
need_multigraph();
my %disks;
sub do_collect
{
my $input;
my @tmp;
my $ssh = $ENV{'ssh'} || '/usr/bin/ssh';
my $sshuser = $ENV{'sshuser'} || $ENV{'USER'};
my $sshopts = $ENV{'sshopts'} || "";
my ($host, undef, undef, undef) = Munin::Plugin::SNMP->config_session();
$input=`$ssh $sshopts $sshuser\@$host stats show disk:*:disk_busy`;
foreach my $line (split(/\n/, $input))
{
@tmp = split(/:/, $line);
($disks{$tmp[2]} = $tmp[12]) =~ s/%//;
}
}
sub do_config_root
{
# graph_category san # To show plugin in Gallery also in this category
my ($host) = @_;
print "multigraph diskbusy\n";
print "graph_title $host Aggregate busy status\n";
print "graph_args --base 1000 --lower-limit 0 --rigid\n";
print "graph_vlabel aggr busy status\n";
print "graph_category disk\n";
print "graph_info This graph shows the aggr busy status in percent for $host without spares\n";
print "diskbusy.label DiskBusy\n";
print "diskbusy.min 0\n";
print "diskbusy.draw AREASTACK\n";
print "diskbusy.type GAUGE\n";
}
sub do_config_disk
{
my ($host,$disk) = @_;
my $extrainfo = '';
print "multigraph diskbusy.$disk\n";
print "graph_title disk busy status for disk $disk\n";
print "graph_args --base 1000 --lower-limit 0 --rigid\n";
print "graph_vlabel disk busy status\n";
print "graph_category disk\n";
print "graph_info This graph shows disk busy status in percent for the $disk disk.$extrainfo\n";
print "diskbusy.info This is the disk busy status in percent of $disk\n";
print "diskbusy.type GAUGE\n";
print "diskbusy.label DiskBusy\n";
print "diskbusy.min 0\n";
print "diskbusy.draw AREASTACK\n";
}
sub do_fetch_root
{
my $spares=$ENV{'spares'} || 0;
my $busy =0;
my $numberofdisk=0;
my $diskbusy=0;
$numberofdisk =(keys %disks);
foreach my $disk (keys %disks)
{
$busy += $disks{$disk};
}
$diskbusy=$busy/($numberofdisk-$spares);
print "multigraph diskbusy\n";
printf("diskbusy.value %.3f \n",$diskbusy);
}
sub do_fetch_disk
{
my($disk) = @_;
my $busy;
$busy = $disks{$disk};
print "multigraph diskbusy.$disk\n";
print "diskbusy.value $busy\n";
}
sub do_config
{
my ($host, undef, undef, undef) = Munin::Plugin::SNMP->config_session();
print "host_name $host\n" unless $host eq 'localhost';
foreach my $disk (sort keys %disks)
{
do_config_disk($host,$disk);
}
do_config_root($host);
}
sub do_fetch
{
foreach my $disk (sort keys %disks)
{
do_fetch_disk($disk);
}
do_fetch_root();
}
do_collect();
if ($ARGV[0] and $ARGV[0] eq "config")
{
do_config();
exit 0;
}
do_fetch();
exit 0;
__END__

View file

@ -0,0 +1,286 @@
#!/usr/bin/perl
# -*- perl -*-
# vim: ft=perl
=head1 NAME
snmp__netapp_cifs - Munin plugin to retrieve general cifs information from NetApp storage appliances.
=head1 APPLICABLE SYSTEMS
cifs should be reported by any NetApp storage appliance
with SNMP agent daemon activated. See na_snmp(8) for details.
=head1 CONFIGURATION
Unfortunately, SNMPv3 is not fully supported on all NetApp equipments.
For this reason, this plugin will use SNMPv2 by default, which is
insecure because it doesn't encrypt the community string.
The following parameters will help you get this plugin working :
[snmp_*]
env.community MyCommunity
If your community name is 'public', you should really worry about
security and immediately reconfigure your appliance.
Please see 'perldoc Munin::Plugin::SNMP' for further configuration.
=head1 INTERPRETATION
The plugin reports various cifs connections, users and open files.
=head1 MIB INFORMATION
This plugin requires support for the NETWORK-APPLIANCE-MIB issued by
Network Appliance. It reports the content of the cifs OID.
=head1 MAGIC MARKERS
#%# family=snmpauto
#%# capabilities=snmpconf
=head1 BUGS
This plugin wasn't tested on many hardware and only on Ontap 7.3.x.
=head1 AUTHOR
2013, Claudius Herder
NetApp is a registered trademark and Network Appliance is a trademark
of Network Appliance, Inc. in the U.S. and other countries.
=head1 LICENSE
GPLv2.
=cut
use strict;
use warnings;
use Munin::Plugin;
use Munin::Plugin::SNMP;
need_multigraph();
my %volbytes =
(
df64TotalKBytes => 'df64TotalKBytes',
df64UsedKBytes => 'df64UsedKBytes',
df64SisSavedKBytes => 'df64SisSavedKBytes',
);
my %snapbytes =
(
df64TotalKBytes => 'df64SnapShotTotalKBytes',
df64UsedKBytes => 'df64SnapShotUsedKBytes',
);
my %config =
(
df64TotalKBytes => 'VolumeSize',
df64UsedKBytes => 'Used',
df64SisSavedKBytes => 'SisSaved',
df64SnapShotTotalKBytes => 'SnapShotReserve',
df64SnapShotUsedKBytes => 'SnapShotUsed',
df64TotalAndSnapTotalKBytes => 'Total',
);
my $dfinfo;
my $aggrFlexvollist;
my $aggr_name;
my $aggr_id;
sub do_collect
{
my $session = Munin::Plugin::SNMP->session();
$dfinfo = $session->get_hash
(
-baseoid => '1.3.6.1.4.1.789.1.5.4.1',
-cols =>
{
1 => 'dfIndex',
2 => 'dfFileSys',
29 => 'df64TotalKBytes',
30 => 'df64UsedKBytes',
31 => 'df64AvailKBytes',
33 => 'df64SisSavedKBytes',
},
);
$aggrFlexvollist = $session->get_hash
(
-baseoid => '1.3.6.1.4.1.789.1.5.11.1',
-cols =>
{
2 => 'aggrName',
9 => 'aggrFlexvollist',
},
);
}
sub do_config_vol
{
my ($host,$aggr_name,$vol) = @_;
my $extrainfo = '';
if ( $dfinfo->{$vol}->{dfFileSys} eq $aggr_name )
{
print "multigraph diskusage2_$aggr_name\n";
print "graph_title $host disk usage of $aggr_name\n";
print "graph_info This graph shows the disk usage on NetApp host $host\n";
}
else
{
print "multigraph diskusage2_$aggr_name.$dfinfo->{$vol}->{dfFileSys}\n";
print "graph_title $host disk usage of $dfinfo->{$vol}->{dfFileSys} on $aggr_name\n";
print "graph_info This graph shows the disk usage for $dfinfo->{$vol}->{dfFileSys} on NetApp host $host\n";
}
print "graph_args --base 1024 --lower-limit 0\n";
print "graph_vlabel bytes\n";
# graph_category san # To show plugin in Gallery also in this category
print "graph_category disk\n";
print "graph_order df64UsedKBytes df64SnapShotUsedKBytes df64SisSavedKBytes df64TotalKBytes df64SnapShotTotalKBytes df64TotalAndSnapTotalKBytes \n";
foreach my $k (sort keys %config )
{
print "$k.info $config{$k} of Volume $dfinfo->{$vol}->{dfFileSys}.\n";
print "$k.label $config{$k}\n";
print "$k.min 0\n";
if ($k eq "df64TotalKBytes" )
{
print "$k.draw LINE3\n";
}
elsif ( $k eq "df64SnapShotTotalKBytes" )
{
print "$k.draw LINE0\n";
}
elsif ( $k eq "df64TotalAndSnapTotalKBytes" )
{
print "$k.draw LINE3\n";
}
else
{
print "$k.draw AREASTACK\n";
}
print "$k.type GAUGE\n";
print "$k.cdef $k,1024,*\n"
}
}
sub do_fetch_vol
{
my (undef, $aggr_name,$vol) = @_;
my $sum = 0;
my $index = 'U';
my $v = 'U';
$index = $dfinfo->{$vol}->{dfIndex};
if ( $dfinfo->{$vol}->{dfFileSys} eq $aggr_name )
{
print "multigraph diskusage2_$aggr_name\n";
}
else
{
print "multigraph diskusage2_$aggr_name.$dfinfo->{$vol}->{dfFileSys}\n";
}
foreach my $k (keys %snapbytes)
{
if ( $k eq "df64TotalKBytes" )
{
$sum += $dfinfo->{$index+1}->{$k};
$v = $dfinfo->{$index+1}->{$k};
}
else
{
$v = $dfinfo->{$index+1}->{$k};
}
print "$snapbytes{$k}.value $v\n";
}
foreach my $k (keys %volbytes)
{
if ( $k eq "df64TotalKBytes" )
{
$sum += $dfinfo->{$vol}->{$k};
$v = $dfinfo->{$vol}->{$k};
print "df64TotalAndSnapTotalKBytes.value $sum\n";
}
else
{
$v = $dfinfo->{$vol}->{$k};
}
print "$volbytes{$k}.value $v\n";
}
}
sub do_config_fetch
{
my ($func) = @_;
my $fcall;
my %op = (
'config' => \&do_config_vol,
'fetch' => \&do_fetch_vol,
);
my ($host, undef, undef, undef ) = Munin::Plugin::SNMP->config_session();
if ( $func eq "config" )
{
$fcall = $op{config};
print "host_name $host\n" unless $host eq 'localhost';
}
elsif ( $func eq "fetch")
{
$fcall = $op{fetch};
}
foreach my $vol (sort {$a <=> $b} keys %{$dfinfo})
{
$dfinfo->{$vol}->{dfFileSys} =~ s/(\/vol\/)(.*?)\//$2/;
if ( $dfinfo->{$vol}->{dfFileSys} ~~ [ split(' ',$aggrFlexvollist->{$aggr_id}->{aggrFlexvollist}), $aggr_name ])
{
$fcall->($host,$aggr_name,$vol);
}
}
}
sub do_setaggr {
if ( $0 =~ /netapp_diskusage2_$/)
{
die ("Can't run without a symlinked name\n")
}
elsif ($0 =~ /netapp_diskusage2_(.+)*$/)
{
$aggr_name = $1;
foreach my $aggr (keys %{$aggrFlexvollist})
{
if ( $aggr_name =~ $aggrFlexvollist->{$aggr}->{aggrName} )
{
$aggr_id = $aggr;
}
}
}
}
if (defined $ARGV[0])
{
if ($ARGV[0] eq "config")
{
do_collect();
do_setaggr();
do_config_fetch("config");
exit 0;
}
elsif ($ARGV[0] eq "snmpconf")
{
print "index 1.3.6.1.4.1.789.1.5.11.1.2.\n";
exit 0;
}
}
else
{
do_collect();
do_setaggr();
do_config_fetch("fetch");
}
exit 0;
__END__

View file

@ -0,0 +1,120 @@
#!/usr/bin/perl
# -*- perl -*-
# vim: ft=perl
=head1 NAME
snmp__netapp_cifs - Munin plugin to retrieve general cifs information from NetApp storage appliances.
=head1 APPLICABLE SYSTEMS
cifs should be reported by any NetApp storage appliance
with SNMP agent daemon activated. See na_snmp(8) for details.
=head1 CONFIGURATION
Unfortunately, SNMPv3 is not fully supported on all NetApp equipments.
For this reason, this plugin will use SNMPv2 by default, which is
insecure because it doesn't encrypt the community string.
The following parameters will help you get this plugin working :
[snmp_*]
env.community MyCommunity
If your community name is 'public', you should really worry about
security and immediately reconfigure your appliance.
Please see 'perldoc Munin::Plugin::SNMP' for further configuration.
=head1 INTERPRETATION
The plugin reports various cifs connections, users and open files.
=head1 MIB INFORMATION
This plugin requires support for the NETWORK-APPLIANCE-MIB issued by
Network Appliance. It reports the content of the cifs OID.
=head1 MAGIC MARKERS
#%# family=snmpauto
#%# capabilities=snmpconf
=head1 BUGS
This plugin wasn't tested on many hardware and only on Ontap 7.3.x.
=head1 AUTHOR
2013, Claudius Herder
NetApp is a registered trademark and Network Appliance is a trademark
of Network Appliance, Inc. in the U.S. and other countries.
=head1 LICENSE
GPLv2.
=cut
use strict;
use warnings;
use Munin::Plugin::SNMP;
my %oids =
(
misc64DiskReadBytes => 'DISKUTIL_DISKREADBYTES',
misc64DiskWriteBytes => 'DISKUTIL_DISKWRITEBYTES',
);
if (defined $ARGV[0] and $ARGV[0] eq 'snmpconf')
{
print "require 1.3.6.1.4.1.789.1.2.2.1.0 [0-9]\n";
exit 0;
}
my $session = Munin::Plugin::SNMP->session();
if (defined $ARGV[0] and $ARGV[0] eq "config")
{
my ($host, undef, undef, undef) = Munin::Plugin::SNMP->config_session();
print "host_name $host\n" unless $host eq 'localhost';
print "graph_title $host Disk throughput\n";
print "graph_args --base 1024\n";
print "graph_vlabel Bytes/\${graph_period} write (-) / read (+)\n";
# graph_category san # To show plugin in Gallery also in this category
print "graph_category disk\n";
print "graph_info This graph shows DiskUtil calls for the $host NetApp equipment.\n";
print "graph_order misc64DiskWriteBytes misc64DiskReadBytes\n";
print "misc64DiskWriteBytes.type COUNTER\n";
print "misc64DiskWriteBytes.label bps\n";
print "misc64DiskWriteBytes.min 0\n";
print "misc64DiskWriteBytes.graph no\n";
print "misc64DiskReadBytes.type COUNTER\n";
print "misc64DiskReadBytes.min 0\n";
print "misc64DiskReadBytes.label bps\n";
print "misc64DiskReadBytes.negative misc64DiskWriteBytes\n";
print "misc64DiskReadBytes.info misc64DiskWriteBytes/misc64DiskReadBytes\n";
exit 0;
}
my $values = $session->get_hash
(
-baseoid => '1.3.6.1.4.1.789.1.2.2',
-cols =>
{
32 => 'misc64DiskReadBytes',
33 => 'misc64DiskWriteBytes',
},
);
foreach my $k (keys %oids)
{
my $v = 'U';
$v = $values->{0}->{$k} if (defined $values);
print "$k.value $v\n";
}
exit 0;
__END__

126
plugins/netapp/snmp__netapp_ndmp Executable file
View file

@ -0,0 +1,126 @@
#!/usr/bin/perl
# -*- perl -*-
# vim: ft=perl
=head1 NAME
snmp__netapp_cifs - Munin plugin to retrieve general cifs information from NetApp storage appliances.
=head1 APPLICABLE SYSTEMS
cifs should be reported by any NetApp storage appliance
with SNMP agent daemon activated. See na_snmp(8) for details.
=head1 CONFIGURATION
Unfortunately, SNMPv3 is not fully supported on all NetApp equipments.
For this reason, this plugin will use SNMPv2 by default, which is
insecure because it doesn't encrypt the community string.
The following parameters will help you get this plugin working :
[snmp_*]
env.community MyCommunity
If your community name is 'public', you should really worry about
security and immediately reconfigure your appliance.
Please see 'perldoc Munin::Plugin::SNMP' for further configuration.
=head1 INTERPRETATION
The plugin reports various cifs connections, users and open files.
=head1 MIB INFORMATION
This plugin requires support for the NETWORK-APPLIANCE-MIB issued by
Network Appliance. It reports the content of the cifs OID.
=head1 MAGIC MARKERS
#%# family=snmpauto
#%# capabilities=snmpconf
=head1 BUGS
This plugin wasn't tested on many hardware and only on Ontap 7.3.x.
=head1 AUTHOR
2013, Claudius Herder
NetApp is a registered trademark and Network Appliance is a trademark
of Network Appliance, Inc. in the U.S. and other countries.
=head1 LICENSE
GPLv2.
=cut
use strict;
use warnings;
use Munin::Plugin::SNMP;
my %oids =
(
ndmpSessionOpened => 'SessionsOpened',
ndmpBackupActive => 'BackupActive',
ndmpRestoreActive => 'RestoreActive',
);
if (defined $ARGV[0] and $ARGV[0] eq 'snmpconf')
{
print "require 1.3.6.1.4.1.789.1.10.1.0 [0-9]\n";
exit 0;
}
my $session = Munin::Plugin::SNMP->session();
if (defined $ARGV[0] and $ARGV[0] eq "config")
{
my ($host, undef, undef, undef) = Munin::Plugin::SNMP->config_session();
print "host_name $host\n" unless $host eq 'localhost';
print "graph_title $host NDMP \n";
print "graph_args --base 1000 --lower-limit 0 --rigid\n";
print "graph_vlabel NDMP status\n";
print "graph_category san\n";
print "graph_info This graph shows NDMP status for the $host NetApp equipment.\n";
print "graph_order ";
foreach (sort keys %oids)
{
print "$_ ";
}
print "\n";
foreach my $k (sort keys %oids)
{
print "$k.info The number of NDMP $oids{$k}\n";
print "$k.label $oids{$k}\n";
print "$k.min 0\n";
print "$k.draw AREASTACK\n";
print "$k.type GAUGE\n";
}
exit 0;
}
my $values = $session->get_hash
(
-baseoid => '1.3.6.1.4.1.789.1.10',
-cols =>
{
2 => 'ndmpSessionOpened',
3 => 'ndmpBackupActive',
4 => 'ndmpRestoreActive',
},
);
foreach my $k (keys %oids)
{
my $v = 'U';
$v = $values->{0}->{$k} if (defined $values);
print "$k.value $v\n";
}
exit 0;
__END__

120
plugins/netapp/snmp__netapp_net Executable file
View file

@ -0,0 +1,120 @@
#!/usr/bin/perl
# -*- perl -*-
# vim: ft=perl
=head1 NAME
snmp__netapp_cifs - Munin plugin to retrieve general cifs information from NetApp storage appliances.
=head1 APPLICABLE SYSTEMS
cifs should be reported by any NetApp storage appliance
with SNMP agent daemon activated. See na_snmp(8) for details.
=head1 CONFIGURATION
Unfortunately, SNMPv3 is not fully supported on all NetApp equipments.
For this reason, this plugin will use SNMPv2 by default, which is
insecure because it doesn't encrypt the community string.
The following parameters will help you get this plugin working :
[snmp_*]
env.community MyCommunity
If your community name is 'public', you should really worry about
security and immediately reconfigure your appliance.
Please see 'perldoc Munin::Plugin::SNMP' for further configuration.
=head1 INTERPRETATION
The plugin reports various cifs connections, users and open files.
=head1 MIB INFORMATION
This plugin requires support for the NETWORK-APPLIANCE-MIB issued by
Network Appliance. It reports the content of the cifs OID.
=head1 MAGIC MARKERS
#%# family=snmpauto
#%# capabilities=snmpconf
=head1 BUGS
This plugin wasn't tested on many hardware and only on Ontap 7.3.x.
=head1 AUTHOR
2013, Claudius Herder
NetApp is a registered trademark and Network Appliance is a trademark
of Network Appliance, Inc. in the U.S. and other countries.
=head1 LICENSE
GPLv2.
=cut
use strict;
use warnings;
use Munin::Plugin::SNMP;
my %oids =
(
misc64NetRcvdBytes => 'NET_NETRCVDBYTES',
misc64NetSentBytes => 'NET_NETSENTBYTES',
);
if (defined $ARGV[0] and $ARGV[0] eq 'snmpconf')
{
print "require 1.3.6.1.4.1.789.1.2.2.1.0 [0-9]\n";
exit 0;
}
my $session = Munin::Plugin::SNMP->session();
if (defined $ARGV[0] and $ARGV[0] eq "config")
{
my ($host, undef, undef, undef) = Munin::Plugin::SNMP->config_session();
print "host_name $host\n" unless $host eq 'localhost';
print "graph_title $host Network interface traffic\n";
print "graph_args --base 1000\n";
print "graph_vlabel Bytes in (-) / out (+) per \${graph_period}\n";
# graph_category san # To show plugin in Gallery also in this category
print "graph_category network\n";
print "graph_info This graph shows net stats for the $host NetApp equipment.\n";
print "graph_order misc64NetRcvdBytes misc64NetSentBytes\n";
print "misc64NetRcvdBytes.type COUNTER\n";
print "misc64NetRcvdBytes.min 0\n";
print "misc64NetRcvdBytes.graph no\n";
print "misc64NetRcvdBytes.label bps\n";
print "misc64NetSentBytes.type COUNTER\n";
print "misc64NetSentBytes.label bps\n";
print "misc64NetSentBytes.min 0\n";
print "misc64NetSentBytes.negative misc64NetRcvdBytes\n";
print "misc64NetSentBytes.info misc64NetRcvdBytes/misc64NetSentBytes\n";
exit 0;
}
my $values = $session->get_hash
(
-baseoid => '1.3.6.1.4.1.789.1.2.2',
-cols =>
{
30 => 'misc64NetRcvdBytes',
31 => 'misc64NetSentBytes',
},
);
foreach my $k (keys %oids)
{
my $v = 'U';
$v = $values->{0}->{$k} if (defined $values);
print "$k.value $v\n";
}
exit 0;
__END__

View file

@ -0,0 +1,183 @@
#!/usr/bin/perl
=head1 NAME
snmp__netapp_nfs3calls - Munin plugin to retrieve NFSv3 calls types
stats from NetApp storage appliances.
=head1 APPLICABLE SYSTEMS
NFSv3 calls stats should be reported by any NetApp storage appliance
with SNMP agent daemon activated. See na_snmp(8) for details.
=head1 CONFIGURATION
Unfortunately, SNMPv3 is not fully supported on all NetApp equipments.
For this reason, this plugin will use SNMPv2 by default, which is
insecure because it doesn't encrypt the community string.
The following parameters will help you get this plugin working :
[snmp_*]
env.community MyCommunity
If your community name is 'public', you should really worry about
security and immediately reconfigure your appliance.
Please see 'perldoc Munin::Plugin::SNMP' for further configuration.
=head1 INTERPRETATION
The plugin reports various NFSv3 calls by type. This can help you
determine what calls types are killing your appliance under heavy
loads.
=head1 MIB INFORMATION
This plugin requires support for the NETWORK-APPLIANCE-MIB issued by
Network Appliance. It reports the content of the v3Calls OID.
=head1 MAGIC MARKERS
#%# family=snmpauto
#%# capabilities=snmpconf
=head1 VERSION
v1.0 - 06/19/2009 18:36:02 CEST
Initial revision
=head1 AUTHOR
This plugin is copyright (c) 2009 by Guillaume Blairon.
NetApp is a registered trademark and Network Appliance is a trademark
of Network Appliance, Inc. in the U.S. and other countries.
=head1 BUGS
This plugin wasn't tested on many hardware. If you encounter bugs,
please report any to Guillaume Blairon E<lt>L<g@yom.be>E<gt>.
=head1 LICENSE
GPLv2 or (at your option) any later version.
=cut
use strict;
use warnings;
use Munin::Plugin::SNMP;
use vars qw($DEBUG);
$DEBUG = $ENV{'MUNIN_DEBUG'};
my @palette =
#Better colours from munin 1.3.x
#Greens Blues Oranges Dk yel Dk blu Purple Lime Reds Gray
qw(00CC00 0066B3 FF8000 FFCC00 330099 990099 CCFF00 FF0000 808080
008F00 00487D B35A00 B38F00 6B006B 8FB300 B30000 BEBEBE
80FF80 80C9FF FFC080 FFE680 AA80FF EE00CC FF8080
666600 FFBFFF 00FFCC CC6699 999900);
my %oids = (
nulls => 'NFSPROC3_NULL (Do Nothing)',
getattrs => 'NFSPROC3_GETATTR (Get File Attributes)',
setattrs => 'NFSPROC3_SETATTR (Set File Attributes)',
lookups => 'NFSPROC3_LOOKUP (Lookup Filename)',
accesss => 'NFSPROC3_ACCESS (Check Access Permission)',
readlinks => 'NFSPROC3_READLINK (Read from Symbolic Link)',
reads => 'NFSPROC3_READ (Read from File)',
writes => 'NFSPROC3_WRITE (Write to File)',
creates => 'NFSPROC3_CREATE (Create a File)',
mkdirs => 'NFSPROC3_MKDIR (Create a Directory)',
symlinks => 'NFSPROC3_SYMLINK (Create a Symbolic Link)',
mknods => 'NFSPROC3_MKNOD (Create a Special Device)',
removes => 'NFSPROC3_REMOVE (Remove a File)',
rmdirs => 'NFSPROC3_RMDIR (Remove a Directory)',
renames => 'NFSPROC3_RENAME (Rename a File or Directory)',
links => 'NFSPROC3_LINK (Create Link to an Object)',
readdirs => 'NFSPROC3_READDIR (Read from Directory)',
readdirpluss => 'NFSPROC3_READDIRPLUS (Extended Read from Directory)',
fsstats => 'NFSPROC3_FSSTAT (Get Dynamic File System Information)',
fsinfos => 'NFSPROC3_FSINFO (Get Static File System Information)',
pathconfs => 'NFSPROC3_PATHCONF (Retrieve POSIX Information)',
commits => 'NFSPROC3_COMMIT (Commit Cached Data on a Server to Stable Storage)',
);
if (defined $ARGV[0] and $ARGV[0] eq 'snmpconf') {
print "require 1.3.6.1.4.1.789.1.3.1.2.4.1.1.0 [0-9]\n";
exit 0;
}
my $session = Munin::Plugin::SNMP->session();
if (defined $ARGV[0] and $ARGV[0] eq "config") {
my ($host, undef, undef, undef) = Munin::Plugin::SNMP->config_session();
print "host_name $host\n" unless $host eq 'localhost';
print "graph_title $host NFSv3 calls\n";
print "graph_args --base 1000\n";
print "graph_vlabel calls / \${graph_period}\n";
# graph_category san # To show plugin in Gallery also in this category
print "graph_category nfs\n";
print "graph_info This graph shows NFSv3 calls for the $host NetApp equipment.\n";
print "graph_order ";
foreach (sort keys %oids) { print "$_ "; }
print "\n";
my $c = 0;
foreach my $k (sort keys %oids) {
my $i = $oids{$k};
my $l = $k;
$l =~ s/s$//g;
print "$k.info The number of NFS Version 3 calls received for the $i procedure, since the last time the statistics were cleared.\n";
print "$k.type DERIVE\n";
print "$k.label $l\n";
print "$k.min 0\n";
print "$k.colour $palette[$c]\n";
$c++;
}
exit 0;
}
my $values = $session->get_hash(
-baseoid => '1.3.6.1.4.1.789.1.3.1.2.4.1',
-cols => {
1 => 'nulls',
2 => 'getattrs',
3 => 'setattrs',
4 => 'lookups',
5 => 'accesss',
6 => 'readlinks',
7 => 'reads',
8 => 'writes',
9 => 'creates',
10 => 'mkdirs',
11 => 'symlinks',
12 => 'mknods',
13 => 'removes',
14 => 'rmdirs',
15 => 'renames',
16 => 'links',
17 => 'readdirs',
18 => 'readdirpluss',
19 => 'fsstats',
20 => 'fsinfos',
21 => 'pathconfs',
22 => 'commits',
},
);
foreach my $k (keys %oids) {
my $v = 'U';
$v = $values->{0}->{$k} if (defined $values);
print "$k.value $v\n";
}
exit 0;
__END__

134
plugins/netapp/snmp__netapp_ops Executable file
View file

@ -0,0 +1,134 @@
#!/usr/bin/perl
# -*- perl -*-
# vim: ft=perl
=head1 NAME
snmp__netapp_cifs - Munin plugin to retrieve general cifs information from NetApp storage appliances.
=head1 APPLICABLE SYSTEMS
cifs should be reported by any NetApp storage appliance
with SNMP agent daemon activated. See na_snmp(8) for details.
=head1 CONFIGURATION
Unfortunately, SNMPv3 is not fully supported on all NetApp equipments.
For this reason, this plugin will use SNMPv2 by default, which is
insecure because it doesn't encrypt the community string.
The following parameters will help you get this plugin working :
[snmp_*]
env.community MyCommunity
If your community name is 'public', you should really worry about
security and immediately reconfigure your appliance.
Please see 'perldoc Munin::Plugin::SNMP' for further configuration.
=head1 INTERPRETATION
The plugin reports various cifs connections, users and open files.
=head1 MIB INFORMATION
This plugin requires support for the NETWORK-APPLIANCE-MIB issued by
Network Appliance. It reports the content of the cifs OID.
=head1 MAGIC MARKERS
#%# family=snmpauto
#%# capabilities=snmpconf
=head1 BUGS
This plugin wasn't tested on many hardware and only on Ontap 7.3.x.
=head1 AUTHOR
2013, Claudius Herder
NetApp is a registered trademark and Network Appliance is a trademark
of Network Appliance, Inc. in the U.S. and other countries.
=head1 LICENSE
GPLv2.
=cut
use strict;
use warnings;
use Munin::Plugin::SNMP;
my %config =
(
misc64CifsOps => 'CifsOps',
misc64NfsOps => 'NfsOps',
iscsi64Ops => 'IscsiOps',
fcp64Ops => 'FcpOps',
misc64HttpOps => 'HttpOps',
);
if (defined $ARGV[0] and $ARGV[0] eq 'snmpconf')
{
print "require 1.3.6.1.4.1.789.1.2.2.1.0 [0-9]\n";
exit 0;
}
my $session = Munin::Plugin::SNMP->session();
if (defined $ARGV[0] and $ARGV[0] eq "config")
{
my ($host, undef, undef, undef) = Munin::Plugin::SNMP->config_session();
print "host_name $host\n" unless $host eq 'localhost';
print "graph_title $host OPS \n";
print "graph_args --base 1000 --lower-limit 0 --rigid\n";
print "graph_vlabel OPS \n";
print "graph_category san\n";
print "graph_info This graph shows OPS for the $host NetApp equipment.\n";
print "graph_order misc64CifsOps misc64NfsOps iscsi64Ops fcp64Ops misc64HttpOps\n";
foreach my $k (sort keys %config)
{
print "$k.info The number of OPS for $config{$k}.\n";
print "$k.type COUNTER\n";
print "$k.label $config{$k}\n";
print "$k.min 0\n";
print "$k.draw AREASTACK\n";
}
exit 0;
}
my $system = $session->get_hash
(
-baseoid => '1.3.6.1.4.1.789.1.2.2',
-cols =>
{
27 => 'misc64NfsOps',
28 => 'misc64CifsOps',
29 => 'misc64HttpOps',
},
);
my $block = $session->get_hash
(
-baseoid => '1.3.6.1.4.1.789.1.17',
-cols =>
{
24 => 'iscsi64Ops',
25 => 'fcp64Ops',
},
);
my $tmp->{0} = { %{$system->{0}}, %{$block->{0}}} ;
foreach my $k (keys %config)
{
my $v = 'U';
$v = $tmp->{0}->{$k} if (defined $tmp);
print "$k.value $v\n";
}
exit 0;
__END__

View file

@ -0,0 +1,239 @@
#!/usr/bin/perl -w
# -*- perl -*-
# vim: ft=perl
=head1 NAME
=head1 APPLICABLE SYSTEMS
=head1 CONFIGURATION
You have to setup ssh with public key authentication for this plugin
SNMP is only used for getting the hostname
[snmp_$host_netapp_diskbusy]
env.ssh /usr/bin/ssh (default)
env.sshuser munin (default)
env.sshopts -i /home/munin/.ssh/id_rsa -o UserKnownHostsFile=/home/munin/.ssh/known_hosts (no default)
env.spares 2 (no default)
Number of spares is only used for total diskusage.
=head1 INTERPRETATION
This plugin only prints the disk busy status at check time. There is no
average calculated, but it still gives a goood overview if all disk are
used equally or you have got a single hot disk.
=head1 AUTHOR
2013, Claudius Herder
=head1 LICENSE
GPLv2.
=cut
use strict;
use Munin::Plugin;
use Munin::Plugin::SNMP;
need_multigraph();
my %vols;
sub do_collect
{
my $input;
my @tmp;
my $ssh = $ENV{'ssh'} || '/usr/bin/ssh';
my $sshuser = $ENV{'sshuser'} || $ENV{'USER'};
my $sshopts = $ENV{'sshopts'} || "";
my ($host, undef, undef, undef) = Munin::Plugin::SNMP->config_session();
$input=`$ssh $sshopts $sshuser\@$host reallocate status`;
my $hit=0;
my $key="";
my $value=0;
foreach my $line (split(/\n/, $input))
{
if (($line =~ m/^\/vol/ || ($line =~ m/^aggr/ ) && !$hit))
{
($key= "$line") =~ s/(\/vol\/|^)(.*?)\:\ /$2/;
$hit=1;
}
if ($line =~ m/State/ && $hit )
{
@tmp = split(/:/, $line);
if ( $tmp[1] =~ "Idle")
{
$value = 0; #reallocate idle initialising
}
elsif ( $tmp[1] =~ "Reallocating" )
{
$value = 1; #reallocate active
}
elsif ( $tmp[1] =~ "Redirect" )
{
$value = 2; #redirect active
}
elsif ( $tmp[1] =~ "Quiesce" )
{
$value = 3; #quiesce reallocate paused
}
else
{
$value = 5;
}
$hit=0;
$vols{$key} = $value;
}
}
}
sub do_config_vol
{
my ($host,$vol) = @_;
if ( ! $vol )
{
print "multigraph reallocate_status\n";
print "graph_title $host Reallocation status\n";
print "graph_info This graph shows the reallocation status for $host\n";
}
else
{
print "multigraph reallocate_status.$vol\n";
print "graph_title reallocate_status status for vol $vol\n";
print "graph_info This graph shows reallocate_status status for $vol\n";
}
print "graph_args --base 1000 --lower-limit 0 --rigid\n";
print "graph_vlabel reallocate_status status\n";
print "graph_category san\n";
foreach my $state ("reallocating", "redirecting", "quiesce", "debug")
{
print "$state.label $state\n";
print "$state.min 0\n";
print "$state.draw AREASTACK\n";
print "$state.type GAUGE\n";
if ( $vol )
{
print "$state.info This is the $state status of $vol.\n";
}
}
}
sub do_fetch_root
{
my $status = 0;
my $reallocating = 0;
my $redirecting = 0;
my $quiesce = 0;
my $debug = 0;
foreach my $vol (keys %vols)
{
$status=$vols{$vol};
if ($status == 0)
{
#reallocate idle
}
elsif ($status == 1)
{
$reallocating++;
}
elsif ($status == 2)
{
$redirecting++;
}
elsif ($status == 3)
{
$quiesce++;
}
else
{
$debug++;
}
}
print "multigraph reallocate_status\n";
print "reallocating.value $reallocating\n";
print "redirecting.value $redirecting\n";
print "quiesce.value $quiesce\n";
print "debug.value $debug\n";
}
sub do_fetch_vol
{
my($vol) = @_;
my $status = 0;
my $reallocating = 0;
my $redirecting = 0;
my $quiesce = 0;
my $debug = 0;
$status = $vols{$vol};
if ($status == 0)
{
#reallocate idle
}
elsif ($status == 1)
{
$reallocating = 1;
}
elsif ($status == 2)
{
$redirecting = 1;
}
elsif ($status == 3)
{
$quiesce = 1;
}
else
{
$debug = 1;
}
print "multigraph reallocate_status.$vol\n";
print "reallocating.value $reallocating\n";
print "redirecting.value $redirecting\n";
print "quiesce.value $quiesce\n";
print "debug.value $debug\n";
}
sub do_config
{
my ($host, undef, undef, undef) = Munin::Plugin::SNMP->config_session();
print "host_name $host\n" unless $host eq 'localhost';
foreach my $vol (sort keys %vols)
{
do_config_vol($host,$vol);
}
do_config_vol($host);
}
sub do_fetch
{
foreach my $vol (sort keys %vols)
{
do_fetch_vol($vol);
}
do_fetch_root();
}
do_collect();
if ($ARGV[0] and $ARGV[0] eq "config")
{
do_config();
exit 0;
}
do_fetch();
exit 0;
__END__

239
plugins/netapp/snmp__netapp_sis Executable file
View file

@ -0,0 +1,239 @@
#!/usr/bin/perl -w
# -*- perl -*-
# vim: ft=perl
=head1 NAME
snmp__netapp_sis - Munin plugin to retrieve sis operation status from NetApp storage appliances.
=head1 APPLICABLE SYSTEMS
sis should be reported by any NetApp storage appliance
with SNMP agent daemon activated. See na_snmp(8) for details.
=head1 CONFIGURATION
Unfortunately, SNMPv3 is not fully supported on all NetApp equipments.
For this reason, this plugin will use SNMPv2 by default, which is
insecure because it doesn't encrypt the community string.
The following parameters will help you get this plugin working :
[snmp_*]
env.community MyCommunity
If your community name is 'public', you should really worry about
security and immediately reconfigure your appliance.
Please see 'perldoc Munin::Plugin::SNMP' for further configuration.
=head1 INTERPRETATION
The plugin reports sis status (initialising, running, pending) per filer and per volume.
This could be helpful for sis schedule optimization.
=head1 MIB INFORMATION
This plugin requires support for the NETWORK-APPLIANCE-MIB issued by
Network Appliance. It reports the content of the sis OID.
=head1 MAGIC MARKERS
#%# family=snmpauto
#%# capabilities=snmpconf
=head1 BUGS
This plugin wasn't tested on many hardware and only on Ontap 7.3.x.
=head1 AUTHOR
2013, Claudius Herder
NetApp is a registered trademark and Network Appliance is a trademark
of Network Appliance, Inc. in the U.S. and other countries.
=head1 LICENSE
GPLv2.
=cut
use strict;
use warnings;
use Munin::Plugin;
use Munin::Plugin::SNMP;
need_multigraph();
if (defined $ARGV[0] and $ARGV[0] eq "snmpconf")
{
print "require 1.3.6.1.4.1.789.1.23.2.1.1. [0-9]\n";
exit 0;
}
my $volOIDBase = "1.3.6.1.4.1.789.1.23.2.1";
# Needed as globals
my $snmpinfo;
sub do_collect
{
# Collect information from SNMP agent
my $session = Munin::Plugin::SNMP->session();
$snmpinfo = $session->get_hash
(
-baseoid => $volOIDBase,
-cols =>
{
2 => 'sisPath',
4 => 'sisStatus',
}
);
}
sub do_config_vol
{
my ($host,$vol) = @_;
if ( ! $vol )
{
print "multigraph sis_status\n";
print "graph_title $host SIS status\n";
print "graph_info This graph shows the sis status for $host\n";
}
else
{
$snmpinfo->{$vol}->{sisPath} =~ s/(\/vol\/)(.*?)/$2/;
print "multigraph sis_status.$snmpinfo->{$vol}->{sisPath}\n";
print "graph_title sis status for volume $snmpinfo->{$vol}->{sisPath}\n";
print "graph_info This graph shows the sis status for the $snmpinfo->{$vol}->{sisPath} volume\n";
}
print "graph_args --base 1000 --lower-limit 0 --rigid\n";
print "graph_vlabel sis status\n";
print "graph_category san\n";
print "graph_order sisInitialising sisRunning sisPending sisDebug\n";
foreach my $state ("debug", "initialising", "running", "pending")
{
if ($vol)
{
print "$state.info This is the $state status of $snmpinfo->{$vol}->{sisPath}.\n";
}
print "$state.label $state\n";
print "$state.min 0\n";
print "$state.draw AREASTACK\n";
print "$state.type GAUGE\n";
}
}
sub do_fetch_root
{
# Construct root graphs for the sis_status spaces
my $sisSumIni = 0;
my $sisSumRun = 0;
my $sisSumPen = 0;
my $sisDebug = 0;
foreach my $vol (keys %{$snmpinfo})
{
my $status;
$status = $snmpinfo->{$vol}->{sisStatus};
if ($status == 1)
{
# sis idle
}
elsif ($status == 2 )
{
$sisSumIni++; #sis initialising
}
elsif ( $status == 3)
{
$sisSumRun++; #sis running
}
elsif ( $status == 5)
{
$sisSumPen++; #sis pending
}
else
{
$sisDebug++;
}
}
print "multigraph sis_status\n";
print "initialising.value $sisSumIni\n";
print "running.value $sisSumRun\n";
print "pending.value $sisSumPen\n";
print "debug.value $sisDebug\n";
}
sub do_fetch_vol
{
my($vol) = @_;
my $status = $snmpinfo->{$vol}->{sisStatus};
my $sisIni = 0;
my $sisRun = 0;
my $sisPen = 0;
my $sisDebug = 0;
if ($status == 1)
{
# sis idle
}
elsif ($status == 2)
{
$sisIni = 1;
}
elsif ($status == 3)
{
$sisRun = 1;
}
elsif ($status == 5)
{
$sisPen = 1;
}
else
{
$sisDebug = $status;
}
$snmpinfo->{$vol}->{sisPath} =~ s/(\/vol\/)(.*?)/$2/;
print "multigraph sis_status.$snmpinfo->{$vol}->{sisPath}\n";
print "initialising.value $sisIni\n";
print "running.value $sisRun\n";
print "pending.value $sisPen\n";
print "debug.value $sisDebug\n";
}
sub do_config
{
my ($host, undef, undef, undef) = Munin::Plugin::SNMP->config_session();
print "host_name $host\n" unless $host eq 'localhost';
foreach my $vol (sort {$a <=> $b} keys %{$snmpinfo})
{
do_config_vol($host,$vol);
}
do_config_vol($host);
}
sub do_fetch
{
foreach my $vol (sort {$a <=> $b} keys %{$snmpinfo})
{
do_fetch_vol($vol);
}
do_fetch_root();
}
do_collect;
if ($ARGV[0] and $ARGV[0] eq "config")
{
do_config();
exit 0;
}
do_fetch();
exit 0;
__END__