Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
MetaGer
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
open-source
MetaGer
Commits
85267ea6
Commit
85267ea6
authored
5 years ago
by
Dominik Hebeler
Browse files
Options
Downloads
Patches
Plain Diff
added stats
parent
dbee982d
No related branches found
Branches containing commit
No related tags found
1 merge request
!1435
Development
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
app/Http/Controllers/AdminInterface.php
+48
-0
48 additions, 0 deletions
app/Http/Controllers/AdminInterface.php
resources/views/admin/countGraphToday.blade.php
+6
-6
6 additions, 6 deletions
resources/views/admin/countGraphToday.blade.php
routes/web.php
+1
-0
1 addition, 0 deletions
routes/web.php
with
55 additions
and
6 deletions
app/Http/Controllers/AdminInterface.php
+
48
−
0
View file @
85267ea6
...
...
@@ -193,6 +193,54 @@ class AdminInterface extends Controller
}
public
function
engineStats
()
{
$result
=
[];
$result
[
"loadavg"
]
=
sys_getloadavg
();
// Memory Data
$data
=
explode
(
"
\n
"
,
trim
(
file_get_contents
(
"/proc/meminfo"
)));
$meminfo
=
[];
foreach
(
$data
as
$line
)
{
list
(
$key
,
$val
)
=
explode
(
":"
,
$line
);
$meminfo
[
$key
]
=
trim
(
$val
);
}
$conversions
=
[
"KB"
,
"MB"
,
"GB"
,
"TB"
,
];
$memAvailable
=
$meminfo
[
"MemAvailable"
];
$memAvailable
=
intval
(
explode
(
" "
,
$memAvailable
)[
0
]);
$counter
=
0
;
while
(
$memAvailable
>
1000
)
{
$memAvailable
/=
1000.0
;
$counter
++
;
}
$memAvailable
=
round
(
$memAvailable
);
$memAvailable
.
=
" "
.
$conversions
[
$counter
];
$result
[
"memoryAvailable"
]
=
$memAvailable
;
$resultCount
=
0
;
$file
=
"/var/log/metager/mg3.log"
;
if
(
file_exists
(
$file
))
{
$fh
=
fopen
(
$file
,
"r"
);
try
{
while
(
fgets
(
$fh
)
!==
false
)
{
$resultCount
++
;
}
}
finally
{
fclose
(
$fh
);
}
}
$result
[
"resultCount"
]
=
number_format
(
$resultCount
,
0
,
","
,
"."
);
return
response
()
->
json
(
$result
);
}
private
function
getStats
(
$days
)
{
$maxDate
=
Carbon
::
createFromFormat
(
'd.m.Y'
,
"28.06.2016"
);
...
...
This diff is collapsed.
Click to expand it.
resources/views/admin/countGraphToday.blade.php
+
6
−
6
View file @
85267ea6
...
...
@@ -12,14 +12,14 @@
<svg
xmlns=
"http://www.w3.org/2000/svg"
version=
"1.1"
width=
"100%"
height=
"auto"
viewBox=
"0 0 400 100"
>
<!-- Y-Achse -->
<path
d=
"m{{$startX}} {{$startY}} L{{$startX}} {{$padding}} L{{$startX-1}} {{$padding}} L{{$startX}} {{$padding-1}} L{{$startX+1}} {{$padding}} L{{$startX}} {{$padding}}z"
fill=
"#333"
stroke=
"#333"
stroke-width=
".7"
/>
<text
x=
"{{ $startX + 4}}"
y=
"{{ $padding + $paddingArrow - 2 }}"
style=
"font-size:
.3em
;"
fill=
"rgba(0,0,0,.5)"
>
X
(Abfragen)
<text
x=
"{{ $startX + 4}}"
y=
"{{ $padding + $paddingArrow - 2 }}"
style=
"font-size:
6px
;"
fill=
"rgba(0,0,0,.5)"
>
Y
(Abfragen)
</text>
<!-- Skalierung Y-Achse -->
@for($i = 0; $i
<
10;
$
i
++)
<
line
x1=
"{{$startX-1}}"
y1=
"{{ ($padding+$paddingArrow) + (($startY-($padding+$paddingArrow)) * ($i/10.0)) }}"
x2=
"{{$startX+1}}"
y2=
"{{ ($padding+$paddingArrow) + (($startY-($padding+$paddingArrow)) * ($i/10.0)) }}"
fill=
"#333"
stroke=
"#333"
stroke-width=
".7"
/>
<line
x1=
"{{$startX}}"
y1=
"{{ ($padding+$paddingArrow) + (($startY-($padding+$paddingArrow)) * ($i/10.0)) }}"
x2=
"{{$width-$padding-$paddingArrow}}"
y2=
"{{ ($padding+$paddingArrow) + (($startY-($padding+$paddingArrow)) * ($i/10.0)) }}"
fill=
"#777"
stroke=
"#777"
stroke-width=
".2"
/>
<text
x=
"{{$startX - 15}}"
y=
"{{ ($padding+$paddingArrow) + (($startY-($padding+$paddingArrow)) * ($i/10.0)) + 2 }}"
style=
"font-size:
.3em
;"
>
<text
x=
"{{$startX - 15}}"
y=
"{{ ($padding+$paddingArrow) + (($startY-($padding+$paddingArrow)) * ($i/10.0)) + 2 }}"
style=
"font-size:
6px
;"
>
@php ($value = round($data["max"] - $i * ($data["max"] / 10.0)))
@if($value >= 1000)
@php($value = round($value / 100.0) / 10.0 . "k" )
...
...
@@ -29,13 +29,13 @@
@endfor
@for($i = 0; $i
<
$
entryCount
;
$
i
++)
<
rect
x=
"{{ $startX + ($widthPerElement * $i * 2) + $widthPerElement}}"
y=
"{{ $startY - ($heightPerSearch * $data["
hourly
"][$
i
])
}}"
width=
"{{ $widthPerElement }}"
height=
"{{ ($heightPerSearch * $data["
hourly
"][$
i
])
}}"
style=
"fill:rgb(255,127,0); stroke-width:0;"
/>
<text
x=
"{{ $startX + ($widthPerElement * 1.4) + (($width - $padding - $paddingArrow - $startX - ($widthPerElement * 2)) * ($i/($entryCount-1)))}}"
y=
"{{$startY + 6}}"
style=
"font-size:
.3em
;"
>
<text
x=
"{{ $startX + ($widthPerElement * 1.4) + (($width - $padding - $paddingArrow - $startX - ($widthPerElement * 2)) * ($i/($entryCount-1)))}}"
y=
"{{$startY + 6}}"
style=
"font-size:
6px
;"
>
{{ number_format($i, 0, ",", ".") }}
</text>
@endfor
<!-- X-Achse -->
<path
d=
"m{{$startX}} {{$startY}} L{{$width-$padding}} {{$startY}} L{{$width-$padding}} {{$startY-1}} L{{$width-($padding-1)}} {{$startY}} L{{$width-$padding}} {{$startY+1}} L{{$width-$padding}} {{$startY}}z"
fill=
"#333"
stroke=
"#333"
stroke-width=
".5"
/>
<text
x=
"{{ $width - 4}}"
y=
"{{ $startY + 3}}"
style=
"font-size:
.3em
;"
fill=
"rgba(0,0,0,.5)"
writing-mode=
"tb"
>
Y
(h)
<text
x=
"{{ $width - 4}}"
y=
"{{ $startY + 3}}"
style=
"font-size:
6px
;"
fill=
"rgba(0,0,0,.5)"
writing-mode=
"tb"
>
X
(h)
</text>
</svg>
This diff is collapsed.
Click to expand it.
routes/web.php
+
1
−
0
View file @
85267ea6
...
...
@@ -171,6 +171,7 @@ Route::group(
Route
::
get
(
'/'
,
'AdminInterface@index'
);
Route
::
match
([
'get'
,
'post'
],
'count'
,
'AdminInterface@count'
);
Route
::
get
(
'count/graphtoday.svg'
,
'AdminInterface@countGraphToday'
);
Route
::
get
(
'engine/stats.json'
,
'AdminInterface@engineStats'
);
Route
::
get
(
'check'
,
'AdminInterface@check'
);
Route
::
get
(
'engines'
,
'AdminInterface@engines'
);
});
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment