2
0
mirror of https://github.com/munin-monitoring/contrib.git synced 2018-11-08 00:59:34 +01:00

Merge pull request #302 from claudius23/snmp_netapp

plugins/snmp/snmp__netapp_* initial checkin of my snmp__netapp_ plugins.
This commit is contained in:
Kenyon Ralph 2013-05-10 00:54:12 -07:00
commit 3c08471566
11 changed files with 1827 additions and 0 deletions

126
plugins/snmp/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 CIFS\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 cifs\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__

145
plugins/snmp/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 CPU\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,155 @@
#!/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
{
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,285 @@
#!/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";
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,119 @@
#!/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";
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/snmp/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 NDMP\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__

119
plugins/snmp/snmp__netapp_net Executable file
View File

@ -0,0 +1,119 @@
#!/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";
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__

134
plugins/snmp/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 OPS\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 intialising
}
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 reallocate\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/snmp/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 sis\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 intialising
}
elsif ( $status == 3)
{
$sisSumRun++; #sis runnung
}
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__