[Orca-checkins] rev 241 - trunk/orca/data_gatherers/procallator
Blair Zajac
blair at orcaware.com
Sun Jun 15 13:29:57 PDT 2003
Author: blair
Date: Sun Jun 15 13:29:55 2003
New Revision: 241
Modified:
trunk/orca/data_gatherers/procallator/TODO
trunk/orca/data_gatherers/procallator/procallator.pl.in
Log:
* data_gatherers/procallator/procallator.pl.in:
This is Perl, so
1) Use Sys::Hostname to determine the system's hostname, not
`hostname`.
2) Use mkdir() instead of `mkdir`.
Rename $OUTDIR to $OUT_DIR.
Remove hardwired paths for $PROC, $COMPRESS, $DEST_DIR and $OUT_DIR.
Use the paths specified by configure.
* data_gatherers/procallator/TODO:
Spell check and wrap to 80 characters.
Modified: trunk/orca/data_gatherers/procallator/TODO
==============================================================================
--- trunk/orca/data_gatherers/procallator/TODO (original)
+++ trunk/orca/data_gatherers/procallator/TODO Sun Jun 15 13:29:55 2003
@@ -1,6 +1,7 @@
Procallator TODO list:
- - Use the same names for data sets as in solaris version for using same config files
- - Document and optimize collectorn source code
+ - 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
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 Jun 15 13:29:55 2003
@@ -1,26 +1,40 @@
-#!/usr/bin/perl -w
+# Collector for /proc statistics for use with Linux 2.2 and 2.4 kernels.
#
-# collector for /proc statistics for use with Linux 2.2 and 2.4 kernels.
-#
-# Copyright (C) 2001 Guilherme Carvalho Chehab. All Rights Reserved.
+# Copyright (C) 2001 Guilherme Carvalho Chehab. All Rights Reserved.
#
# 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
+
+use Sys::Hostname;
+
+#
+# Configuration variables.
+#
+
+# The process directory, usually /proc.
+my $PROC = '@PROC_DIR@';
+
+# Compression program to use after closing an output data file.
+my $COMPRESS = '@COMPRESSOR@';
+
+# The output base directory.
+my $OUT_DIR = '@VAR_DIR@/procallator';
+
+# Measurement interval, in seconds.
+my $INTERVAL = 300;
# Initializations
-$r=0; # Rotating indice for measuring counter differences
-$rate_ok=0; # Check if is ok to calculate rates
+my $r = 0; # Rotating indice for measuring counter differences.
+my $rate_ok = 0; # Check if is ok to calculate rates.
-# Create output dir if needed
-if (! -d $DEST_DIR ) {
- `mkdir -p $DEST_DIR`;
+# 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";
+ }
}
# Read kernel version
More information about the Orca-checkins
mailing list