~ubuntu-branches/ubuntu/gutsy/munin/gutsy

« back to all changes in this revision

Viewing changes to node/node.d.aix/netstat.in

  • Committer: Bazaar Package Importer
  • Author(s): Tore Anderson
  • Date: 2004-05-21 20:51:19 UTC
  • Revision ID: james.westby@ubuntu.com-20040521205119-oz8bllbjp9hs80ig
Tags: upstream-0+1.0.0pre5
ImportĀ upstreamĀ versionĀ 0+1.0.0pre5

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!@@PERL@@
 
2
#
 
3
# Plugin to monitor network connections.
 
4
#
 
5
#   DESCRIPTION
 
6
#   ===========
 
7
#      This will measure the amount of network traffic coming into and
 
8
#      out of the server.  It will report back the number of connections
 
9
#      accepted, requested, established, and closed.  It uses
 
10
#      /usr/bin/netstat to gather it's information.
 
11
#      
 
12
#   RESTRICTION
 
13
#   ===========
 
14
#      None known.  /usr/bin/netstat should be executable by everyone by
 
15
#      default.
 
16
#
 
17
# $Log: netstat.in,v $
 
18
# Revision 1.1  2004/01/02 18:50:00  jimmyo
 
19
# Renamed occurrances of lrrd -> munin
 
20
#
 
21
# Revision 1.1.1.1  2004/01/02 15:18:07  jimmyo
 
22
# Import of LRRD CVS tree after renaming to Munin
 
23
#
 
24
# Revision 1.2  2003/11/07 17:43:16  jimmyo
 
25
# Cleanups and log entries
 
26
#
 
27
#
 
28
#
 
29
# Parameters:
 
30
#
 
31
#       config   (required)
 
32
#       autoconf (optional - only used by munin-config)
 
33
#
 
34
# Magic markers (optional - used by munin-config and some installation
 
35
# scripts):
 
36
#%# family=contrib
 
37
#%# capabilities=autoconf
 
38
 
 
39
use strict;
 
40
 
 
41
if($ARGV[0] && $ARGV[0] eq "autoconf")
 
42
  {
 
43
    if(-e "/usr/bin/netstat" && -X "/usr/bin/netstat")
 
44
      {
 
45
        print "yes\n";
 
46
        exit 0;
 
47
      }
 
48
    else
 
49
      {
 
50
        print "no\n";
 
51
        exit 1;
 
52
      }
 
53
  }
 
54
  
 
55
if($ARGV[0] && $ARGV[0] eq "config")
 
56
  {
 
57
    print "graph_title Netstat\n";
 
58
    print "graph_args -l 0 --base 1000\n";
 
59
    print "graph_vlabel requests connections\n";
 
60
    print "requests.label requests\n";
 
61
    print "requests.type COUNTER\n";
 
62
    print "requests.max 50000\n";
 
63
    print "accepts.label accepts\n";
 
64
    print "accepts.type COUNTER\n";
 
65
    print "accepts.max 50000\n";
 
66
    print "established.label established\n";
 
67
    print "established.type COUNTER\n";
 
68
    print "established.max 50000\n";
 
69
    print "closed.label closed\n";
 
70
    print "closed.type COUNTER\n";
 
71
    print "closed.max 50000\n";
 
72
    exit 0;
 
73
  }
 
74
  
 
75
my(%toFind) = ("requests" => "connection requests",
 
76
               "accepts" => "connection accepts",
 
77
               "established" => "connections established",
 
78
               "closed" => "connections closed ("
 
79
              );
 
80
              
 
81
my($item,$line,@lineArray);
 
82
 
 
83
foreach $item (keys(%toFind))
 
84
  {
 
85
    $line = `/usr/bin/netstat -s|grep '$toFind{$item}'`;
 
86
    @lineArray = split(/ +/,$line);
 
87
    print "$item.value $lineArray[0]\n";
 
88
  }