centreon / centreon-nagvis

A module to integrate Nagvis into Centreon in order to have simple graphical views
10 stars 10 forks source link

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

Open centreon opened 9 years ago

centreon commented 9 years ago

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 commented 9 years ago

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 commented 9 years ago

clipboard01

pvillard31 commented 8 years ago

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 commented 8 years ago

@pvillard31 maybe you can attach a working config here?

pvillard31 commented 8 years ago

@maksimatveev You can have a look at the pull request I submitted https://github.com/centreon/centreon-nagvis/pull/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 commented 8 years ago

@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 commented 8 years ago

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

maksimatveev commented 8 years ago

@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 commented 8 years ago

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

maksimatveev commented 8 years ago

@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 commented 8 years ago

@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 commented 8 years ago

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

maksimatveev commented 8 years ago

@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 commented 8 years ago

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 commented 8 years ago

@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 commented 8 years ago

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 commented 8 years ago

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

pvillard31 commented 8 years ago

@maksimatveev

echo $arrValidConfig;

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

maksimatveev commented 8 years ago

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

bk0815 commented 8 years ago

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 commented 8 years ago

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

sujeitosuspeito commented 8 years ago

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

ErrafayM commented 8 years ago

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 commented 8 years ago

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

ErrafayM commented 8 years ago

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 commented 8 years ago

Good evening ErrafayM,

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

ErrafayM commented 8 years ago

Yeah sure,

GlobalBackendcentreonbroker.php

nagvis.ini.php

sujeiitosuspeito commented 8 years ago

Thank you so much ErrafayM,

It worked.

ErrafayM commented 8 years ago

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

EllaStique commented 8 years ago

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 commented 8 years ago

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

EllaStique commented 8 years ago

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