[Orca-checkins] rev 112 - in trunk/orca: . src

blair at orcaware.com blair at orcaware.com
Sat Jul 13 19:16:01 PDT 2002


Author: blair
Date: Fri, 28 Jun 2002 22:00:14 -0700
New Revision: 112

Modified:
   trunk/orca/CHANGES
   trunk/orca/NEWS
   trunk/orca/src/orca.pl
   trunk/orca/src/orcallator_running.pl.in
   trunk/orca/src/start_orcallator.sh.in
Log:
Load orca-0.23 into trunk/orca.


Modified: trunk/orca/src/orcallator_running.pl.in
==============================================================================
--- trunk/orca/src/orcallator_running.pl.in	(original)
+++ trunk/orca/src/orcallator_running.pl.in	Sat Jul 13 19:15:52 2002
@@ -7,7 +7,7 @@
 
 # Set this to the list of directories that contain the output from
 # percollator.se.
-my @stats_dirs = ('@PERCOLLATOR_DIR@');
+my @stats_dirs = ('@ORCALLATOR_DIR@');
 
 foreach my $stats_dir (@stats_dirs) {
 

Modified: trunk/orca/src/start_orcallator.sh.in
==============================================================================
--- trunk/orca/src/start_orcallator.sh.in	(original)
+++ trunk/orca/src/start_orcallator.sh.in	Sat Jul 13 19:15:52 2002
@@ -10,7 +10,7 @@
 CUT=@CUT@
 EXPR=@EXPR@
 UNAME=@UNAME@
-PERCOLLATOR_DIR=@PERCOLLATOR_DIR@
+ORCALLATOR_DIR=@ORCALLATOR_DIR@
 SE=@SE@
 WATCH_HTTPD="@WATCH_HTTPD@"
 WEB_LOG=@WEB_LOG@
@@ -19,8 +19,8 @@
 # anything past the first `.'.
 uname=`$UNAME -n | $CUT -d. -f1`
 
-# The directory these files go into is $PERCOLLATOR_DIR/HOSTNAME
-OUTDIR=$PERCOLLATOR_DIR/$uname
+# The directory these files go into is $ORCALLATOR_DIR/HOSTNAME
+OUTDIR=$ORCALLATOR_DIR/$uname
 
 # Export the environmental variables.
 export OUTDIR WEB_LOG

Modified: trunk/orca/src/orca.pl
==============================================================================
--- trunk/orca/src/orca.pl	(original)
+++ trunk/orca/src/orca.pl	Sat Jul 13 19:15:52 2002
@@ -17,7 +17,7 @@
 
 # This is the version of Orca.
 use vars qw($VERSION);
-$VERSION = '0.22';
+$VERSION = '0.23';
 
 # This is the version number used in creating the DS names in RRDs.
 # This should be updated any time a new version of Orca needs some new
@@ -456,27 +456,35 @@
     _all_rrd_ref	=> $rrd_data_files_ref,
     _my_rrd_list	=> [ &::unique(@$my_rrds_ref) ],
     _plot_ref           => $plot_ref,
-    _interval           => int($config_files->{$files_key}{interval}+0.5),
     _expire             => $config_options->{expire_gifs},
     _gif_height         => 0,
     _gif_width          => 0,
     _graph_options      => []
   }, $class;
 
-  # If the GIF already exists, then use its last modification time to
-  # calculate when it was last updated.  If the file modification time
-  # is newer than the timestamp of the last data point entered, then
-  # assume that the GIF needs to be recreated.  This data will cause
-  # the GIF to be created if the GIF does not exist.
   my $plot_end_time = $self->plot_end_time;
-  foreach my $plot_type (@gif_plot_type) {
-    my @stat = stat("$gif_basename-$plot_type.gif");
+  my $interval      = int($config_files->{$files_key}{interval}+0.5);
+  for (my $i=0; $i<@gif_plot_type; ++$i) {
+    # Load the data that helps this class determine if a particular
+    # GIF file, such as the daily GIF, is current or needs to be
+    # created or recreated.  The data saved is the Unix epoch file
+    # modification time.  If the file does not exist or the file
+    # modification time is newer than the time of te last data point
+    # entered, then save a file modification time of -1 which will
+    # definitely cause the GIF to be recreated.
+    my $plot_type = $gif_plot_type[$i];
+    my @stat      = stat("$gif_basename-$plot_type.gif");
     if (@stat and $stat[9] <= $plot_end_time) {
       $self->{"_${plot_type}_update_time"} = $stat[9];
     }
     else {
       $self->{"_${plot_type}_update_time"} = -1;
     }
+
+    # Calculate how old this plot must be before it is recreated.
+    my $gif_pdp_count = int($gif_pdp_count[$i]*300.0/$interval + 0.5);
+    $gif_pdp_count    = 1 if $gif_pdp_count < 1;
+    $self->{"_${plot_type}_plot_age"} = $gif_pdp_count*$interval;
   }
 
   $self->_update_graph_options;
@@ -618,36 +626,26 @@
   # Make the plots and specify how far back in time to plot.
   my $plot_made = 0;
   for (my $i=0; $i<@gif_plot_type; ++$i) {
-    if ($self->_plot($gif_plot_type[$i],
-                     $gif_days_back[$i],
-                     $gif_pdp_count[$i])) {
-      $plot_made = 1;
-    }
+    $plot_made = 1 if $self->_plot($gif_plot_type[$i], $gif_days_back[$i]);
   }
 
   $plot_made;
 }
 
 sub _plot {
-  my ($self, $plot_type, $gif_days_back, $gif_pdp_count) = @_;
+  my ($self, $plot_type, $gif_days_back) = @_;
 
   # Get the time stamp of the last data point entered into the RRDs
   # that are used to generate this GIF.
   my $plot_end_time = $self->plot_end_time;
 
-  # Determine if the plot needs to be generated.  First see if there
-  # has been data flushed to the RRD that needs to be plotted.
-  # Otherwise, see if the does not file exists or if the time
-  # corresponding to the last data point is newer than the GIF.  Take
-  # into account that a new plot does not need to be generated until a
-  # primary data point has been added.  Primary data points are added
-  # after a data point falls into a new bin, where the bin ends on
-  # multiples of the sampling iterval.
-  my $interval        = $self->{_interval};
-  $gif_pdp_count      = int($gif_pdp_count*300.0/$interval + 0.5);
-  $gif_pdp_count      = 1 if $gif_pdp_count < 1;
-  my $plot_age        = $gif_pdp_count*$interval;
+  # Determine if the plot needs to be generated by taking into account
+  # that a new plot does not need to be generated until a primary data
+  # point has been added.  Primary data points are added after a data
+  # point falls into a new bin, where the bin ends on multiples of the
+  # sampling iterval.
   my $time_update_key = "_${plot_type}_update_time";
+  my $plot_age        = $self->{"_${plot_type}_plot_age"};
   if (int($self->{$time_update_key}/$plot_age) == int($plot_end_time/$plot_age)) {
     return;
   }
@@ -669,6 +667,7 @@
       'COMMENT:Last data entered at ' . localtime($plot_end_time) . '.';
   if (my $error = RRDs::error) {
     warn "$0: warning: cannot create `$gif_filename': $error\n";
+    return;
   }
   else {
     $self->{$time_update_key} = $plot_end_time;

Modified: trunk/orca/CHANGES
==============================================================================
--- trunk/orca/CHANGES	(original)
+++ trunk/orca/CHANGES	Sat Jul 13 19:15:52 2002
@@ -1,3 +1,16 @@
+Thu May 27 10:53:02 PDT 1999
+
+	Release version 0.23.
+
+Thu May 27 09:24:20 PDT 1999
+
+	Add another optimization that saves the result of computing how
+	old each GIF must be before it is recreated.
+
+	Fix a bug noted by Peter Radcliffe <pir at pir.net> where I missed
+	changing some PERCOLLATOR_DIR variables to ORCALLATOR_DIR in
+	src/start_orcallator.sh.in and src/orcallator_running.pl.in.
+
 Wed May 26 17:54:26 PDT 1999
 
 	Release version 0.22.

Modified: trunk/orca/NEWS
==============================================================================
--- trunk/orca/NEWS	(original)
+++ trunk/orca/NEWS	Sat Jul 13 19:15:52 2002
@@ -1,3 +1,8 @@
+New in version 0.23.
+ 1) Fix two important bugs in orcallator_running and start_orcallator
+    which where using old PERCOLLATOR_DIR variables instead of the new
+    ORCALLATOR_DIR.
+
 New in version 0.22.
  1) Add a new command line option (-r) that tells Orca to only update
     the RRD data files and not to generate any HTML or GIF files.




More information about the Orca-checkins mailing list