Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
monitoring
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
cylab
monitoring
Commits
c624e0bf
Commit
c624e0bf
authored
6 years ago
by
Tibo
Browse files
Options
Downloads
Patches
Plain Diff
Add agent to check installed client version
parent
54f2a129
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
web/app/Sensor/ClientVersion.php
+25
-0
25 additions, 0 deletions
web/app/Sensor/ClientVersion.php
web/app/Server.php
+2
-1
2 additions, 1 deletion
web/app/Server.php
web/tests/Unit/ExampleTest.php
+5
-0
5 additions, 0 deletions
web/tests/Unit/ExampleTest.php
with
32 additions
and
1 deletion
web/app/Sensor/ClientVersion.php
0 → 100644
+
25
−
0
View file @
c624e0bf
<?php
namespace
App\Sensor
;
/**
* Description of Reboot
*
* @author tibo
*/
class
ClientVersion
extends
\App\AbstractSensor
{
public
function
latestVersion
()
{
return
json_decode
(
file_get_contents
(
"https://gitlab.cylab.be/cylab/monitoring/raw/master/php-client/release/manifest.json"
))[
0
]
->
version
;
}
//put your code here
public
function
report
()
{
return
"<p>Installed version: "
.
$this
->
getServer
()
->
clientVersion
()
.
"</p>"
.
"<p>Latest client version: "
.
$this
->
latestVersion
()
.
"</p>"
;
}
public
function
status
()
{
return
self
::
STATUS_OK
;
}
}
This diff is collapsed.
Click to expand it.
web/app/Server.php
+
2
−
1
View file @
c624e0bf
...
...
@@ -15,7 +15,8 @@ class Server extends Model
\App\Sensor\Updates
::
class
,
\App\Sensor\Disks
::
class
,
\App\Sensor\Inodes
::
class
,
\App\Sensor\Date
::
class
\App\Sensor\Date
::
class
,
\App\Sensor\ClientVersion
::
class
];
public
function
__construct
(
array
$attributes
=
array
())
{
...
...
This diff is collapsed.
Click to expand it.
web/tests/Unit/ExampleTest.php
+
5
−
0
View file @
c624e0bf
...
...
@@ -72,7 +72,12 @@ tmpfs 2451716 0 2451716 0% /run/user/1000";
$cpuinfo
=
$server
->
parseCpuinfo
(
$string
);
$this
->
assertEquals
(
8
,
$cpuinfo
[
"threads"
]);
$this
->
assertEquals
(
"Intel(R) Core(TM) i7-7700HQ CPU @ 2.80GHz"
,
$cpuinfo
[
"cpu"
]);
}
public
function
testClientVersion
()
{
$server
=
new
\App\Server
();
$client_version
=
new
\App\Sensor\ClientVersion
(
$server
);
$this
->
assertStringMatchesFormat
(
'%f'
,
$client_version
->
latestVersion
());
}
...
...
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