Skip to content
This repository has been archived by the owner on Aug 5, 2022. It is now read-only.

The attribute backendtype in section backend_centreonbroker_1 in main configuration file does not match the correct format. #2

Open
centreon opened this issue May 5, 2015 · 32 comments
Labels
Milestone

Comments

@centreon
Copy link
Collaborator

centreon commented May 5, 2015

Zmylna write :

Can't run nagvis because error:
"The attribute backendtype in section backend_centreonbroker_1 in main configuration file does not match the correct format. Please review your configuration."

I did everything like decribed here: https://blog.centreon.com/nagviscentreon-broker-for-better-or-for-worse/
But no luck :(
PS.
Sorry for my english.

@Sk8dada
Copy link

Sk8dada commented May 7, 2015

I have the same problem and don't find a way to correct it.

I have CES 3.1 and installed nagvis 1.7.10.

Edit: Follow this tutorial to install nagvis. I did it and have no more problems now
https://documentation.centreon.com/docs/centreon-nagvis/en/latest/Install/Nagvis_backend.html

@centreon
Copy link
Collaborator Author

centreon commented Jul 6, 2015

clipboard01

@leoncx leoncx added the bug label Sep 3, 2015
@leoncx leoncx added this to the 1.1.2 milestone Sep 3, 2015
@pvillard31
Copy link

I faced the same issue, but by debugging the issue
=> looking in /usr/share/nagvis/share/server/core/classes/GlobalMainCfg.php (around line 1906)
It seems that we must be careful when using quotes in the Nagvis configuration file.
I copied/pasted the backend configuration from the web and the quotes was not correctly interpreted in Nagvis. If doing the same manually, it is OK.

@maksimatveev
Copy link

@pvillard31 maybe you can attach a working config here?

@pvillard31
Copy link

@maksimatveev You can have a look at the pull request I submitted #8 (I tested the use of Centreon with Nagvis for latest versions 2.7.1 and 1.9b4).

In the nagvis.ini.php file, here is what I changed :

[paths]
htmlcgi="/centreon"
[defaults]
backend="centreonbroker"
urltarget="_parent"
hosturl="[htmlcgi]/main.php?p=20201&o=svc&host_search=[host_name]&search=&poller=&hostgroup=&output_search="
hostgroupurl="[htmlcgi]/main.php?p=20209&o=svcOVHG"
serviceurl="[htmlcgi]/main.php?p=20201&o=svcd&host_name=[host_name]&service_description=[service_description]&poller=&hostgroup=&output_search="
servicegroupurl="[htmlcgi]/main.php?p=20212&o=svcOVSG"
mapurl="[htmlcgi]/main.php?p=403&map=[map_name]"
[backend_centreonbroker]
backendtype="centreonbroker"
dbhost="localhost"
dbport=3306
dbname="centreon_storage"
dbuser="centreon"
dbpass="password"

Let me know if you have other questions

@maksimatveev
Copy link

@pvillard31
"Unknown value dbhost used in section backend_centreonbroker in main configuration file."
I can not understand what he needs? My configuration in the attachment
nagvis.ini.php.zip

@pvillard31
Copy link

@maksimatveev could you try without the line statushost="" ?

@maksimatveev
Copy link

@pvillard31
Removed - "The section is not supported in main configuration. Please take a look at the documentation."
The configuration took here https://documentation.centreon.com/docs/centreon-nagvis/en/latest/Install/Nagvis_backend.html.
With such did not face before =(

@pvillard31
Copy link

@maksimatveev Did you add the backend into Nagvis class directory ?
https://github.com/centreon/centreon-nagvis-backend

@maksimatveev
Copy link

@pvillard31 Of course:
[root@rnd-oms-centreon classes]# pwd
/usr/share/nagvis/share/server/core/classes
[root@rnd-oms-centreon classes]# find GlobalBackendcentreonbroker.php
GlobalBackendcentreonbroker.php
This is not anything you need to send a file?

@pvillard31
Copy link

@maksimatveev

If your message is "The section is not supported in main configuration. Please take a look at the documentation.". I'd say that, in some way, Nagvis finds empty section in the configuration. In any case, it means that your configuration is not formatted as expected. Maybe you can give a try with the attached configuration.

nagvis.ini.php.txt

The error you mention is in : share/server/core/classes/GlobalMainCfg.php
Function : private function checkMainConfigIsValid($printErr)
Line 1840

I'd try to add some debug lines to understand what is going on...

@maksimatveev
Copy link

@pvillard31 Many thanks for your help)) Today try your file.

@maksimatveev
Copy link

@pvillard31 I use your file (just changed the password), but the error remained:
"Unknown value dbhost used in section backend_centreonbroker in main configuration file"
on http://10.19.74.37/nagvis/frontend/nagvis-js/index.php web-page.
I have version 1.7 may try to upgrade to the latest? What versions are supported?

@pvillard31
Copy link

Well not sure this is related with the Nagvis version but I didn't try with Nagvis 1.7 so it could be.
I'd suggest to add some logs/echo in the the class GlobalMainCfg.php where you have the error. It would help understanding what is going on exactly and on what check Nagvis considers the configuration as not correctly formatted.

@maksimatveev
Copy link

@pvillard31 I find the file you specified earlier in the line 1840 comment:
// This value could be empty....
To be added private function checkMainConfigIsValid($printErr) ?

Upgrading to version 1.8.5 has not helped.

@pvillard31
Copy link

On my side I am using the last version of Nagvis (1.9b4) so the lines could be different but I'd suggest to have a look here :

if(!isset($arrValidConfig[$key])) {
  // unknown attribute
  if($printErr) {
    throw new NagVisException(l('Unknown value [ATTRIBUTE] used in section [TYPE] in main configuration file.',
    Array('ATTRIBUTE' => $key, 'TYPE' => $type)));
  }
  return FALSE;
}

You may try printing the content of $arrValidConfig to check what are the expected values according to Nagvis for this backend.

@maksimatveev
Copy link

@pvillard31 I understand the logic of this problem. how to get the output $arrValidConfig?

@pvillard31
Copy link

@maksimatveev

echo $arrValidConfig;

Then, when displaying the home page of Nagvis, you should see the result.

@maksimatveev
Copy link

@pvillard31 I found the section, which you mentioned, what part you want to add "echo $arrValidConfig;"?

@bk0815
Copy link

bk0815 commented Feb 25, 2016

We ran into the same problem.
We saw that the MariaDB is setup without password by default, you should set a password.
Installing phpmyadmin is also for further administration of the DB recommended.
Then you can just configure Nagvis by Webfrontend - choose "add datasource", take an exisiting entry like merlinmy for e.g. and insert the parameters of your DB.

This is just a workaround of course, we have no clue, why this format issue occurs when editing the config files directly.

@maksimatveev
Copy link

@bk0815 Thank you, I will try in the near future.

@sujeitosuspeito
Copy link

Hello,
You have the same problem, someone managed to solve?

@ErrafayM
Copy link

ErrafayM commented Apr 4, 2016

I ran into the same problem in CES 3.3, any solution ?

EDIT :
I found my problem , i'm using nagvis 1.7.10 and i was using the latest GlobalBackendcentreonbroker.php which i guess only works with version higher than 1.8.x so i had to git clone tha older GlobalBackendcentreonbroker.php

@maksimatveev
Copy link

@ErrafayM And what error message you have displayed? I have version 1.8.5 and it does not solve the problem.

@ErrafayM
Copy link

ErrafayM commented Apr 5, 2016

The same problem you had "Unknown value dbhost used in section backend_centreonbroker in main configuration file", i also deleted Nagvis and started it from scratch.

@sujeiitosuspeito
Copy link

Good evening ErrafayM,

You could provide your configuration files and nagvis.php.ini
GlobalBackendcentreonbroker.php?

@ErrafayM
Copy link

ErrafayM commented Apr 7, 2016

@sujeiitosuspeito
Copy link

Thank you so much ErrafayM,

It worked.

@ErrafayM
Copy link

ErrafayM commented Apr 7, 2016

No problem sujeiitosuspeito ! i'm glad i could help.

@EllaStique
Copy link

EllaStique commented Jul 8, 2016

Hello,
I've also got the problem : "Unknown value dbhost used in section backend_centreonbroker in main configuration file" even after copying your nagvis.php.ini and GlobalBackendcentreonbroker.php files, and starting NagVis from scratch. Or maybe it was not really from scratch ...
Do you have any idea which files except from those above could affect my NagVis ?
(I'm using CES3.3 and nagvis 1.7.10)

[EDIT : After restarting twice, it's seems to be working. I kept using your files, so thaks anyway :) ]

@maksimatveev
Copy link

@EllaStique Hello!
what you mean by "restarting"?

@EllaStique
Copy link

EllaStique commented Jul 8, 2016

I guess "starting" was not the right term. I meant "delete all the nagios files and install it again" ;)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

9 participants