Repository
Munin (2.0)
Last change
2018-08-17
Family
auto
Capabilities
Keywords
Language
Perl
License
GPL-2.0-only

iostat.hd_only

Name

iostat.hd_only - Plugin for watching io-bound traffic (in KiloBytes) on disks

Configuration

No configuration

Notes

Description

Similar to the iostat script, but will only report usage on hdisks physically installed in the server.

Restrictions

Same as the iostat script, see its RESTRICTIONS.

Note: If you have virtual paths, typical when gigabit fiber cards are installed and attached to an ESS (Shark) or some sort of large disk array, this will not include any information for them. This only collects information for hdisks physically located in the machine, no virtual drives are included.

Author

Unknown author

License

GPLv2

Magic Markers

#%# family=auto
#%# capabilities=autoconf
#!@@PERL@@ -w
# -*- perl -*-

=head1 NAME

iostat.hd_only - Plugin for watching io-bound traffic (in KiloBytes) on disks

=head1 CONFIGURATION

No configuration

=head1 NOTES

=head2 DESCRIPTION

Similar to the iostat script, but will only report usage on hdisks
physically installed in the server.

=head2 RESTRICTIONS

Same as the iostat script, see its RESTRICTIONS.

Note: If you have virtual paths, typical when gigabit fiber cards are
installed and attached to an ESS (Shark) or some sort of large disk
array, this will not include any information for them.  This only
collects information for hdisks physically located in the machine, no
virtual drives are included.

=head1 AUTHOR

Unknown author

=head1 LICENSE

GPLv2

=head1 MAGIC MARKERS

 #%# family=auto
 #%# capabilities=autoconf

=cut

use strict;
use POSIX;

my($arg) = shift;

if($arg && $arg eq "autoconf") {
    if ( (-e "/usr/bin/iostat" && -X "/usr/bin/iostat") &&
	 (-e '/usr/sbin/lspv' && -X '/usr/sbin/lspv')) {
        print "yes\n";
        exit 0;
    } else {
        print "no (need /usr/bin/iostat and /usr/sbin/lspv)\n";
        exit 0;
    }
}

if($arg && $arg eq "config")
  {
    print "graph_title IOstat (Internal Disks Only)\n";
    print "graph_args --base 1024 --logarithmic\n";
    print "graph_vlabel KB / \${graph_period}\n";
    my(@info) = getDiskIO("disk only");
    my($line);
    foreach $line (@info)
      {
        print "$line.label $line\n";
        print "$line.type COUNTER\n";
        print "$line.max 100000\n";
      }
    exit 0;
  }

my(@info) = getDiskIO('');
my($line);
foreach $line (@info)
  {print "$line";}


sub getDiskIO
{
  my($diskOnly) = @_;
  my($line,@lineArray,@diskArray,$writes,$reads,$diskLine);
  if($diskOnly && $diskOnly eq 'disk only')
    {
      open DISKLIST, "/usr/sbin/lspv|grep hdisk|grep -v none|";
      while($line = <DISKLIST>)
        {
          @lineArray = split(/ +/,$line);
          push(@diskArray,"$lineArray[0]_read","$lineArray[0]_write");
        }
    }
  else
    {
      open DISKLIST, "/usr/sbin/lspv|grep hdisk|grep -v none|";
      while($line = <DISKLIST>)
        {
          @lineArray = split(/ +/,$line);
          $diskLine = `/usr/bin/iostat|grep $lineArray[0]`;
          @lineArray = split(/ +/,$diskLine);
          $writes = $lineArray[5];
          chomp($writes);
          $reads = $lineArray[4];
          chomp($reads);

          push(@diskArray,"$lineArray[0]_read.value $reads\n","$lineArray[0]_write.value $writes\n");
        }
    }
  return @diskArray
}