New features

  • Added real-time monitoring for hosts and services
  • Added acknowledgement for hosts and services
  • Added downtimes for hosts and services
  • Added the list of monitoring server configurations
  • Added the proxy configuration

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

Authentication

Login and logout endpoints to retrieve authentication token

Login

Entry point to retrieve an authentication token.

Request Body schema: application/json

Authentication schema

security
object

Responses

200

OK

401

Unauthorized

post /login
{protocol}://{server}:{port}/centreon/api/{version}/login

Request samples

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

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

OK

403

Forbidden

get /logout
{protocol}://{server}:{port}/centreon/api/{version}/logout

Response samples

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

Proxy

Display the default configuration of the Centreon proxy

Authorizations:

Responses

200

OK

403

Forbidden

500

Internal Server Error

get /configuration/proxy
{protocol}://{server}:{port}/centreon/api/{version}/configuration/proxy

Response samples

Content type
application/json
Copy
Expand all Collapse all
{
  • "url": "proxy.internal.company.org",
  • "port": 3128,
  • "user": "proxy-user",
  • "password": "proxy-pass"
}

Update the default configuration of the Centreon proxy

Authorizations:
Request Body schema: application/json
url
required
string

URL of the proxy

port
required
integer [ 0 .. 65535 ]

Port of the proxy

user
required
string

Login used to connect to proxy

password
required
string

Password used to connect to proxy

Responses

204

Command Sent

403

Forbidden

500

Internal Server Error

put /configuration/proxy
{protocol}://{server}:{port}/centreon/api/{version}/configuration/proxy

Request samples

Content type
application/json
Copy
Expand all Collapse all
{
  • "url": "proxy.internal.company.org",
  • "port": 3128,
  • "user": "proxy-user",
  • "password": "proxy-pass"
}

Response samples

Content type
application/json
Copy
Expand all Collapse all
{
  • "code": 403,
  • "message": "You are not authorized to access this resource"
}

Monitoring Server

List all monitoring servers configurations

List all monitoring servers configurations.

The available parameters to search / sort_by are:

  • id
  • name
  • is_localhost
  • address
  • is_activate
Authorizations:
query Parameters
search
object
limit
integer >= 1
Default: 10
Example: limit=20

Number of items per pages

page
integer >= 1
Default: 1
Example: page=4

Number of the requested page

sort_by
object
Example: sort_by={"host.name":"ASC"}

Sort the resulted data by its properties

Responses

200

OK

403

Forbidden

500

Internal Server Error

get /configuration/monitoring-servers
{protocol}://{server}:{port}/centreon/api/{version}/configuration/monitoring-servers

Response samples

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

Host

List all hosts

List all the hosts in real-time monitoring.

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
  • host.is_acknowledged
  • host.downtime
  • host.criticality
Authorizations:
query Parameters
show_service
boolean
Default: false
Example: show_service=true

Allows to display services belonging to items

search
object
limit
integer >= 1
Default: 10
Example: limit=20

Number of items per pages

page
integer >= 1
Default: 1
Example: page=4

Number of the requested page

sort_by
object
Example: sort_by={"host.name":"ASC"}

Sort the resulted data by its properties

Responses

200

OK

403

Forbidden

500

Internal Server Error

get /monitoring/hosts
{protocol}://{server}:{port}/centreon/api/{version}/monitoring/hosts

Response samples

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

Get a host

Return a single host with full details and some details about its services.

Authorizations:
path Parameters
host_id
required
integer <int64>
Example: 12

ID of the host

Responses

200

OK

403

Forbidden

404

Not Found

500

Internal Server Error

get /monitoring/hosts/{host_id}
{protocol}://{server}:{port}/centreon/api/{version}/monitoring/hosts/{host_id}

Response samples

Content type
application/json
Copy
Expand all Collapse all
{
  • "id": 12,
  • "alias": "Central",
  • "display_name": "Central",
  • "name": "Central",
  • "state": 0,
  • "services":
    [
    ],
  • "poller_id": 1,
  • "acknowledged": false,
  • "address_ip": "127.0.0.1",
  • "check_attempt": 1,
  • "checked": true,
  • "execution_time": 0.070906,
  • "icon_image": "ppm/operatingsystems-linux-snmp-linux-128.png",
  • "icon_image_alt": "",
  • "last_check": "2020-04-21T13:26:26Z",
  • "last_hard_state_change": "2020-04-21T13:26:26Z",
  • "last_state_change": "2020-04-21T13:26:26Z",
  • "last_time_down": "2020-04-21T13:26:26Z",
  • "last_time_unreachable": "2020-04-21T13:26:26Z",
  • "last_time_up": "2020-04-21T13:26:26Z",
  • "last_update": "2020-04-21T13:26:26Z",
  • "max_check_attempts": 3,
  • "output": "OK - 127.0.0.1 rta 0.100ms lost 0%\n",
  • "passive_checks": false,
  • "state_type": 0,
  • "timezone": ":Europe/Paris",
  • "scheduled_downtime_depth": 0,
  • "criticality": 10,
  • "active_checks": true,
  • "check_command": "base_host_alive",
  • "check_interval": 5,
  • "check_period": "24x7",
  • "check_type": 0,
  • "last_hard_state": "2020-04-21T13:26:26Z",
  • "last_notification": "2020-04-21T13:26:26Z",
  • "latency": 0.005,
  • "next_check": "2020-04-21T13:26:26Z",
  • "next_host_notification": 0,
  • "notification_interval": 30,
  • "notification_number": 3,
  • "notify": true,
  • "notify_on_down": true,
  • "notify_on_downtime": false,
  • "notify_on_flapping": false,
  • "notify_on_recovery": true,
  • "notify_on_unreachable": false,
  • "flapping": false,
  • "percent_state_change": 3.5,
  • "downtimes":
    [