MINI SHELL

Server : Apache/2.2.2 (Fedora)
System : Linux App1.pathumtani.go.th 2.6.20-1.2320.fc5smp #1 SMP Tue Jun 12 19:40:16 EDT 2007 i686
User : apache ( 48)
PHP Version : 5.2.9
Disable Function : NONE
Directory :  /usr/local/src/munin-1.2.6/node/node.d.aix/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //usr/local/src/munin-1.2.6/node/node.d.aix/iostat.hd_only.in
#!@@PERL@@ -w
#
# $Log$
# Revision 1.4  2004/12/10 18:51:43  jimmyo
# linux/apt* has been forced to LANG=C, to get predictable output.
#
# Revision 1.3  2004/12/10 10:47:48  jimmyo
# Change name from ${scale} to ${graph_period}, to be more consistent.
#
# Revision 1.2  2004/12/09 22:12:55  jimmyo
# Added "graph_period" option, to make "graph_sums" usable.
#
# Revision 1.1  2004/01/02 18:50:00  jimmyo
# Renamed occurrances of lrrd -> munin
#
# Revision 1.1.1.1  2004/01/02 15:18:07  jimmyo
# Import of LRRD CVS tree after renaming to Munin
#
# Revision 1.2  2003/11/07 17:43:16  jimmyo
# Cleanups and log entries
#
#
#
# Plugin for watching io-bound traffic (in KiloBytes) on disks.
#
#   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 it's 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.
#
# Usage: Link or copy into /etc/munin/node.d/
#
# Parameters:
#
# 	config   (required)
# 	autoconf (optional - used by munin-config)
#
# Magic markers (optional - used by munin-config and some installation
# scripts):
#
#%# family=contrib
#%# capabilities=autoconf

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\n";
        exit 1;
      }
  }
 
if($arg && $arg eq "config")
  {
    print "graph_title IOstat (Internal Disks Only)\n";
    print "graph_args --base 1024 -l 0\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
}


Anon7 - 2021