Index: openacs-4/packages/xotcl-request-monitor/tcl/throttle_mod-init.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/xotcl-request-monitor/tcl/throttle_mod-init.tcl,v
diff -u -r1.3 -r1.4
--- openacs-4/packages/xotcl-request-monitor/tcl/throttle_mod-init.tcl 13 Sep 2007 13:17:32 -0000 1.3
+++ openacs-4/packages/xotcl-request-monitor/tcl/throttle_mod-init.tcl 16 Sep 2007 11:15:15 -0000 1.4
@@ -23,30 +23,3 @@
### this is probably not sufficient to do something useful...
}
-# Populate the counters
-# Initialize from the old counters
-
-set logdir [parameter::get_from_package_key -package_key xotcl-request-monitor \
- -parameter log-dir \
- -default [file dirname [file root [ns_config ns/parameters ServerLog]]]]
-
-set max_urls [parameter::get_from_package_key -package_key "xotcl-request-monitor" -parameter max-url-stats -default 13]
-set time_window [parameter::get_from_package_key -package_key "xotcl-request-monitor" -parameter "time-window" -default 13]
-
-set nr_trend_elements [parameter::get_from_package_key -package_key "xotcl-request-monitor" -parameter "trend-elements" -default 48]
-incr nr_trend_elements
-
-# Create the file to load. This is per hour = 60*3 + 2 lines
-set number_of_lines [expr 182 * $nr_trend_elements]
-exec /usr/bin/tail -n $number_of_lines ${logdir}/counter.log >${logdir}/counter-new.log
-set f [open $logdir/counter-new.log]
-
-while {-1 != [gets $f line]} {
- regexp {(.*) -- (.*) ::(.*) (.*)} $line match timestamp server label value
- set nr_stats_elements [parameter::get_from_package_key -package_key "xotcl-request-monitor" -parameter "max-stats-elements" -default 48]
- throttle do $label lappend trend $value
- set stats [throttle do $label lappend stats [list $timestamp $value]]
- set stats [lrange [lsort -real -decreasing -index 1 $stats] 0 [expr {$nr_stats_elements - 1}]]
- throttle do $label set stats $stats
-}
-
Index: openacs-4/packages/xotcl-request-monitor/tcl/throttle_mod-procs.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/xotcl-request-monitor/tcl/throttle_mod-procs.tcl,v
diff -u -r1.10 -r1.11
--- openacs-4/packages/xotcl-request-monitor/tcl/throttle_mod-procs.tcl 16 Sep 2007 09:31:20 -0000 1.10
+++ openacs-4/packages/xotcl-request-monitor/tcl/throttle_mod-procs.tcl 16 Sep 2007 11:15:15 -0000 1.11
@@ -660,6 +660,46 @@
-default [file dirname [file root [ns_config ns/parameters ServerLog]]]]
if {![file isdirectory $logdir]} {file mkdir $logdir}
+
+# ns_log notice "+++ initialize conters"
+# # Populate the counters
+# # Initialize from the old counters
+
+# set logdir [parameter::get_from_package_key -package_key xotcl-request-monitor \
+# -parameter log-dir \
+# -default [file dirname [file root [ns_config ns/parameters ServerLog]]]]
+
+# set max_urls [parameter::get_from_package_key \
+# -package_key "xotcl-request-monitor" \
+# -parameter max-url-stats -default 13]
+# set time_window [parameter::get_from_package_key \
+# -package_key "xotcl-request-monitor" \
+# -parameter "time-window" -default 13]
+
+# set nr_trend_elements [parameter::get_from_package_key \
+# -package_key "xotcl-request-monitor" \
+# -parameter "trend-elements" -default 48]
+# incr nr_trend_elements
+
+# # Create the file to load. This is per hour = 60*3 + 2 lines
+# set number_of_lines [expr {182 * $nr_trend_elements}]
+# exec /usr/bin/tail -n $number_of_lines ${logdir}/counter.log >${logdir}/counter-new.log
+# set f [open $logdir/counter-new.log]
+
+# while {-1 != [gets $f line]} {
+# regexp {(.*) -- (.*) ::(.*) (.*)} $line match timestamp server label value
+# set nr_stats_elements [parameter::get_from_package_key \
+# -package_key "xotcl-request-monitor" \
+# -parameter "max-stats-elements" -default 48]
+# ns_log notice "throttle do $label lappend trend $value"
+# $label lappend trend $value
+# set stats [$label lappend stats [list $timestamp $value]]
+# set stats [lrange [lsort -real -decreasing -index 1 $stats] 0 [expr {$nr_stats_elements - 1}]]
+# $label set stats $stats
+# }
+# close $f
+
+
} -persistent 1 -ad_doc {
This is a small request-throttle application that handles simple
DOS-attracks on an AOL-server. A user (request key) is identified
Index: openacs-4/packages/xotcl-request-monitor/www/index.adp
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/xotcl-request-monitor/www/index.adp,v
diff -u -r1.2 -r1.3
--- openacs-4/packages/xotcl-request-monitor/www/index.adp 1 Dec 2006 09:33:22 -0000 1.2
+++ openacs-4/packages/xotcl-request-monitor/www/index.adp 16 Sep 2007 11:15:15 -0000 1.3
@@ -2,8 +2,11 @@
@title@
-
+
+
+
+
Index: openacs-4/packages/xotcl-request-monitor/www/index.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/xotcl-request-monitor/www/index.tcl,v
diff -u -r1.9 -r1.10
--- openacs-4/packages/xotcl-request-monitor/www/index.tcl 12 Dec 2006 20:12:46 -0000 1.9
+++ openacs-4/packages/xotcl-request-monitor/www/index.tcl 16 Sep 2007 11:15:15 -0000 1.10
@@ -115,6 +115,8 @@
set end [clock format [clock seconds] -format "%Y,%m,%d,%H,%M,%S"]
set begin [clock format [clock scan "-$size $type"] -format "%Y,%m,%d,%H,%M,%S"]
+ regsub -all {,0} $begin , begin
+ regsub -all {,0} $end , end
#ns_log Notice "begin: $begin, end: $end, $size $type"
set diagram [subst {