Skip to main content

Hello, 
I am using Centreon 24.04 and I try to send a downtime to business activity because something a batch job change a business activity in Error mode.

First step, I use the webui to send a downtime on my business activity. 
Monitoring->Business Activity->Monitoring   / Select one Business Activity and more actions and Schedule downtime ( Fixed is use ).

When I use api to retreive my ba service with this :
GET https://centreon.int.dns/centreon/api/latest/monitoring/services/downtimes
Response is : 
{"start_time":"2025-01-27T14:15:00+01:00","end_time":"2025-01-27T14:30:00+01:00","actual_start_time":"2025-01-27T14:15:33+01:00","actual_end_time":null,"id":27,"entry_time":"2025-01-27T14:15:27+01:00","author_id":26,"author_name":"fzimmermann","host_id":13,"service_id":9438,"is_cancelled":false,"comment":"Downtime set on WebUI","deletion_time":null,"duration":900,"internal_id":4,"is_fixed":true,"poller_id":1,"is_started":true,"max_date":"2099-12-31T23:59:00+00:00"}


Also, I can retreive my business activity with the previous response ( "host_id":13,"service_id":9438 ) 
GET https://centreon/centreon/api/latest/monitoring/hosts/13/services/9438
Response is : 
{"duration":"1d 3h","id":9438,"check_attempt":"1","check_command":"","check_interval":0.0,"check_period":"","check_type":0,"command_line":"Unable to hide passwords in command (Reason: Check command of service id 9438 not found)","description":"ba_75","display_name":"ba_75","execution_time":0.087952,"icon_image":"","icon_image_alt":"","is_acknowledged":false,"is_active_check":false,"is_checked":true,"scheduled_downtime_depth":1,"last_check":"2025-01-27T14:16:25+01:00","last_hard_state_change":"2025-01-26T11:16:25+01:00","last_notification":null,"last_time_critical":"2025-01-26T11:11:25+01:00","last_time_ok":"2025-01-27T14:16:25+01:00","last_time_unknown":null,"last_time_warning":null,"last_update":"2025-01-26T14:57:34+01:00","last_state_change":"2025-01-26T11:16:25+01:00","latency":0.241,"max_check_attempts":1,"next_check":"2025-01-27T14:21:25+01:00","output":"Status is OK - All KPIs are in an OK state\n","performance_data":"","state":0,"state_type":1,"criticality":null,"downtimes":i{"start_time":"2025-01-27T14:15:00+01:00","end_time":"2025-01-27T14:30:00+01:00","actual_start_time":"2025-01-27T14:15:33+01:00","actual_end_time":null,"id":27,"entry_time":"2025-01-27T14:15:27+01:00","author_id":26,"author_name":"fzimmermann","host_id":13,"service_id":9438,"is_cancelled":false,"comment":"Downtime set on WebUI","deletion_time":null,"duration":900,"internal_id":4,"is_fixed":true,"poller_id":1,"is_started":true,"max_date":"2099-12-31T23:59:00+00:00"}],"acknowledgement":null,"flapping":false,"status":{"code":0,"name":"OK","severity_code":5},"notify":false}

But if I use api to send a downtime to the business activity ( "host_id":13,"service_id":9438 corresponding of "description":"ba_75","display_name":"ba_75" ) 
POST https://centreon.int.dns/centreon/api/latest/monitoring/hosts/13/services/9438/downtimes
data : {"comment": "Downtime set by Batch","start_time": "2025-01-27T14:21:20+01:00","end_time": "2025-01-27T14:51:20+01:00","is_fixed": true,"duration": 1800}
Response is : 
{"code":500,"message":"The host of service (id: 9438) is not defined"}


How to set a downtime in api mode the same way of Web UI with business activity ? 
Is there an other way to do that ? 

Regards.

Be the first to reply!

Reply