fix: metrics parsing
This commit is contained in:
parent
c8155c8a32
commit
a43de75b42
@ -5,8 +5,6 @@ namespace App\Models;
|
|||||||
use App\Actions\Server\InstallDocker;
|
use App\Actions\Server\InstallDocker;
|
||||||
use App\Enums\ProxyTypes;
|
use App\Enums\ProxyTypes;
|
||||||
use App\Jobs\PullSentinelImageJob;
|
use App\Jobs\PullSentinelImageJob;
|
||||||
use App\Notifications\Server\Revived;
|
|
||||||
use App\Notifications\Server\Unreachable;
|
|
||||||
use Illuminate\Database\Eloquent\Builder;
|
use Illuminate\Database\Eloquent\Builder;
|
||||||
use Illuminate\Database\Eloquent\Casts\Attribute;
|
use Illuminate\Database\Eloquent\Casts\Attribute;
|
||||||
use Illuminate\Support\Collection;
|
use Illuminate\Support\Collection;
|
||||||
@ -503,9 +501,27 @@ $schema://$host {
|
|||||||
|
|
||||||
return [(int) $time, (float) $value];
|
return [(int) $time, (float) $value];
|
||||||
});
|
});
|
||||||
})->toArray();
|
});
|
||||||
|
if ($mins === 30 || $mins === 60) {
|
||||||
|
$parsedCollection = $parsedCollection->filter(function ($item, $key) {
|
||||||
|
return $key % 5 === 0;
|
||||||
|
});
|
||||||
|
$parsedCollection = $parsedCollection->values();
|
||||||
|
}
|
||||||
|
if ($mins === 720) {
|
||||||
|
$parsedCollection = $parsedCollection->filter(function ($item, $key) {
|
||||||
|
return $key % 10 === 0;
|
||||||
|
});
|
||||||
|
$parsedCollection = $parsedCollection->values();
|
||||||
|
}
|
||||||
|
if ($mins === 10080) {
|
||||||
|
$parsedCollection = $parsedCollection->filter(function ($item, $key) {
|
||||||
|
return $key % 20 === 0;
|
||||||
|
});
|
||||||
|
$parsedCollection = $parsedCollection->values();
|
||||||
|
}
|
||||||
|
|
||||||
return $parsedCollection;
|
return $parsedCollection->toArray();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -529,9 +545,27 @@ $schema://$host {
|
|||||||
|
|
||||||
return [(int) $time, (float) $usedPercent];
|
return [(int) $time, (float) $usedPercent];
|
||||||
});
|
});
|
||||||
})->toArray();
|
});
|
||||||
|
if ($mins === 30 || $mins === 60) {
|
||||||
|
$parsedCollection = $parsedCollection->filter(function ($item, $key) {
|
||||||
|
return $key % 5 === 0;
|
||||||
|
});
|
||||||
|
$parsedCollection = $parsedCollection->values();
|
||||||
|
}
|
||||||
|
if ($mins === 720) {
|
||||||
|
$parsedCollection = $parsedCollection->filter(function ($item, $key) {
|
||||||
|
return $key % 10 === 0;
|
||||||
|
});
|
||||||
|
$parsedCollection = $parsedCollection->values();
|
||||||
|
}
|
||||||
|
if ($mins === 10080) {
|
||||||
|
$parsedCollection = $parsedCollection->filter(function ($item, $key) {
|
||||||
|
return $key % 20 === 0;
|
||||||
|
});
|
||||||
|
$parsedCollection = $parsedCollection->values();
|
||||||
|
}
|
||||||
|
|
||||||
return $parsedCollection;
|
return $parsedCollection->toArray();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -14,14 +14,13 @@
|
|||||||
<script>
|
<script>
|
||||||
checkTheme();
|
checkTheme();
|
||||||
const optionsServerCpu = {
|
const optionsServerCpu = {
|
||||||
|
stroke: {
|
||||||
|
curve: 'straight',
|
||||||
|
},
|
||||||
chart: {
|
chart: {
|
||||||
height: '150px',
|
height: '150px',
|
||||||
id: '{!! $chartId !!}',
|
id: '{!! $chartId !!}',
|
||||||
type: 'area',
|
type: 'area',
|
||||||
stroke: {
|
|
||||||
curve: 'straight',
|
|
||||||
},
|
|
||||||
|
|
||||||
toolbar: {
|
toolbar: {
|
||||||
show: false,
|
show: false,
|
||||||
tools: {
|
tools: {
|
||||||
|
@ -14,14 +14,13 @@
|
|||||||
<script>
|
<script>
|
||||||
checkTheme();
|
checkTheme();
|
||||||
const optionsServerMemory = {
|
const optionsServerMemory = {
|
||||||
|
stroke: {
|
||||||
|
curve: 'straight',
|
||||||
|
},
|
||||||
chart: {
|
chart: {
|
||||||
height: '150px',
|
height: '150px',
|
||||||
id: '{!! $chartId !!}',
|
id: '{!! $chartId !!}',
|
||||||
type: 'area',
|
type: 'area',
|
||||||
stroke: {
|
|
||||||
curve: 'straight',
|
|
||||||
},
|
|
||||||
|
|
||||||
toolbar: {
|
toolbar: {
|
||||||
show: false,
|
show: false,
|
||||||
tools: {
|
tools: {
|
||||||
@ -122,7 +121,6 @@
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user