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
9f59f7eb
Commit
9f59f7eb
authored
8 years ago
by
Dominik Hebeler
Browse files
Options
Downloads
Patches
Plain Diff
SVG Grafik geändert, sodass Sie nur den Zeitraum der letzten Stunde anzeigt
parent
0d4f68ee
No related branches found
Branches containing commit
No related tags found
2 merge requests
!127
Development
,
!126
SVG Grafik geändert, sodass Sie nur den Zeitraum der letzten Stunde anzeigt
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
app/Http/Controllers/AdminInterface.php
+16
-3
16 additions, 3 deletions
app/Http/Controllers/AdminInterface.php
resources/views/admin.blade.php
+27
-7
27 additions, 7 deletions
resources/views/admin.blade.php
with
43 additions
and
10 deletions
app/Http/Controllers/AdminInterface.php
+
16
−
3
View file @
9f59f7eb
...
@@ -9,23 +9,36 @@ use Redis;
...
@@ -9,23 +9,36 @@ use Redis;
class
AdminInterface
extends
Controller
class
AdminInterface
extends
Controller
{
{
public
function
index
()
public
function
index
(
Request
$request
)
{
{
$time
=
$request
->
input
(
'time'
,
60
);
# Zunächst einmal die Redis-Verbindung:
# Zunächst einmal die Redis-Verbindung:
$redis
=
Redis
::
connection
(
'redisLogs'
);
$redis
=
Redis
::
connection
(
'redisLogs'
);
# Dann lesen wir alle Server aus:
# Dann lesen wir alle Server aus:
$member
=
$redis
->
smembers
(
'logs.worker'
);
$member
=
$redis
->
smembers
(
'logs.worker'
);
$today
=
strtotime
(
date
(
DATE_RFC822
,
mktime
(
0
,
0
,
0
,
date
(
"m"
),
date
(
"d"
),
date
(
"Y"
))));
$beginningTime
=
strtotime
(
date
(
DATE_RFC822
,
mktime
(
date
(
"H"
),
date
(
"i"
)
-
$time
,
date
(
"s"
),
date
(
"m"
),
date
(
"d"
),
date
(
"Y"
))))
-
$today
;
# Jetzt besorgen wir uns die Daten für jeden Server:
# Jetzt besorgen wir uns die Daten für jeden Server:
$data
=
[];
$data
=
[];
foreach
(
$member
as
$mem
)
foreach
(
$member
as
$mem
)
{
{
$tmp
=
$redis
->
hgetall
(
'logs.worker.'
.
$mem
);
$tmp
=
$redis
->
hgetall
(
'logs.worker.'
.
$mem
);
$data
[
$mem
]
=
$tmp
;
ksort
(
$tmp
,
SORT_NUMERIC
);
$tmp2
=
[];
foreach
(
$tmp
as
$el
=>
$value
)
{
if
(
$el
>=
$beginningTime
)
$data
[
$mem
][
$el
]
=
$value
;
}
}
}
#$data = [ 5 => "majm", 2 => "mngsn", 7 => "akljsd"];
#arsort($data);
return
view
(
'admin'
)
return
view
(
'admin'
)
->
with
(
'data'
,
$data
)
->
with
(
'data'
,
$data
)
->
with
(
'title'
,
"Admin-Interface-MetaGer"
);
->
with
(
'title'
,
"Admin-Interface-MetaGer"
)
->
with
(
'time'
,
$time
);
}
}
}
}
This diff is collapsed.
Click to expand it.
resources/views/admin.blade.php
+
27
−
7
View file @
9f59f7eb
...
@@ -27,25 +27,43 @@
...
@@ -27,25 +27,43 @@
<
line
x1
=
"99%"
y1
=
"95%"
x2
=
"98%"
y2
=
"98%"
style
=
"stroke:rgb(0,0,0);stroke-width:3"
/>
<
line
x1
=
"99%"
y1
=
"95%"
x2
=
"98%"
y2
=
"98%"
style
=
"stroke:rgb(0,0,0);stroke-width:3"
/>
<!--
Beschriftungen
der
X
-
Achse
-->
<!--
Beschriftungen
der
X
-
Achse
-->
@
for
(
$x
=
(((
99
-
1
)
/
24
)
+
1
);
$x
<
98.9
;
$x
=
(
$x
+
((
99
-
1
)
/
24
))
)
<?
php
<
line
x1
=
"{{
$x
}}%"
y1
=
"93%"
x2
=
"{{
$x
}}%"
y2
=
"97%"
style
=
"stroke:rgb(0,0,0);stroke-width:1"
/>
$last
=
0
;
<
text
x
=
"{{
$x
}}%"
y
=
"99%"
fill
=
"black"
style
=
"font-size:10px;"
>
{{
((
$x
-
1
)
/
98
)
*
24
}}
</
text
>
for
(
$x
=
(((
99
-
1
)
/
$time
)
+
1
);
$x
<
98.9
;
$x
=
(
$x
+
((
99
-
1
)
/
$time
))
)
@
endfor
{
echo
'<line x1="'
.
$x
.
'%" y1="93%" x2="'
.
$x
.
'%" y2="97%" style="stroke:rgb(0,0,0);stroke-width:1" />'
;
if
(
(
$x
-
$last
)
>=
3
)
{
echo
'<text x="'
.
(
$x
-
1
)
.
'%" y="99%" fill="black" style="font-size:8px;">'
.
date
(
"H:i"
,
mktime
(
date
(
"H"
),
date
(
"i"
)
-
(
$time
-
((
$x
-
1
)
/
98
)
*
$time
),
date
(
"s"
),
date
(
"m"
),
date
(
"d"
),
date
(
"Y"
)))
.
'</text>'
;
$last
=
$x
;
}
}
?>
<text
x=
"95%"
y=
"90%"
fill=
"red"
>
Zeit (h): y
</text>
<text
x=
"95%"
y=
"90%"
fill=
"red"
>
Zeit (h): y
</text>
<!-- Nun die Datenpunkte: -->
<!-- Nun die Datenpunkte: -->
<?php
<?php
$count
=
0
;
$count
=
0
;
$maximum
=
0
;
$maximumY
=
0
;
foreach
(
$dataPoints
as
$key
=>
$value
)
foreach
(
$dataPoints
as
$key
=>
$value
)
{
{
if
(
$count
>
0
)
if
(
$count
>
0
)
{
{
$x1
=
(
$oldKey
/
86400
)
*
98
;
$start
=
strtotime
(
date
(
DATE_RFC822
,
mktime
(
date
(
"H"
),
date
(
"i"
)
-
$time
,
date
(
"s"
),
date
(
"m"
),
date
(
"d"
),
date
(
"Y"
))))
-
strtotime
(
date
(
DATE_RFC822
,
mktime
(
0
,
0
,
0
,
date
(
"m"
),
date
(
"d"
),
date
(
"Y"
))));
$x2
=
(
$key
/
86400
)
*
98
;
$lastkey
=
$oldKey
-
$start
;
$newkey
=
$key
-
$start
;
$x1
=
((
$lastkey
/
(
$time
*
60
))
*
98
)
+
1
;
$x2
=
((
$newkey
/
(
$time
*
60
))
*
98
)
+
1
;
$y1
=
95
-
((
$oldVal
/
100
)
*
95
);
$y1
=
95
-
((
$oldVal
/
100
)
*
95
);
$y2
=
95
-
((
$value
/
100
)
*
95
);
$y2
=
95
-
((
$value
/
100
)
*
95
);
if
(
$value
>
$maximum
)
{
$maximum
=
$value
;
$maximumY
=
$y2
;
}
echo
'<line x1="'
.
$x1
.
'%" y1="'
.
$y1
.
'%" x2="'
.
$x2
.
'%" y2="'
.
$y2
.
'%" style="stroke:rgb(0,0,0);stroke-width:1" />'
;
echo
'<line x1="'
.
$x1
.
'%" y1="'
.
$y1
.
'%" x2="'
.
$x2
.
'%" y2="'
.
$y2
.
'%" style="stroke:rgb(0,0,0);stroke-width:1" />'
;
}
}
$oldKey
=
$key
;
$oldKey
=
$key
;
...
@@ -53,6 +71,8 @@
...
@@ -53,6 +71,8 @@
$count
++
;
$count
++
;
}
}
?>
?>
<!-- Und noch eine Linie für das Maximum: -->
<line
x1=
"1%"
y1=
"{{ $maximumY }}%"
x2=
"99%"
y2=
"{{ $maximumY }}%"
style=
"stroke:rgb(255,0,0);stroke-width:1"
stroke-dasharray=
"5,5"
d=
"M5 20 l215 0"
/>
</svg>
</svg>
</div>
</div>
@endforeach
@endforeach
...
...
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