Private GIT
Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
centreon
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
vlbox
centreon
Commits
20de58c4
Commit
20de58c4
authored
Jan 9, 2018
by
Jeremy Delpierre
Browse files
Options
Downloads
Patches
Plain Diff
feat(api): Add new core data broker and engine versions
parent
103e7efd
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
www/api/class/centreon_statistics.class.php
+4
-4
4 additions, 4 deletions
www/api/class/centreon_statistics.class.php
www/class/centreonVersion.class.php
+30
-6
30 additions, 6 deletions
www/class/centreonVersion.class.php
with
34 additions
and
10 deletions
www/api/class/centreon_statistics.class.php
+
4
−
4
View file @
20de58c4
...
@@ -37,6 +37,7 @@ require_once dirname(__FILE__) . "/webService.class.php";
...
@@ -37,6 +37,7 @@ require_once dirname(__FILE__) . "/webService.class.php";
require_once
_CENTREON_PATH_
.
"/www/class/centreonUUID.class.php"
;
require_once
_CENTREON_PATH_
.
"/www/class/centreonUUID.class.php"
;
require_once
_CENTREON_PATH_
.
"/www/class/centreonGMT.class.php"
;
require_once
_CENTREON_PATH_
.
"/www/class/centreonGMT.class.php"
;
require_once
_CENTREON_PATH_
.
"/www/class/centreonVersion.class.php"
;
require_once
_CENTREON_PATH_
.
"/www/class/centreonVersion.class.php"
;
require_once
_CENTREON_PATH_
.
"/www/class/centreonDB.class.php"
;
class
CentreonStatistics
extends
CentreonWebService
class
CentreonStatistics
extends
CentreonWebService
{
{
...
@@ -78,11 +79,10 @@ class CentreonStatistics extends CentreonWebService
...
@@ -78,11 +79,10 @@ class CentreonStatistics extends CentreonWebService
*/
*/
public
function
getVersion
()
public
function
getVersion
()
{
{
$centreonVersion
=
new
CentreonVersion
(
$this
->
pearDB
);
$dbStorage
=
new
CentreonDB
(
"centstorage"
);
$centreonVersion
=
new
CentreonVersion
(
$this
->
pearDB
,
$dbStorage
);
return
array
(
return
array
(
'core'
=>
array
(
'core'
=>
$centreonVersion
->
getCore
(),
'centreon-web'
=>
$centreonVersion
->
getVersion
()
),
'modules'
=>
$centreonVersion
->
getModules
(),
'modules'
=>
$centreonVersion
->
getModules
(),
'widgets'
=>
$centreonVersion
->
getWidgets
(),
'widgets'
=>
$centreonVersion
->
getWidgets
(),
'system'
=>
$centreonVersion
->
getSystem
(),
'system'
=>
$centreonVersion
->
getSystem
(),
...
...
This diff is collapsed.
Click to expand it.
www/class/centreonVersion.class.php
+
30
−
6
View file @
20de58c4
...
@@ -37,34 +37,58 @@ class CentreonVersion
...
@@ -37,34 +37,58 @@ class CentreonVersion
{
{
/**
/**
* @var CentreonDB
* @var CentreonDB
* @var CentreonDBStorage
*/
*/
private
$db
;
private
$db
;
private
$dbStorage
;
/**
/**
* Constructor
* Constructor
*
*
* @param CentreonDB $db
* @param CentreonDB $db
* @param CentreonDBStorage $dbStorage
*/
*/
public
function
__construct
(
$db
)
public
function
__construct
(
$db
,
$dbStorage
=
null
)
{
{
$this
->
db
=
$db
;
$this
->
db
=
$db
;
if
(
!
is_null
(
$dbStorage
))
{
$this
->
dbStorage
=
$dbStorage
;
}
}
}
/**
/**
* Get Centreon
web
version
* Get Centreon
core
version
*
*
* @return
string
* @return
array
*/
*/
public
function
get
Version
()
public
function
get
Core
()
{
{
$data
=
''
;
$data
=
array
()
;
// Get version of the centreon-web
$query
=
'SELECT i.value FROM informations i '
.
$query
=
'SELECT i.value FROM informations i '
.
'WHERE i.key = "version"'
;
'WHERE i.key = "version"'
;
$result
=
$this
->
db
->
query
(
$query
);
$result
=
$this
->
db
->
query
(
$query
);
if
(
$row
=
$result
->
fetchRow
())
{
if
(
$row
=
$result
->
fetchRow
())
{
$data
=
$row
[
'value'
];
$data
[
'centreon-web'
]
=
$row
[
'value'
];
}
}
// Get version of the centreon-broker
$cmd
=
shell_exec
(
"cbd -v"
);
if
(
preg_match
(
'/^.*(\d+\.\d+\.\d+)$/'
,
$cmd
,
$matches
))
{
$data
[
'centreon-broker'
]
=
$matches
[
1
];
}
// Get version of the centreon-engine
$queryProgram
=
"SELECT DISTINCT instance_id, version AS program_version, engine AS program_name, name AS instance_name FROM instances WHERE deleted = 0 "
;
$result
=
$this
->
dbStorage
->
query
(
$queryProgram
);
while
(
$info
=
$result
->
fetchRow
())
{
$data
[
'centreon-engine'
]
=
$info
[
"program_version"
];
}
return
$data
;
return
$data
;
}
}
...
...
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