centreon / centreon-clapi

Centreon CLAPI Module
14 stars 14 forks source link

Importing services massively #355

Closed kozfelipe closed 7 years ago

kozfelipe commented 7 years ago

Centreon Web 2.8.4-5 Centreon Engine 1.6.1 Centreon Broker 3.0.1 CentOS release 6.8 (Final) MariaDB 5.5.53 CES VirtualBox

[root@OP-CENTREON tmp]# centreon -V
Centreon version 2.8.4
Centreon CLAPI version undefined

Unable to import services by host

here's my clapi-export.txt

SERVICE;ADD;RTCE-RBO008-01;RTCE-RBO008-01 Traffic eth-1/1 ACL3000006;
SERVICE;setparam;RTCE-RBO008-01;RTCE-RBO008-01 Traffic eth-1/1 ACL3000006;check_command;check_traffic64
SERVICE;setparam;RTCE-RBO008-01;RTCE-RBO008-01 Traffic eth-1/1 ACL3000006;check_period;24x7
SERVICE;setparam;RTCE-RBO008-01;RTCE-RBO008-01 Traffic eth-1/1 ACL3000006;notification_period;24x7
SERVICE;setparam;RTCE-RBO008-01;RTCE-RBO008-01 Traffic eth-1/1 ACL3000006;service_is_volatile;2
SERVICE;setparam;RTCE-RBO008-01;RTCE-RBO008-01 Traffic eth-1/1 ACL3000006;service_normal_check_interval;5
SERVICE;setparam;RTCE-RBO008-01;RTCE-RBO008-01 Traffic eth-1/1 ACL3000006;service_active_checks_enabled;2
SERVICE;setparam;RTCE-RBO008-01;RTCE-RBO008-01 Traffic eth-1/1 ACL3000006;service_passive_checks_enabled;2
SERVICE;setparam;RTCE-RBO008-01;RTCE-RBO008-01 Traffic eth-1/1 ACL3000006;service_parallelize_check;2
SERVICE;setparam;RTCE-RBO008-01;RTCE-RBO008-01 Traffic eth-1/1 ACL3000006;service_obsess_over_service;2
SERVICE;setparam;RTCE-RBO008-01;RTCE-RBO008-01 Traffic eth-1/1 ACL3000006;service_check_freshness;2
SERVICE;setparam;RTCE-RBO008-01;RTCE-RBO008-01 Traffic eth-1/1 ACL3000006;service_event_handler_enabled;2
SERVICE;setparam;RTCE-RBO008-01;RTCE-RBO008-01 Traffic eth-1/1 ACL3000006;service_flap_detection_enabled;2
SERVICE;setparam;RTCE-RBO008-01;RTCE-RBO008-01 Traffic eth-1/1 ACL3000006;service_process_perf_data;2
SERVICE;setparam;RTCE-RBO008-01;RTCE-RBO008-01 Traffic eth-1/1 ACL3000006;service_retain_status_information;2
SERVICE;setparam;RTCE-RBO008-01;RTCE-RBO008-01 Traffic eth-1/1 ACL3000006;service_retain_nonstatus_information;2
SERVICE;setparam;RTCE-RBO008-01;RTCE-RBO008-01 Traffic eth-1/1 ACL3000006;service_notifications_enabled;2
SERVICE;setparam;RTCE-RBO008-01;RTCE-RBO008-01 Traffic eth-1/1 ACL3000006;contact_additive_inheritance;0
SERVICE;setparam;RTCE-RBO008-01;RTCE-RBO008-01 Traffic eth-1/1 ACL3000006;cg_additive_inheritance;0
SERVICE;setparam;RTCE-RBO008-01;RTCE-RBO008-01 Traffic eth-1/1 ACL3000006;service_use_only_contacts_from_hostname;0
SERVICE;setparam;RTCE-RBO008-01;RTCE-RBO008-01 Traffic eth-1/1 ACL3000006;check_command_arguments;!eth-1/1
SERVICE;setparam;RTCE-RBO008-01;RTCE-RBO008-01 Traffic eth-1/1 ACL3000006;service_locked;0
SERVICE;setparam;RTCE-RBO008-01;RTCE-RBO008-01 Traffic eth-1/1 ACL3000006;service_register;1
SERVICE;setparam;RTCE-RBO008-01;RTCE-RBO008-01 Traffic eth-1/1 ACL3000006;service_activate;1

here's my import output

Line 1 : Object not found:
Line 2 : Object not found:RTCE-RBO008-01/RTCE-RBO008-01 Traffic eth-1/1 ACL3000006
Line 3 : Object not found:RTCE-RBO008-01/RTCE-RBO008-01 Traffic eth-1/1 ACL3000006
Line 4 : Object not found:RTCE-RBO008-01/RTCE-RBO008-01 Traffic eth-1/1 ACL3000006
Line 5 : Object not found:RTCE-RBO008-01/RTCE-RBO008-01 Traffic eth-1/1 ACL3000006
Line 6 : Object not found:RTCE-RBO008-01/RTCE-RBO008-01 Traffic eth-1/1 ACL3000006
Line 7 : Object not found:RTCE-RBO008-01/RTCE-RBO008-01 Traffic eth-1/1 ACL3000006
Line 8 : Object not found:RTCE-RBO008-01/RTCE-RBO008-01 Traffic eth-1/1 ACL3000006
Line 9 : Object not found:RTCE-RBO008-01/RTCE-RBO008-01 Traffic eth-1/1 ACL3000006
Line 10 : Object not found:RTCE-RBO008-01/RTCE-RBO008-01 Traffic eth-1/1 ACL3000006
Line 11 : Object not found:RTCE-RBO008-01/RTCE-RBO008-01 Traffic eth-1/1 ACL3000006
Line 12 : Object not found:RTCE-RBO008-01/RTCE-RBO008-01 Traffic eth-1/1 ACL3000006
Line 13 : Object not found:RTCE-RBO008-01/RTCE-RBO008-01 Traffic eth-1/1 ACL3000006
Line 14 : Object not found:RTCE-RBO008-01/RTCE-RBO008-01 Traffic eth-1/1 ACL3000006
Line 15 : Object not found:RTCE-RBO008-01/RTCE-RBO008-01 Traffic eth-1/1 ACL3000006
Line 16 : Object not found:RTCE-RBO008-01/RTCE-RBO008-01 Traffic eth-1/1 ACL3000006
Line 17 : Object not found:RTCE-RBO008-01/RTCE-RBO008-01 Traffic eth-1/1 ACL3000006
Line 18 : Object not found:RTCE-RBO008-01/RTCE-RBO008-01 Traffic eth-1/1 ACL3000006
Line 19 : Object not found:RTCE-RBO008-01/RTCE-RBO008-01 Traffic eth-1/1 ACL3000006
Line 20 : Object not found:RTCE-RBO008-01/RTCE-RBO008-01 Traffic eth-1/1 ACL3000006
Line 21 : Object not found:RTCE-RBO008-01/RTCE-RBO008-01 Traffic eth-1/1 ACL3000006
Line 22 : Object not found:RTCE-RBO008-01/RTCE-RBO008-01 Traffic eth-1/1 ACL3000006
Line 23 : Object not found:RTCE-RBO008-01/RTCE-RBO008-01 Traffic eth-1/1 ACL3000006
Line 24 : Object not found:RTCE-RBO008-01/RTCE-RBO008-01 Traffic eth-1/1 ACL3000006

here's the host

image

services by hostgroup works fine

here's an alternative trial (https://documentation.centreon.com/docs/centreon-clapi/en/latest/objects/services.html#add)

[root@OP-CENTREON tmp]# centreon -u admin -p ****** -o SERVICE -a add -v "RTCE-RBO008-01;RTCE-RBO008-01 Traffic eth-1/1 ACL3000006;generic-service"
Please check that your parameters are valid

references: https://forum.centreon.com/forum/centreon-ui/centreon-clapi-import-export-automation-etc/139350-clapi-imports-all-except-services?p=139388#post139388

196

kozfelipe commented 7 years ago

I managed to insert the service including a template. Apparently its mandatory. Yet, I couldnt view it as my operating user. The service can only by viewed by admin user

image

on massive services import, clapi imports only the first service from script without check_command_arguments

[root@OP-CENTREON tmp]# centreon -u admin -p ****** -o SERVICE -a setparam -v "RTCE-RBO008-01;RTCE-RBO008-01 Traffic eth-1/1 ACL3000006;check_command_arguments;!eth-1/1"
-bash: !eth-1/1": event not found

clapi wont escape "!"

also another issue:

[root@OP-CENTREON tmp]# centreon -u admin -p ****** -o SERVICE -a setparam -v "RTCE-RBO008-01;RTCE-RBO008-01 Traffic eth-1/1 ACL3000006;service_use_only_contacts_from_hostname;0"
Please check that your parameters are valid
kozfelipe commented 7 years ago

I managed to escape "!" with the following command:

centreon -u admin -p ****** -o SERVICE -a setparam -v "RTCE-RBO008-01;RTCE-RBO008-01 Traffic eth-1/1 ACL3000006;check_command_arguments;"'!'"eth-1/1"

and I ignored service_use_only_contacts_from_hostname setparam

after that the script continued the next services

kozfelipe commented 7 years ago

A missing ACL association was preventing users to view imported services via clapi.

Im closing this issue