Skip to content

Commit e48b5c0

Browse files
author
blumley
committed
Bugfixes
1 parent 4181f37 commit e48b5c0

File tree

3 files changed

+25
-25
lines changed

3 files changed

+25
-25
lines changed

apache_vh_accesses

+14-14
Original file line numberDiff line numberDiff line change
@@ -45,17 +45,17 @@ $includes[] = "development.com";
4545
exec(sprintf("find %s -iname *_access.log", LOG_PATH), $files);
4646

4747
foreach ($files as $key=>$file) {
48-
foreach ($includes as $include) {
49-
if (strpos($file, $include)) {
50-
continue 2;
51-
}
52-
}
53-
foreach ($excludes as $exclude) {
54-
if (preg_match($exclude, $file)) {
55-
unset($files[$key]);
56-
continue 2;
57-
}
58-
}
48+
foreach ($includes as $include) {
49+
if (strpos($file, $include)) {
50+
continue 2;
51+
}
52+
}
53+
foreach ($excludes as $exclude) {
54+
if (preg_match($exclude, $file)) {
55+
unset($files[$key]);
56+
continue 2;
57+
}
58+
}
5959
}
6060

6161
if (isset($argv[1]) && $argv[1]=='config') {
@@ -80,9 +80,9 @@ if (isset($argv[1]) && $argv[1]=='config') {
8080
function calculate_rate($file, $num_lines) {
8181
$ago = get_time($file, $num_lines);
8282
$increment = floor($num_lines/2);
83-
$its == 0;
83+
$its = 0;
84+
$opp = false;
8485
while ($ago < 270 || $ago > 330) {
85-
$op == false;
8686
if ($ago < 270) {
8787
if ($opp == "sub") {
8888
$increment = floor($increment/2);
@@ -117,7 +117,7 @@ function get_time($file, $num_lines) {
117117
if ($checkstring == $string) {
118118
$seen_lines = exec(sprintf("wc -l %s 2>/dev/null", $file));
119119
if (file_exists($file . ".1")) {
120-
$string = exec(sprintf("tail -n %s %s.0 2>/dev/null | head -n 1", ($num_lines - $seen_lines), $file));
120+
$string = exec(sprintf("tail -n %s %s.1 2>/dev/null | head -n 1", ($num_lines - $seen_lines), $file));
121121
} else {
122122
$num_lines = $seen_lines;
123123
}

apache_vh_errors

+5-4
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,8 @@ if (isset($argv[1]) && $argv[1]=='config') {
6363
$sitename = sitename($file);
6464
#echo hashname($file) . "_error.label $sitename (err/sec)\n";
6565
echo hashname($file) . "_error_req.label $sitename\n";
66-
66+
echo hashname($file) . "_error_req.warning 5\n";
67+
echo hashname($file) . "_error_req.critical 10\n";
6768
}
6869
echo "graph_category apache\n";
6970
echo "graph_title Apache Errors By Vhost\n";
@@ -86,9 +87,9 @@ if (isset($argv[1]) && $argv[1]=='config') {
8687
function calculate_rate($file, $num_lines) {
8788
$ago = get_time($file, $num_lines);
8889
$increment = floor($num_lines/2);
89-
$its == 0;
90+
$its = 0;
91+
$opp = false;
9092
while ($ago < 270 || $ago > 330) {
91-
$op == false;
9293
if ($ago < 270) {
9394
if ($opp == "sub") {
9495
$increment = floor($increment/2);
@@ -123,7 +124,7 @@ function get_time($file, $num_lines) {
123124
if ($checkstring == $string) {
124125
$seen_lines = exec(sprintf("wc -l %s 2>/dev/null", $file));
125126
if (file_exists($file . ".1")) {
126-
$string = exec(sprintf("tail -n %s %s.0 2>/dev/null | head -n 1", ($num_lines - $seen_lines), $file));
127+
$string = exec(sprintf("tail -n %s %s.1 2>/dev/null | head -n 1", ($num_lines - $seen_lines), $file));
127128
} else {
128129
$num_lines = $seen_lines;
129130
}

apache_vh_volume

+6-7
Original file line numberDiff line numberDiff line change
@@ -43,14 +43,14 @@ $includes = array();
4343
$includes[] = "development.com";
4444

4545
exec(sprintf("find %s -iname *_access.log", LOG_PATH), $files);
46-
46+
$files = array('/home/blumley/testlog.log');
4747
foreach ($files as $key=>$file) {
4848
foreach ($includes as $include) {
4949
if (strpos($file, $include)) {
5050
continue 2;
5151
}
52-
}
53-
foreach ($excludes as $exclude) {
52+
}
53+
foreach ($excludes as $exclude) {
5454
if (preg_match($exclude, $file)) {
5555
unset($files[$key]);
5656
continue 2;
@@ -78,12 +78,11 @@ if (isset($argv[1]) && $argv[1]=='config') {
7878
}
7979

8080
function calculate_rate($file, $num_lines) {
81-
8281
$ago = get_time($file, $num_lines);
8382
$increment = floor($num_lines/2);
84-
$its == 0;
83+
$its = 0;
84+
$opp = false;
8585
while ($ago < 270 || $ago > 330) {
86-
$op == false;
8786
if ($ago < 270) {
8887
if ($opp == "sub") {
8988
$increment = floor($increment/2);
@@ -122,7 +121,7 @@ function get_time($file, $num_lines) {
122121
if ($checkstring == $string) {
123122
$seen_lines = exec(sprintf("wc -l %s 2>/dev/null", $file));
124123
if (false && file_exists($file . ".1")) {
125-
$string = exec(sprintf("tail -n %s %s.0 2>/dev/null | head -n 1", ($num_lines - $seen_lines), $file));
124+
$string = exec(sprintf("tail -n %s %s.1 2>/dev/null | head -n 1", ($num_lines - $seen_lines), $file));
126125
} else {
127126
$num_lines = $seen_lines;
128127
}

0 commit comments

Comments
 (0)