YPSI-SAS / centctl

Centctl is a Go CLI which allows to manage multiple Centreon servers.
MIT License
11 stars 4 forks source link

adding new host does not show up in Centreon wb interface #30

Open fmeunierFKY opened 9 months ago

fmeunierFKY commented 9 months ago

Hi, When I add a host it returns me that the host is added , but I did not show up in Centreon web interface in host view ... any idea?

thanks

centctl_windows_amd64.exe" add host -n server -i x.x.x.x -a "Serveur" -p Poller1 -t Windows-NSClient -g INFRA --server "xxx" --password xxx --login xxx --version v1 --url https://xxx/centreon

INFO: The host xxxx is created INFO: The template of the host xxxx is applied

vcoumailleau commented 9 months ago

Hello, Did you check if the host you created is present in Configuration>Hosts>Hosts menu on Centreon WebUI ? If you want your host to be present directly in monitoring view, you can add the --apply flag to your command

Regards,

fmeunierFKY commented 9 months ago

Tu es Francais je crois.?

vcoumailleau commented 9 months ago

Oui je suis francais

fmeunierFKY commented 9 months ago

ok super! donc non je ne le vois pas dans Configuration>Hosts>Hosts. et en ajoutant --apply, j'ai ca en retour

<!DOCTYPE html>

An Error Occurred: Internal Server Error

Oops! An Error Occurred

The server returned a "500 Internal Server Error".

Something is broken. Please let us know what you were doing when this error occurred. We will fix it as soon as possible. Sorry for any inconvenience caused.

vcoumailleau commented 9 months ago

Okay alors il semblerait que les arguments --login --password et --url ne soit pas pris en compte dans ta requête Peux tu essayer de mettre ces valeurs dans ton fichier de config yaml CentCTL ? (Si tu en a créé un) De cette facon:

servers:
   - server: "NAMESERVER"
     url: "URL" 
     login: "LOGIN"
     password: "PASSWORD"
     version: VERSION

En remplacant les valeurs en majuscule par les tienne

fmeunierFKY commented 9 months ago

ok ca avance, par contre j'ai ca

centctl/cmd.initConfig:root.go:213 centctl authentification - invalid character '<' looking for beginning of value

voila mon fichier

servers:

vcoumailleau commented 9 months ago

Quelle est l'url de Centreon sur la WebUI quand tu es sur la page de login par exemple? image

fmeunierFKY commented 9 months ago

celle ci https://monserveur/centreon/login

vcoumailleau commented 9 months ago

Quel est la version de Centreon que tu utilises, et la version de CentCTL (centctl_windows_amd64.exe version )? La commande que tu utilises pour faire les tests est la même que celle du premier message? Sinon peux tu me l'envoyer stp?

Aussi, ton fichier de config CentCTL est bien déclaré en variable d'environnement?

fmeunierFKY commented 9 months ago

centctl v2.5.2

centctl_windows_amd64.exe" add host -n servername -i xxx.xxx.xxx.xxx -a "Serveur Test" -p Poller1 -t NSClient-05-NRPE -g INFRA --server CENTREONPROD --apply

et oui mon ficher centctl.yaml est bien déclaré dans $env:CENTCTL_CONF

vcoumailleau commented 9 months ago

Okay on va essayer via une requête curl si la requête d'authentification passe de cette facon Peux-tu lancer cette commande

curl.exe -X POST -F "username=USERNAME" -F "password=PASSWORD" https://SERVEURCENTREON/centreon/api/index.php?action=authenticate

Et me dire si tu as bien un retour de cette forme:

{"authToken":"123456789abcdefg"}
fmeunierFKY commented 9 months ago

{"authToken":"q9venotBrlgA75nrSVfeIb+Se\/qIlRQmRf+1G9V2tINUH8llnM7lRQf4BsV9SQ4F"}

vcoumailleau commented 9 months ago

Okay donc les requêtes d'auth fonctionnent bien Essaye de prendre la dernière version de CentCTL et test si tu as la même erreur que tout à l'heure "centctl/cmd.initConfig:root.go:213 centctl authentification - invalid character '<' looking for beginning of value"