Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
centreon
Project overview
Project overview
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Groupe EDF
Public
centreon
Commits
e93f5ab6
Commit
e93f5ab6
authored
Mar 05, 2018
by
loiclau
Committed by
Loic Laurent
Mar 05, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix(clapi) link host with default poller if unknown poller (#6099)
parent
ba022241
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
20 additions
and
1 deletion
+20
-1
lib/Centreon/Object/Instance/Instance.php
lib/Centreon/Object/Instance/Instance.php
+12
-0
www/class/centreon-clapi/centreonHost.class.php
www/class/centreon-clapi/centreonHost.class.php
+8
-1
No files found.
lib/Centreon/Object/Instance/Instance.php
View file @
e93f5ab6
...
...
@@ -45,4 +45,16 @@ class Centreon_Object_Instance extends Centreon_Object
protected
$table
=
"nagios_server"
;
protected
$primaryKey
=
"id"
;
protected
$uniqueLabelField
=
"name"
;
public
function
getDefaultInstance
()
{
$res
=
$this
->
db
->
query
(
"SELECT `name` FROM `nagios_server` WHERE `is_default` = 1"
);
if
(
$res
->
rowCount
()
==
0
)
{
$res
=
$this
->
db
->
query
(
"SELECT `name` FROM `nagios_server` WHERE `localhost` = '1'"
);
}
$row
=
$res
->
fetch
();
return
$row
[
'name'
];
}
}
www/class/centreon-clapi/centreonHost.class.php
View file @
e93f5ab6
...
...
@@ -257,7 +257,14 @@ class CentreonHost extends CentreonObject
if
(
$instanceName
)
{
$tmp
=
$instanceObject
->
getIdByParameter
(
$instanceObject
->
getUniqueLabelField
(),
$instanceName
);
if
(
!
count
(
$tmp
))
{
throw
new
CentreonClapiException
(
self
::
OBJECT_NOT_FOUND
.
":"
.
$instanceName
);
$defaultInstanceName
=
$instanceObject
->
getDefaultInstance
();
$tmp
=
$instanceObject
->
getIdByParameter
(
$instanceObject
->
getUniqueLabelField
(),
$defaultInstanceName
);
if
(
!
count
(
$tmp
))
{
throw
new
CentreonClapiException
(
self
::
OBJECT_NOT_FOUND
.
" :"
.
$instanceName
);
}
}
$instanceId
=
$tmp
[
0
];
}
else
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment