[Orca-checkins] r466 - in trunk/orca: .
guilherme_chehab at yahoo.com
guilherme_chehab at yahoo.com
Sun Jul 17 04:23:57 PDT 2005
Author: guilherme_chehab at yahoo.com
Date: Sun Jul 17 04:22:43 2005
New Revision: 466
Added:
trunk/orca/data_gatherers/procallator/BUGS
trunk/orca/data_gatherers/procallator/CHANGES
- copied, changed from r457, /tags/orca/0.27/contrib/procallator/CHANGES
trunk/orca/data_gatherers/procallator/S99procallator.sh.in
trunk/orca/data_gatherers/procallator/gpl.txt
- copied unchanged from r457, /tags/orca/0.27/contrib/procallator/gpl.txt
trunk/orca/data_gatherers/procallator/update_orca_server.sh.in
- copied, changed from r457, /trunk/orca/data_gatherers/procallator/update_orca_server.sh
Removed:
trunk/orca/data_gatherers/procallator/update_orca_server.sh
Modified:
trunk/orca/TODO
trunk/orca/configure.in
trunk/orca/data_gatherers/procallator/README
trunk/orca/data_gatherers/procallator/TODO
trunk/orca/data_gatherers/procallator/procallator.cfg.in
trunk/orca/data_gatherers/procallator/procallator.pl.in
Log:
Procallator version 0.3 - added linux kernel 2.6 support and many bug fixes.
Modified: trunk/orca/TODO
==============================================================================
--- trunk/orca/TODO (original)
+++ trunk/orca/TODO Sun Jul 17 04:22:43 2005
@@ -1,14 +1,9 @@
-Have Orca's pages look much nicer. Check out some of our competition
+have Orca's pages look much nicer. Check out some of our competition
from Cacti:
http://www.raxnet.net/products/cacti/
http://www.bigspring.k12.pa.us/cacti/graph_view.php?action=tree&tree_id=31&leaf_id=408&select_first=true
-Remove the warnings that procallator generates when it runs.
-
-See how much work there is to do (if any) in getting procallator to
-run on Linux 2.6 kernels.
-
From Hans-Werner Jouy:
Is it possilbe to use different config files with a "include
@@ -29,15 +24,10 @@
Fix lib/Orca/OldState.pm to handle missing data files that are pointed
to.
-Update procallator to the latest version.
-
-Remove the percol listing in find_files in procallator.cfg and
-orca_services.cfg.
+Remove the percol listing in find_files in orca_services.cfg.
Update orca_services to 1.7.2 or 2.0.
-Update procallator's install and Makefile.
-
Code review procallator.
* Bug: If there is no match made in a find_files, then handle this case.
Modified: trunk/orca/configure.in
==============================================================================
--- trunk/orca/configure.in (original)
+++ trunk/orca/configure.in Sun Jul 17 04:22:43 2005
@@ -615,6 +615,7 @@
OUTPUT_PROCALLATOR="data_gatherers/procallator/Makefile
data_gatherers/procallator/procallator.cfg
data_gatherers/procallator/procallator.pl
+ data_gatherers/procallator/update_orca_server.sh
data_gatherers/procallator/S99procallator.sh"
fi
Added: trunk/orca/data_gatherers/procallator/BUGS
==============================================================================
--- (empty file)
+++ trunk/orca/data_gatherers/procallator/BUGS Sun Jul 17 04:22:43 2005
@@ -0,0 +1,9 @@
+These are the current documented BUGs in procallator:
+
+Version 0.3 - and probably the older versions
+- When running as a guest OS in MWARE Workstation the perl sleep funcion (that
+ calls nanosleep system call) seems to hang when the virtual machine is idle
+ (or with low load). There is no known workaroud, and apparently it happens
+ with other programas using this system call. Have to confirm that this occurs
+ with other installations and verify viable alternatives, like time-hires or
+ other ways to create reliable timers on vmware guests.
Copied: trunk/orca/data_gatherers/procallator/CHANGES (from r457, /tags/orca/0.27/contrib/procallator/CHANGES)
==============================================================================
--- /tags/orca/0.27/contrib/procallator/CHANGES (original)
+++ trunk/orca/data_gatherers/procallator/CHANGES Sun Jul 17 04:22:43 2005
@@ -1,15 +1,27 @@
History change for procallator
-- 0.01 first version
-- 0.02 fixed some stats of disk usage on NFS disks
-- 0.03 License changed to GPL
- Multiple files per day if number of columns of the output changes
- Added compatibility with 2.6 kernel versions
- Added support for /proc/partitions -> partitions stats in 2.4 kernels
- Added support for /proc/diskstats -> partitions stats in 2.6 kernels
- Removed support for page-ins e page-ous metrics due to misunderstood interpretations real meaning of values
- New cfg file, with better handling of tcp stats
- Added IO Wait for 2.6 kernels
- Using real device names on disk statistics for 2.4 and 2.6 kernels
- Added NFS4 statistics, and revised NFS config (now uses totals bye default)
- Added configuration variable to control per protocolo colection
- Process now starts as a real daemon
+0.01: - first version
+0.02: - fixed some stats of disk usage on NFS disks
+0.03: - License changed to GPL
+ - Multiple files per day if number of columns of the output changes
+ - Added compatibility with 2.6 kernel versions
+ - Added support for /proc/partitions -> partitions stats in 2.4 kernels
+ - Added support for /proc/diskstats -> partitions stats in 2.6 kernels
+ - Removed support for page-ins e page-ous metrics due to misunderstood
+ interpretations real meaning of values
+ - New cfg file, with better handling of tcp stats - every stat is now a
+ counter and not gauges, this corrects the way the stas are plotted,
+ unfornately its not compatible with older versions
+ - Added IO Wait for 2.6 kernels
+ - Using real device names on disk statistics for 2.4 and 2.6 kernels
+ - Added NFS4 statistics, and revised NFS config (now totalizes every NFS
+ version by default)
+ - Added configuration variable to control some network protocol
+ colection
+ - Process now starts as a real daemon
+ - Now it is integrated with orca install and makefiles
+ - Used perltidy to embelish and uniformize perl source code
+ IMPORTANT - Due to the various fixes and additions the new config file
+ as well as the new collected files are not compatible with older
+ versions, that way, using the new cfg with older collected data, or
+ the older cfg with newer collected data may lead to some problems, like
+ missing graphs and so. That way the upgrade should be planned with care
Modified: trunk/orca/data_gatherers/procallator/README
==============================================================================
--- trunk/orca/data_gatherers/procallator/README (original)
+++ trunk/orca/data_gatherers/procallator/README Sun Jul 17 04:22:43 2005
@@ -1,21 +1,23 @@
-Linux Orca-aware statistics collector.
+Linux ORCA-aware statistics colector
-This piece of software is for use with Orca, by Blair Zajac
- http://www.orcaware.com/orca/
-and intends to provide relevant system statistics in a friendly and
-graphical interface.
+This piece of software is for use with Orca, by Blair Zajac -
+http://www.orcaware.com/ - and intends to provide relevant system statistics
+in a friendly and graphical interface.
- Requirements:
- - A running Orca server.
- - Perl 5 installed on target Linux systems.
- - a mechanism for remote distribution of software to send
- collected stats from the target to the server.
+Requirements:
+- A running Orca server.
+- perl 5 installad on target linux systems
+- a mecanism for remote distribution of software to send
+ collected stats from de target to the server.
- I use rsync, but anything, ranging from ftp to NFS will do fine.
+I use rsync, but anything, ranging from ftp to NFS will do fine.
+Check the updat_orca_server.sh script (I use it in crontab) for reference on
+doing it
- Check the update_orca_server.sh script (I use it in
- crontab) for reference on doing it.
+Installation:
+The installation is quite simple. It installs with orca normal installations
+For instructions check orca documents
-This software is in alpha stage, so use at your own risk.
-Any comments to Guilherme Chehab <gchehab at abordo.com.br>
-Copyright (C) 2001 Guilherme Carvalho Chehab. All Rights Reserved
+This software is in alpha stage, use at your own risk.
+Any comments to Guilherme Chehab <guilherme_chehab at yahoo.com>
+Copyright (C) 2001-2005 Guilherme Carvalho Chehab. All Rights Reserved
Added: trunk/orca/data_gatherers/procallator/S99procallator.sh.in
==============================================================================
--- (empty file)
+++ trunk/orca/data_gatherers/procallator/S99procallator.sh.in Sun Jul 17 04:22:43 2005
@@ -0,0 +1,81 @@
+#!/bin/sh
+#
+# Startup script for the procallator data measurement tool
+#
+# chkconfig: 2345 99 01
+#
+# description: Procallator is a data measurement tool that measures
+# many system statistics.
+#
+# $HeadURL$
+# $LastChangedRevision$
+# $LastChangedDate$
+# $LastChangedBy$
+
+prefix=@prefix@
+exec_prefix=@exec_prefix@
+bindir=@bindir@
+procallator=$bindir/procallator
+
+RETVAL=0
+
+# Source function library.
+. /etc/init.d/functions
+
+start()
+{
+ echo -n $"Starting procallator: "
+ if test -x $procallator; then
+ $procallator &
+ RETVAL=$?
+ PID=$!
+ if test $RETVAL -eq 0; then
+ success $"procallator startup"
+ touch /var/lock/subsys/procallator
+ echo $PID > /var/run/procallator.pid
+ else
+ failure $"procallator startup"
+ fi
+ echo
+ else
+ failure "$0: $procallator does not exist or is not executable."
+ fi
+}
+
+stop()
+{
+ echo -n $"Stopping procallator: "
+ killproc $procallator
+ RETVAL=$?
+ echo
+ if test $RETVAL -eq 0; then
+ rm -f /var/lock/subsys/procallator /var/run/procallator.pid
+ fi
+}
+
+# See how we were called.
+case "$1" in
+ start)
+ start
+ ;;
+
+ stop)
+ stop
+ ;;
+
+ status)
+ status procallator
+ ;;
+
+ restart)
+ stop
+ start
+ ;;
+
+ *)
+ echo "usage: $0 {start|stop|restart|status}"
+ exit 1
+ ;;
+esac
+
+exit $RETVAL
Modified: trunk/orca/data_gatherers/procallator/TODO
==============================================================================
--- trunk/orca/data_gatherers/procallator/TODO (original)
+++ trunk/orca/data_gatherers/procallator/TODO Sun Jul 17 04:22:43 2005
@@ -1,10 +1,12 @@
Procallator TODO list:
- - Use the same names for data sets as in the Solaris version
- for using same config files
- - Document and optimize collector source code
- - Write better config file for network and NFS stats
- - Add web server stats
- - LVM statsi
+- Use the same names for data sets as in the Solaris version to use the same
+ config files -- that seems harder each version -> too many different metrics
+- Document and optimize collector source code. It is possible to do lots of
+ optmizations and better memory handling
+- Write better config file for network and NFS stats
+- Add web server stats
+- LVM statistics
+- Document metric meanings and best tunning practices
-Copyright (C) 2001 Guilherme Carvalho Chehab. All Rights Reserved
+Copyright (C) 2001-2005 Guilherme Carvalho Chehab. All Rights Reserved
Modified: trunk/orca/data_gatherers/procallator/procallator.cfg.in
==============================================================================
--- trunk/orca/data_gatherers/procallator/procallator.cfg.in (original)
+++ trunk/orca/data_gatherers/procallator/procallator.cfg.in Sun Jul 17 04:22:43 2005
@@ -5,6 +5,7 @@
# $LastChangedDate$
# $LastChangedBy$
+
# Require at least this version of Orca.
require Orca 0.28.0
@@ -41,28 +42,27 @@
# This defines the email address of people to warn when a file that is
# being updated constantly stops being updated. For mathematical
-# expressions use the word 'interval' to get the interval number for
+# expressions use the word `interval' to get the interval number for
# the data source.
warn_email @WARN_EMAIL@
-late_interval interval + 30
+late_interval interval + 30
# These parameters specify which plots to generate.
-generate_hourly_plot 0
-generate_daily_plot 1
-generate_weekly_plot 1
-generate_monthly_plot 1
-generate_quarterly_plot 1
-generate_yearly_plot 1
+generate_hourly_plot 0
+generate_daily_plot 1
+generate_weekly_plot 1
+generate_monthly_plot 1
+generate_quarterly_plot 1
+generate_yearly_plot 1
# This sets the HTML markup that is placed at the very top of every
-# web page and is primarily used to display the site's logo.
-html_page_header <h3>Put your site's logo here.</h3>
+# web page and is primarly used to display the site's logo.
+html_page_header <h3>Put your site's logo here.</h3>
-# This sets the text, that should not be HTML markup, that is used
-# only in the main index.html file. It is used in the <title></title>
-# element and also placed in the HTML body after the html_page_header
-# in a <h1></h1> element index.html file.
-html_top_title Orca Host Status
+# This sets the text that is placed in the pages' <title></title>
+# element and just after the html_page_header HTML markup text is
+# placed on the page.
+html_top_title Orca Host Status
# This sets the HTML markup that is placed at the bottom of every web
# page.
@@ -87,7 +87,7 @@
# generated RRD data files.
group procallator {
-find_files @VAR_DIR@/procallator/(.*)/(?:(?:procallator)|(?:proccol))-\d{4}-\d{2}-\d{2}(?:-\d{3,})?(?:\.(?:Z|gz|bz2))?
+find_files /usr/local/var/orca/procallator/(.*)/(?:(?:procallator)|(?:proccol))-\d{4}-\d{2}-\d{2}(?:-\d{3,})(?:\.(?:Z|gz|bz2))?
column_description first_line
date_source column_name timestamp
interval 300
@@ -104,28 +104,16 @@
}
plot {
-title %g Uptime
-source procallator
-data uptime / 86400
-data uptime / ( 86400 * 7 )
-data uptime / ( 86400 * 30 )
-line_type area
-legend Uptime in Days
-legend Uptime in Weeks
-legend Uptime in Months
-y_legend Total Time
-data_min 0
-plot_min 0
-href http://www.orcaware.com/orca/docs/orcallator.html#system_uptime
-}
-
-plot {
-title %g Average # Processes in Run Queue (Load Average)
+title %g Average # Processes in Run Queue (Load Average) & number of CPUs
source procallator
data 1runq
-data 5runq
+data 5runq
data 15runq
-data ncpus
+data ncpus
+color 00ff00
+color 0000ff
+color ff00ff
+color ff0000
line_type LINE1
line_type LINE1
line_type LINE1
@@ -133,11 +121,12 @@
legend 1 minute average
legend 5 minute average
legend 15 minute average
-legend Number CPUs
-y_legend Number Processes
+legend CPUs (load threshold)
+y_legend Number of processes and CPUs
+
data_min 0
-data_max 1000
-href http://www.orcaware.com/orca/docs/orcallator.html#processes_in_run_queue
+data_max 100
+href http://www.orcaware.com/orca/docs/procallator.html#processes_in_run_queue
}
plot {
@@ -146,14 +135,17 @@
data usr%
data sys%
data nice%
-data 100 - usr% - sys% - nice%
+data wait%
+data 100 - usr% - sys% - nice% - wait%
line_type area
line_type stack
line_type stack
line_type stack
+line_type stack
legend User
legend System
legend Nice
+legend Io Wait
legend Idle
y_legend Percent
data_min 0
@@ -162,10 +154,11 @@
plot_max 100
rigid_min_max 1
color 00ff00
-color ff0000
color 0000ff
+color ffff4f
+color ff0000
color ffffd0
-href http://www.orcaware.com/orca/docs/orcallator.html#cpu_usage
+href http://www.orcaware.com/orca/docs/procallator.html#cpu_usage
}
plot {
@@ -178,24 +171,26 @@
y_legend New processes/s
data_min 0
data_max 100000
-href http://www.orcaware.com/orca/docs/orcallator.html#new_process_spawn_rate
+href http://www.orcaware.com/orca/docs/procallator.html#new_process_spawn_rate
}
plot {
-title %g Number of System & Running Processes
+title %g Number of System & running Processes on cpu per cpu
source procallator
-data #proc
-data #proc_oncpu
+data #proc / ncpus
+data #proc_oncpu / ncpus
+data #proc_blckd / ncpus
line_type line1
line_type area
-legend System total
-legend Running
+legend System total / cpu
+legend Running / cpu
+legend Blocked / cpu
y_legend Number Processes
data_min 0
data_max 10000
color 0000ff
color 00ff00
-href http://www.orcaware.com/orca/docs/orcallator.html#number_system_processes
+href http://www.orcaware.com/orca/docs/procallator.html#number_system_processes
}
plot {
@@ -211,7 +206,7 @@
data_min 0
color 00ff00
color 0000ff
-href http://www.orcaware.com/orca/docs/orcallator.html#web_server_hit_rate
+href http://www.orcaware.com/orca/docs/procallator.html#web_server_hit_rate
}
plot {
@@ -238,7 +233,7 @@
plot_min 0
plot_max 100
rigid_min_max 1
-href http://www.orcaware.com/orca/docs/orcallator.html#web_server_file_size
+href http://www.orcaware.com/orca/docs/procallator.html#web_server_file_size
}
plot {
@@ -249,7 +244,7 @@
legend Bytes/s
y_legend Bytes/s
data_min 0
-href http://www.orcaware.com/orca/docs/orcallator.html#web_server_data_transfer_rate
+href http://www.orcaware.com/orca/docs/procallator.html#web_server_data_transfer_rate
}
plot {
@@ -260,217 +255,307 @@
legend HTTP errors/s
y_legend Errors/s
data_min 0
-href http://www.orcaware.com/orca/docs/orcallator.html#web_server_error_rate
+href http://www.orcaware.com/orca/docs/procallator.html#web_server_error_rate
}
plot {
-title %g Context Switches & Interrupts Rate
-source procallator
-data ctxt/s
-data intr/s
-legend Context switches
-legend Interrupts
-y_legend Counts/s
-data_min 0
+title %g Memory Page ins & outs rate
+source procallator
+data mempages_in
+data mempages_out
+legend pages in/s
+legend pages out/s
+y_legend Pages/s
+data_min 0
}
plot {
-title %g Interface Input Bits Per Second
-source procallator
-data 8 * if_in_b_(.*)
-line_type line1
-legend $1
-y_legend Bits/s
-data_min 0
-data_max 1000000000
-href http://www.orcaware.com/orca/docs/orcallator.html#interface_bits_per_second
+title %g Swap ins & outs rate
+source procallator
+data swap_in
+data swap_out
+legend Swap in/s
+legend Swap out/s
+y_legend Pages/s
+data_min 0
}
plot {
-title %g Interface Output Bits Per Second
-source procallator
-data 8 * if_out_b_(.*)
-line_type line1
-legend $1
-y_legend Bits/s
-data_min 0
-data_max 1000000000
-href http://www.orcaware.com/orca/docs/orcallator.html#interface_bits_per_second
+title %g Context switches & Interrupts rate per CPU
+source procallator
+data ctxt/s / ncpus
+data intr/s / ncpus
+legend Context switches / Cpu
+legend Interrupts / Cpu
+y_legend rate/s
+data_min 0
}
-plot {
-title %g Interface Input Packets Per Second
-source procallator
-data if_in_p_(.*)
-line_type line1
-legend $1
-y_legend Packets/s
-data_min 0
-data_max 100000
-flush_regexps 1
-href http://www.orcaware.com/orca/docs/orcallator.html#interface_packets_per_second
-}
plot {
-title %g Interface Output Packets Per Second
-source procallator
-data if_out_p_(.*)
-line_type line1
-legend $1
-y_legend Packets/s
-data_min 0
-data_max 100000
+title %g Interface Input Bits Per Second
+source procallator
+data 8 * if_in_b_(.*)
+line_type line1
+legend $1
+y_legend Bits/s
+data_min 0
+data_max 100000000
flush_regexps 1
-href http://www.orcaware.com/orca/docs/orcallator.html#interface_packets_per_second
+href http://www.orcaware.com/orca/docs/procallator.html#interface_bits_per_second
}
plot {
-title %g Interface Input Errors Per Second
-source procallator
-data if_in_e_(.*)
-line_type line1
-legend $1
-y_legend Errors/s
-data_min 0
+title %g Interface Ouput Bits Per Second
+source procallator
+data 8 * if_out_b_(.*)
+line_type line1
+legend $1
+y_legend Bits/s
+data_min 0
+data_max 100000000
flush_regexps 1
-href http://www.orcaware.com/orca/docs/orcallator.html#interface_errors_per_second
+href http://www.orcaware.com/orca/docs/procallator.html#interface_bits_per_second
}
plot {
-title %g Interface Output Errors Per Second
+title %g Interface Input Packets Per Second
source procallator
-data if_out_e_(.*)
+data if_in_p_(.*)
line_type line1
legend $1
-y_legend Errors/s
+y_legend Packets/s
data_min 0
+data_max 100000
flush_regexps 1
-href http://www.orcaware.com/orca/docs/orcallator.html#interface_errors_per_second
+href http://www.orcaware.com/orca/docs/procallator.html#interface_packets_per_second
}
plot {
-title %g Interface Input Dropped Per Second
-source procallator
-data if_in_d_(.*)
-line_type line1
-legend $1
-y_legend Errors/s
-data_min 0
-flush_regexps 1
-href http://www.orcaware.com/orca/docs/orcallator.html#interface_deferred_packet_rate
+title %g Interface Output Packets Per Second
+source procallator
+data if_out_p_(.*)
+line_type line1
+legend $1
+y_legend Packets/s
+data_min 0
+data_max 100000
+flush_regexps 1
+href http://www.orcaware.com/orca/docs/procallator.html#interface_packets_per_second
}
plot {
-title %g Interface Output Dropped Per Second
+title %g Interface Input Errors Per Second
source procallator
-data if_out_d_(.*)
+data if_in_e_(.*)
line_type line1
legend $1
y_legend Errors/s
data_min 0
flush_regexps 1
-href http://www.orcaware.com/orca/docs/orcallator.html#interface_deferred_packet_rate
-}
-
-plot {
-title %g Interface Output Collisions
-source procallator
-data if_out_cl_(.*)
-line_type area
-legend $1
-y_legend Percent
-data_min 0
-data_max 200
-flush_regexps 1
-href http://www.orcaware.com/orca/docs/orcallator.html#interface_collisions
+href http://www.orcaware.com/orca/docs/procallator.html#interface_errors_per_second
}
plot {
-title %g Interface Output Carrier Losses
-source procallator
-data if_out_ca_(.*)
-line_type area
-legend $1
-y_legend Percent
+title %g Interface Output Errors Per Second
+source procallator
+data if_out_e_(.*)
+line_type line1
+legend $1
+y_legend Errors/s
+data_min 0
+flush_regexps 1
+href http://www.orcaware.com/orca/docs/procallator.html#interface_errors_per_second
+}
+
+plot {
+title %g Interface Input Dropped Per Second
+source procallator
+data if_in_d_(.*)
+line_type line1
+legend $1
+y_legend Errors/s
+data_min 0
+flush_regexps 1
+href http://www.orcaware.com/orca/docs/procallator.html#interface_deferred_packet_rate
+}
+
+plot {
+title %g Interface Output Dropped Per Second
+source procallator
+data if_out_d_(.*)
+line_type line1
+legend $1
+y_legend Errors/s
+data_min 0
+flush_regexps 1
+href http://www.orcaware.com/orca/docs/procallator.html#interface_deferred_packet_rate
+}
+
+plot {
+title %g Interface Output Collisions
+source procallator
+data if_out_cl_(.*)
+line_type area
+legend $1
+y_legend Percent
+data_min 0
+data_max 200
+flush_regexps 1
+href http://www.orcaware.com/orca/docs/procallator.html#interface_collisions
+}
+
+plot {
+title %g Interface Output Carrier Losses
+source procallator
+data if_out_ca_(.*)
+line_type area
+legend $1
+y_legend Percent
+data_min 0
+data_max 200
+flush_regexps 1
+href http://www.orcaware.com/orca/docs/procallator.html#interface_collisions
+}
+
+plot {
+title %g IP Traffic statistics
+source procallator
+data Ip_InReceives
+data Ip_OutRequests
+data Ip_ForwDatagrams
+data_type counter
+data_type counter
+data_type counter
+legend IP Input datagrams
+legend IP Ouput datagrams
+legend IP Forwarded datagrams
+y_legend rate
+data_min 0
+flush_regexps 1
+}
+
+plot {
+title %g IP Error statistics
+source procallator
+data Ip_InHdrErrors + Ip_InHdrErrors + Ip_InAddrErrors + Ip_InUnknownProtos + Ip_InDiscards
+data Ip_OutDiscards + Ip_OutNoRoutes
+data Ip_ReasmTimeout + Ip_ReasmFails
+data Ip_FragFails
+data_type counter
+data_type counter
+data_type counter
+data_type counter
+legend IP Input errors
+legend IP Output errors
+legend IP Reassemble errors
+legend IP Fragmentation fails
+y_legend rate
+data_min 0
+flush_regexps 1
+}
+
+plot {
+title %g TCP Connection statistics
+source procallator
+data Tcp_CurrEstab
+data Tcp_ActiveOpens
+data Tcp_PassiveOpens
+data Tcp_AttemptFails + Tcp_EstabResets
+data TcpExt_ListenOverflows + TcpExt_ListenDrops
+data_type gauge
+data_type counter
+data_type counter
+data_type counter
+data_type counter
+legend TCP Connections
+legend TCP Active opens
+legend TCP Passive opens
+legend Connections attempts fails
+legend Listen drops & overflows
+y_legend Connections
data_min 0
-data_max 200
flush_regexps 1
-href http://www.orcaware.com/orca/docs/orcallator.html#interface_collisions
}
-plot {
-title %g TCP Current Connections
-source procallator
-data gTcp_(.*)
-line_type area
-legend Connections
-y_legend Number Open TCP Connections
-data_min 0
-flush_regexps 1
-}
plot {
-title %g IP Statistics
-source procallator
-data Ip_(.*)
-legend $1 rate
-y_legend Counts/s
-data_min 0
-flush_regexps 1
-}
-
-plot {
-title %g TCP Statistics
-source procallator
-data Tcp_(.*)
-legend $1 rate
-y_legend Counts/s
-data_min 0
-flush_regexps 1
-}
-
-plot {
-title %g ICMP Statistics
-source procallator
-data Icmp_(.*)
-legend $1 rate
-y_legend Counts/s
-data_min 0
-flush_regexps 1
-}
-
-plot {
-title %g UDP Statistics
-source procallator
-data Udp_(.*)
-legend $1 rate
-y_legend Counts/s
-data_min 0
-flush_regexps 1
+title %g TCP Traffic statistics
+source procallator
+data Tcp_InSegs
+data Tcp_OutSegs
+data_type counter
+data_type counter
+legend Tcp Input segments
+legend Tcp Output segments
+y_legend rate
+data_min 0
+flush_regexps 1
+}
+
+plot {
+title %g TCP Error statistics
+source procallator
+data Tcp_InErrs
+data Tcp_OutRsts
+data Tcp_RetransSegs
+data_type counter
+data_type counter
+data_type counter
+legend Tcp Input errors
+legend Tcp Output errors
+legend TCP Retransmissions
+y_legend rate
+data_min 0
+flush_regexps 1
+}
+
+plot {
+title %g ICMP statistics
+source procallator
+data Icmp_(.*)
+data_type counter
+legend $1 rate
+y_legend rate
+data_min 0
+flush_regexps 1
+}
+
+plot {
+title %g UDP statistics
+source procallator
+data Udp_(.*)
+data_type counter
+legend $1 rate
+y_legend rate
+data_min 0
+flush_regexps 1
}
plot {
title %g NFS Server Statistics
source procallator
data nfs_s_(.*)
+data_type counter
line_type line1
legend $1/s
-y_legend Counts/s
+y_legend rate
data_min 0
flush_regexps 1
-href http://www.orcaware.com/orca/docs/orcallator.html#NFS_server_call_rate
+href http://www.orcaware.com/orca/docs/procallator.html#NFS_server_call_rate
}
plot {
title %g NFS Client Statistics
-source procallator
-data nfs_c_(.*)
-line_type line1
-legend $1/s
-y_legend Counts/s
-data_min 0
-flush_regexps 1
-href http://www.orcaware.com/orca/docs/orcallator.html#NFS_server_call_rate
+source procallator
+data nfs_c_(.*)
+data_type counter
+line_type line1
+legend $1/s
+y_legend rate
+data_min 0
+flush_regexps 1
+href http://www.orcaware.com/orca/docs/procallator.html#NFS_server_call_rate
}
plot {
@@ -484,8 +569,8 @@
legend Writes/s
y_legend Ops/s
data_min 0
-flush_regexps 1
-href http://www.orcaware.com/orca/docs/orcallator.html#disk_system_wide_reads_writes_per_second
+flush_regexps 1
+href http://www.orcaware.com/orca/docs/procallator.html#disk_system_wide_reads_writes_per_second
}
plot {
@@ -499,40 +584,42 @@
legend Write transfer rate
y_legend Block/s
data_min 0
-flush_regexps 1
-href http://www.orcaware.com/orca/docs/orcallator.html#disk_system_wide_transfer_rate
+flush_regexps 1
+href http://www.orcaware.com/orca/docs/procallator.html#disk_system_wide_transfer_rate
}
plot {
-title %g Disk Reads/Writes Per Second
-source procallator
-data disk_rd_(.*)/s
-data disk_wr_$1/s
-line_type area
-line_type line1
-legend $1 Reads/s
-legend $1 Writes/s
-y_legend Ops/s
-data_min 0
-flush_regexps 1
-href http://www.orcaware.com/orca/docs/orcallator.html#disk_system_wide_reads_writes_per_second
+title %g Disk Reads/Writes Per Second
+source procallator
+data disk_rd_(.*)/s
+data disk_wr_(.*)/s
+line_type area
+line_type line1
+legend $1 Reads/s
+legend $1 Writes/s
+y_legend Ops/s
+data_min 0
+flush_regexps 1
+href http://www.orcaware.com/orca/docs/procallator.html#disk_system_wide_reads_writes_per_second
}
plot {
-title %g Disk Transfer Rate
-source procallator
-data disk_rB_(.*)/s
-data disk_wB_$1/s
-line_type area
-line_type line1
-legend $1 Read transfer rate
-legend $1 Write transfer rate
-y_legend Block/s
-data_min 0
-flush_regexps 1
-href http://www.orcaware.com/orca/docs/orcallator.html#disk_system_wide_transfer_rate
+title %g Disk Transfer Rate
+source procallator
+data disk_rB_(.*)/s
+data disk_wB_(.*)/s
+line_type area
+line_type line1
+legend $1 Read transfer rate
+legend $1 Write transfer rate
+y_legend Block/s
+data_min 0
+flush_regexps 1
+href http://www.orcaware.com/orca/docs/procallator.html#disk_system_wide_transfer_rate
}
+
+
plot {
title %g Disk Space Percent Usage
source procallator
@@ -544,11 +631,11 @@
data_max 100
plot_min 0
plot_max 100
-href http://www.orcaware.com/orca/docs/orcallator.html#disk_space_percent_usage
+href http://www.orcaware.com/orca/docs/procallator.html#disk_space_percent_usage
}
plot {
-title %g Physical Memory Usage
+title %g Physical Memory usage percent
source procallator
data mem_used%
data mem_free%
@@ -558,55 +645,36 @@
line_type area
line_type stack
line_type line1
-line_type stack
-line_type stack
+line_type stack
+line_type stack
legend Used memory
legend Free memory
-legend Shared memory
-legend Buffer memory
-legend Cached memory
-y_legend Percent
-data_min 0
-data_max 100
-href http://www.orcaware.com/orca/docs/orcallator.html#memory_free
-}
-
-plot {
-title %g Swap Usage
-source procallator
-data swp_used%
-data swp_free%
-line_type area
-line_type stack
-legend Swap Used
-legend Swap Free
+legend shared memory
+legend buffer memory
+legend cached memory
y_legend percent
data_min 0
data_max 100
-href http://www.orcaware.com/orca/docs/orcallator.html#memory_free
+plot_min 0
+plot_max 100
+href http://www.orcaware.com/orca/docs/procallator.html#memory_free
}
plot {
-title %g Page Ins & Outs Rate
-source procallator
-data pages_in
-data pages_out
-legend Pages in/s
-legend Pages out/s
-y_legend Pages/s
-data_min 0
+title %g Swap usage percent
+source procallator
+data swp_used%
+data swp_free%
+line_type area
+line_type stack
+legend Used swap
+legend Free swap
+y_legend percent
+data_min 0
+data_max 100
+href http://www.orcaware.com/orca/docs/procallator.html#memory_free
}
-plot {
-title %g Swap Ins & Outs Rate
-source procallator
-data swap_in
-data swap_out
-legend Swap in/s
-legend Swap out/s
-y_legend Pages/s
-data_min 0
-}
plot {
title %g Memory Page Scan Rate
@@ -616,7 +684,7 @@
legend Page scan rate
y_legend Pages/s
data_min 0
-href http://www.orcaware.com/orca/docs/orcallator.html#page_scan_rate
+href http://www.orcaware.com/orca/docs/procallator.html#page_scan_rate
}
plot {
@@ -627,7 +695,7 @@
legend Page residence time
y_legend Seconds
data_min 0
-href http://www.orcaware.com/orca/docs/orcallator.html#page_residence_time
+href http://www.orcaware.com/orca/docs/procallator.html#page_residence_time
}
plot {
@@ -639,7 +707,7 @@
y_legend Bytes
base 1024
data_min 0
-href http://www.orcaware.com/orca/docs/orcallator.html#available_swap_space
+href http://www.orcaware.com/orca/docs/procallator.html#available_swap_space
}
plot {
@@ -663,7 +731,7 @@
color 00ff00
color ff0000
color 0000ff
-href http://www.orcaware.com/orca/docs/orcallator.html#page_usage
+href http://www.orcaware.com/orca/docs/procallator.html#page_usage
}
plot {
@@ -678,5 +746,5 @@
y_legend Number Of Pages
data_min 0
plot_min 0
-href http://www.orcaware.com/orca/docs/orcallator.html#pages_locked_IO
+href http://www.orcaware.com/orca/docs/procallator.html#pages_locked_IO
}
Modified: trunk/orca/data_gatherers/procallator/procallator.pl.in
==============================================================================
--- trunk/orca/data_gatherers/procallator/procallator.pl.in (original)
+++ trunk/orca/data_gatherers/procallator/procallator.pl.in Sun Jul 17 04:22:43 2005
@@ -1,567 +1,1101 @@
-# Collector for /proc statistics for use with Linux 2.2 and 2.4 kernels.
+#!/usr/bin/perl -w
+#
+# Performance statistics collector for /proc statistics for use
+# with Linux 2.2, 2.4 & 2.6 kernels.
+#
+# Copyright (C) 2001 Guilherme Carvalho Chehab.
#
# $HeadURL$
# $LastChangedRevision$
# $LastChangedDate$
# $LastChangedBy$
+#
+#This program is free software; you can redistribute it and/or
+#modify it under the terms of the GNU General Public License
+#as published by the Free Software Foundation; either version 2
+#of the License, or (at your option) any later version.
#
-# Copyright (C) 2001 Guilherme Carvalho Chehab. All Rights Reserved.
-
-use Sys::Hostname;
-
+#This program is distributed in the hope that it will be useful,
+#but WITHOUT ANY WARRANTY; without even the implied warranty of
+#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+#GNU General Public License for more details.
#
-# Configuration variables.
+#You should have received a copy of the GNU General Public License
+#along with this program; if not, write to the Free Software
+#Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
-# The process directory, usually /proc.
-my $PROC = '@PROC_DIR@';
-
-# Compression program to use after closing an output data file.
-my $COMPRESS = '@COMPRESSOR@';
+# Config variables
-# The output base directory.
-my $OUT_DIR = '@VAR_DIR@/procallator';
+$PROC = "/proc"; # Proc directory, usually /proc
+$INTERVAL = 300; # Interval between each measure, in seconds
+$COMPRESS = "/usr/bin/gzip"; # Compressor...
+$HOSTNAME = `/bin/hostname`;
+chomp $HOSTNAME;
+$DEST_DIR =
+ "@VAR_DIR@/procallator/$HOSTNAME"; # Destination dir for output files
-# Measurement interval, in seconds.
-my $INTERVAL = 300;
+#$DEST_DIR="/tmp"; # Destination dir for output files
+#
+# Output Options
+$NFS_PROTO_DETAILS = 0; # Include per NFS per protocol versions stats on output
# Initializations
-my $r = 0; # Rotating indice for measuring counter differences.
-my $rate_ok = 0; # Check if is ok to calculate rates.
+$DEBUG = 0;
+$r = 0; # Rotating indice for measuring counter differences
+$rate_ok = 0; # Check if is ok to calculate rates
+$num = 0; # Serial number of output file
+$n_cols[0] = 0;
+$n_cols[1] = 0;
+
+if ( !$DEBUG ) {
+ use POSIX qw(setsid);
+ umask 0;
+ exit(0) if (fork);
+ setsid;
+}
-# Destination directory for the output data files.
-my $hostname = hostname;
-my $DEST_DIR = "$OUT_DIR/$hostname";
-
-# Create output directory if needed.
-unless (-d $DEST_DIR) {
- unless (mkdir($DEST_DIR, 0755)) {
- die "$0: cannot create destiniation directory '$DEST_DIR': $!\n";
- }
+# Create output dir if needed
+if ( !-d $DEST_DIR && !$DEBUG ) {
+ `mkdir -p $DEST_DIR`;
}
# Read kernel version
-open (F_VERSION, "<$PROC/version");
-($os,$line,$version)=split / +/ , <F_VERSION>, 4;
-close (F_VERSION);
+open( F_VERSION, "<$PROC/version" );
+( $os, $line, $version ) = split / +/, <F_VERSION>, 4;
+close(F_VERSION);
+
+print "$os, $line, $version \n" if ($DEBUG);
+my ( $major, $minor, $release ) = split /[\.| |-]/, $version;
+
+$INTERVAL = 5 if ($DEBUG);
# Main loop
do {
- # Wait for the next INTERVAL
- sleep ($INTERVAL-time() % $INTERVAL);
- # Loop initializations
- $n_cols[$r]=0;
+ # Wait for the next INTERVAL
+ sleep( $INTERVAL - time() % $INTERVAL ) if ( !$DEBUG );
+ sleep($INTERVAL) if ( $DEBUG && $rate_ok );
+
+ # Loop initializations
+ $n_cols[$r] = 0;
+
+ # Get Local time
+ $timestamp[$r] = time();
+ ( $sec, $min, $hour, $mday, $mon, $year, $yday[$r], $isdst ) =
+ localtime( $timestamp[$r] );
+ $mon += 1;
+ $year += 1900;
+ $locltime = sprintf "%02d:%02d:%02d", $hour, $min, $sec;
+
+ # Get uptime
+ open( F_UPTIME, "<$PROC/uptime" );
+ ($uptime) = split / +/, <F_UPTIME>;
+ close(F_UPTIME);
+
+ # insert in output table
+ put_output( "timestamp", $timestamp[$r], "locltime", $locltime, "uptime",
+ $uptime );
+
+ # Read load average
+ open( F_LOADAVG, "<$PROC/loadavg" );
+ ( $runq_1, $runq_5, $runq_15, $proc_run, $procs[$r], $last_pid ) =
+ split / +|\//, <F_LOADAVG>;
+ chomp $last_pid;
+ close(F_LOADAVG);
+ put_output(
+ "1runq", $runq_1, "5runq", $runq_5,
+ "15runq", $runq_15, "#proc_oncpu", $proc_run,
+ "#proc", $procs[$r], "#proc/s", rate(@procs)
+ );
+
+ # Read system stats
+ open( F_STAT, "<$PROC/stat" );
+ $n_cpus = 0;
+ while ( $line = <F_STAT> ) {
+ chomp($line);
+ if ( $line =~ /cpu[0-9]*/ ) {
+ (
+ $cpu[$r][$n_cpus], $usr[$r][$n_cpus], $nice[$r][$n_cpus],
+ $sys[$r][$n_cpus], $idle[$r][$n_cpus], $wait[$r][$n_cpus],
+ $hi[$r][$n_cpus], $si[$r][$n_cpus], $dumb
+ )
+ = split / +/, $line;
+ ( $wait[$r][$n_cpus], $hi[$r][$n_cpus], $si[$r][$n_cpus] ) =
+ ( 0, 0, 0 )
+ if ( !defined $wait[$r][$n_cpus] );
+ $total[$r][$n_cpus] =
+ $usr[$r][$n_cpus] + $nice[$r][$n_cpus] + $sys[$r][$n_cpus] +
+ $idle[$r][$n_cpus] + $wait[$r][$n_cpus] + $hi[$r][$n_cpus] +
+ $si[$r][$n_cpus];
+ $sys[$r][$n_cpus] += $hi[$r][$n_cpus] + $si[$r][$n_cpus];
+ $n_cpus++;
+ }
+ if ( $line =~ /page/ ) {
+ ( $dumb, $dsk_rio_t[$r], $dsk_wio_t[$r] ) = split / +/, $line
+ ; # This is the real mean... Will only use on 2.2 kernels since it is calculated on 2.4 and above
+ $page_in[$r] = $page_out[$r] =
+ 0; # Ops ! This metric does not appear until kernel 2.6
+ }
+ if ( $line =~ /swap/ ) {
+ ( $dumb, $swap_in[$r], $swap_out[$r] ) = split / +/, $line;
+ }
+ if ( $line =~ /ctxt/ ) {
+ ( $dumb, $ctxt[$r] ) = split / +/, $line;
+ }
+ if ( $line =~ /procs_blocked/ ) {
+ ( $dumb, $proc_block ) = split / +/, $line;
+ put_output( "#proc_blckd", $proc_block );
+ }
+ if ( $line =~ /intr/ ) {
+ @dumb = split / /, $line;
+ $intr[$r] = 0;
+ $i = 1;
+ while ( $i < @dumb ) {
+ $intr[$r] += $dumb[$i];
+ $i++;
+ }
+ }
- # Get Local time & uptime
- $timestamp=time();
- ($sec,$min,$hour,$mday,$mon,$year,$yday,$isdst)=localtime($timestamp);
- $mon+=1;
- $year+=1900;
- $locltime=sprintf "%02d:%02d:%02d", $hour,$min,$sec;
- open (F_UPTIME,"<$PROC/uptime");
- ($uptime)=split / +/,<F_UPTIME>;
- close (F_UPTIME);
-
- # insert in output table
- put_output("timestamp",$timestamp,"locltime",$locltime,"uptime",$uptime);
-
- # Evaluate filename
- $out_filename[$r]=sprintf "%s/proccol-%04d-%02d-%02d",$DEST_DIR, $year,$mon,$mday;
-
- # Read load average
- open (F_LOADAVG, "<$PROC/loadavg");
- ($runq_1, $runq_5, $runq_15, $proc_run, $procs[$r], $last_pid)=split / +|\//, <F_LOADAVG>;
- chomp $last_pid;
- close (F_LOADAVG);
- put_output ( "1runq",$runq_1,
- "5runq",$runq_5,
- "15runq",$runq_15,
- "#proc_oncpu",$proc_run,
- "#proc",$procs[$r],
- "#proc/s",rate(@procs)
- );
-
- # Read system stats
- open (F_STAT, "<$PROC/stat");
- $n_cpus=0;
- while ( $line=<F_STAT> ) {
- chomp ($line);
- if ( $line=~/cpu[0-9]*/ ) {
- ($cpu[$r][$n_cpus], $usr[$r][$n_cpus], $nice[$r][$n_cpus], $sys[$r][$n_cpus], $idle[$r][$n_cpus])= split / +/,$line;
- $total[$r][$n_cpus]= $usr[$r][$n_cpus] + $nice[$r][$n_cpus] + $sys[$r][$n_cpus] + $idle[$r][$n_cpus];
- $n_cpus++;
- }
- if ( $line=~/page/) {
- ($dumb, $page_in[$r], $page_out[$r])= split / +/,$line;
- }
- if ( $line=~/swap/) {
- ($dumb, $swap_in[$r], $swap_out[$r])= split / +/,$line;
- }
- if ( $line=~/ctxt/) {
- ($dumb, $ctxt[$r])= split / +/,$line;
- }
- if ( $line=~/intr/) {
- @dumb=split / /,$line;
- $intr[$r]=0;
- $i=1;
- while ($i<@dumb) {
- $intr[$r]+=$dumb[$i];
- $i++;
- }
- }
-
- # Linux 2.4 style I/O report
- if ( $line=~/disk_io/ ) {
- @dsk=0;
- $i=0;
- ($dsk_stat_t[$r],$dsk_rio_t[$r],$dsk_rblk_t[$r],$dsk_wio_t[$r],$dsk_wblk_t[$r])=(0,0,0,0);
-
- ($dumb, $line)= split /: /,$line;
- $n_dsk=@dsk= split / /,$line;
-
- while ($i<$n_dsk) {
- ( $dumb,
- $dsk_maj[$r][$i],$dsk_min[$r][$i],
- $dsk_stat[$r][$i],
- $dsk_rio[$r][$i],$dsk_rblk[$r][$i],
- $dsk_wio[$r][$i],$dsk_wblk[$r][$i]
- ) = split /[^0-9]+/,$dsk[$i];
- $dsk_stat_t[$r]+=$dsk_stat[$r][$i];
- $dsk_rio_t[$r] +=$dsk_rio[$r][$i];
- $dsk_rblk_t[$r]+=$dsk_rblk[$r][$i];
- $dsk_wio_t[$r] +=$dsk_wio[$r][$i];
- $dsk_wblk_t[$r]+=$dsk_wblk[$r][$i];
- $i++;
- }
- }
+ # Linux 2.4 style I/O report
+ if ( $line =~ /disk_io/ ) {
+ @dsk = 0;
+ $i = 0;
+ (
+ $dsk_stat_t[$r], $dsk_rio_t[$r], $dsk_rblk_t[$r],
+ $dsk_wio_t[$r], $dsk_wblk_t[$r]
+ )
+ = ( 0, 0, 0, 0 );
+
+ ( $dumb, $line ) = split /: /, $line;
+ $n_dsk = @dsk = split / /, $line;
+
+ while ( $i < $n_dsk ) {
+ (
+ $dumb, $dsk_maj[$r][$i], $dsk_min[$r][$i],
+ $dsk_stat[$r][$i], $dsk_rio[$r][$i], $dsk_rblk[$r][$i],
+ $dsk_wio[$r][$i], $dsk_wblk[$r][$i]
+ )
+ = split /[^0-9]+/, $dsk[$i];
+ $dsk_stat_t[$r] += $dsk_stat[$r][$i];
+ $dsk_rio_t[$r] += $dsk_rio[$r][$i];
+ $dsk_rblk_t[$r] += $dsk_rblk[$r][$i];
+ $dsk_wio_t[$r] += $dsk_wio[$r][$i];
+ $dsk_wblk_t[$r] += $dsk_wblk[$r][$i];
+ $dumb = "c$dsk_maj[$r][$i]_d$dsk_min[$r][$i]";
+ put_output(
+ "disk_op_$dumb/s",
+ rate( $dsk_stat[$r][$i], $dsk_stat[ 1 - $r ][$i] ),
+ "disk_rd_$dumb/s",
+ rate( $dsk_rio[$r][$i], $dsk_rio[ 1 - $r ][$i] ),
+ "disk_wr_$dumb/s",
+ rate( $dsk_wio[$r][$i], $dsk_wio[ 1 - $r ][$i] ),
+ "disk_rB_$dumb/s",
+ rate( $dsk_rblk[$r][$i], $dsk_rblk[ 1 - $r ][$i] ),
+ "disk_wB_$dumb/s",
+ rate( $dsk_wblk[$r][$i], $dsk_wblk[ 1 - $r ][$i] )
+ );
+ $i++;
+ }
+ }
- # Linux 2.2 style I/O report, they are strangely limited to first 4 disks
- if ( $line=~/disk / ) {
- @dumb=split / /,$line;
- $dsk_stat_t[$r]=0;
- $i=1;
- while ($i<@dumb) {
- $dsk_stat_t[$r]+=$dumb[$i];
- $i++;
- }
- }
- if ( $line=~/disk_rio / ) {
- @dumb=split / /,$line;
- $dsk_rio_t[$r]=0;
- $i=1;
- while ($i<@dumb) {
- $dsk_rio_t[$r]+=$dumb[$i];
- $i++;
- }
- }
- if ( $line=~/disk_wio / ) {
- @dumb=split / /,$line;
- $dsk_wio_t[$r]=0;
- $i=1;
- while ($i<@dumb) {
- $dsk_wio_t[$r]+=$dumb[$i];
- $i++;
- }
- }
- if ( $line=~/disk_rblk / ) {
- @dumb=split / /,$line;
- $dsk_rblk_t[$r]=0;
- $i=1;
- while ($i<@dumb) {
- $dsk_rblk_t[$r]+=$dumb[$i];
- $i++;
- }
- }
- if ( $line=~/disk_wblk / ) {
- @dumb=split / /,$line;
- $dsk_wblk_t[$r]=0;
- $i=1;
- while ($i<@dumb) {
- $dsk_wblk_t[$r]+=$dumb[$i];
- $i++;
- }
- }
- }
-
- # Operate percentuals and rates for system Stats
- for ($i=0;$i<$n_cpus ;$i++) {
- $usr_100 [$i]=rate_prcnt($usr [$r][$i],$usr [1-$r][$i],$total[$r][$i],$total[1-$r][$i]);
- $nice_100[$i]=rate_prcnt($nice[$r][$i],$nice[1-$r][$i],$total[$r][$i],$total[1-$r][$i]);
- $sys_100 [$i]=rate_prcnt($sys [$r][$i],$sys [1-$r][$i],$total[$r][$i],$total[1-$r][$i]);
- $idle_100[$i]=rate_prcnt($idle[$r][$i],$idle[1-$r][$i],$total[$r][$i],$total[1-$r][$i]);
- if ($i==0) {
- put_output("ncpus",$n_cpus-1,"usr%",$usr_100 [$i],"nice%",$nice_100[$i],"sys%",$sys_100 [$i],"wait%",$idle_100[$i]);
- } else {
- if ($n_cpus>2) {
- put_output("usr_%_$i",$usr_100 [$i],"nice_%_$i",$nice_100[$i],"sys_%_$i",$sys_100 [$i],"wait_%_$i",$idle_100[$i]);
- }
- }
- }
-
- put_output ( "pages_in",rate(@page_in),
- "pages_out",rate(@page_out),
- "swap_in",rate(@swap_in),
- "swap_out",rate(@swap_out),
- "ctxt/s",rate(@ctxt),
- "intr/s",rate (@intr)
- );
-
- put_output ( "disk_op/s",rate(@dsk_stat_t),
- "disk_rd/s",rate(@dsk_rio_t),
- "disk_wr/s",rate(@dsk_wio_t),
- "disk_rB/s",rate(@dsk_rblk_t),
- "disk_wB/s",rate(@dsk_wblk_t)
- );
-
- if ( $version=~/^2\.4/ ) {
- for ($i=0; $i<$n_dsk; $i++) {
- $dumb="c$dsk_maj[$r][$i]_d$dsk_min[$r][$i]";
- put_output("disk_op_$dumb/s",rate($dsk_stat[$r][$i],$dsk_stat[1-$r][$i]),
- "disk_rd_$dumb/s",rate($dsk_rio[$r][$i], $dsk_rio[1-$r][$i]),
- "disk_wr_$dumb/s",rate($dsk_wio[$r][$i], $dsk_wio[1-$r][$i]),
- "disk_rB_$dumb/s",rate($dsk_rblk[$r][$i],$dsk_rblk[1-$r][$i]),
- "disk_wB_$dumb/s",rate($dsk_wblk[$r][$i],$dsk_wblk[1-$r][$i])
- );
- }
- }
- close (F_STAT);
-
- # Get filesystem ocupation
- @df=`/bin/df -k`;
- for ($i=1,$j=0;$df[$i];$i++) {
- if (!(($df[$i]=~/cdrom/)||($df[$i]=~/cdrom/))) {
- chomp $df[$i];
- ($dumb, $fs[2][$j], $fs[3][$j], $dumb, $dumb, $fs[0][$j])= split / +/,$df[$i];
- $fs[1][$j]=prcnt($fs[3][$j],$fs[2][$j]);
- put_output("mnt_$fs[0][$j]",$fs[1][$j]);
- $j++;
- }
- }
- $n_fs=$j;
-
- # Get memory ocupation
- open (F_MEMINFO, "<$PROC/meminfo");
- <F_MEMINFO>;
- ($dumb, $mem_total,$mem_used,$mem_free,$mem_shrd,$mem_buff,$mem_cchd)=split /[^0-9]+/,<F_MEMINFO>;
- ($dumb, $swp_total,$swp_used,$swp_free)=split /[^0-9]+/,<F_MEMINFO>;
- close (F_MEMINFO);
- put_output ( "mem_used%",prcnt($mem_used,$mem_total),
- "mem_free%",prcnt($mem_free,$mem_total),
- "mem_shrd%",prcnt($mem_shrd,$mem_total),
- "mem_buff%",prcnt($mem_buff,$mem_total),
- "mem_cchd%",prcnt($mem_cchd,$mem_total),
- "swp_free%",prcnt($swp_free,$swp_total),
- "swp_used%",prcnt($swp_used,$swp_total)
- );
-
- # Get network interface statistics
- open (F_NET_DEV, "<$PROC/net/dev");
- $i=0;
- while ($line=<F_NET_DEV>) {
- if ($line=~/:/) {
- ($if_name[$i][$r],$line)=split /: */,$line;
- ($dumb, $if_name[$i][$r])=split /^ +/,$if_name[$i][$r];
- ( $if_in_b[$i][$r], $if_in_p[$i][$r],
- $if_in_e[$i][$r], $if_in_d[$i][$r],
- $if_in_ff[$i][$r], $if_in_fr[$i][$r],
- $if_in_c[$i][$r], $if_in_m[$i][$r],
- $if_out_b[$i][$r], $if_out_p[$i][$r],
- $if_out_e[$i][$r], $if_out_d[$i][$r],
- $if_out_ff[$i][$r],$if_out_cl[$i][$r],
- $if_out_ca[$i][$r], $if_out_cp[$i][$r]
- ) = split / +/,$line;
- put_output ( "if_in_b_$if_name[$i][$r]", rate ($if_in_b[$i][$r] ,$if_in_b[$i][1-$r]),
- "if_in_p_$if_name[$i][$r]", rate ($if_in_p[$i][$r],$if_in_p[$i][1-$r]),
- "if_in_e_$if_name[$i][$r]", rate ($if_in_e[$i][$r],$if_in_e[$i][1-$r]),
- "if_in_d_$if_name[$i][$r]", rate ($if_in_d[$i][$r],$if_in_d[$i][1-$r]),
- "if_in_ff_$if_name[$i][$r]", rate ($if_in_ff[$i][$r],$if_in_ff[$i][1-$r]),
- "if_in_fr_$if_name[$i][$r]", rate ($if_in_fr[$i][$r],$if_in_fr[$i][1-$r]),
- "if_in_c_$if_name[$i][$r]", rate ($if_in_c[$i][$r],$if_in_c[$i][1-$r]),
- "if_in_m_$if_name[$i][$r]", rate ($if_in_m[$i][$r],$if_in_m[$i][1-$r]),
- "if_out_b_$if_name[$i][$r]", rate ($if_out_b[$i][$r],$if_out_b[$i][1-$r]),
- "if_out_p_$if_name[$i][$r]", rate ($if_out_p[$i][$r],$if_out_p[$i][1-$r]),
- "if_out_e_$if_name[$i][$r]", rate ($if_out_e[$i][$r],$if_out_e[$i][1-$r]),
- "if_out_d_$if_name[$i][$r]", rate ($if_out_d[$i][$r],$if_out_d[$i][1-$r]),
- "if_out_ff_$if_name[$i][$r]",rate ($if_out_ff[$i][$r],$if_out_ff[$i][1-$r]),
- "if_out_cl_$if_name[$i][$r]",rate ($if_out_cl[$i][$r],$if_out_cl[$i][1-$r]),
- "if_out_ca_$if_name[$i][$r]",rate ($if_out_ca[$i][$r],$if_out_ca[$i][1-$r]),
- "if_out_cp_$if_name[$i][$r]",rate ($if_out_cp[$i][$r],$if_out_cp[$i][1-$r])
- );
-
- $i++;
- }
- }
- $n_nets=$i;
-
- # Get TCP/IP statistics
- open (F_SNMP, "<$PROC/net/snmp");
- $j=0;
- while ($line=<F_SNMP>) {
- $line2=<F_SNMP>;
- chomp $line;
- chomp $line2;
- ($cat,$line) = split /: +/,$line;
- ($dumb,$line2)=split /: +/,$line2;
- (@dumb) =split / +/,$line;
- (@dumb2)=split / +/,$line2;
- for ($i=0; $dumb[$i]; $i++, $j++) {
- $net_parm[0][$j]=sprintf "%s_%s",$cat,$dumb[$i];
- $net_parm[2+$r][$j]= $dumb2[$i];
- $net_parm[1][$j]= rate ($net_parm[2+$r][$j],$net_parm[3-$r][$j]);
- SWITCH: {
- if ($cat=~/Ip/) {
- if ($net_parm[0][$j]=~/In|Out|Forw|Reasm|Frag/) {
- put_output("$net_parm[0][$j]",$net_parm[1][$j]);
- };
- last SWITCH;
- }
- if ($cat=~/Icmp/) {
- put_output("$net_parm[0][$j]",$net_parm[1][$j]);
- last SWITCH;
- }
- if ($cat=~/Udp/) {
- put_output("$net_parm[0][$j]",$net_parm[1][$j]);
- last SWITCH;
- }
- if ($cat=~/Tcp/) {
- if ($net_parm[0][$j]=~/Rto|Max/) { last SWITCH; }
- if ($net_parm[0][$j]=~/CurrEstab/) {
- put_output("g$net_parm[0][$j]",$net_parm[2+$r][$j]);
- last SWITCH;
- }
- put_output("$net_parm[0][$j]",$net_parm[1][$j]);
- last SWITCH;
- };
- }
- }
- }
- $net_parms=$j;
-
- # Get NFS Client statistics
- if ( -f "$PROC/net/rpc/nfs") {
- open (F_NFS, "<$PROC/net/rpc/nfs");
- while ($line=<F_NFS>) {
-
- if ($line=~/rpc/) {
- ($dumb,$nfs_c_rpc_calls[$r],$nfs_c_rpc_retrs[$r],$nfs_c_rpc_auth[$r])=split / +/,$line;
- put_output( "nfs_c_rpc_calls", rate(@nfs_c_rpc_calls),
- "nfs_c_rpc_retrs", rate(@nfs_c_rpc_retrs),
- "nfs_c_rpc_auth", rate(@nfs_c_rpc_auth)
- );
- }
+ # Linux 2.2 style I/O report, they are strangely limited to first 4 disks
+ if ( $line =~ /disk / ) {
+ @dumb = split / /, $line;
+ $dsk_stat_t[$r] = 0;
+ $i = 1;
+ while ( $i < @dumb ) {
+ $dsk_stat_t[$r] += $dumb[$i];
+ $i++;
+ }
+ }
+ if ( $line =~ /disk_rio / ) {
+ @dumb = split / /, $line;
+ $dsk_rio_t[$r] = 0;
+ $i = 1;
+ while ( $i < @dumb ) {
+ $dsk_rio_t[$r] += $dumb[$i];
+ $i++;
+ }
+ }
+ if ( $line =~ /disk_wio / ) {
+ @dumb = split / /, $line;
+ $dsk_wio_t[$r] = 0;
+ $i = 1;
+ while ( $i < @dumb ) {
+ $dsk_wio_t[$r] += $dumb[$i];
+ $i++;
+ }
+ }
+ if ( $line =~ /disk_rblk / ) {
+ @dumb = split / /, $line;
+ $dsk_rblk_t[$r] = 0;
+ $i = 1;
+ while ( $i < @dumb ) {
+ $dsk_rblk_t[$r] += $dumb[$i];
+ $i++;
+ }
+ }
+ if ( $line =~ /disk_wblk / ) {
+ @dumb = split / /, $line;
+ $dsk_wblk_t[$r] = 0;
+ $i = 1;
+ while ( $i < @dumb ) {
+ $dsk_wblk_t[$r] += $dumb[$i];
+ $i++;
+ }
+ }
+ }
- if ($line=~/proc2/) {
- ( $dumb,$dumb,$dumb, $nfs_c_p2_getattr[$r], $nfs_c_p2_setattr[$r], $nfs_c_p2_root[$r],
- $nfs_c_p2_lookup[$r], $nfs_c_p2_readlink[$r], $nfs_c_p2_read[$r], $nfs_c_p2_wrcache[$r],
- $nfs_c_p2_write[$r], $nfs_c_p2_create[$r], $nfs_c_p2_remove[$r], $nfs_c_p2_rename[$r],
- $nfs_c_p2_link[$r], $nfs_c_p2_symlink[$r], $nfs_c_p2_mkdir[$r], $nfs_c_p2_rmdir[$r],
- $nfs_c_p2_readdir[$r], $nfs_c_p2_fsstat[$r]
- ) = split / +/,$line;
-
- put_output( "nfs_c_p2_getattr", rate(@nfs_c_p2_getattr),
- "nfs_c_p2_setattr", rate(@nfs_c_p2_setattr),
- "nfs_c_p2_root", rate(@nfs_c_p2_root),
- "nfs_c_p2_lookup", rate(@nfs_c_p2_lookup),
- "nfs_c_p2_readlink", rate(@nfs_c_p2_readlink),
- "nfs_c_p2_read", rate(@nfs_c_p2_read),
- "nfs_c_p2_wrcache", rate(@nfs_c_p2_wrcache),
- "nfs_c_p2_write", rate(@nfs_c_p2_write),
- "nfs_c_p2_create", rate(@nfs_c_p2_create),
- "nfs_c_p2_remove", rate(@nfs_c_p2_remove),
- "nfs_c_p2_rename", rate(@nfs_c_p2_rename),
- "nfs_c_p2_link", rate(@nfs_c_p2_link),
- "nfs_c_p2_symlink", rate(@nfs_c_p2_symlink),
- "nfs_c_p2_mkdir", rate(@nfs_c_p2_mkdir),
- "nfs_c_p2_rmdir", rate(@nfs_c_p2_rmdir),
- "nfs_c_p2_readdir", rate(@nfs_c_p2_readdir),
- "nfs_c_p2_fsstat", rate(@nfs_c_p2_fsstat)
- );
- }
- if ($line=~/proc3/) {
- ( $dumb,$dumb,$dumb, $nfs_c_p3_getattr[$r], $nfs_c_p3_setattr[$r], $nfs_c_p3_lookup[$r],
- $nfs_c_p3_access[$r], $nfs_c_p3_readlink[$r], $nfs_c_p3_read[$r], $nfs_c_p3_write[$r],
- $nfs_c_p3_create[$r], $nfs_c_p3_mkdir[$r], $nfs_c_p3_symlink[$r], $nfs_c_p3_mknod[$r],
- $nfs_c_p3_remove[$r], $nfs_c_p3_rmdir[$r], $nfs_c_p3_rename[$r], $nfs_c_p3_link[$r],
- $nfs_c_p3_readdir[$r], $nfs_c_p3_readdirplus[$r],$nfs_c_p3_fsstat[$r], $nfs_c_p3_fsinfo[$r],
- $nfs_c_p3_pathconf[$r], $nfs_c_p3_commit[$r]
- )=split / +/,$line;
-
- put_output( "nfs_c_p3_getattr", rate(@nfs_c_p3_getattr),
- "nfs_c_p3_setattr", rate(@nfs_c_p3_setattr),
- "nfs_c_p3_lookup", rate(@nfs_c_p3_lookup),
- "nfs_c_p3_access", rate(@nfs_c_p3_access),
- "nfs_c_p3_readlink", rate(@nfs_c_p3_readlink),
- "nfs_c_p3_read", rate(@nfs_c_p3_read),
- "nfs_c_p3_write", rate(@nfs_c_p3_write),
- "nfs_c_p3_create", rate(@nfs_c_p3_create),
- "nfs_c_p3_mkdir", rate(@nfs_c_p3_mkdir),
- "nfs_c_p3_symlink", rate(@nfs_c_p3_symlink),
- "nfs_c_p3_mknod", rate(@nfs_c_p3_mknod),
- "nfs_c_p3_remove", rate(@nfs_c_p3_remove),
- "nfs_c_p3_rmdir", rate(@nfs_c_p3_rmdir),
- "nfs_c_p3_rename", rate(@nfs_c_p3_rename),
- "nfs_c_p3_link", rate(@nfs_c_p3_link),
- "nfs_c_p3_readdir", rate(@nfs_c_p3_readdir),
- "nfs_c_p3_readdirplus", rate(@nfs_c_p3_readdirplus),
- "nfs_c_p3_fsstat", rate(@nfs_c_p3_fsstat),
- "nfs_c_p3_fsinfo", rate(@nfs_c_p3_fsinfo),
- "nfs_c_p3_pathconf", rate(@nfs_c_p3_pathconf),
- "nfs_c_p3_commit", rate(@nfs_c_p3_commit)
- );
- }
- }
- }
-
- # Get NFS Server statistics
- if ( -f "$PROC/net/rpc/nfsd") {
- open (F_NFS, "<$PROC/net/rpc/nfsd");
- while ($line=<F_NFS>) {
-
- if ($line=~/rpc/) {
- ( $dumb,$nfs_s_rpc_calls[$r], $nfs_s_rpc_badcalls[$r],
- $nfs_s_rpc_badauth[$r], $nfs_s_rpc_badclnt[$r], $nfs_s_rpc_xdrcall[$r]
- )=split / +/,$line;
- put_output( "nfs_s_rpc_calls", rate(@nfs_s_rpc_calls),
- "nfs_s_rpc_badcalls", rate(@nfs_s_rpc_badcalls),
- "nfs_s_rpc_badauth", rate(@nfs_s_rpc_badauth),
- "nfs_s_rpc_badclnt", rate(@nfs_s_rpc_badclnt),
- "nfs_s_rpc_xdrcall", rate(@nfs_s_rpc_xdrcall)
+ # Operate percentuals and rates for system Stats
+ for ( $i = 0 ; $i < $n_cpus ; $i++ ) {
+ $usr_100[$i] = rate_prcnt(
+ $usr[$r][$i], $usr[ 1 - $r ][$i],
+ $total[$r][$i], $total[ 1 - $r ][$i]
+ );
+ $nice_100[$i] = rate_prcnt(
+ $nice[$r][$i], $nice[ 1 - $r ][$i],
+ $total[$r][$i], $total[ 1 - $r ][$i]
+ );
+ $sys_100[$i] = rate_prcnt(
+ $sys[$r][$i], $sys[ 1 - $r ][$i],
+ $total[$r][$i], $total[ 1 - $r ][$i]
+ );
+ $idle_100[$i] = rate_prcnt(
+ $idle[$r][$i], $idle[ 1 - $r ][$i],
+ $total[$r][$i], $total[ 1 - $r ][$i]
+ );
+ $wait_100[$i] = rate_prcnt(
+ $wait[$r][$i], $wait[ 1 - $r ][$i],
+ $total[$r][$i], $total[ 1 - $r ][$i]
+ );
+ if ( $i == 0 ) {
+ put_output(
+ "ncpus", $n_cpus - 1, "usr%", $usr_100[$i],
+ "nice%", $nice_100[$i], "sys%", $sys_100[$i],
+ "wait%", $wait_100[$i], "idle%", $idle_100[$i]
);
- }
+ }
+ else {
+ if ( $n_cpus > 2 ) {
+ put_output(
+ "usr_%_$i", $usr_100[$i], "nice_%_$i", $nice_100[$i],
+ "sys_%_$i", $sys_100[$i], "wait_%_$i", $idle_100[$i]
+ );
+ }
+ }
+ }
- if ($line=~/proc2/) {
- ( $dumb,$dumb,$dumb, $nfs_s_p2_getattr[$r], $nfs_s_p2_setattr[$r], $nfs_s_p2_root[$r],
- $nfs_s_p2_lookup[$r], $nfs_s_p2_readlink[$r], $nfs_s_p2_read[$r], $nfs_s_p2_wrcache[$r],
- $nfs_s_p2_write[$r], $nfs_s_p2_create[$r], $nfs_s_p2_remove[$r], $nfs_s_p2_rename[$r],
- $nfs_s_p2_link[$r], $nfs_s_p2_symlink[$r], $nfs_s_p2_mkdir[$r], $nfs_s_p2_rmdir[$r],
- $nfs_s_p2_readdir[$r], $nfs_s_p2_fsstat[$r]
- ) = split / +/,$line;
-
- put_output( "nfs_s_p2_getattr", rate(@nfs_s_p2_getattr),
- "nfs_s_p2_setattr", rate(@nfs_s_p2_setattr),
- "nfs_s_p2_root", rate(@nfs_s_p2_root),
- "nfs_s_p2_lookup", rate(@nfs_s_p2_lookup),
- "nfs_s_p2_readlink", rate(@nfs_s_p2_readlink),
- "nfs_s_p2_read", rate(@nfs_s_p2_read),
- "nfs_s_p2_wrcache", rate(@nfs_s_p2_wrcache),
- "nfs_s_p2_write", rate(@nfs_s_p2_write),
- "nfs_s_p2_create", rate(@nfs_s_p2_create),
- "nfs_s_p2_remove", rate(@nfs_s_p2_remove),
- "nfs_s_p2_rename", rate(@nfs_s_p2_rename),
- "nfs_s_p2_link", rate(@nfs_s_p2_link),
- "nfs_s_p2_symlink", rate(@nfs_s_p2_symlink),
- "nfs_s_p2_mkdir", rate(@nfs_s_p2_mkdir),
- "nfs_s_p2_rmdir", rate(@nfs_s_p2_rmdir),
- "nfs_s_p2_readdir", rate(@nfs_s_p2_readdir),
- "nfs_s_p2_fsstat", rate(@nfs_s_p2_fsstat)
- );
- }
- if ($line=~/proc3/) {
- ( $dumb,$dumb,$dumb, $nfs_s_p3_getattr[$r], $nfs_s_p3_setattr[$r], $nfs_s_p3_lookup[$r],
- $nfs_s_p3_access[$r], $nfs_s_p3_readlink[$r], $nfs_s_p3_read[$r], $nfs_s_p3_write[$r],
- $nfs_s_p3_create[$r], $nfs_s_p3_mkdir[$r], $nfs_s_p3_symlink[$r], $nfs_s_p3_mknod[$r],
- $nfs_s_p3_remove[$r], $nfs_s_p3_rmdir[$r], $nfs_s_p3_rename[$r], $nfs_s_p3_link[$r],
- $nfs_s_p3_readdir[$r], $nfs_s_p3_readdirplus[$r],$nfs_s_p3_fsstat[$r], $nfs_s_p3_fsinfo[$r],
- $nfs_s_p3_pathconf[$r], $nfs_s_p3_commit[$r]
- )=split / +/,$line;
-
- put_output( "nfs_s_p3_getattr", rate(@nfs_s_p3_getattr),
- "nfs_s_p3_setattr", rate(@nfs_s_p3_setattr),
- "nfs_s_p3_lookup", rate(@nfs_s_p3_lookup),
- "nfs_s_p3_access", rate(@nfs_s_p3_access),
- "nfs_s_p3_readlink", rate(@nfs_s_p3_readlink),
- "nfs_s_p3_read", rate(@nfs_s_p3_read),
- "nfs_s_p3_write", rate(@nfs_s_p3_write),
- "nfs_s_p3_create", rate(@nfs_s_p3_create),
- "nfs_s_p3_mkdir", rate(@nfs_s_p3_mkdir),
- "nfs_s_p3_symlink", rate(@nfs_s_p3_symlink),
- "nfs_s_p3_mknod", rate(@nfs_s_p3_mknod),
- "nfs_s_p3_remove", rate(@nfs_s_p3_remove),
- "nfs_s_p3_rmdir", rate(@nfs_s_p3_rmdir),
- "nfs_s_p3_rename", rate(@nfs_s_p3_rename),
- "nfs_s_p3_link", rate(@nfs_s_p3_link),
- "nfs_s_p3_readdir", rate(@nfs_s_p3_readdir),
- "nfs_s_p3_readdirplus", rate(@nfs_s_p3_readdirplus),
- "nfs_s_p3_fsstat", rate(@nfs_s_p3_fsstat),
- "nfs_s_p3_fsinfo", rate(@nfs_s_p3_fsinfo),
- "nfs_s_p3_pathconf", rate(@nfs_s_p3_pathconf),
- "nfs_s_p3_commit", rate(@nfs_s_p3_commit)
+ # In kernel 2.6 paging and swapping information must be computed on other file
+ if ( $version =~ /^2\.6/ ) {
+ open( F_VMSTAT, "<$PROC/vmstat" );
+ while ( $line = <F_VMSTAT> ) {
+
+ # Not sure about the meaning of theese
+ #if ( $line=~/pgactivate/) {
+ # ($dumb, $page_in[$r])= split / +/,$line;
+ #}
+ #if ( $line=~/pgdectivate/) {
+ # ($dumb, $page_out[$r])= split / +/,$line;
+ #}
+ if ( $line =~ /pswpin/ ) {
+ ( $dumb, $swap_in[$r] ) = split / +/, $line;
+ }
+ if ( $line =~ /pswpout/ ) {
+ ( $dumb, $swap_out[$r] ) = split / +/, $line;
+ }
+ }
+ close(F_VMSTAT);
+ }
+
+# Now lets get 2.4 /proc/partitions and 2.5 /proc/diskstats for acurate disk measurements
+#
+ if ( $minor >= 4 ) {
+ (
+ $dsk_stat_t[$r], $dsk_rio_t[$r], $dsk_rblk_t[$r],
+ $dsk_wio_t[$r], $dsk_wblk_t[$r]
+ )
+ = ( 0, 0, 0, 0 );
+ open( F_DSKSTAT, "<$PROC/partitions" ) if ( $minor == 4 );
+ open( F_DSKSTAT, "<$PROC/diskstats" ) if ( $minor > 4 );
+
+ $i = 0;
+ while ( $line = <F_DSKSTAT> ) {
+ if ( $line =~ /sd|hd/ ) { # just IDE or SCSI disks
+ chomp $line;
+ $line = " 0 " . $line
+ if ( $minor == 6 ); # make 2.6 version look alike a 2.4 one
+ (
+ $dumb, $dumb,
+ $dumb, $dumb,
+ $name[$r][$i], $rdops[$r][$i],
+ $rdops_seq[$r][$i], $rdsct[$r][$i],
+ $rdtm[$r][$i], $wrops[$r][$i],
+ $wrops_seq[$r][$i], $wrsct[$r][$i],
+ $wrtm[$r][$i], $ioqueue[$r][$i],
+ $iotm[$r][$i], $weightiotm[$r][$i]
+ )
+ = split / +/, $line;
+ if ( $name[$r][$i] !~ /[0-9]/ ) {
+ $dsk_rio_t[$r] += $rdops[$r][$i];
+ $dsk_wio_t[$r] += $wrops[$r][$i];
+ $dsk_rblk_t[$r] += $rdsct[$r][$i];
+ $dsk_wblk_t[$r] += $wrsct[$r][$i];
+ put_output(
+ "disk_rd_$name[$r][$i]/s",
+ rate( $rdops[$r][$i], $rdops[ 1 - $r ][$i] ),
+ "disk_wr_$name[$r][$i]/s",
+ rate( $wrops[$r][$i], $wrops[ 1 - $r ][$i] ),
+ "disk_rB_$name[$r][$i]/s",
+ rate( $rdsct[$r][$i], $rdsct[ 1 - $r ][$i] ),
+ "disk_wB_$name[$r][$i]/s",
+ rate( $wrsct[$r][$i], $wrsct[ 1 - $r ][$i] ),
+ "disk_rdseq_$name[$r][$i]/s",
+ rate( $rdops_seq[$r][$i], $rdops_seq[ 1 - $r ][$i] ),
+ "disk_wrseq_$name[$r][$i]/s",
+ rate( $wrops_seq[$r][$i], $ops_seq[ 1 - $r ][$i] ),
+ "disk_rtm_$name[$r][$i]/s",
+ rate( $rdtm[$r][$i], $rdtm[ 1 - $r ][$i] ),
+ "disk_wtm_$name[$r][$i]/s",
+ rate( $wrtm[$r][$i], $wrtm[ 1 - $r ][$i] ),
+ "disk_iotm_$name[$r][$i]/s",
+ rate( $iotm[$r][$i], $iotm[ 1 - $r ][$i] ),
+ "disk_ioqueue_$name[$r][$i]/s",
+ rate( $ioqueue[$r][$i], $ioqueue[ 1 - $r ][$i] ),
+ "disk_weightiotm_$name[$r][$i]/s",
+ rate( $weightiotm[$r][$i], $weightiotm[ 1 - $r ][$i] ),
+ );
+ }
+ else {
+ put_output( # 2.6 has less metrics, wich messes vars names
+ "part_rd_$name[$r][$i]/s",
+ rate( $rdops[$r][$i], $rdops[ 1 - $r ][$i] ),
+ "part_wr_$name[$r][$i]/s",
+ rate( $rdsct[$r][$i], $rdsct[ 1 - $r ][$i] ),
+ "part_rB_$name[$r][$i]/s",
+ rate( $rdops_seq[$r][$i], $rdops_seq[ 1 - $r ][$i] ),
+ "part_wB_$name[$r][$i]/s",
+ rate( $rdtm[$r][$i], $rdtm[ 1 - $r ][$i] )
+ )
+ if ( $minor == 6 );
+ put_output(
+ "part_rd_$name[$r][$i]/s",
+ rate( $rdops[$r][$i], $rdops[ 1 - $r ][$i] ),
+ "part_wr_$name[$r][$i]/s",
+ rate( $wrops[$r][$i], $wrops[ 1 - $r ][$i] ),
+ "part_rB_$name[$r][$i]/s",
+ rate( $rdsct[$r][$i], $rdsct[ 1 - $r ][$i] ),
+ "part_wB_$name[$r][$i]/s",
+ rate( $wrsct[$r][$i], $wrsct[ 1 - $r ][$i] ),
+ "part_rdseq_$name[$r][$i]/s",
+ rate( $rdops_seq[$r][$i], $rdops_seq[ 1 - $r ][$i] ),
+ "part_wrseq_$name[$r][$i]/s",
+ rate( $wrops_seq[$r][$i], $ops_seq[ 1 - $r ][$i] ),
+ "part_rtm_$name[$r][$i]/s",
+ rate( $rdtm[$r][$i], $rdtm[ 1 - $r ][$i] ),
+ "part_wtm_$name[$r][$i]/s",
+ rate( $wrtm[$r][$i], $wrtm[ 1 - $r ][$i] ),
+ "disk_iotm_$name[$r][$i]/s",
+ rate( $iotm[$r][$i], $iotm[ 1 - $r ][$i] ),
+ "part_ioqueue_$name[$r][$i]/s",
+ rate( $ioqueue[$r][$i], $ioqueue[ 1 - $r ][$i] ),
+ "part_weightiotm_$name[$r][$i]/s",
+ rate( $weightiotm[$r][$i], $weightiotm[ 1 - $r ][$i] ),
+ )
+ if ( $minor == 4 );
+ }
+ $i++;
+ }
+ }
+
+ #$n_parts=$i;
+ $dsk_stat_t[$r] = $dsk_rio_t[$r] + $dsk_wio_t[$r];
+ close(F_DSKSTAT);
+ }
+
+ put_output(
+ "mempages_in", rate(@page_in), "mempages_out", rate(@page_out),
+ "swap_in", rate(@swap_in), "swap_out", rate(@swap_out),
+ "ctxt/s", rate(@ctxt), "intr/s", rate(@intr)
+ );
+
+ put_output(
+ "disk_op/s", rate(@dsk_stat_t), "disk_rd/s", rate(@dsk_rio_t),
+ "disk_wr/s", rate(@dsk_wio_t), "disk_rB/s", rate(@dsk_rblk_t),
+ "disk_wB/s", rate(@dsk_wblk_t)
+ );
+
+ close(F_STAT);
+
+ # Get memory ocupation
+ open( F_MEMINFO, "<$PROC/meminfo" );
+ if ( $version !~ /^2\.6/ ) {
+ <F_MEMINFO>;
+ (
+ $dumb, $mem_total, $mem_used, $mem_free,
+ $mem_shrd, $mem_buff, $mem_cchd
+ )
+ = split /[^0-9]+/, <F_MEMINFO>;
+ ( $dumb, $swp_total, $swp_used, $swp_free ) = split /[^0-9]+/,
+ <F_MEMINFO>;
+ }
+ else {
+ while ( $line = <F_MEMINFO> ) {
+ if ( $line =~ /MemTotal/ ) {
+ ( $dumb, $mem_total ) = split / +/, $line;
+ }
+ if ( $line =~ /MemFree/ ) {
+ ( $dumb, $mem_free ) = split / +/, $line;
+ }
+ if ( $line =~ /Buffers/ ) {
+ ( $dumb, $mem_buff ) = split / +/, $line;
+ }
+ if ( $line =~ /Cached/ ) {
+ ( $dumb, $mem_cchd ) = split / +/, $line;
+ }
+ if ( $line =~ /Shared/ ) {
+ ( $dumb, $mem_shrd ) = split / +/, $line
+ ; # It does not exist anymore -- maybe get will have to get from /proc/sysvipc/shm ?
+ }
+
+ #if ( $line=~/SwapCached/) {
+ # ($dumb, $mem_swpcchd)= split / +/,$line;
+ #}
+ if ( $line =~ /SwapTotal/ ) {
+ ( $dumb, $swp_total ) = split / +/, $line;
+ }
+ if ( $line =~ /SwapFree/ ) {
+ ( $dumb, $swp_free ) = split / +/, $line;
+ }
+ }
+ $mem_used = $mem_total - $mem_free;
+ $swp_used = $swp_total - $swp_free;
+ }
+
+ close(F_MEMINFO);
+
+ put_output(
+ "mem_used%", prcnt( $mem_used, $mem_total ),
+ "mem_free%", prcnt( $mem_free, $mem_total ),
+ "mem_shrd%", prcnt( $mem_shrd, $mem_total ),
+ "mem_buff%", prcnt( $mem_buff, $mem_total ),
+ "mem_cchd%", prcnt( $mem_cchd, $mem_total ),
+ "swp_free%", prcnt( $swp_free, $swp_total ),
+ "swp_used%", prcnt( $swp_used, $swp_total )
+ );
+
+ # Get network interface statistics
+ open( F_NET_DEV, "<$PROC/net/dev" );
+ $i = 0;
+ while ( $line = <F_NET_DEV> ) {
+ if ( $line =~ /:/ ) {
+ ( $if_name[$i][$r], $line ) = split /: */, $line;
+ ( $dumb, $if_name[$i][$r] ) = split /^ +/, $if_name[$i][$r]
+ if ( $if_name[$i][$r] =~ / / );
+
+ (
+ $if_in_b[$i][$r], $if_in_p[$i][$r], $if_in_e[$i][$r],
+ $if_in_d[$i][$r], $if_in_ff[$i][$r], $if_in_fr[$i][$r],
+ $if_in_c[$i][$r], $if_in_m[$i][$r], $if_out_b[$i][$r],
+ $if_out_p[$i][$r], $if_out_e[$i][$r], $if_out_d[$i][$r],
+ $if_out_ff[$i][$r], $if_out_cl[$i][$r], $if_out_ca[$i][$r],
+ $if_out_cp[$i][$r]
+ )
+ = split / +/, $line;
+ put_output(
+ "if_in_b_$if_name[$i][$r]",
+ rate( $if_in_b[$i][$r], $if_in_b[$i][ 1 - $r ] ),
+ "if_in_p_$if_name[$i][$r]",
+ rate( $if_in_p[$i][$r], $if_in_p[$i][ 1 - $r ] ),
+ "if_in_e_$if_name[$i][$r]",
+ rate( $if_in_e[$i][$r], $if_in_e[$i][ 1 - $r ] ),
+ "if_in_d_$if_name[$i][$r]",
+ rate( $if_in_d[$i][$r], $if_in_d[$i][ 1 - $r ] ),
+ "if_in_ff_$if_name[$i][$r]",
+ rate( $if_in_ff[$i][$r], $if_in_ff[$i][ 1 - $r ] ),
+ "if_in_fr_$if_name[$i][$r]",
+ rate( $if_in_fr[$i][$r], $if_in_fr[$i][ 1 - $r ] ),
+ "if_in_c_$if_name[$i][$r]",
+ rate( $if_in_c[$i][$r], $if_in_c[$i][ 1 - $r ] ),
+ "if_in_m_$if_name[$i][$r]",
+ rate( $if_in_m[$i][$r], $if_in_m[$i][ 1 - $r ] ),
+ "if_out_b_$if_name[$i][$r]",
+ rate( $if_out_b[$i][$r], $if_out_b[$i][ 1 - $r ] ),
+ "if_out_p_$if_name[$i][$r]",
+ rate( $if_out_p[$i][$r], $if_out_p[$i][ 1 - $r ] ),
+ "if_out_e_$if_name[$i][$r]",
+ rate( $if_out_e[$i][$r], $if_out_e[$i][ 1 - $r ] ),
+ "if_out_d_$if_name[$i][$r]",
+ rate( $if_out_d[$i][$r], $if_out_d[$i][ 1 - $r ] ),
+ "if_out_ff_$if_name[$i][$r]",
+ rate( $if_out_ff[$i][$r], $if_out_ff[$i][ 1 - $r ] ),
+ "if_out_cl_$if_name[$i][$r]",
+ rate( $if_out_cl[$i][$r], $if_out_cl[$i][ 1 - $r ] ),
+ "if_out_ca_$if_name[$i][$r]",
+ rate( $if_out_ca[$i][$r], $if_out_ca[$i][ 1 - $r ] ),
+ "if_out_cp_$if_name[$i][$r]",
+ rate( $if_out_cp[$i][$r], $if_out_cp[$i][ 1 - $r ] )
);
- }
- }
- }
+ $i++;
+ }
+ }
+ $n_nets = $i;
+ close(F_NET_DEV);
+
+ # Get TCP/IP statistics
+ #
+ for ( my $k = 0 ; $k < 2 ; $k++ ) {
+
+ if ( $k == 1 ) {
+ if ( $minor >= 4 ) {
+ open( F_SNMP, "<$PROC/net/netstat" );
+ }
+ else {
+ next;
+ }
+
+ }
+ else {
+ open( F_SNMP, "<$PROC/net/snmp" );
+ }
+
+ $j = 0;
+ while ( $line = <F_SNMP> ) {
+ $line2 = <F_SNMP>;
+ chomp $line;
+ chomp $line2;
+ ( $cat, $line ) = split /: +/, $line;
+ ( $dumb, $line2 ) = split /: +/, $line2;
+ (@dumb) = split / +/, $line;
+ (@dumb2) = split / +/, $line2;
+ for ( $i = 0 ; $dumb[$i] ; $i++, $j++ ) {
+ $net_parm[0][$j] = sprintf "%s_%s", $cat, $dumb[$i];
+ $net_parm[ 2 + $r ][$j] = $dumb2[$i];
+
+ # Will save as counter and not as gauge
+ # $net_parm[1][$j]= rate ($net_parm[2+$r][$j],$net_parm[3-$r][$j]);
+ SWITCH: {
+ if ( $cat =~ /Ip/ ) {
+ if ( $net_parm[0][$j] =~ /In|Out|Forw|Reasm|Frag/ ) {
+ put_output( "$net_parm[0][$j]",
+ $net_parm[ 2 + $r ][$j] );
+ }
+ last SWITCH;
+ }
+ if ( $cat =~ /Icmp/ ) {
+ put_output( "$net_parm[0][$j]",
+ $net_parm[ 2 + $r ][$j] );
+ last SWITCH;
+ }
+ if ( $cat =~ /Udp/ ) {
+ put_output( "$net_parm[0][$j]",
+ $net_parm[ 2 + $r ][$j] );
+ last SWITCH;
+ }
+ if ( $cat =~ /Tcp/ ) {
+ if ( $net_parm[0][$j] =~ /Rto|Max/ ) { last SWITCH; }
+
+ #if ($net_parm[0][$j]=~/CurrEstab/) {
+ # put_output("$net_parm[0][$j]",$net_parm[2+$r][$j]);
+ # last SWITCH;
+ #}
+ put_output( "$net_parm[0][$j]",
+ $net_parm[ 2 + $r ][$j] );
+ last SWITCH;
+ }
+ }
+ }
+ }
+ close(F_SNMP);
+ $net_parms = $j;
+ }
+
+ # Get NFS Client statistics
+ if ( -f "$PROC/net/rpc/nfs" ) {
+ open( F_NFS, "<$PROC/net/rpc/nfs" );
+ while ( $line = <F_NFS> ) {
+
+ if ( $line =~ /rpc/ ) {
+ (
+ $dumb, $nfs_c_rpc_calls[$r], $nfs_c_rpc_retrs[$r],
+ $nfs_c_rpc_auth[$r]
+ )
+ = split / +/, $line;
+ put_output(
+ "nfs_c_rpc_calls", rate(@nfs_c_rpc_calls),
+ "nfs_c_rpc_retrs", rate(@nfs_c_rpc_retrs),
+ "nfs_c_rpc_auth", rate(@nfs_c_rpc_auth)
+ );
+ }
+
+ if ( $line =~ /proc2/ ) {
+ (
+ $dumb, $dumb,
+ $dumb, $nfs_c_p2_getattr[$r],
+ $nfs_c_p2_setattr[$r], $nfs_c_p2_root[$r],
+ $nfs_c_p2_lookup[$r], $nfs_c_p2_readlink[$r],
+ $nfs_c_p2_read[$r], $nfs_c_p2_wrcache[$r],
+ $nfs_c_p2_write[$r], $nfs_c_p2_create[$r],
+ $nfs_c_p2_remove[$r], $nfs_c_p2_rename[$r],
+ $nfs_c_p2_link[$r], $nfs_c_p2_symlink[$r],
+ $nfs_c_p2_mkdir[$r], $nfs_c_p2_rmdir[$r],
+ $nfs_c_p2_readdir[$r], $nfs_c_p2_fsstat[$r]
+ )
+ = split / +/, $line;
+
+ put_output(
+ "nfs_c_p2_getattr", rate(@nfs_c_p2_getattr),
+ "nfs_c_p2_setattr", rate(@nfs_c_p2_setattr),
+ "nfs_c_p2_root", rate(@nfs_c_p2_root),
+ "nfs_c_p2_lookup", rate(@nfs_c_p2_lookup),
+ "nfs_c_p2_readlink", rate(@nfs_c_p2_readlink),
+ "nfs_c_p2_read", rate(@nfs_c_p2_read),
+ "nfs_c_p2_wrcache", rate(@nfs_c_p2_wrcache),
+ "nfs_c_p2_write", rate(@nfs_c_p2_write),
+ "nfs_c_p2_create", rate(@nfs_c_p2_create),
+ "nfs_c_p2_remove", rate(@nfs_c_p2_remove),
+ "nfs_c_p2_rename", rate(@nfs_c_p2_rename),
+ "nfs_c_p2_link", rate(@nfs_c_p2_link),
+ "nfs_c_p2_symlink", rate(@nfs_c_p2_symlink),
+ "nfs_c_p2_mkdir", rate(@nfs_c_p2_mkdir),
+ "nfs_c_p2_rmdir", rate(@nfs_c_p2_rmdir),
+ "nfs_c_p2_readdir", rate(@nfs_c_p2_readdir),
+ "nfs_c_p2_fsstat", rate(@nfs_c_p2_fsstat)
+ )
+ if ($NFS_PROTO_DETAILS);
+ }
+ if ( $line =~ /proc3/ ) {
+ (
+ $dumb, $dumb,
+ $dumb, $nfs_c_p3_getattr[$r],
+ $nfs_c_p3_setattr[$r], $nfs_c_p3_lookup[$r],
+ $nfs_c_p3_access[$r], $nfs_c_p3_readlink[$r],
+ $nfs_c_p3_read[$r], $nfs_c_p3_write[$r],
+ $nfs_c_p3_create[$r], $nfs_c_p3_mkdir[$r],
+ $nfs_c_p3_symlink[$r], $nfs_c_p3_mknod[$r],
+ $nfs_c_p3_remove[$r], $nfs_c_p3_rmdir[$r],
+ $nfs_c_p3_rename[$r], $nfs_c_p3_link[$r],
+ $nfs_c_p3_readdir[$r], $nfs_c_p3_readdirplus[$r],
+ $nfs_c_p3_fsstat[$r], $nfs_c_p3_fsinfo[$r],
+ $nfs_c_p3_pathconf[$r], $nfs_c_p3_commit[$r]
+ )
+ = split / +/, $line;
+
+ put_output(
+ "nfs_c_p3_getattr", rate(@nfs_c_p3_getattr),
+ "nfs_c_p3_setattr", rate(@nfs_c_p3_setattr),
+ "nfs_c_p3_lookup", rate(@nfs_c_p3_lookup),
+ "nfs_c_p3_access", rate(@nfs_c_p3_access),
+ "nfs_c_p3_readlink", rate(@nfs_c_p3_readlink),
+ "nfs_c_p3_read", rate(@nfs_c_p3_read),
+ "nfs_c_p3_write", rate(@nfs_c_p3_write),
+ "nfs_c_p3_create", rate(@nfs_c_p3_create),
+ "nfs_c_p3_mkdir", rate(@nfs_c_p3_mkdir),
+ "nfs_c_p3_symlink", rate(@nfs_c_p3_symlink),
+ "nfs_c_p3_mknod", rate(@nfs_c_p3_mknod),
+ "nfs_c_p3_remove", rate(@nfs_c_p3_remove),
+ "nfs_c_p3_rmdir", rate(@nfs_c_p3_rmdir),
+ "nfs_c_p3_rename", rate(@nfs_c_p3_rename),
+ "nfs_c_p3_link", rate(@nfs_c_p3_link),
+ "nfs_c_p3_readdir", rate(@nfs_c_p3_readdir),
+ "nfs_c_p3_readdirplus", rate(@nfs_c_p3_readdirplus),
+ "nfs_c_p3_fsstat", rate(@nfs_c_p3_fsstat),
+ "nfs_c_p3_fsinfo", rate(@nfs_c_p3_fsinfo),
+ "nfs_c_p3_pathconf", rate(@nfs_c_p3_pathconf),
+ "nfs_c_p3_commit", rate(@nfs_c_p3_commit)
+ )
+ if ($NFS_PROTO_DETAILS);
+ }
+ if ( $line =~ /proc4/ ) {
+ (
+ $dumb, $dumb,
+ $dumb, $nfs_c_p4_getattr[$r],
+ $nfs_c_p4_setattr[$r], $nfs_c_p4_lookup[$r],
+ $nfs_c_p4_access[$r], $nfs_c_p4_readlink[$r],
+ $nfs_c_p4_read[$r], $nfs_c_p4_write[$r],
+ $nfs_c_p4_create[$r], $nfs_c_p4_mkdir[$r],
+ $nfs_c_p4_symlink[$r], $nfs_c_p4_mknod[$r],
+ $nfs_c_p4_remove[$r], $nfs_c_p4_rmdir[$r],
+ $nfs_c_p4_rename[$r], $nfs_c_p4_link[$r],
+ $nfs_c_p4_readdir[$r], $nfs_c_p4_readdirplus[$r],
+ $nfs_c_p4_fsstat[$r], $nfs_c_p4_fsinfo[$r],
+ $nfs_c_p4_pathconf[$r], $nfs_c_p4_commit[$r]
+ )
+ = split / +/, $line;
+
+ put_output(
+ "nfs_c_p4_getattr", rate(@nfs_c_p4_getattr),
+ "nfs_c_p4_setattr", rate(@nfs_c_p4_setattr),
+ "nfs_c_p4_lookup", rate(@nfs_c_p4_lookup),
+ "nfs_c_p4_access", rate(@nfs_c_p4_access),
+ "nfs_c_p4_readlink", rate(@nfs_c_p4_readlink),
+ "nfs_c_p4_read", rate(@nfs_c_p4_read),
+ "nfs_c_p4_write", rate(@nfs_c_p4_write),
+ "nfs_c_p4_create", rate(@nfs_c_p4_create),
+ "nfs_c_p4_mkdir", rate(@nfs_c_p4_mkdir),
+ "nfs_c_p4_symlink", rate(@nfs_c_p4_symlink),
+ "nfs_c_p4_mknod", rate(@nfs_c_p4_mknod),
+ "nfs_c_p4_remove", rate(@nfs_c_p4_remove),
+ "nfs_c_p4_rmdir", rate(@nfs_c_p4_rmdir),
+ "nfs_c_p4_rename", rate(@nfs_c_p4_rename),
+ "nfs_c_p4_link", rate(@nfs_c_p4_link),
+ "nfs_c_p4_readdir", rate(@nfs_c_p4_readdir),
+ "nfs_c_p4_readdirplus", rate(@nfs_c_p4_readdirplus),
+ "nfs_c_p4_fsstat", rate(@nfs_c_p4_fsstat),
+ "nfs_c_p4_fsinfo", rate(@nfs_c_p4_fsinfo),
+ "nfs_c_p4_pathconf", rate(@nfs_c_p4_pathconf),
+ "nfs_c_p4_commit", rate(@nfs_c_p4_commit)
+ )
+ if ($NFS_PROTO_DETAILS);
+ }
+ }
+ close(F_NFS);
+
+ put_output(
+ "nfs_c_t_getattr",
+ rate(@nfs_c_p2_getattr) + rate(@nfs_c_p3_getattr) +
+ rate(@nfs_c_p4_getattr),
+ "nfs_c_t_setattr",
+ rate(@nfs_c_p2_setattr) + rate(@nfs_c_p3_setattr) +
+ rate(@nfs_c_p4_setattr),
+ "nfs_c_t_lookup",
+ rate(@nfs_c_p2_lookup) + rate(@nfs_c_p3_lookup) +
+ rate(@nfs_c_p4_lookup),
+ "nfs_c_t_access",
+ rate(@nfs_c_p3_access) + rate(@nfs_c_p4_access),
+ "nfs_c_t_readlink",
+ rate(@nfs_c_p2_readlink) + rate(@nfs_c_p3_readlink) +
+ rate(@nfs_c_p4_readlink),
+ "nfs_c_t_read",
+ rate(@nfs_c_p2_read) + rate(@nfs_c_p3_read) + rate(@nfs_c_p4_read),
+ "nfs_c_t_write",
+ rate(@nfs_c_p2_write) + rate(@nfs_c_p3_write) +
+ rate(@nfs_c_p4_write),
+ "nfs_c_t_create",
+ rate(@nfs_c_p2_create) + rate(@nfs_c_p3_create) +
+ rate(@nfs_c_p4_create),
+ "nfs_c_t_mkdir",
+ rate(@nfs_c_p2_mkdir) + rate(@nfs_c_p3_mkdir) +
+ rate(@nfs_c_p4_mkdir),
+ "nfs_c_t_symlink",
+ rate(@nfs_c_p2_symlink) + rate(@nfs_c_p3_symlink) +
+ rate(@nfs_c_p4_symlink),
+ "nfs_c_t_mknod",
+ rate(@nfs_c_p3_mknod) + rate(@nfs_c_p4_mknod),
+ "nfs_c_t_remove",
+ rate(@nfs_c_p2_remove) + rate(@nfs_c_p3_remove) +
+ rate(@nfs_c_p4_remove),
+ "nfs_c_t_rmdir",
+ rate(@nfs_c_p2_rmdir) + rate(@nfs_c_p3_rmdir) +
+ rate(@nfs_c_p4_rmdir),
+ "nfs_c_t_rename",
+ rate(@nfs_c_p2_rename) + rate(@nfs_c_p3_rename) +
+ rate(@nfs_c_p4_rename),
+ "nfs_c_t_link",
+ rate(@nfs_c_p2_link) + rate(@nfs_c_p3_link) + rate(@nfs_c_p4_link),
+ "nfs_c_t_readdir",
+ rate(@nfs_c_p2_readdir) + rate(@nfs_c_p3_readdir) +
+ rate(@nfs_c_p4_readdir),
+ "nfs_c_t_readdirplus",
+ rate(@nfs_c_p3_readdirplus) + rate(@nfs_c_p4_readdirplus),
+ "nfs_c_t_fsstat",
+ rate(@nfs_c_p2_fsstat) + rate(@nfs_c_p3_fsstat) +
+ rate(@nfs_c_p4_fsstat),
+ "nfs_c_t_fsinfo",
+ rate(@nfs_c_p3_fsinfo) + rate(@nfs_c_p4_fsinfo),
+ "nfs_c_t_pathconf",
+ rate(@nfs_c_p3_pathconf) + rate(@nfs_c_p4_pathconf),
+ "nfs_c_t_commit",
+ rate(@nfs_c_p3_commit) + rate(@nfs_c_p4_commit)
+ );
+ }
+
+ # Get NFS Server statistics
+ if ( -f "$PROC/net/rpc/nfsd" ) {
+ open( F_NFS, "<$PROC/net/rpc/nfsd" );
+ while ( $line = <F_NFS> ) {
+
+ if ( $line =~ /rpc/ ) {
+ (
+ $dumb, $nfs_s_rpc_calls[$r],
+ $nfs_s_rpc_badcalls[$r], $nfs_s_rpc_badauth[$r],
+ $nfs_s_rpc_badclnt[$r], $nfs_s_rpc_xdrcall[$r]
+ )
+ = split / +/, $line;
+ put_output(
+ "nfs_s_rpc_calls", rate(@nfs_s_rpc_calls),
+ "nfs_s_rpc_badcalls", rate(@nfs_s_rpc_badcalls),
+ "nfs_s_rpc_badauth", rate(@nfs_s_rpc_badauth),
+ "nfs_s_rpc_badclnt", rate(@nfs_s_rpc_badclnt),
+ "nfs_s_rpc_xdrcall", rate(@nfs_s_rpc_xdrcall)
+ );
+ }
+
+ if ( $line =~ /proc2/ ) {
+ (
+ $dumb, $dumb,
+ $dumb, $nfs_s_p2_getattr[$r],
+ $nfs_s_p2_setattr[$r], $nfs_s_p2_root[$r],
+ $nfs_s_p2_lookup[$r], $nfs_s_p2_readlink[$r],
+ $nfs_s_p2_read[$r], $nfs_s_p2_wrcache[$r],
+ $nfs_s_p2_write[$r], $nfs_s_p2_create[$r],
+ $nfs_s_p2_remove[$r], $nfs_s_p2_rename[$r],
+ $nfs_s_p2_link[$r], $nfs_s_p2_symlink[$r],
+ $nfs_s_p2_mkdir[$r], $nfs_s_p2_rmdir[$r],
+ $nfs_s_p2_readdir[$r], $nfs_s_p2_fsstat[$r]
+ )
+ = split / +/, $line;
+
+ put_output(
+ "nfs_s_p2_getattr", rate(@nfs_s_p2_getattr),
+ "nfs_s_p2_setattr", rate(@nfs_s_p2_setattr),
+ "nfs_s_p2_root", rate(@nfs_s_p2_root),
+ "nfs_s_p2_lookup", rate(@nfs_s_p2_lookup),
+ "nfs_s_p2_readlink", rate(@nfs_s_p2_readlink),
+ "nfs_s_p2_read", rate(@nfs_s_p2_read),
+ "nfs_s_p2_wrcache", rate(@nfs_s_p2_wrcache),
+ "nfs_s_p2_write", rate(@nfs_s_p2_write),
+ "nfs_s_p2_create", rate(@nfs_s_p2_create),
+ "nfs_s_p2_remove", rate(@nfs_s_p2_remove),
+ "nfs_s_p2_rename", rate(@nfs_s_p2_rename),
+ "nfs_s_p2_link", rate(@nfs_s_p2_link),
+ "nfs_s_p2_symlink", rate(@nfs_s_p2_symlink),
+ "nfs_s_p2_mkdir", rate(@nfs_s_p2_mkdir),
+ "nfs_s_p2_rmdir", rate(@nfs_s_p2_rmdir),
+ "nfs_s_p2_readdir", rate(@nfs_s_p2_readdir),
+ "nfs_s_p2_fsstat", rate(@nfs_s_p2_fsstat)
+ )
+ if ($NFS_PROTO_DETAILS);
+ }
+ if ( $line =~ /proc3/ ) {
+ (
+ $dumb, $dumb,
+ $dumb, $nfs_s_p3_getattr[$r],
+ $nfs_s_p3_setattr[$r], $nfs_s_p3_lookup[$r],
+ $nfs_s_p3_access[$r], $nfs_s_p3_readlink[$r],
+ $nfs_s_p3_read[$r], $nfs_s_p3_write[$r],
+ $nfs_s_p3_create[$r], $nfs_s_p3_mkdir[$r],
+ $nfs_s_p3_symlink[$r], $nfs_s_p3_mknod[$r],
+ $nfs_s_p3_remove[$r], $nfs_s_p3_rmdir[$r],
+ $nfs_s_p3_rename[$r], $nfs_s_p3_link[$r],
+ $nfs_s_p3_readdir[$r], $nfs_s_p3_readdirplus[$r],
+ $nfs_s_p3_fsstat[$r], $nfs_s_p3_fsinfo[$r],
+ $nfs_s_p3_pathconf[$r], $nfs_s_p3_commit[$r]
+ )
+ = split / +/, $line;
+
+ put_output(
+ "nfs_s_p3_getattr", rate(@nfs_s_p3_getattr),
+ "nfs_s_p3_setattr", rate(@nfs_s_p3_setattr),
+ "nfs_s_p3_lookup", rate(@nfs_s_p3_lookup),
+ "nfs_s_p3_access", rate(@nfs_s_p3_access),
+ "nfs_s_p3_readlink", rate(@nfs_s_p3_readlink),
+ "nfs_s_p3_read", rate(@nfs_s_p3_read),
+ "nfs_s_p3_write", rate(@nfs_s_p3_write),
+ "nfs_s_p3_create", rate(@nfs_s_p3_create),
+ "nfs_s_p3_mkdir", rate(@nfs_s_p3_mkdir),
+ "nfs_s_p3_symlink", rate(@nfs_s_p3_symlink),
+ "nfs_s_p3_mknod", rate(@nfs_s_p3_mknod),
+ "nfs_s_p3_remove", rate(@nfs_s_p3_remove),
+ "nfs_s_p3_rmdir", rate(@nfs_s_p3_rmdir),
+ "nfs_s_p3_rename", rate(@nfs_s_p3_rename),
+ "nfs_s_p3_link", rate(@nfs_s_p3_link),
+ "nfs_s_p3_readdir", rate(@nfs_s_p3_readdir),
+ "nfs_s_p3_readdirplus", rate(@nfs_s_p3_readdirplus),
+ "nfs_s_p3_fsstat", rate(@nfs_s_p3_fsstat),
+ "nfs_s_p3_fsinfo", rate(@nfs_s_p3_fsinfo),
+ "nfs_s_p3_pathconf", rate(@nfs_s_p3_pathconf),
+ "nfs_s_p3_commit", rate(@nfs_s_p3_commit)
+ )
+ if ($NFS_PROTO_DETAILS);
+ }
+ if ( $line =~ /proc4/ ) {
+ ( $dumb, $dumb, $dumb, $nfs_s_p4_compound[$r] ) = split / +/,
+ $line;
+
+ put_output( "nfs_s_p4_compound", rate(@nfs_s_p4_compound) )
+ if ($NFS_PROTO_DETAILS);
+ }
+ }
+ close(F_NFS);
+ put_output(
+ "nfs_s_t_getattr",
+ rate(@nfs_s_p2_getattr) + rate(@nfs_s_p3_getattr),
+ "nfs_s_t_setattr",
+ rate(@nfs_s_p2_setattr) + rate(@nfs_s_p3_setattr),
+ "nfs_s_t_lookup",
+ rate(@nfs_s_p2_lookup) + rate(@nfs_s_p3_lookup),
+ "nfs_s_t_access",
+ rate(@nfs_s_p3_access),
+ "nfs_s_t_readlink",
+ rate(@nfs_s_p2_readlink) + rate(@nfs_s_p3_readlink),
+ "nfs_s_t_read",
+ rate(@nfs_s_p2_read) + rate(@nfs_s_p3_read),
+ "nfs_s_t_write",
+ rate(@nfs_s_p2_write) + rate(@nfs_s_p3_write),
+ "nfs_s_t_create",
+ rate(@nfs_s_p2_create) + rate(@nfs_s_p3_create),
+ "nfs_s_t_mkdir",
+ rate(@nfs_s_p2_mkdir) + rate(@nfs_s_p3_mkdir),
+ "nfs_s_t_symlink",
+ rate(@nfs_s_p2_symlink) + rate(@nfs_s_p3_symlink),
+ "nfs_s_t_mknod",
+ rate(@nfs_s_p3_mknod),
+ "nfs_s_t_remove",
+ rate(@nfs_s_p2_remove) + rate(@nfs_s_p3_remove),
+ "nfs_s_t_rmdir",
+ rate(@nfs_s_p2_rmdir) + rate(@nfs_s_p3_rmdir),
+ "nfs_s_t_rename",
+ rate(@nfs_s_p2_rename) + rate(@nfs_s_p3_rename),
+ "nfs_s_t_link",
+ rate(@nfs_s_p2_link) + rate(@nfs_s_p3_link),
+ "nfs_s_t_readdir",
+ rate(@nfs_s_p2_readdir) + rate(@nfs_s_p3_readdir),
+ "nfs_s_t_readdirplus",
+ rate(@nfs_s_p3_readdirplus),
+ "nfs_s_t_fsstat",
+ rate(@nfs_s_p2_fsstat) + rate(@nfs_s_p3_fsstat),
+ "nfs_s_t_fsinfo",
+ rate(@nfs_s_p3_fsinfo),
+ "nfs_s_t_pathconf",
+ rate(@nfs_s_p3_pathconf),
+ "nfs_s_t_commit",
+ rate(@nfs_s_p3_commit),
+ "nfs_s_t_compound",
+ rate(@nfs_s_p4_compound)
+ );
+ }
+
+ # Get filesystem ocupation
+ @df = `/bin/df -klP`;
+ for ( $i = 1, $j = 0 ; $df[$i] ; $i++ ) {
+ if ( !( ( $df[$i] =~ /cdrom/ ) || ( $df[$i] =~ /cdrom/ ) ) ) {
+ chomp $df[$i];
+ ( $dumb, $fs[2][$j], $fs[3][$j], $dumb, $dumb, $fs[0][$j] ) =
+ split / +/, $df[$i];
+ $fs[1][$j] = prcnt( $fs[3][$j], $fs[2][$j] );
+ put_output( "mnt_$fs[0][$j]", $fs[1][$j] );
+ $j++;
+ }
+ }
+ $n_fs = $j;
+
+ # Check if number of columns have changed
+ if ( $n_cols[$r] != $n_cols[ 1 - $r ] ) {
+ $num++;
+ }
- # flush output
- flush_output();
+ # If year day has changed and is not first execution: zero output seq.
+ if ( ($rate_ok) && ( $yday[$r] != $yday[ 1 - $r ] ) ) {
+ $num = 0;
+ }
+
+ # Evaluate filename
+ $out_filename[$r] = sprintf "%s/proccol-%04d-%02d-%02d-%03d", $DEST_DIR,
+ $year, $mon, $mday, $num;
+
+ # on first execution check file existence
+ if ( !$rate_ok ) {
+ while ( -f $out_filename[$r] ) {
+ $num++;
+ $out_filename[$r] = sprintf "%s/proccol-%04d-%02d-%02d-%03d",
+ $DEST_DIR, $year, $mon, $mday, $num;
+ }
+ }
- $r=1-$r;
- $rate_ok=1;
+ # flush output if not in Debug mode
+ flush_output() if ( !$DEBUG );
-} while (1);
+ $r = 1 - $r;
+ $rate_ok = 1;
+
+} while ( !$DEBUG || $r ); # If in debug mode does only 2 iteractions
# to perl dont complain on unused vars
-($os,$n_fs,$net_parms,$n_nets,$cpu,$yday,$isdst)=($os,$n_fs,$net_parms,$n_nets,$cpu,$yday,$isdst);
+( $os, $n_fs, $net_parms, $n_nets, $cpu, $yday, $isdst ) =
+ ( $os, $n_fs, $net_parms, $n_nets, $cpu, $yday, $isdst );
sub rate {
- my ($a,$b) = @_;
- my $c;
- $c= (!($a&&$b))?0:((abs($a-$b)%$INTERVAL)==0)?abs($a-$b)/$INTERVAL:sprintf("%.3f",abs($a-$b)/$INTERVAL);
- return $c;
+ my ( $a, $b ) = @_;
+ my $c;
+ my $d = $INTERVAL; #1; # abs($timestamp[$r]-$timestamp[1-$r]);
+ if ( !defined $a || $a eq "" ) { $a = 0 }
+ if ( !defined $b || $b eq "" ) { $b = 0 }
+
+ $c =
+ ( $rate_ok == 1 )
+ ? ( ( ( abs( $a - $b ) % $d ) == 0 )
+ ? abs( $a - $b ) / $d
+ : sprintf( "%.3f", abs( $a - $b ) / $d ) )
+ : 0;
+
+ return $c;
}
sub prcnt {
- my ($a,$b) = @_;
- return ($b==0) ? 0 : sprintf ("%.2f",100 * $a / $b);
+ my ( $a, $b ) = @_;
+ if ( !defined $a || $a eq "" ) { $a = 0 }
+ if ( !defined $b || $b eq "" ) { $b = 0 }
+ return ( $b == 0 ) ? 0 : sprintf( "%.2f", 100 * $a / $b );
}
sub rate_prcnt {
- my ($a1,$a2,$b1,$b2) = @_;
- if (!($a1&&$b1&&$a2&&$b2)) {
- return 0;
- }
+ my ( $a1, $a2, $b1, $b2 ) = @_;
+ if ( !( $a1 && $b1 && $a2 && $b2 ) ) {
+ return 0;
+ }
- return (abs($b1-$b2)==0)?0:sprintf ("%.2f",100*abs($a1-$a2)/abs($b1-$b2));
-}
+ return ( abs( $b1 - $b2 ) == 0 )
+ ? 0
+ : sprintf( "%.2f", 100 * abs( $a1 - $a2 ) / abs( $b1 - $b2 ) );
+}
sub flush_output {
- my $t;
+ my $t;
- # check if new file is not required
- open (F_OUT,">>$out_filename[$r]") or die "Could not open output";
+ # check if new file is not required
+ open( F_OUT, ">>$out_filename[$r]" ) or die "Could not open output";
- if (!$rate_ok) {
- for ($t=0;$t<$n_cols[$r];$t++) {
- print F_OUT $out [0][$t]," ";
- }
- print F_OUT "\n";
- } else {
- if ( ($n_cols[$r]!=$n_cols[1-$r]) || ($out_filename[$r] ne $out_filename[1-$r]) || $rate_ok==0 ) {
- for ($t=0;$t<$n_cols[$r];$t++) {
- print F_OUT $out [0][$t]," ";
- }
- print F_OUT "\n";
- }
- if ($out_filename[$r] ne $out_filename[1-$r]) {
- `$COMPRESS $out_filename[1-$r]`;
- }
- }
-
- for ($t=0;$t<$n_cols[$r];$t++) {
- print F_OUT $out [1][$t]," ";
- }
- print F_OUT "\n";
- close F_OUT;
+ if ( !$rate_ok ) {
+ for ( $t = 0 ; $t < $n_cols[$r] ; $t++ ) {
+ print F_OUT $out[0][$t], " ";
+ }
+ print F_OUT "\n";
+ }
+ else {
+ if ( ( $n_cols[$r] != $n_cols[ 1 - $r ] )
+ || ( $out_filename[$r] ne $out_filename[ 1 - $r ] )
+ || $rate_ok == 0 )
+ {
+ for ( $t = 0 ; $t < $n_cols[$r] ; $t++ ) {
+ print F_OUT $out[0][$t], " ";
+ }
+ print F_OUT "\n";
+ }
+ if ( $out_filename[$r] ne $out_filename[ 1 - $r ] ) {
+ `$COMPRESS $out_filename[1-$r]`;
+ }
+ }
+
+ for ( $t = 0 ; $t < $n_cols[$r] ; $t++ ) {
+ print F_OUT $out[1][$t], " ";
+ }
+ print F_OUT "\n";
+ close F_OUT;
- @out=();
+ @out = ();
}
+
sub put_output {
- my (@a) = @_;
- my $t;
+ my (@a) = @_;
+ my $t;
- for ($t=0;$a[$t];$t+=2,$n_cols[$r]+=1) {
- $out [0][$n_cols[$r]]=$a[$t];
- $out [1][$n_cols[$r]]=$a[$t+1];
- }
+ for ( $t = 0 ; $a[$t] ; $t += 2, $n_cols[$r] += 1 ) {
+ $out[0][ $n_cols[$r] ] = $a[$t];
+ $out[1][ $n_cols[$r] ] = $a[ $t + 1 ];
+ if ($DEBUG) {
+ print $out[0][ $n_cols[$r] ] . ": " . $out[1][ $n_cols[$r] ] . "\n";
+ }
+ }
}
Copied: trunk/orca/data_gatherers/procallator/update_orca_server.sh.in (from r457, /trunk/orca/data_gatherers/procallator/update_orca_server.sh)
==============================================================================
--- /trunk/orca/data_gatherers/procallator/update_orca_server.sh (original)
+++ trunk/orca/data_gatherers/procallator/update_orca_server.sh.in Sun Jul 17 04:22:43 2005
@@ -1,5 +1,5 @@
server=Orca_Server::package
host=`hostname`
-cd /usr/local/var/orca/$host
+cd @VAR_DIR@/procallator:/$host
rsync --times --delete --recursive . $server/$host
cd /
More information about the Orca-checkins
mailing list