Centron API (2.0.0)

Centron API v2

New features

  • Added real-time monitoring for hosts and services
  • Added acknowledgement for hosts and services

Information

All dates are in ISO 8601 format

Authentication

There are two modes of authentication:

  • By token: after identification with your login credentials
  • By cookie: by reusing a valid session ID

Token

The use of the API requires a security token.

To retrieve it, you will need to authenticate yourself with your login credentials.

The token will be deleted if it has not been used for more than one hour.

Security scheme type: API Key
Header parameter name: X-AUTH-TOKEN

Cookie

If you have already connected on the Centreon web application, you can reused the PHPSESSID cookie.

The cookie will be valid as long as the connection to Centreon is maintained.

Security scheme type: API Key
Cookie parameter name: PHPSESSID

Acknowledgements

This API allow to:

  • Show the latest acknowledgement for host or service
  • Acknowledge a host or a service
  • Cancel an acknowledgement of host or service

List the latest acknowledgement of each host

Authorizations:
query Parameters
limit
integer (RequestParameters.limit) >= 1
Example: limit=20

Max items per pages

page
integer (RequestParameters.page) >= 1
Example: page=1

Number of the page requested

sort_by
any

Used to sort the request

search
any

Used to search with specifics parameters

Responses

200

successful operation

403

Forbidden

500

Internal Server Error

get /acknowledgements/hosts
http://localhost/centreon/api/beta/acknowledgements/hosts

Response samples

Content type
application/json
Copy
Expand all Collapse all
{
  • "result":
    [
    ],
  • "meta":
    {
    }
}

Adds an acknowledgement on host

Authorizations:
Request Body schema: application/json

Acknowledgment

comment
string

Short description of the acknowledgement

host_id
integer <int64>

Unique id of the host

is_notify_contacts
boolean

Indicates whether notification is send to the contacts linked to the host or service

is_persistent_comment
boolean

Indicates whether acknowledgement is maintained in the case of a restart of the scheduler

is_sticky
boolean

Indicates whether acknowledgement is maintained in the case of a change of status

Responses

204

Command sent

403

Forbidden

500

Internal Server Error

post /acknowledgements/hosts
http://localhost/centreon/api/beta/acknowledgements/hosts

Request samples

Content type
application/json
Copy
Expand all Collapse all
{
  • "comment": "string",
  • "host_id": 0,
  • "is_notify_contacts": true,
  • "is_persistent_comment": true,
  • "is_sticky": true
}

Response samples

Content type
application/json
Copy
Expand all Collapse all
{
  • "message": "string"
}

Cancel an acknowledgement on host

Authorizations:
path Parameters
host_id
required
integer <int64>

ID of host for which you want to cancel acknowledgement

Responses

204

Command sent

403

Forbidden

500

Internal Server Error

delete /acknowledgements/hosts/{host_id}
http://localhost/centreon/api/beta/acknowledgements/hosts/{host_id}

Response samples

Content type
application/json
Copy
Expand all Collapse all
{
  • "message": "string"
}

List the latest acknowledgement of each service

Authorizations:
query Parameters
limit
integer (RequestParameters.limit) >= 1
Example: limit=20

Max items per pages

page
integer (RequestParameters.page) >= 1
Example: page=1

Number of the page requested

sort_by
any

Used to sort the request

search
any

Used to search with specifics parameters

Responses

200

successful operation

403

Forbidden

500

Internal Server Error

get /acknowledgements/services
http://localhost/centreon/api/beta/acknowledgements/services

Response samples

Content type
application/json
Copy
Expand all Collapse all
{
  • "result":
    [
    ],
  • "meta":
    {
    }
}

Adds an acknowledgement on service

Authorizations:
Request Body schema: application/json

Acknowledgment

comment
string

Short description of the acknowledgement

host_id
integer <int64>

Unique id of the host

is_notify_contacts
boolean

Indicates whether notification is send to the contacts linked to the host or service

is_persistent_comment
boolean

Indicates whether acknowledgement is maintained in the case of a restart of the scheduler

is_sticky
boolean

Indicates whether acknowledgement is maintained in the case of a change of status

service_id
integer <int64>

Unique id of the service to acknowledge

Responses

204

Command sent

403

Forbidden

500

Internal Server Error

post /acknowledgements/services
http://localhost/centreon/api/beta/acknowledgements/services

Request samples

Content type
application/json
Copy
Expand all Collapse all
{
  • "comment": "string",
  • "host_id": 0,
  • "is_notify_contacts": true,
  • "is_persistent_comment": true,
  • "is_sticky": true,
  • "service_id": 0
}

Response samples

Content type
application/json
Copy
Expand all Collapse all
{
  • "message": "string"
}

Cancel an acknowledgement on service

Authorizations:
path Parameters
host_id
required
integer <int64>

ID of host linked to service

service_id
required
integer <int64>

ID of service for which you want to cancel acknowledgement

Responses

204

Command sent

403

Forbidden

500

Internal Server Error

delete /acknowledgements/hosts/{host_id}/services/{service_id}
http://localhost/centreon/api/beta/acknowledgements/hosts/{host_id}/services/{service_id}

Response samples

Content type
application/json
Copy
Expand all Collapse all
{
  • "message": "string"
}

Authentication

Login

Entry point to retrieve an authentication token.

Authorizations:
Request Body schema: application/x-www-form-urlencoded

Authentication schema

security
object

Responses

200

successful operation

401

Unauthorized

post /login
http://localhost/centreon/api/beta/login

Response samples

Content type
application/json
Copy
Expand all Collapse all
{
  • "contact":
    {
    },
  • "security":
    {
    }
}

Logout

Entry point to delete an existing authentication token.

Authorizations:

Responses

200

successful operation

403

Forbidden

get /logout
http://localhost/centreon/api/beta/logout

Response samples

Content type
application/json
Copy
Expand all Collapse all
{
  • "message": "string"
}

Monitoring

Real-time monitoring of the services and hosts

List all services grouped by host groups

Returns all services grouped by host groups.

The available parameters to search / sort_by are:

  • host.id
  • host.name
  • host.alias
  • host.address
  • host.state
  • poller.id
  • service.display_name
  • host_group.id

Information

By default, the hosts property of hostgroup object is not displayed. To display it, set the URI parameter "show_host" to true.

/monitoring/hostgroups?show_host=true

By default, the services property of host object is not displayed. To display it, set the URI parameter "show_service" to true.

/monitoring/hostgroups?show_service=true

Authorizations:
query Parameters
limit
integer (RequestParameters.limit) >= 1
Example: limit=20

Max items per pages

page
integer (RequestParameters.page) >= 1
Example: page=1

Number of the page requested

sort_by
any

Used to sort the request

search
any

Used to search with specifics parameters

show_service
boolean

Allows to display services belonging to hosts belonging to requested hostgroups (by default: false)

show_host
boolean

Allows to display hosts belonging to hostgroups (by default: false)

Responses

200

successful operation

403

Forbidden

500

Internal Server Error

get /monitoring/hostgroups
http://localhost/centreon/api/beta/monitoring/hostgroups

Response samples

Content type
application/json
Copy
Expand all Collapse all
{
  • "result":
    [
    ],
  • "meta":
    {
    }
}

List all hosts

Returns all hosts.

The available parameters to search / sort_by are:

  • host.id
  • host.name
  • host.alias
  • host.address
  • host.state
  • poller.id
  • service.display_name
  • host_group.id

Information

By default, the services property of host object is not displayed. To display it, set the URI parameter "show_service" to true.

/monitoring/hosts?show_service=true

Authorizations:
query Parameters
limit
integer (RequestParameters.limit) >= 1
Example: limit=20

Max items per pages

page
integer (RequestParameters.page) >= 1
Example: page=1

Number of the page requested

sort_by
any

Used to sort the request

search
any

Used to search with specifics parameters

show_service
boolean

Allows to display services belonging to hosts (by default: false)

Responses

200

successful operation

403

Forbidden

500

Internal Server Error

get /monitoring/hosts
http://localhost/centreon/api/beta/monitoring/hosts

Response samples

Content type
application/json
Copy
Expand all Collapse all
{
  • "result":
    [
    ],
  • "meta":
    {
    }
}

Find host by ID

Retuns a single host with full details and some details about its services

Authorizations:
path Parameters
hostId
required
integer <int64>

ID of host to return

Responses

200

successful operation

403

Forbidden

404

Host not found

500

Internal Server Error

get /monitoring/hosts/{hostId}
http://localhost/centreon/api/beta/monitoring/hosts/{hostId}

Response samples

Content type
application/json
Copy
Expand all Collapse all
{
  • "id": 0,
  • "alias": "string",
  • "display_name": "string",
  • "name": "string",
  • "state": 0,
  • "services":
    [
    ],
  • "poller_id": 0,
  • "acknowledged": true,
  • "address_ip": "192.168.0.1",
  • "check_attempt": 0,
  • "checked": true,
  • "execution_time": 0,
  • "icon_image": "string",
  • "icon_image_alt": "string",
  • "last_check": "2019-10-14T11:49:13Z",
  • "last_hard_state_change": "2019-10-14T11:49:13Z",
  • "last_state_change": "2019-10-14T11:49:13Z",
  • "last_time_down": "2019-10-14T11:49:13Z",
  • "last_time_unreachable": "2019-10-14T11:49:13Z",
  • "last_time_up": "2019-10-14T11:49:13Z",
  • "last_update": "2019-10-14T11:49:13Z",
  • "max_check_attempts": 0,
  • "output": "string",
  • "passive_checks": true,
  • "state_type": 0,
  • "timezone": ":Europe/Paris",
  • "active_checks": true,
  • "check_command": "string",
  • "check_interval": 0,
  • "check_period": "string",
  • "check_type": 0,
  • "last_hard_state": "2019-10-14T11:49:13Z",
  • "last_notification": "2019-10-14T11:49:13Z",
  • "latency": "string",
  • "next_check": "2019-10-14T11:49:13Z",
  • "next_host_notification": 0,
  • "notification_interval": 0,
  • "notification_number": 0,
  • "notify": true,
  • "notify_on_down": true,
  • "notify_on_downtime": true,
  • "notify_on_flapping": true,
  • "notify_on_recovery": true,
  • "notify_on_unreachable": true
}

Find host-related services

Returns all services associated with a host.

The available parameters to search / sort_by are:

  • service.id
  • service.description
  • service.display_name
  • service_group.id
  • service.is_acknowledged
  • service.state
Authorizations:
path Parameters
hostId
required
integer <int64>

Host Id for which we want to get its associated services

query Parameters
limit
integer (RequestParameters.limit) >= 1
Example: limit=20

Max items per pages

page
integer (RequestParameters.page) >= 1
Example: page=1

Number of the page requested

sort_by
any

Used to sort the request

search
any

Used to search with specifics parameters

Responses

200

successful operation

403

Forbidden

404

Host not found

500

Internal Server Error

get /monitoring/hosts/{hostId}/services
http://localhost/centreon/api/beta/monitoring/hosts/{hostId}/services

Response samples

Content type
application/json
Copy
Expand all Collapse all
{
  • "result":
    [
    ],
  • "meta":
    {
    }
}

Find service by ID related to a host

Retuns a single host with full details

Authorizations:
path Parameters
hostId
required
integer <int64>

Host Id for which service is associed

serviceId
required
integer <int64>

ID of service to return

Responses

200

successful operation

403

Forbidden

404

Host or service not found

500

Internal Server Error

get /monitoring/hosts/{hostId}/services/{serviceId}
http://localhost/centreon/api/beta/monitoring/hosts/{hostId}/services/{serviceId}

Response samples

Content type
application/json
Copy
Expand all Collapse all
{
  • "id": 0,
  • "description": "string",
  • "display_name": "string",
  • "state": 0,
  • "check_attempt": 0,
  • "icon_image": "string",
  • "icon_image_alt": "string",
  • "last_check": "2019-10-14T11:49:13Z",
  • "last_state_change": "2019-10-14T11:49:13Z",
  • "max_check_attempts": 0,
  • "output": "string",
  • "state_type": 0,
  • "check_command": "string",
  • "check_interval": 0,
  • "check_period": "string",
  • "check_type": 0,
  • "command_line": "string",
  • "execution_time": 0,
  • "is_acknowledged": true,
  • "is_active_check": true,
  • "is_checked": true,
  • "last_hard_state_change": "2019-10-14T11:49:13Z",
  • "last_notification": "2019-10-14T11:49:13Z",
  • "last_time_critical": "2019-10-14T11:49:13Z",
  • "last_time_ok": "2019-10-14T11:49:13Z",
  • "last_time_unknown": "2019-10-14T11:49:13Z",
  • "last_time_warning": "2019-10-14T11:49:13Z",
  • "last_update": "2019-10-14T11:49:13Z",
  • "latency": 0,
  • "next_check": "2019-10-14T11:49:13Z",
  • "performance_data": "string",
  • "scheduled_downtime_depth": 0
}

List all services grouped by service groups

Returns all services grouped by service groups.

The available parameters to search / sort_by are:

  • host.id
  • host.name
  • host.alias
  • host.address
  • host.state
  • poller.id
  • service.display_name
  • service_group.id
  • service_group.name

Information

By default, the hosts property of service group object is not displayed. To display it, set the URI parameter "show_host" to true.

/monitoring/hostgroups?show_host=true

By default, the services property of host object is not displayed. To display it, set the URI parameter "show_service" to true.

/monitoring/hostgroups?show_service=true

Authorizations:
query Parameters
limit
integer (RequestParameters.limit) >= 1
Example: limit=20

Max items per pages

page
integer (RequestParameters.page) >= 1
Example: page=1

Number of the page requested

sort_by
any

Used to sort the request

search
any

Used to search with specifics parameters

show_service
boolean

Allows to display services belonging to servicegroups (by default: false)

show_host
boolean

Allows to display hosts related to services belonging to servicegroups (by default: false)

Responses

200

successful operation

403

Forbidden

500

Internal Server Error

get /monitoring/servicegroups
http://localhost/centreon/api/beta/monitoring/servicegroups

Response samples

Content type
application/json
Copy
Expand all Collapse all
{
  • "result":
    [
    ],
  • "meta":
    {
    }
}

List all services

Returns all services.

The available parameters to search / sort_by are:

  • host.id
  • host.name
  • host.alias
  • host.address
  • host.state
  • host_group.id
  • service.display_name
  • service.description
  • service.is_acknowledged
  • service.output
  • service.state
  • service_group.id
  • poller.id
Authorizations:
query Parameters
limit
integer (RequestParameters.limit) >= 1
Example: limit=20

Max items per pages

page
integer (RequestParameters.page) >= 1
Example: page=1

Number of the page requested

sort_by
any

Used to sort the request

search
any

Used to search with specifics parameters

Responses

200

successful operation

403

Forbidden

500

Internal Server Error

get /monitoring/services
http://localhost/centreon/api/beta/monitoring/services

Response samples

Content type
application/json
Copy
Expand all Collapse all
{
  • "result":
    [
    ],
  • "meta":
    {
    }
}