Adding service via API
Posted: Wed May 30, 2018 3:55 am
Hi friends.
I need to add a new service to more tham 1000 hosts, and via API is more easier than manual, but i have a problem.
This is my commnad to add it
curl -XPOST "http://IP_NAGIOS/nagiosxi/api/v1/config/service?apikey=MY_API_KEY&pretty=1" -d "host_name=HOSTNAME&service_description=SERVICENAME&use=generic-service&check_command=check_nrpe!check_service!-a "filter= name like 'servicename'" "warning= count = 0" "ok=state='running'" "critical=state='stopped'" "perf-config=*(ignored:true)"!!!!!!&max_check_attempts=5&check_interval=15
&retry_interval=5&active_checks_enabled=1&passive_checks_enabled=1
&check_period=xi_timeperiod_24x7&flap_detection_enabled=0
¬ification_interval=15¬ification_period=xi_timeperiod_24x7
¬ifications_enabled=1&contacts=nagiosadmin&_xiwizard=passiveobject®ister=1"
Command line has been copied from a manual creation into CCM nagios xi
My nagios xi version is 5.4.13
Well i get this error
error sintactico cerca del elemento inesperado `('
and i think problem is double quotes at command line.
Thanks and regards
I need to add a new service to more tham 1000 hosts, and via API is more easier than manual, but i have a problem.
This is my commnad to add it
curl -XPOST "http://IP_NAGIOS/nagiosxi/api/v1/config/service?apikey=MY_API_KEY&pretty=1" -d "host_name=HOSTNAME&service_description=SERVICENAME&use=generic-service&check_command=check_nrpe!check_service!-a "filter= name like 'servicename'" "warning= count = 0" "ok=state='running'" "critical=state='stopped'" "perf-config=*(ignored:true)"!!!!!!&max_check_attempts=5&check_interval=15
&retry_interval=5&active_checks_enabled=1&passive_checks_enabled=1
&check_period=xi_timeperiod_24x7&flap_detection_enabled=0
¬ification_interval=15¬ification_period=xi_timeperiod_24x7
¬ifications_enabled=1&contacts=nagiosadmin&_xiwizard=passiveobject®ister=1"
Command line has been copied from a manual creation into CCM nagios xi
My nagios xi version is 5.4.13
Well i get this error
error sintactico cerca del elemento inesperado `('
and i think problem is double quotes at command line.
Thanks and regards