Commit 1b2910f7 authored by Dominik Hebeler's avatar Dominik Hebeler
Browse files

fixed scaling of graph. little speed improvement

parent 2a970c84
......@@ -45,33 +45,37 @@ class ConvertCountFile implements ShouldQueue
$logTime = [];
$interface = "";
// i.e. [Wed Apr 17 00:00:01] ref=https://metager.de/ time=0.51 serv=web interface=de
if (preg_match('/(\d{2}:\d{2}:\d{2}).*?\sinterface=(\S+)/', $line, $matches)) {
if (preg_match('/(\d{2}):(\d{2}):\d{2}.*?\sinterface=(\S+)/', $line, $matches)) {
// Create Date Object
$logTime = $matches[1];
$interface = $matches[2];
$minutes = intval($matches[2]);
$minutes = $minutes - ($minutes % 5);
if($minutes < 10){
$minutes = "0" . $minutes;
}
$logTime .= ":" . $minutes;
$interface = $matches[3];
} else {
continue;
}
$thatTime = \DateTime::createFromFormat('H:i:s', $logTime);
$thatTime->sub(new \DateInterval("PT" . ($thatTime->format('i') % 5) . "M"));
if (empty($result["time"][$thatTime->format('H:i')])) {
$result["time"][$thatTime->format('H:i')] = [
if (empty($result["time"][$logTime])) {
$result["time"][$logTime] = [
"insgesamt" => [
"all" => 0,
],
];
}
if (empty($result["time"][$thatTime->format('H:i')]["all"])) {
$result["time"][$thatTime->format('H:i')]["all"] = 1;
if (empty($result["time"][$logTime]["all"])) {
$result["time"][$logTime]["all"] = 1;
} else {
$result["time"][$thatTime->format('H:i')]["all"]++;
$result["time"][$logTime]["all"]++;
}
if (!empty($interface)) {
if (empty($result["time"][$thatTime->format('H:i')][$interface])) {
$result["time"][$thatTime->format('H:i')][$interface] = 1;
if (empty($result["time"][$logTime][$interface])) {
$result["time"][$logTime][$interface] = 1;
} else {
$result["time"][$thatTime->format('H:i')][$interface]++;
$result["time"][$logTime][$interface]++;
}
}
// Update the total statistics
......
......@@ -10,7 +10,7 @@
@php ($startX = 20)
@php ($startY = $height-20)
@php ($maxCount = intval(str_replace(".", "", $rekordCount)))
@php ($minCount = $minCount)
@php ($minCount = 0)
@php ($scaleFromTo = $maxCount - $minCount)
@php ($yPerSearch = ($startY - $padding - $paddingArrow) / floatval($scaleFromTo))
@php ($entryCount = min(sizeof($oldLogs), 30))
......@@ -50,7 +50,6 @@
@endfor
</svg>
</div>
<p>{{ exec("uptime") }}</p>
@if( isset($rekordDate) && isset($rekordTagSameTime) && isset($rekordCount) )
<p>Rekord am {{ $rekordDate }} zur gleichen Zeit <span class="text-info">{{ $rekordTagSameTime }}</span> - insgesamt <span class="text-danger">{{ $rekordCount }}</span></p>
@endif
......@@ -97,7 +96,7 @@
style="color: green"
@endif
>
@if($averageIncrease < 0)-@else+@endif{{number_format(floatval($averageIncrease), 0, ",", ".")}}
@if($averageIncrease >= 0)+@endif{{number_format(floatval($averageIncrease), 0, ",", ".")}}
</span>
@endif</td>
<td>???</td>
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment