hello
could you please describe how you are using the api with curl, and what is your workflow? (and also which endpoint you are using and version of centreon)
I’m using the api for a lot of monitoring, but not really for modifying the config, and the api is pretty responsive
Hello,
I use ansible to install my Centreon environment.
Here, you have my template import task
- name: Import Host Template
uri:
url: "https://@IP_Centreon/centreon/api/v23.04/configuration/hosts/groups"
method: POST
status_code: 201, 409
body_format: json
body:
name: "{{ item.name }}"
alias: "{{ item.alias }}"
icon_id: "{{ item.icon_id | default(omit) }}"
is_activated: "{{ item.is_activated }}"
headers:
Cookie: "{{ login.cookies_string }}"
with_items: "{{ template_host_group }}"
Here, the host group list:
template_host_group:
- name: HGRP-TOTO-TOTO1
alias: HGRP-TOTO-TOTO1
is_activated: true
- name: HGRP-TOTO-TOTO2
alias: HGRP-TOTO-TOTO2
is_activated: true
O...] (~ 130 hosts group)
Here, the result of ansible tasks:
TASK centreon_import_data : Import Host Template] ***************************************************************************************************************************************************************************************************************************************
Tuesday 24 September 2024 09:39:41 +0000 (0:00:00.044) 0:00:08.876 *****
ok: 0Centreon_Server] => (item={'name': 'HGRP-TOTO-TOTO1', 'alias': 'HGRP-TOTO-TOTO1', 'is_activated': True})
ok: TCentreon_Server] => (item={'name': ''HGRP-TOTO-TOTO2', 'alias': ''HGRP-TOTO-TOTO2', 'is_activated': True})
G...] ( ~ 130 lines)
It may be slow because it's a technical limitation of ansible. But if I parralel the imports, I'm afraid I'll “break” the database or Centreon configuration files.
When I use the clapi method, i import the file with all my host group directly on the Centreon Server, then i run the command: “centreon -u admin -p password -i file_host_group”, and this is faster.