Skip to main content
Question

APIv2 host service template auto creation

  • Oct 7, 2024 7:49 AM UTC
  • 6 replies
  • 370 views

Forum|alt.badge.img+2

Hi,

I'm new to Centreon (24.04), and I'm probably missing something.

I want to add my host via the API (using Ansible). I managed to do it using this endpoint: /centreon/api/latest/configuration/hosts.

The host creation is successful, and it's linked to the correct template, but no services are created.

How can I achieve this, similar to the option in the host creation GUI that says "Create Services linked to the Template too"?

I've looked everywhere in the API documentation but couldn't find any clues: https://docs-api.centreon.com/api/centreon-web/#tag/Host.

Can someone please help?

6 replies

Forum|alt.badge.img+5
  • Steward **
  • Nov 8, 2024 2:53 PM UTC

Hello,
I had the same problem.
I believe this function is not available in api V2.
I used the api v1 pour this.

Cordialement


ponchoh
Centreonian
Forum|alt.badge.img+14
  • Centreonian
  • Nov 8, 2024 3:26 PM UTC

@Lionel do you mean this action?

 


ponchoh
Centreonian
Forum|alt.badge.img+14
  • Centreonian
  • Nov 8, 2024 4:15 PM UTC

ok please try after

/configuration/hosts/{host_id}/services/deploy

Add services to a host based on associated host template

 

Thanks everyone.


Forum|alt.badge.img+5
  • Steward **
  • Nov 8, 2024 4:48 PM UTC

Yes it’s what I need. Thanks for the anwser.
Unfortunatly my platform is a 23.10 version. I will have to wait a lot ...
I hope Lionel will be happy with this news.


ponchoh
Centreonian
Forum|alt.badge.img+14
  • Centreonian
  • Nov 8, 2024 4:52 PM UTC

@cabrilucide you can always upgrade hehehe 😁😎😜

https://docs.centreon.com/docs/upgrade/upgrade-from-23-10/


Forum|alt.badge.img+2
  • Author
  • Steward *
  • Nov 12, 2024 8:43 AM UTC

Hi,

until now, i was using old v1 clapi. But i will test your suggestion thank you.

Lionel