Skip to main content
Question

APIv2 host service template auto creation

  • October 7, 2024
  • 6 replies
  • 284 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 **
  • 7 replies
  • November 8, 2024

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
  • 531 replies
  • November 8, 2024

@Lionel do you mean this action?

 


ponchoh
Centreonian
Forum|alt.badge.img+14
  • Centreonian
  • 531 replies
  • November 8, 2024

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 **
  • 7 replies
  • November 8, 2024

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
  • 531 replies
  • November 8, 2024

@cabrilucide you can always upgrade hehehe 😁😎😜

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


Forum|alt.badge.img+2
  • Author
  • Steward *
  • 5 replies
  • November 12, 2024

Hi,

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

Lionel