From guilherme_chehab at yahoo.com Fri Jul 1 07:05:51 2005 From: guilherme_chehab at yahoo.com (guilherme_chehab at yahoo.com) Date: Fri, 1 Jul 2005 07:05:51 -0700 Subject: [Orca-checkins] r457 - tags/orca/0.27/contrib/procallator Message-ID: <200507011405.j61E5pkZ003849@orca1.orcaware.com> Author: guilherme_chehab at yahoo.com Date: Fri Jul 1 07:05:23 2005 New Revision: 457 Added: tags/orca/0.27/contrib/procallator/CHANGES tags/orca/0.27/contrib/procallator/Makefile.in tags/orca/0.27/contrib/procallator/gpl.txt tags/orca/0.27/contrib/procallator/install.sh.in tags/orca/0.27/contrib/procallator/procallator.cfg.in tags/orca/0.27/contrib/procallator/procallator.in tags/orca/0.27/contrib/procallator/update_orca_server.sh.in Removed: tags/orca/0.27/contrib/procallator/install.sh tags/orca/0.27/contrib/procallator/procallator tags/orca/0.27/contrib/procallator/procallator.cfg tags/orca/0.27/contrib/procallator/update_orca_server.sh Modified: tags/orca/0.27/contrib/procallator/README tags/orca/0.27/contrib/procallator/TODO tags/orca/0.27/contrib/procallator/procallator.pl.in Log: 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 Added: tags/orca/0.27/contrib/procallator/CHANGES ============================================================================== --- (empty file) +++ tags/orca/0.27/contrib/procallator/CHANGES Fri Jul 1 07:05:23 2005 @@ -0,0 +1,15 @@ +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 Added: tags/orca/0.27/contrib/procallator/Makefile.in ============================================================================== --- (empty file) +++ tags/orca/0.27/contrib/procallator/Makefile.in Fri Jul 1 07:05:23 2005 @@ -0,0 +1,83 @@ + at SET_MAKE@ + +prefix = @prefix@ +exec_prefix = @exec_prefix@ +bindir = @bindir@ +libdir = @libdir@ +INSTALL = @INSTALL@ +MKDIR = @MKDIR@ +PERL_HEAD = @PERL_HEAD@ +VAR_DIR = @VAR_DIR@ +RRD_DIR = @RRD_DIR@ +RRDTOOL_DIR = @RRDTOOL_DIR@ +PROCALLATOR_DIR = $(VAR_DIR)/procallator +PERL_SCRIPTS = procallator.pl +SHELL_SCRIPTS = procallator install.sh update_orca_server.sh +TARGETS = $(PERL_SCRIPTS) $(SHELL_SCRIPTS) + +all: Makefile $(TARGETS) procallator.cfg + +install: all + $(MKDIR) $(bindir) + $(MKDIR) $(libdir) + $(MKDIR) $(RRD_DIR)/procallator + @for file in $(TARGETS); do \ + echo $(INSTALL) $$file $(bindir); \ + $(INSTALL) $$file $(bindir); \ + done + if test -r $(libdir)/procallator.cfg; then \ + cp -p $(libdir)/procallator.cfg $(libdir)/procallator.cfg.`date +%Y-%m-%d-%H:%M:%S`; \ + fi + $(INSTALL) -m 0644 procallator.cfg $(libdir) + $(INSTALL) -m 0755 procallator.pl $(libdir) + +procallator_run_at_boot: all + -$(RM) /etc/init.d/procallator /etc/rc0.d/K01procallator + -$(RM) /etc/rc1.d/K01procallator /etc/rc3.d/S99procallator + $(INSTALL) -m 0744 S99procallator /etc/init.d/procallator + ln /etc/init.d/procallator /etc/rc0.d/K01procallator + ln /etc/init.d/procallator /etc/rc1.d/K01procallator + ln /etc/init.d/procallator /etc/rc3.d/S99procallator + +clean: + $(RM) $(TARGETS) procallator.cfg + +distclean: clean + $(RM) *.sh Makefile + +.SUFFIXES: .pl .sh + +.pl: $(PERL_HEAD) + cat $(PERL_HEAD) $< > $@ + chmod 0755 $@ + +.sh: + cp $< $@ + chmod 0755 $@ + chmod 0755 procallator + +Makefile: Makefile.in + cd ../.. && CONFIG_FILES=contrib/procallator/Makefile ./config.status + chmod 755 *.pl *.sh procallator + $(MAKE) + +procallator.cfg: procallator.cfg.in + cd ../.. && CONFIG_FILES=contrib/procallator/procallator.cfg ./config.status + +procallator.pl: procallator.pl.in $(PERL_HEAD) + cd ../.. && CONFIG_FILES=contrib/procallator/procallator.pl ./config.status + cat $(PERL_HEAD) procallator.pl > procallator.perl + mv procallator.perl procallator.pl + chmod 0755 procallator.pl + +procallator: procallator.in + cd ../.. && CONFIG_FILES=contrib/procallator/procallator ./config.status + chmod 0755 procallator + +install.sh: install.sh.in + cd ../.. && CONFIG_FILES=contrib/procallator/install.sh ./config.status + chmod 0755 install.sh + +update_orca_server.sh: update_orca_server.sh.in + cd ../.. && CONFIG_FILES=contrib/procallator/update_orca_server.sh ./config.status + chmod 0755 update_orca_server.sh Modified: tags/orca/0.27/contrib/procallator/README ============================================================================== --- tags/orca/0.27/contrib/procallator/README (original) +++ tags/orca/0.27/contrib/procallator/README Fri Jul 1 07:05:23 2005 @@ -19,5 +19,5 @@ - on the server, run orca using the exmple procallator.cfg This software is in alpha stage, use at your own risk. -Any comments to Guilherme Chehab +Any comments to Guilherme Chehab Copyright (C) 2001 Guilherme Carvalho Chehab. All Rights Reserved Modified: tags/orca/0.27/contrib/procallator/TODO ============================================================================== --- tags/orca/0.27/contrib/procallator/TODO (original) +++ tags/orca/0.27/contrib/procallator/TODO Fri Jul 1 07:05:23 2005 @@ -3,7 +3,8 @@ - Document and optimize collectorn source code - Write better config file for network and NFS stats - Add web server stats - - LVM statsi + - LVM stats + - Organize and modularize code Copyright (C) 2001 Guilherme Carvalho Chehab. All Rights Reserved Added: tags/orca/0.27/contrib/procallator/gpl.txt ============================================================================== --- (empty file) +++ tags/orca/0.27/contrib/procallator/gpl.txt Fri Jul 1 07:05:23 2005 @@ -0,0 +1,280 @@ + GNU GENERAL PUBLIC LICENSE + Version 2, June 1991 + + Copyright (C) 1989, 1991 Free Software Foundation, Inc. + 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +License is intended to guarantee your freedom to share and change free +software--to make sure the software is free for all its users. This +General Public License applies to most of the Free Software +Foundation's software and to any other program whose authors commit to +using it. (Some other Free Software Foundation software is covered by +the GNU Library General Public License instead.) You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +this service if you wish), that you receive source code or can get it +if you want it, that you can change the software or use pieces of it +in new free programs; and that you know you can do these things. + + To protect your rights, we need to make restrictions that forbid +anyone to deny you these rights or to ask you to surrender the rights. +These restrictions translate to certain responsibilities for you if you +distribute copies of the software, or if you modify it. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must give the recipients all the rights that +you have. You must make sure that they, too, receive or can get the +source code. And you must show them these terms so they know their +rights. + + We protect your rights with two steps: (1) copyright the software, and +(2) offer you this license which gives you legal permission to copy, +distribute and/or modify the software. + + Also, for each author's protection and ours, we want to make certain +that everyone understands that there is no warranty for this free +software. If the software is modified by someone else and passed on, we +want its recipients to know that what they have is not the original, so +that any problems introduced by others will not reflect on the original +authors' reputations. + + Finally, any free program is threatened constantly by software +patents. We wish to avoid the danger that redistributors of a free +program will individually obtain patent licenses, in effect making the +program proprietary. To prevent this, we have made it clear that any +patent must be licensed for everyone's free use or not licensed at all. + + The precise terms and conditions for copying, distribution and +modification follow. + + GNU GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License applies to any program or other work which contains +a notice placed by the copyright holder saying it may be distributed +under the terms of this General Public License. The "Program", below, +refers to any such program or work, and a "work based on the Program" +means either the Program or any derivative work under copyright law: +that is to say, a work containing the Program or a portion of it, +either verbatim or with modifications and/or translated into another +language. (Hereinafter, translation is included without limitation in +the term "modification".) Each licensee is addressed as "you". + +Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running the Program is not restricted, and the output from the Program +is covered only if its contents constitute a work based on the +Program (independent of having been made by running the Program). +Whether that is true depends on what the Program does. + + 1. You may copy and distribute verbatim copies of the Program's +source code as you receive it, in any medium, provided that you +conspicuously and appropriately publish on each copy an appropriate +copyright notice and disclaimer of warranty; keep intact all the +notices that refer to this License and to the absence of any warranty; +and give any other recipients of the Program a copy of this License +along with the Program. + +You may charge a fee for the physical act of transferring a copy, and +you may at your option offer warranty protection in exchange for a fee. + + 2. You may modify your copy or copies of the Program or any portion +of it, thus forming a work based on the Program, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) You must cause the modified files to carry prominent notices + stating that you changed the files and the date of any change. + + b) You must cause any work that you distribute or publish, that in + whole or in part contains or is derived from the Program or any + part thereof, to be licensed as a whole at no charge to all third + parties under the terms of this License. + + c) If the modified program normally reads commands interactively + when run, you must cause it, when started running for such + interactive use in the most ordinary way, to print or display an + announcement including an appropriate copyright notice and a + notice that there is no warranty (or else, saying that you provide + a warranty) and that users may redistribute the program under + these conditions, and telling the user how to view a copy of this + License. (Exception: if the Program itself is interactive but + does not normally print such an announcement, your work based on + the Program is not required to print an announcement.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Program, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Program, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Program. + +In addition, mere aggregation of another work not based on the Program +with the Program (or with a work based on the Program) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may copy and distribute the Program (or a work based on it, +under Section 2) in object code or executable form under the terms of +Sections 1 and 2 above provided that you also do one of the following: + + a) Accompany it with the complete corresponding machine-readable + source code, which must be distributed under the terms of Sections + 1 and 2 above on a medium customarily used for software interchange; or, + + b) Accompany it with a written offer, valid for at least three + years, to give any third party, for a charge no more than your + cost of physically performing source distribution, a complete + machine-readable copy of the corresponding source code, to be + distributed under the terms of Sections 1 and 2 above on a medium + customarily used for software interchange; or, + + c) Accompany it with the information you received as to the offer + to distribute corresponding source code. (This alternative is + allowed only for noncommercial distribution and only if you + received the program in object code or executable form with such + an offer, in accord with Subsection b above.) + +The source code for a work means the preferred form of the work for +making modifications to it. For an executable work, complete source +code means all the source code for all modules it contains, plus any +associated interface definition files, plus the scripts used to +control compilation and installation of the executable. However, as a +special exception, the source code distributed need not include +anything that is normally distributed (in either source or binary +form) with the major components (compiler, kernel, and so on) of the +operating system on which the executable runs, unless that component +itself accompanies the executable. + +If distribution of executable or object code is made by offering +access to copy from a designated place, then offering equivalent +access to copy the source code from the same place counts as +distribution of the source code, even though third parties are not +compelled to copy the source along with the object code. + + 4. You may not copy, modify, sublicense, or distribute the Program +except as expressly provided under this License. Any attempt +otherwise to copy, modify, sublicense or distribute the Program is +void, and will automatically terminate your rights under this License. +However, parties who have received copies, or rights, from you under +this License will not have their licenses terminated so long as such +parties remain in full compliance. + + 5. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Program or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Program (or any work based on the +Program), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Program or works based on it. + + 6. Each time you redistribute the Program (or any work based on the +Program), the recipient automatically receives a license from the +original licensor to copy, distribute or modify the Program subject to +these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties to +this License. + + 7. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Program at all. For example, if a patent +license would not permit royalty-free redistribution of the Program by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Program. + +If any portion of this section is held invalid or unenforceable under +any particular circumstance, the balance of the section is intended to +apply and the section as a whole is intended to apply in other +circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system, which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 8. If the distribution and/or use of the Program is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Program under this License +may add an explicit geographical distribution limitation excluding +those countries, so that distribution is permitted only in or among +countries not thus excluded. In such case, this License incorporates +the limitation as if written in the body of this License. + + 9. The Free Software Foundation may publish revised and/or new versions +of the General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + +Each version is given a distinguishing version number. If the Program +specifies a version number of this License which applies to it and "any +later version", you have the option of following the terms and conditions +either of that version or of any later version published by the Free +Software Foundation. If the Program does not specify a version number of +this License, you may choose any version ever published by the Free Software +Foundation. + + 10. If you wish to incorporate parts of the Program into other free +programs whose distribution conditions are different, write to the author +to ask for permission. For software which is copyrighted by the Free +Software Foundation, write to the Free Software Foundation; we sometimes +make exceptions for this. Our decision will be guided by the two goals +of preserving the free status of all derivatives of our free software and +of promoting the sharing and reuse of software generally. + + NO WARRANTY + + 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY +FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN +OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES +PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED +OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS +TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE +PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, +REPAIR OR CORRECTION. + + 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR +REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, +INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING +OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED +TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY +YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER +PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE +POSSIBILITY OF SUCH DAMAGES. + + END OF TERMS AND CONDITIONS Added: tags/orca/0.27/contrib/procallator/install.sh.in ============================================================================== --- (empty file) +++ tags/orca/0.27/contrib/procallator/install.sh.in Fri Jul 1 07:05:23 2005 @@ -0,0 +1,13 @@ +cp procallator.pl /usr/local/bin +cp procallator /etc/rc.d/init.d +ln -s /etc/rc.d/init.d/procallator /etc/rc.d/rc3.d/S99procallator +ln -s /etc/rc.d/init.d/procallator /etc/rc.d/rc3.d/K10procallator +ln -s /etc/rc.d/init.d/procallator /etc/rc.d/rc5.d/S99procallator +ln -s /etc/rc.d/init.d/procallator /etc/rc.d/rc5.d/K10procallator +chmod 755 /etc/rc.d/init.d/procallator +chmod 755 /usr/local/bin/procallator.pl +/etc/rc.d/init.d/procallator start +echo "Dont forget to copy procallator.cfg to your orca server, and start a new instance of orca using this file as the config file" +echo "To copy the collected files I suggest the use of rsync" +echo "This software is in alpha stagge, use at you own risk" +echo "Copyright (C) 2001 Guilherme Carvalho Chehab. All Rights Reserved" Added: tags/orca/0.27/contrib/procallator/procallator.cfg.in ============================================================================== --- (empty file) +++ tags/orca/0.27/contrib/procallator/procallator.cfg.in Fri Jul 1 07:05:23 2005 @@ -0,0 +1,743 @@ +# Orca configuration file for procallator files. + +# Require at least this version of Orca +require Orca 0.265 + +# base_dir is prepended to the paths find_files, html_dir, rrd_dir, +# and state_file only if the path does not match the regular +# expression ^\\?\.{0,2}/, which matches /, ./, ../, and \./. +base_dir @RRD_DIR@/procallator + +# rrd_dir specifies the location of the generated RRD data files. +rrd_dir . + +# state_file specifies the location of the state file that remembers +# the modification time of each source data file. +state_file orca.state + +# html_dir specifies the top of the HTML tree created by Orca. +html_dir @HTML_DIR@/procallator + +# By default create .meta tag files for all PNGs or GIFs so that the +# web browser will automatically reload them. +expire_images 1 + +# Find files at the following times: +# 0:10 to pick up new orcallator files for the new day. +# 1:00 to pick up late comer orcallator files for the new day. +# 6:00 to pick up new files before the working day. +# 12:00 to pick up new files during the working day. +# 19:00 to pick up new files after the working day. +find_times 0:10 1:00 6:00 12:00 19:00 + +# 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 +# the data source. +warn_email root at localhost +late_interval interval + 30 + +# These parameters specify which plots to generate. +generate_hourly_plot 1 +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 primarly used to display the site's logo. +html_page_header

Put your site's logo here.

+ +# This sets the text that is placed in the pages' +# 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. +html_page_footer + + These plots brought to you by your local system administrator. + + + +# This defines where the find the source data files and the format of +# those files. Notes about the fields: +# find_files +# You'll notice that all but the first () has the form (?:...). +# This tells Perl to match the expression but not save the matched +# text in the $1, $2, variables. Orca uses the matched text to +# generate a subgroup name, which is used to place files into +# different subgroups. Here, only the hostname should be used to +# generate a subgroup name, hence all the (?:...) for matching +# anything else. +# interval +# The interval here must match the interval used by orcallator to +# record data. Do not change this, as it has an effect on the +# generated RRD data files. + +group orcallator { +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 +#date_format %s +interval 300 +reopen 1 +filename_compare sub { + my ($ay, $am, $ad) = $a =~ /-(\d{4})-(\d\d)-(\d\d)/; + my ($by, $bm, $bd) = $b =~ /-(\d{4})-(\d\d)-(\d\d)/; + if (my $c = (( $ay <=> $by) || + ( $am <=> $bm) || + (($ad >> 3) <=> ($bd >> 3)))) { + return 2*$c; + } + $ad <=> $bd; + } +} + +plot { +title %g Average # Processes in Run Queue (Load Average) & number of CPUs +source orcallator +data 1runq +data 5runq +data 15runq +data ncpus +color 00ff00 +color 0000ff +color ff00ff +color ff0000 +line_type LINE1 +line_type LINE1 +line_type LINE1 +line_type LINE2 +legend 1 minute average +legend 5 minute average +legend 15 minute average +legend CPUs (load threshold) +y_legend Number of processes and CPUs + +data_min 0 +data_max 100 +href http://www.orcaware.com/orca/docs/orcallator.html#processes_in_run_queue +} + +plot { +title %g CPU Usage +source orcallator +data usr% +data sys% +data 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 +data_max 100 +plot_min 0 +plot_max 100 +rigid_min_max 1 +color 00ff00 +color 0000ff +color ffff4f +color ff0000 +color ffffd0 +href http://www.orcaware.com/orca/docs/orcallator.html#cpu_usage +} + +plot { +title %g New Process Spawn Rate +source orcallator +data #proc/s +line_type area +line_type line1 +legend 5 min average +y_legend New processes/s +data_min 0 +data_max 100000 +href http://www.orcaware.com/orca/docs/orcallator.html#new_process_spawn_rate +} + +plot { +title %g Number of System & running Processes on cpu per cpu +source orcallator +data #proc / ncpus +data #proc_oncpu / ncpus +data #proc_blckd / ncpus +line_type line1 +line_type area +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 +} + +plot { +title %g Web Server Hit Rate +source orcallator +data httpop/s +data http/p5s +line_type area +line_type line1 +legend 5 min average hits/s +legend Peak 5 second hits/s +y_legend Hits/s +data_min 0 +color 00ff00 +color 0000ff +href http://www.orcaware.com/orca/docs/orcallator.html#web_server_hit_rate +} + +plot { +title %g Web Server File Size +source orcallator +data %to1KB +data %to10KB +data %to100KB +data %to1MB +data %over1MB +line_type area +line_type stack +line_type stack +line_type stack +line_type stack +legend 0 - 1 KB +legend 1 - 10 KB +legend 10 - 100 KB +legend 100 - 1000 KB +legend Greater than 1 MB +y_legend Percent +data_min 0 +data_max 100 +plot_min 0 +plot_max 100 +rigid_min_max 1 +href http://www.orcaware.com/orca/docs/orcallator.html#web_server_file_size +} + +plot { +title %g Web Server Data Transfer Rate +source orcallator +data httpb/s +line_type area +legend Bytes/s +y_legend Bytes/s +data_min 0 +href http://www.orcaware.com/orca/docs/orcallator.html#web_server_data_transfer_rate +} + +plot { +title %g Web Server HTTP Error Rate +source orcallator +data htErr/s +line_type area +legend HTTP errors/s +y_legend Errors/s +data_min 0 +href http://www.orcaware.com/orca/docs/orcallator.html#web_server_error_rate +} + +plot { +title %g Memory Page ins & outs rate +source orcallator +data mempages_in +data mempages_out +legend pages in/s +legend pages out/s +y_legend Pages/s +data_min 0 +} + +plot { +title %g Swap ins & outs rate +source orcallator +data swap_in +data swap_out +legend Swap in/s +legend Swap out/s +y_legend Pages/s +data_min 0 +} + +plot { +title %g Context switches & Interrupts rate per CPU +source orcallator +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 Bits Per Second +source orcallator +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_bits_per_second +} + +plot { +title %g Interface Ouput Bits Per Second +source orcallator +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_bits_per_second +} + +plot { +title %g Interface Input Packets Per Second +source orcallator +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 orcallator +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/orcallator.html#interface_packets_per_second +} + +plot { +title %g Interface Input Errors Per Second +source orcallator +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_errors_per_second +} + +plot { +title %g Interface Output Errors Per Second +source orcallator +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/orcallator.html#interface_errors_per_second +} + +plot { +title %g Interface Input Dropped Per Second +source orcallator +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 +} + +plot { +title %g Interface Output Dropped Per Second +source orcallator +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/orcallator.html#interface_deferred_packet_rate +} + +plot { +title %g Interface Output Collisions +source orcallator +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 +} + +plot { +title %g Interface Output Carrier Losses +source orcallator +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/orcallator.html#interface_collisions +} + +plot { +title %g IP Traffic statistics +source orcallator +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 orcallator +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 orcallator +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 +flush_regexps 1 +} + + +plot { +title %g TCP Traffic statistics +source orcallator +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 orcallator +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 orcallator +data Icmp_(.*) +data_type counter +legend $1 rate +y_legend rate +data_min 0 +flush_regexps 1 +} + +plot { +title %g UDP statistics +source orcallator +data Udp_(.*) +data_type counter +legend $1 rate +y_legend rate +data_min 0 +flush_regexps 1 +} + +plot { +title %g NFS Server Statistics +source orcallator +data nfs_s_(.*) +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/orcallator.html#NFS_server_call_rate +} + +plot { +title %g NFS Client Statistics +source orcallator +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/orcallator.html#NFS_server_call_rate +} + +plot { +title %g Disk System Wide Reads/Writes Per Second +source orcallator +data disk_rd/s +data disk_wr/s +line_type area +line_type line1 +legend Reads/s +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 +} + +plot { +title %g Disk System Wide Transfer Rate +source orcallator +data disk_rB/s +data disk_wB/s +line_type area +line_type line1 +legend Read transfer rate +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 +} + +plot { +title %g Disk Reads/Writes Per Second +source orcallator +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/orcallator.html#disk_system_wide_reads_writes_per_second +} + +plot { +title %g Disk Transfer Rate +source orcallator +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/orcallator.html#disk_system_wide_transfer_rate +} + + + +plot { +title %g Disk Space Percent Usage +source orcallator +data mnt_(.*) +line_type line1 +legend $1 +y_legend Percent Used +data_min 0 +data_max 100 +plot_min 0 +plot_max 100 +href http://www.orcaware.com/orca/docs/orcallator.html#disk_space_percent_usage +} + +plot { +title %g Physical Memory usage percent +source orcallator +data mem_used% +data mem_free% +data mem_shrd% +data mem_buff% +data mem_cchd% +line_type area +line_type stack +line_type line1 +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 +plot_min 0 +plot_max 100 +href http://www.orcaware.com/orca/docs/orcallator.html#memory_free +} + +plot { +title %g Swap usage percent +source orcallator +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/orcallator.html#memory_free +} + + +plot { +title %g Memory Page Scan Rate +source orcallator +data scanrate +line_type area +legend Page scan rate +y_legend Pages/s +data_min 0 +href http://www.orcaware.com/orca/docs/orcallator.html#page_scan_rate +} + +plot { +title %g Memory Page Residence Time +source orcallator +data page_rstim +line_type area +legend Page residence time +y_legend Seconds +data_min 0 +href http://www.orcaware.com/orca/docs/orcallator.html#page_residence_time +} + +plot { +title %g Memory Available Swap Space +source orcallator +data 1024 * swap_avail +line_type area +legend Available swap space +y_legend Bytes +base 1024 +data_min 0 +href http://www.orcaware.com/orca/docs/orcallator.html#available_swap_space +} + +plot { +title %g Memory Page Usage +source orcallator +data pp_kernel +data free_pages +data pagestotl - pp_kernel - free_pages +data pagestotl +line_type area +line_type stack +line_type stack +line_type line1 +legend Kernel +legend Free list +legend Other +legend System total +y_legend Number Of Pages +data_min 0 +plot_min 0 +color 00ff00 +color ff0000 +color 0000ff +href http://www.orcaware.com/orca/docs/orcallator.html#page_usage +} + +plot { +title %g Memory Pages Locked & IO +source orcallator +data pageslock +data pagesio +line_type area +line_type line1 +legend Locked +legend IO +y_legend Number Of Pages +data_min 0 +plot_min 0 +href http://www.orcaware.com/orca/docs/orcallator.html#pages_locked_IO +} Added: tags/orca/0.27/contrib/procallator/procallator.in ============================================================================== --- (empty file) +++ tags/orca/0.27/contrib/procallator/procallator.in Fri Jul 1 07:05:23 2005 @@ -0,0 +1,31 @@ +#!/bin/sh +# +# procallator Script to load procallator at time. +# +# Author Guilherme Carvalho Chehab +# + +# Source function library. +. /etc/init.d/functions + +# See how we were called. +case "$1" in + start) + if [ -f /usr/local/bin/procallator.pl ]; then + action "Initializing procalator statistics colector " /usr/local/bin/procallator.pl & + fi + + ;; + stop) + action "Stopping procallator" kill `ps -ef | grep procallat | grep -v grep | tr -s " " | cut -f 2 -d " "` + + ;; + *) + # do not advertise unreasonable commands that there is no reason + # to use with this device + echo "Usage: procallator {start|stop}" + exit 1 +esac + +exit 0 + Modified: tags/orca/0.27/contrib/procallator/procallator.pl.in ============================================================================== --- tags/orca/0.27/contrib/procallator/procallator.pl.in (original) +++ tags/orca/0.27/contrib/procallator/procallator.pl.in Fri Jul 1 07:05:23 2005 @@ -1,25 +1,55 @@ #!/usr/bin/perl -w # -# collector for /proc statistics for use with Linux 2.2 and 2.4 kernels. +# Performance statistics collector for /proc statistics for use +# with Linux 2.2, 2.4 & 2.6 kernels. # -# Copyright (C) 2001 Guilherme Carvalho Chehab. All Rights Reserved. +# Copyright (C) 2001 Guilherme Carvalho Chehab. # +# 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. +# +# 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. +# +# 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. + # Config variables -#$PROC="./linux-2.2"; # Proc directory, usually /proc + $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="/usr/local/var/orca/$HOSTNAME"; # Destination dir for output files -#$DEST_DIR="/tmp"; # Destination dir for output files +$DEST_DIR="@VAR_DIR@/procallator/$HOSTNAME"; # Destination dir for output files +#$DEST_DIR="/tmp"; # Destination dir for output files +# +# Output Options +$NFS_PROTO_DETAILS=0; # Include per NFS per protocol versions stats on output # Initializations +$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; +} + # Create output dir if needed -if (! -d $DEST_DIR ) { +if (! -d $DEST_DIR && !$DEBUG) { `mkdir -p $DEST_DIR`; } @@ -28,29 +58,34 @@ ($os,$line,$version)=split / +/ , , 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); + sleep ($INTERVAL-time() % $INTERVAL) if (!$DEBUG); + sleep ($INTERVAL) if ($DEBUG && $rate_ok); # Loop initializations $n_cols[$r]=0; - # Get Local time & uptime - $timestamp=time(); - ($sec,$min,$hour,$mday,$mon,$year,$yday,$isdst)=localtime($timestamp); + # 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 / +/,; 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; + put_output("timestamp",$timestamp[$r],"locltime",$locltime,"uptime",$uptime); # Read load average open (F_LOADAVG, "<$PROC/loadavg"); @@ -71,12 +106,15 @@ while ( $line= ) { 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]; + ($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, $page_in[$r], $page_out[$r])= split / +/,$line; + ($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; @@ -84,6 +122,10 @@ 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; @@ -115,6 +157,13 @@ $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++; } } @@ -173,8 +222,9 @@ $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%",$idle_100[$i]); + 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]); @@ -182,8 +232,97 @@ } } - put_output ( "pages_in",rate(@page_in), - "pages_out",rate(@page_out), + # 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=) { + # 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=) { + 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), @@ -197,38 +336,48 @@ "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"); - ; - ($dumb, $mem_total,$mem_used,$mem_free,$mem_shrd,$mem_buff,$mem_cchd)=split /[^0-9]+/,; - ($dumb, $swp_total,$swp_used,$swp_free)=split /[^0-9]+/,; + if ( $version!~/^2\.6/ ) { + ; + ($dumb, $mem_total,$mem_used,$mem_free,$mem_shrd,$mem_buff,$mem_cchd)=split /[^0-9]+/,; + ($dumb, $swp_total,$swp_used,$swp_free)=split /[^0-9]+/,; + } else { + while ($line=) { + 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), @@ -276,9 +425,24 @@ } } $n_nets=$i; + close (F_NET_DEV); # Get TCP/IP statistics - open (F_SNMP, "<$PROC/net/snmp"); + # + 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=) { $line2=; @@ -310,7 +474,7 @@ 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]); + put_output("$net_parm[0][$j]",$net_parm[2+$r][$j]); last SWITCH; } put_output("$net_parm[0][$j]",$net_parm[1][$j]); @@ -319,7 +483,9 @@ } } } + close (F_SNMP); $net_parms=$j; + } # Get NFS Client statistics if ( -f "$PROC/net/rpc/nfs") { @@ -359,7 +525,7 @@ "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], @@ -391,11 +557,68 @@ "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"); @@ -438,7 +661,7 @@ "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], @@ -470,19 +693,83 @@ "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++; + } + + # 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; - # flush output - flush_output(); + # 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; + } + } + + # flush output if not in Debug mode + flush_output() if (!$DEBUG); $r=1-$r; $rate_ok=1; -} while (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); @@ -490,12 +777,19 @@ 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); + 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) = @_; + if (!defined $a || $a eq "") {$a=0} ; + if (!defined $b || $b eq "") {$b=0} ; return ($b==0) ? 0 : sprintf ("%.2f",100 * $a / $b); } @@ -546,5 +840,8 @@ 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"; + } } } Added: tags/orca/0.27/contrib/procallator/update_orca_server.sh.in ============================================================================== --- (empty file) +++ tags/orca/0.27/contrib/procallator/update_orca_server.sh.in Fri Jul 1 07:05:23 2005 @@ -0,0 +1,5 @@ +server=Orca_Server::package +host=`hostname` +cd @VAR_DIR@/procallator:/$host +rsync --times --delete --recursive . $server/$host +cd / From guilherme_chehab at yahoo.com Mon Jul 4 12:18:23 2005 From: guilherme_chehab at yahoo.com (guilherme_chehab at yahoo.com) Date: Mon, 4 Jul 2005 12:18:23 -0700 Subject: [Orca-checkins] r458 - tags/orca/0.27/contrib/procallator Message-ID: <200507041918.j64JINph023617@orca1.orcaware.com> Author: guilherme_chehab at yahoo.com Date: Mon Jul 4 12:17:53 2005 New Revision: 458 Added: tags/orca/0.27/contrib/procallator/install.sh - copied unchanged from r456, /tags/orca/0.27/contrib/procallator/install.sh tags/orca/0.27/contrib/procallator/procallator - copied unchanged from r456, /tags/orca/0.27/contrib/procallator/procallator tags/orca/0.27/contrib/procallator/procallator.cfg - copied unchanged from r456, /tags/orca/0.27/contrib/procallator/procallator.cfg tags/orca/0.27/contrib/procallator/update_orca_server.sh - copied unchanged from r456, /tags/orca/0.27/contrib/procallator/update_orca_server.sh Removed: tags/orca/0.27/contrib/procallator/CHANGES tags/orca/0.27/contrib/procallator/Makefile.in tags/orca/0.27/contrib/procallator/gpl.txt tags/orca/0.27/contrib/procallator/install.sh.in tags/orca/0.27/contrib/procallator/procallator.cfg.in tags/orca/0.27/contrib/procallator/procallator.in tags/orca/0.27/contrib/procallator/update_orca_server.sh.in Modified: tags/orca/0.27/contrib/procallator/README tags/orca/0.27/contrib/procallator/TODO tags/orca/0.27/contrib/procallator/procallator.pl.in Log: * tags/orca/0.27: Revert revision 457 which committed the new procallator code to Orca's 0.27 tag instead of trunk. Modified: tags/orca/0.27/contrib/procallator/README ============================================================================== --- tags/orca/0.27/contrib/procallator/README (original) +++ tags/orca/0.27/contrib/procallator/README Mon Jul 4 12:17:53 2005 @@ -19,5 +19,5 @@ - on the server, run orca using the exmple procallator.cfg This software is in alpha stage, use at your own risk. -Any comments to Guilherme Chehab +Any comments to Guilherme Chehab Copyright (C) 2001 Guilherme Carvalho Chehab. All Rights Reserved Modified: tags/orca/0.27/contrib/procallator/TODO ============================================================================== --- tags/orca/0.27/contrib/procallator/TODO (original) +++ tags/orca/0.27/contrib/procallator/TODO Mon Jul 4 12:17:53 2005 @@ -3,8 +3,7 @@ - Document and optimize collectorn source code - Write better config file for network and NFS stats - Add web server stats - - LVM stats - - Organize and modularize code + - LVM statsi Copyright (C) 2001 Guilherme Carvalho Chehab. All Rights Reserved Modified: tags/orca/0.27/contrib/procallator/procallator.pl.in ============================================================================== --- tags/orca/0.27/contrib/procallator/procallator.pl.in (original) +++ tags/orca/0.27/contrib/procallator/procallator.pl.in Mon Jul 4 12:17:53 2005 @@ -1,55 +1,25 @@ #!/usr/bin/perl -w # -# Performance statistics collector for /proc statistics for use -# with Linux 2.2, 2.4 & 2.6 kernels. +# collector for /proc statistics for use with Linux 2.2 and 2.4 kernels. # -# Copyright (C) 2001 Guilherme Carvalho Chehab. +# Copyright (C) 2001 Guilherme Carvalho Chehab. All Rights Reserved. # -# 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. -# -# 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. -# -# 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. - # Config variables - +#$PROC="./linux-2.2"; # Proc directory, usually /proc $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 -#$DEST_DIR="/tmp"; # Destination dir for output files -# -# Output Options -$NFS_PROTO_DETAILS=0; # Include per NFS per protocol versions stats on output +$DEST_DIR="/usr/local/var/orca/$HOSTNAME"; # Destination dir for output files +#$DEST_DIR="/tmp"; # Destination dir for output files # Initializations -$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; -} - # Create output dir if needed -if (! -d $DEST_DIR && !$DEBUG) { +if (! -d $DEST_DIR ) { `mkdir -p $DEST_DIR`; } @@ -58,34 +28,29 @@ ($os,$line,$version)=split / +/ , , 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) if (!$DEBUG); - sleep ($INTERVAL) if ($DEBUG && $rate_ok); + sleep ($INTERVAL-time() % $INTERVAL); # Loop initializations $n_cols[$r]=0; - # Get Local time - $timestamp[$r]=time(); - ($sec,$min,$hour,$mday,$mon,$year,$yday[$r],$isdst)=localtime($timestamp[$r]); + # 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; - - # Get uptime open (F_UPTIME,"<$PROC/uptime"); ($uptime)=split / +/,; close (F_UPTIME); # insert in output table - put_output("timestamp",$timestamp[$r],"locltime",$locltime,"uptime",$uptime); + 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"); @@ -106,15 +71,12 @@ while ( $line= ) { 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]; + ($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, $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 + ($dumb, $page_in[$r], $page_out[$r])= split / +/,$line; } if ( $line=~/swap/) { ($dumb, $swap_in[$r], $swap_out[$r])= split / +/,$line; @@ -122,10 +84,6 @@ 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; @@ -157,13 +115,6 @@ $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++; } } @@ -222,9 +173,8 @@ $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]); + 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]); @@ -232,97 +182,8 @@ } } - # 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=) { - # 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=) { - 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), + 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), @@ -336,48 +197,38 @@ "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"); - if ( $version!~/^2\.6/ ) { - ; - ($dumb, $mem_total,$mem_used,$mem_free,$mem_shrd,$mem_buff,$mem_cchd)=split /[^0-9]+/,; - ($dumb, $swp_total,$swp_used,$swp_free)=split /[^0-9]+/,; - } else { - while ($line=) { - 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; - } - + ; + ($dumb, $mem_total,$mem_used,$mem_free,$mem_shrd,$mem_buff,$mem_cchd)=split /[^0-9]+/,; + ($dumb, $swp_total,$swp_used,$swp_free)=split /[^0-9]+/,; 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), @@ -425,24 +276,9 @@ } } $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"); - } - - + open (F_SNMP, "<$PROC/net/snmp"); $j=0; while ($line=) { $line2=; @@ -474,7 +310,7 @@ 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]); + put_output("g$net_parm[0][$j]",$net_parm[2+$r][$j]); last SWITCH; } put_output("$net_parm[0][$j]",$net_parm[1][$j]); @@ -483,9 +319,7 @@ } } } - close (F_SNMP); $net_parms=$j; - } # Get NFS Client statistics if ( -f "$PROC/net/rpc/nfs") { @@ -525,7 +359,7 @@ "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], @@ -557,68 +391,11 @@ "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"); @@ -661,7 +438,7 @@ "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], @@ -693,83 +470,19 @@ "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++; - } - - # 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; - } - } - - # flush output if not in Debug mode - flush_output() if (!$DEBUG); + # flush output + flush_output(); $r=1-$r; $rate_ok=1; -} while (!$DEBUG || $r); # If in debug mode does only 2 iteractions +} while (1); # 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); @@ -777,19 +490,12 @@ sub rate { 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; - + $c= (!($a&&$b))?0:((abs($a-$b)%$INTERVAL)==0)?abs($a-$b)/$INTERVAL:sprintf("%.3f",abs($a-$b)/$INTERVAL); return $c; } sub prcnt { 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); } @@ -840,8 +546,5 @@ 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"; - } } } From blair at orcaware.com Sun Jul 10 22:21:57 2005 From: blair at orcaware.com (blair at orcaware.com) Date: Sun, 10 Jul 2005 22:21:57 -0700 Subject: [Orca-checkins] r461 - in trunk/orca: . data_gatherers/orcallator data_gatherers/procallator data_gatherers/winallator docs lib lib/Orca orca patches Message-ID: <200507110521.j6B5Lvp6022666@orca1.orcaware.com> Author: blair at orcaware.com Date: Sun Jul 10 22:21:08 2005 New Revision: 461 Modified: trunk/orca/CHANGES (props changed) trunk/orca/COMMITTERS (props changed) trunk/orca/COPYING (props changed) trunk/orca/COPYING-GPL (props changed) trunk/orca/FAQ (props changed) trunk/orca/INSTALL (props changed) trunk/orca/Makefile.in (props changed) trunk/orca/NEWS (props changed) trunk/orca/README (props changed) trunk/orca/README.DEVELOPERS (contents, props changed) trunk/orca/TODO (props changed) trunk/orca/autogen.sh (props changed) trunk/orca/configure.in (props changed) trunk/orca/data_gatherers/orca_services/README (props changed) trunk/orca/data_gatherers/orcallator/orcallator_column.pl (props changed) trunk/orca/data_gatherers/procallator/README (props changed) trunk/orca/data_gatherers/procallator/update_orca_server.sh (props changed) trunk/orca/data_gatherers/winallator/README (props changed) trunk/orca/data_gatherers/winallator/SourceFile.pm-patch-with-r362.txt (props changed) trunk/orca/data_gatherers/winallator/winallator.htm (props changed) trunk/orca/docs/manual.html (props changed) trunk/orca/lib/Orca/Config.pm (props changed) trunk/orca/lib/Orca/Constants.pm (props changed) trunk/orca/lib/Orca/DataFile.pm (props changed) trunk/orca/lib/Orca/HTMLFile.pm (props changed) trunk/orca/lib/Orca/ImageFile.pm (props changed) trunk/orca/lib/Orca/NewState.pm (props changed) trunk/orca/lib/Orca/OldState.pm (props changed) trunk/orca/lib/Orca/OpenFileHash.pm (props changed) trunk/orca/lib/Orca/RRDFile.pm (props changed) trunk/orca/lib/Orca/SourceFile.pm (props changed) trunk/orca/lib/Orca/SourceFileIDs.pm (props changed) trunk/orca/lib/Orca/Utils.pm (props changed) trunk/orca/lib/orca_logo.gif (props changed) trunk/orca/lib/rothschild_image_logo.png (props changed) trunk/orca/lib/rothschild_image_logo.psd (props changed) trunk/orca/lib/rrdtool_logo.gif (props changed) trunk/orca/orca/upgrade_installation.pl (props changed) trunk/orca/patches/kstat.se-fjge-interface-patch.txt (props changed) trunk/orca/patches/netif.se-fjge-interface-patch.txt (props changed) Log: Apply all Subversion properties listed in the automatic properties section of ~blair/.subversion/config using svn_apply_autoprops.py. * trunk/orca: Add or modify svn:keywords. Modified: trunk/orca/README.DEVELOPERS ============================================================================== --- trunk/orca/README.DEVELOPERS (original) +++ trunk/orca/README.DEVELOPERS Sun Jul 10 22:21:08 2005 @@ -7,7 +7,7 @@ DEVELOPERS'S GUIDE TO ORCA ========================== -$LastChangedDate: 2002-11-07 09:30:37 -0800 (Thu, 07 Nov 2002) $ +$LastChangedDate$ TABLE OF CONTENTS From guilherme_chehab at yahoo.com Sun Jul 17 04:23:57 2005 From: guilherme_chehab at yahoo.com (guilherme_chehab at yahoo.com) Date: Sun, 17 Jul 2005 04:23:57 -0700 Subject: [Orca-checkins] r466 - in trunk/orca: . Message-ID: <200507171123.j6HBNv9R000546@orca1.orcaware.com> 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 -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 +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

Put your site's logo here.

+# web page and is primarly used to display the site's logo. +html_page_header

Put your site's logo here.

-# 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 -# element and also placed in the HTML body after the html_page_header -# in a

element index.html file. -html_top_title Orca Host Status +# This sets the text that is placed in the pages' +# 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 / +/ , , 4; -close (F_VERSION); +open( F_VERSION, "<$PROC/version" ); +( $os, $line, $version ) = split / +/, , 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 / +/, ; + 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 / +|\//, ; + 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 = ) { + 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 / +/,; - 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 / +|\//, ; - 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= ) { - 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"); - ; - ($dumb, $mem_total,$mem_used,$mem_free,$mem_shrd,$mem_buff,$mem_cchd)=split /[^0-9]+/,; - ($dumb, $swp_total,$swp_used,$swp_free)=split /[^0-9]+/,; - 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=) { - 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=) { - $line2=; - 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=) { - - 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=) { - - 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 = ) { + + # 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 = ) { + 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/ ) { + ; + ( + $dumb, $mem_total, $mem_used, $mem_free, + $mem_shrd, $mem_buff, $mem_cchd + ) + = split /[^0-9]+/, ; + ( $dumb, $swp_total, $swp_used, $swp_free ) = split /[^0-9]+/, + ; + } + else { + while ( $line = ) { + 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 = ) { + 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 = ) { + $line2 = ; + 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 = ) { + + 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 = ) { + + 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 / From blair at orcaware.com Wed Jul 20 19:49:33 2005 From: blair at orcaware.com (blair at orcaware.com) Date: Wed, 20 Jul 2005 19:49:33 -0700 Subject: [Orca-checkins] r467 - trunk/orca/lib/Orca Message-ID: <200507210249.j6L2nX35026583@orca1.orcaware.com> Author: blair at orcaware.com Date: Wed Jul 20 19:48:44 2005 New Revision: 467 Modified: trunk/orca/lib/Orca/ImageFile.pm Log: Fix an incompatible change in RRDtool 1.2 where colons in COMMENT arguments to RRDs::graph must be escaped with a backslash. Patch by: Alex Kiernan * lib/Orca/ImageFile.pm (_plot): If RRDs 1.2 or greater is used, then escape all colons with a backslash. Modified: trunk/orca/lib/Orca/ImageFile.pm ============================================================================== --- trunk/orca/lib/Orca/ImageFile.pm (original) +++ trunk/orca/lib/Orca/ImageFile.pm Wed Jul 20 19:48:44 2005 @@ -400,6 +400,14 @@ my $plot_ref = $self->[I_PLOT_REF]; + # An incompatible change was introduced in RRDtool 1.2 where colons + # in COMMENT arguments to RRDs::graph must be escaped with a + # backslash. + my $plot_end_time_ctime = localtime($plot_end_time); + if ($RRDs::VERSION >= 1.2) { + $plot_end_time_ctime =~ s/:/\\:/g; + } + my ($graph_return, $image_width, $image_height) = RRDs::graph $image_filename, @@ -410,7 +418,7 @@ '-w', $plot_ref->{plot_width}, '-h', $plot_ref->{plot_height}, 'COMMENT:\s', - 'COMMENT:Last data entered at ' . localtime($plot_end_time) . '.'; + "COMMENT:Last data entered at $plot_end_time_ctime."; if (my $error = RRDs::error) { warn "$0: warning: cannot create '$image_filename': $error\n"; return; From blair at orcaware.com Wed Jul 20 20:01:30 2005 From: blair at orcaware.com (blair at orcaware.com) Date: Wed, 20 Jul 2005 20:01:30 -0700 Subject: [Orca-checkins] r468 - trunk/orca Message-ID: <200507210301.j6L31UEl027355@orca1.orcaware.com> Author: blair at orcaware.com Date: Wed Jul 20 20:00:40 2005 New Revision: 468 Modified: trunk/orca/README.DEVELOPERS Log: Include all of the 'Crediting' section from Subversion's HACKING document at revision 15372 into Orca's README.DEVELOPERS file. * README.DEVELOPERS (Crediting): New section copied from revision 15372 of http://svn.collab.net/repos/svn/trunk/HACKING . Modified: trunk/orca/README.DEVELOPERS ============================================================================== --- trunk/orca/README.DEVELOPERS (original) +++ trunk/orca/README.DEVELOPERS Wed Jul 20 20:00:40 2005 @@ -20,6 +20,7 @@ * Using page breaks * Other conventions * Writing log messages + * Crediting * Patch submission guidelines * Commit access @@ -346,6 +347,127 @@ +Crediting +========= + +It is very important to record code contributions in a consistent and +parseable way. This allows us to write scripts which help us figure +out who has been actively contributing and how, so we can spot +potential new committers quickly. The Subversion project uses +human-readable but machine-parseable fields in log messages for this, +as described below. + +When committing a patch written by someone else, use "Patch by: " at +the beginning of a line: + + Fix issue #1729: Don't crash because of a missing file. + + Patch by: J. Random + + * subversion/libsvn_ra_ansible/get_editor.c + (frobnicate_file): Check that file exists before frobnicating. + +If multiple people wrote the patch, name them all, one person per +line, making sure to start each continuation line with whitespace. If +you (the committer) were one of the people, list yourself as "me". +Thus: + + Fix issue #1729: Don't crash because of a missing file. + + Patch by: J. Random + Enrico Caruso + me + + * subversion/libsvn_ra_ansible/get_editor.c + (frobnicate_file): Check that file exists before frobnicating. + +If someone pointed out a problem or suggested the fix, but didn't +actually write the patch, use "Suggested by: ": + + Fix issue #1729: Don't crash because of a missing file. + + Suggested by: J. Random + + * subversion/libsvn_ra_ansible/get_editor.c + (frobnicate_file): Check that file exists before frobnicating. + +If someone helped review the change, use "Review by:" + + Fix issue #1729: Don't crash because of a missing file. + + Review by: Eagle Eyes + + * subversion/libsvn_ra_ansible/get_editor.c + (frobnicate_file): Check that file exists before frobnicating. + +(As with "Patch by: ", you can name multiple people in "Review by: " +or "Suggested by: " via whitespace-prefixed continuation lines.) + +Multiple fields in the same log message are fine, for example: + + Fix issue #1729: Don't crash because of a missing file. + + Patch by: J. Random + Enrico Caruso + me + Suggested by: J. Random + Review by: Eagle Eyes + + * subversion/libsvn_ra_ansible/get_editor.c + (frobnicate_file): Check that file exists before frobnicating. + +To give further details about a contribution, use a parenthetical +aside immediately after that field, for example: + + Fix issue #1729: Don't crash because of a missing file. + + Patch by: J. Random + (Tweaked by me.) + + * subversion/libsvn_ra_ansible/get_editor.c + (frobnicate_file): Check that file exists before frobnicating. + +It is understood that a parenthetical aside immediately following a +field applies to that field, and that "me" refers to person who +committed this revision. You don't have to write "me", you can use +your name instead, if you're not tired of typing it. Also, although +the examples above use full name and email address, you can use a +committer's username to refer to that committer from any field. For +example, "Philip Martin " and "philip" would +be equivalent. See the leftmost column of the COMMITTERS file for +canonical usernames. + +Currently, these three fields + + Patch by: + Suggested by: + Review by: + +are the only officially-supported crediting fields (where "supported" +means scripts know to look for them), and they are widely used in +Subversion log messages. Future fields would probably also be of the +form "VERB by: ", and from time to time someone may use a field that +sounds official but really isn't -- there are a few instances of +"Reported by: ", for example. These are okay, but try to use an +official field, or a parenthetical aside, in preference to making up +your own field. Also, don't use "Reported by: " when the reporter is +already recorded in an issue; instead, just refer to the issue. + +Look over Orca's existing log messages to see how to use these fields +in practice. This command from the top of your trunk working copy +will help: + +wget http://svn.collab.net/repos/svn/trunk/contrib/client-side/search-svnlog.pl +svn log | ./search-svnlog.pl "(Patch|Review|Suggested) by: " + +Note that the "Approved by: " field seen in some commits is totally +unrelated to these crediting fields (and is rarely parsed by scripts). +It is simply the standard syntax for indicating either who approved a +partial committer's commit outside their usual area, or (in the case +of merges to release branches) who voted for the change to be merged. + + + Patch submission guidelines =========================== From blair at orcaware.com Wed Jul 20 22:40:39 2005 From: blair at orcaware.com (blair at orcaware.com) Date: Wed, 20 Jul 2005 22:40:39 -0700 Subject: [Orca-checkins] r473 - branches/orca orca/branches orca/tags orca/trunk tags/orca trunk/orca Message-ID: <200507210540.j6L5ec01032597@orca1.orcaware.com> Author: blair at orcaware.com Date: Wed Jul 20 22:33:56 2005 New Revision: 473 Added: orca/ orca/branches/ - copied from r472, /branches/orca/ orca/tags/ - copied from r472, /tags/orca/ orca/trunk/ - copied from r472, /trunk/orca/ Removed: branches/orca/ tags/orca/ trunk/orca/ Modified: orca/trunk/CHANGES orca/trunk/README.DEVELOPERS Log: Restructure the OrcaWare Subversion repository to have the 'more' standard Subversion repository layout where each project has underneath it the branches, tags and trunk directories, instead of having a top level branches, tags and trunk directory with each project underneath. * orca: New directory. * orca/branches: Renamed from branches/orca. * orca/tags: Renamed from tags/orca. * orca/trunk: Renamed from trunk/orca. * orca/trunk/CHANGES, * orca/trunk/README.DEVELOPERS: In all URLs referring to the OrcaWare Subversion repository, change http://www.orcaware.com/svn/repos/trunk/orca/ to http://www.orcaware.com/svn/repos/orca/trunk/ and http://www.orcaware.com/svn/repos/tags/orca/ to http://www.orcaware.com/svn/repos/orca/tags/ Modified: orca/trunk/CHANGES ============================================================================== --- /trunk/orca/CHANGES (original) +++ orca/trunk/CHANGES Wed Jul 20 22:33:56 2005 @@ -6,7 +6,7 @@ 1) Using a Subversion binary and running - svn log http://www.orcaware.com/svn/repos/trunk/orca/ + svn log http://www.orcaware.com/svn/repos/orca/trunk/ This output will be long, so you may want to pipe it to your favorite paging program. Modified: orca/trunk/README.DEVELOPERS ============================================================================== --- /trunk/orca/README.DEVELOPERS (original) +++ orca/trunk/README.DEVELOPERS Wed Jul 20 22:33:56 2005 @@ -60,11 +60,11 @@ The Orca Subversion repository is located at - http://www.orcaware.com/svn/repos/trunk/orca/ + http://www.orcaware.com/svn/repos/orca/trunk/ with tagged releases located at - http://www.orcaware.com/svn/repos/tags/orca/ + http://www.orcaware.com/svn/repos/orca/tags/ The Subversion home page is at @@ -93,7 +93,7 @@ Once you've downloaded and installed Subversion, run the following command to check out Orca HEAD: - % svn co http://www.orcaware.com/svn/repos/trunk/orca/ + % svn checkout http://www.orcaware.com/svn/repos/orca/trunk/ orca This will create a directory named 'orca' in the current working directory. From blair at orcaware.com Thu Jul 21 22:42:50 2005 From: blair at orcaware.com (blair at orcaware.com) Date: Thu, 21 Jul 2005 22:42:50 -0700 Subject: [Orca-checkins] r474 - Message-ID: <200507220542.j6M5go2V006301@orca1.orcaware.com> Author: blair at orcaware.com Date: Thu Jul 21 22:42:42 2005 New Revision: 474 Modified: README Log: Restructure the OrcaWare Subversion repository to have the 'more' standard Subversion repository layout where each project has underneath it the branches, tags and trunk directories, instead of having a top level branches, tags and trunk directory with each project underneath. * README: Update the documentation to reflect the new repository structure. Modified: README ============================================================================== --- README (original) +++ README Thu Jul 21 22:42:42 2005 @@ -1,12 +1,13 @@ -This is the top of OrcaWare Consulting's Subversion repository. +This is the top of OrcaWare Technology's Subversion repository. The +top level directory contains a directory for each separate project +hosted in the repository. Underneath each project are three +directories: trunk/ ......... The latest development sources. When people say "Get the head of trunk", they mean the latest revision of an entire project directory located in - trunk/, such as trunk/find_badblocks or - trunk/orca. Normally, you wouldn't want to check - out an entire copy of trunk/, because it contains - many unrelated projects. + trunk/, such as find_badblocks/trunk or + orca/trunk. branches/ ...... Various development branches. Typically a branch contains a complete copy of a project's directory @@ -31,14 +32,15 @@ Check out the HEAD, that is the latest working copy, of the Orca package: - svn co http://svn.orcaware.com:8000/repos/trunk/orca/ + svn checkout http://www.orcaware.com/svn/repos/orca/trunk/ orca Check out Orca tagged at version 0.27: - svn co http://svn.orcaware.com:8000/repos/tags/orca/0.27/ + svn checkout http://www.orcaware.com/svn/repos/orca/tags/0.27/ orca-0.27 These are the commands to avoid, as they will check out everything - underneath the specified URL. Be careful :) : + underneath the specified URL. Be careful :) : - svn co http://svn.orcaware.com:8000/repos/ - svn co http://svn.orcaware.com:8000/repos/tags/ + svn checkout http://www.orcaware.com/svn/repos/ + svn checkout http://www.orcaware.com/svn/repos/orca/ + svn checkout http://www.orcaware.com/svn/repos/orca/tags/ From guilherme_chehab at yahoo.com Mon Jul 25 10:17:48 2005 From: guilherme_chehab at yahoo.com (guilherme_chehab at yahoo.com) Date: Mon, 25 Jul 2005 10:17:48 -0700 Subject: [Orca-checkins] r475 - orca/trunk/data_gatherers/procallator Message-ID: <200507251717.j6PHHmN5019758@orca1.orcaware.com> Author: guilherme_chehab at yahoo.com Date: Mon Jul 25 10:16:57 2005 New Revision: 475 Modified: orca/trunk/data_gatherers/procallator/CHANGES orca/trunk/data_gatherers/procallator/procallator.cfg.in orca/trunk/data_gatherers/procallator/procallator.pl.in Log: Added @COMPRESSOR@ to procallator.pl and fixed bug on .cfg regarding NFS stats Modified: orca/trunk/data_gatherers/procallator/CHANGES ============================================================================== --- orca/trunk/data_gatherers/procallator/CHANGES (original) +++ orca/trunk/data_gatherers/procallator/CHANGES Mon Jul 25 10:16:57 2005 @@ -10,7 +10,7 @@ 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 + sadly 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 @@ -25,3 +25,7 @@ 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 +0.04 - Added support for COMPRESS variable in configure scripts, defaults to + /usr/bin/gzip + - Fixed error on .cfg regarding the NFS statsdata types, were COUNTERs + when they should be modelled as GAUGEs Modified: orca/trunk/data_gatherers/procallator/procallator.cfg.in ============================================================================== --- orca/trunk/data_gatherers/procallator/procallator.cfg.in (original) +++ orca/trunk/data_gatherers/procallator/procallator.cfg.in Mon Jul 25 10:16:57 2005 @@ -536,7 +536,6 @@ title %g NFS Server Statistics source procallator data nfs_s_(.*) -data_type counter line_type line1 legend $1/s y_legend rate @@ -549,7 +548,6 @@ title %g NFS Client Statistics source procallator data nfs_c_(.*) -data_type counter line_type line1 legend $1/s y_legend rate Modified: orca/trunk/data_gatherers/procallator/procallator.pl.in ============================================================================== --- orca/trunk/data_gatherers/procallator/procallator.pl.in (original) +++ orca/trunk/data_gatherers/procallator/procallator.pl.in Mon Jul 25 10:16:57 2005 @@ -29,7 +29,10 @@ $PROC = "/proc"; # Proc directory, usually /proc $INTERVAL = 300; # Interval between each measure, in seconds -$COMPRESS = "/usr/bin/gzip"; # Compressor... + +$COMPRESS = "@COMPRESSOR@"; # Compressor... +$COMPRESS = "/usr/bin/gzip" if ($COMPRESS eq ""); # Get a default + $HOSTNAME = `/bin/hostname`; chomp $HOSTNAME; $DEST_DIR = From guilherme_chehab at yahoo.com Mon Jul 25 10:23:34 2005 From: guilherme_chehab at yahoo.com (guilherme_chehab at yahoo.com) Date: Mon, 25 Jul 2005 10:23:34 -0700 Subject: [Orca-checkins] r476 - orca/trunk/data_gatherers/procallator Message-ID: <200507251723.j6PHNYED020112@orca1.orcaware.com> Author: guilherme_chehab at yahoo.com Date: Mon Jul 25 10:22:46 2005 New Revision: 476 Modified: orca/trunk/data_gatherers/procallator/CHANGES orca/trunk/data_gatherers/procallator/procallator.pl.in Log: Added @PROC@ to procallator.pl Modified: orca/trunk/data_gatherers/procallator/CHANGES ============================================================================== --- orca/trunk/data_gatherers/procallator/CHANGES (original) +++ orca/trunk/data_gatherers/procallator/CHANGES Mon Jul 25 10:22:46 2005 @@ -25,7 +25,8 @@ 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 -0.04 - Added support for COMPRESS variable in configure scripts, defaults to +0.04 - Added support for @COMPRESS@ variable in configure scripts, defaults to /usr/bin/gzip - Fixed error on .cfg regarding the NFS statsdata types, were COUNTERs when they should be modelled as GAUGEs +0.05 - Added support for @PROC@ variable in configure scripts Modified: orca/trunk/data_gatherers/procallator/procallator.pl.in ============================================================================== --- orca/trunk/data_gatherers/procallator/procallator.pl.in (original) +++ orca/trunk/data_gatherers/procallator/procallator.pl.in Mon Jul 25 10:22:46 2005 @@ -27,7 +27,7 @@ # Config variables -$PROC = "/proc"; # Proc directory, usually /proc +$PROC = "@PROC@"; # Proc directory, usually /proc $INTERVAL = 300; # Interval between each measure, in seconds $COMPRESS = "@COMPRESSOR@"; # Compressor...