Question

Object not found in Centreon API Centreon CLAPI

  • 23 June 2023
  • 4 replies
  • 180 views

Badge +2

Hello everyone,

Being new to Centreon, i just discovered clapi and tried to type a command line to do an action on a particular host but i get everytime such an error “Object ‘MyHost” not found in Centreon API”. So, i went to centreon documentation (https://docs.centreon.com/docs/api/rest-api-v1/) and saw that it was an error perhaps from an authentification matter. My errors are the 401 and 404.

I can’t find a solution for the moment. I need help. Thank you :)


4 replies

Userlevel 4
Badge +13

👋👋👋

 

Welcome @Umuntu for CLAPI you need a different URL

 

https://docs.centreon.com/docs/api/clapi/

Command Line API (v1) - CLAPI

Overview

Centreon CLAPI aims to offer (almost) all the features that are available on the user interface in terms of configuration.

 

Let us know the adventure 😊

Badge +2

Hello, Thank you for your answer, I had already used that link to login into centreon for CLAPI.

Now, when I try to add a host in the format : centreon -u admin -p 'centreon' -o HOST -a add -v "Host name;Alias;IP address;Template name", I get a “missing parameters” error. 

 

Have you ever had such an error pls ? If yes, what other parameters does centreon needs to add my host ? 

 

Thank you.

Userlevel 1
Badge +7

Hello, you forgot to put the poller and the hostgroup.

 

centreon -u admin -p 'centreon' -o HOST -a ADD -v "test;Test host;@IP;generic-host;central;Linux"

 

Order Description
1 Host name
2 Host alias
3 Host IP address
4 Host templates; for multiple definitions, use delimiter **
5 Instance name (poller)
6 Hostgroup; for multiple definitions, use delimiter **
Badge +2

Hello, I put those parameters, but nothing changed. And if I add my poller wich is “Central” I got this error : Object not found : Central. I don’t understand why because so far, I could do other actions on any host such as Show etc, but can’t add one.

Reply