Centreon

IT & Network Monitoring.

Case Management · Centreon

Details

IDCentreon
ProviderCentreon
CategoryCase Management
From Version5.0.0
Docker Imagedemisto/python3:3.12.13.10116658
Supported ModulesAgentix XSIAM

README

Overview

Use Centreon to check the status of hosts and services.

This integration was integrated and tested with Centreon v2.8.20.

NOTE: Cortex XSOAR only works for Centreon v2.8.14 and later.


Use Cases

  • Check the status of hosts.
  • Check the status of services.

Configure Centreon on Cortex XSOAR

  1. Navigate to Settings > Integrations > Servers & Services.
  2. Search for Centreon.
  3. Click Add instance to create and configure a new integration instance.
    • Name: a textual name for the integration instance
    • Server URL (http://147.75.33.100:20016/)
    • Username
    • Do not validate server certificate (not secure)
  4. Click Test to validate the URLs and connection.

Commands

You can execute these commands from the Cortex XSOAR CLI, as part of an automation, or in a playbook. After you successfully execute a command, a DBot message appears in the War Room with the command details.


Get host status: centreon-get-host-status

Command Example

!centreon-get-host-status viewType=all fields=id,name limit=10

Inputs

Parameter Description
viewType

Predefined filter (like in the monitoring view).

  • all
  • unhandled
  • problems
fields

List of fields that you want to get. Fields are separated from each other with a comma.

For example: fields=id,name,alias,address.

status

Status of the host you want to get.

  • up
  • down
  • unreachable
  • pending
  • all
hostgroup

Hostgroup ID filter.

For example: hostgroup=2.

instance

Instance ID filter.

For example: instance=2.

search

Search pattern applied on host name.

For example: search="localhost".

criticality A specific criticality.
sortType

Sorting method.

  • Ascending: asc
  • Descending: desc
limit Number of lines that you want.
number Page number.

 

Context Output

Path Description
Centreon.Host.Output Host output
Centreon.Host.Name Host name
Centreon.Host.State Host state
Centreon.Host.Address Host address
Centreon.Host.Id Host ID


Raw Output

{  
    "Host":[  
               {  
               "Acknowledged":"0",
               "Address":"127.0.0.1",
               "Alias":"Localhost",
               "CheckAttempt":"1",
               "Criticality":"",
               "Id":"17",
               "InstanceName":"Central",
               "LastCheck":"1524487617",
               "LastHardStateChange":"",
               "LastStateChange":"",
               "MaxCheckAttempts":"3",
               "Name":"Localhost",
               "Output":"OK - 127.0.0.1: rta 0.076ms, lost 0%",
               "State":"0",
              "StateType":"1"
      },
               {  
               "Acknowledged":"0",
               "Address":"192.168.1.22",
               "Alias":"jumphost",
               "CheckAttempt":"1",
               "Criticality":"",
               "Id":"37",
               "InstanceName":"Central",
               "LastCheck":"1524487822",
               "LastHardStateChange":"1523986444",
               "LastStateChange":"1523986444",
               "MaxCheckAttempts":"3",
               "Name":"jumphost",
               "Output":"OK - 192.168.1.22: rta 0.379ms, lost 0%",
               "State":"0",
               "StateType":"1"
      },
               {  
               "Acknowledged":"0",
               "Address":"192.168.1.22",
               "Alias":"jumphost",
               "CheckAttempt":"1",
               "Criticality":"",
               "Id":"38",
               "InstanceName":"Central",
               "LastCheck":"1524487722",
               "LastHardStateChange":"1523987517",
               "LastStateChange":"1523987517",
               "MaxCheckAttempts":"3",
               "Name":"jumphost_1",
               "Output":"OK - 192.168.1.22: rta 0.389ms, lost 0%",
               "State":"0",
               "StateType":"1"
      }
   ]
}

Get service status: centreon-get-service-status

Command Example

!centreon-get-service-status status=ok fields=id,host_id limit=5 sortType=asc

Inputs

Parameter Description
viewType

Predefined filter (like in the monitoring view).

  • all
  • unhandled
  • problems
fields

The list of fields that you want to get, each field separated by a comma.

For example: fields=id,name,alias,address.

status

Status of the host you want to get.

  • ok
  • warning
  • critical
  • unknown
  • pending
  • all
hostgroup

Hostgroup ID filter.

For example: hostgroup=2.

servicegroup Servicegroup ID filter.
instance

Instance ID filter.

For example: instance=2.

search Search pattern applied on service.
searchHost Search pattern applied on host.
searchOutput Search pattern applied on output.
criticality A specific criticality.
sortType

Sorting method.

  • Ascending: asc
  • Descending: desc
limit Number of lines that you want.
number Page number.

 

Context Output

Path Description
Centreon.Service.Output Service output
Centreon.Service.Name Service name
Centreon.Service.State Service state
Centreon.Service.Description Service description
Centreon.Service.Id Service ID

 

Raw Output

{
  "Service": [
    {
      "Acknowledged": "0",
      "CheckAttempt": "1",
      "Criticality": "",
      "Description": "Ping",
      "HostId": "37",
      "LastCheck": "1524487467",
      "LastHardStateChange": "1523986444",
      "LastStateChange": "1523986444",
      "MaxCheckAttempts": "3",
      "Name": "jumphost",
      "Output": "OK - 192.168.1.22: rta 0.185ms, lost 0%",
      "Perfdata": "rta=0.185ms;200.000;400.000;0; pl=0%;20;50;; rtmax=0.398ms;;;; rtmin=0.106ms;;;;",
      "ServiceId": "132",
      "State": "0",
      "StateType": "1"
    },
    {
      "Acknowledged": "0",
      "CheckAttempt": "1",
      "Criticality": "",
      "Description": "Ping",
      "HostId": "38",
      "LastCheck": "1524487617",
      "LastHardStateChange": "1523987517",
      "LastStateChange": "1523987517",
      "MaxCheckAttempts": "3",
      "Name": "jumphost_1",
      "Output": "OK - 192.168.1.22: rta 0.235ms, lost 0%",
      "Perfdata": "rta=0.235ms;200.000;400.000;0; pl=0%;20;50;; rtmax=0.514ms;;;; rtmin=0.134ms;;;;",
      "ServiceId": "133",
      "State": "0",
      "StateType": "1"
    }
  ]
}

Configuration parameters

  • server — Server URL (e.g. http://147.75.33.100:20016/) (required)
  • credentials — Username (required)
  • insecure — Trust any certificate (not secure)
  • proxy — Use system proxy settings

Commands (2)

  • centreon-get-host-status

    All the monitoring information regarding hosts.

  • centreon-get-service-status

    All the monitoring information regarding services.

import demistomock as demisto


def test_get_host_status_command(mocker):
    """
    Given: Demisto args and params.
    When:  Running a get_host_status_command normally.
    Then:  ensures the expected result is returned
    """

    mocker.patch.object(
        demisto, "params", return_value={"server": "server", "credentials": {"identifier": "identifier", "password": "password"}}
    )
    mocker.patch.object(demisto, "args", return_value={"service_request_id": "service_request_id"})

    import Centreon

    mocker.patch.object(
        Centreon,
        "httpRequest",
        return_value=[
            {
                "Acknowledged": "0",
                "Address": "192.168.1.22",
                "Alias": "jumphost",
                "CheckAttempt": "1",
                "Criticality": "",
                "Id": "37",
                "InstanceName": "Central",
                "LastCheck": "1524487822",
                "LastHardStateChange": "1523986444",
                "LastStateChange": "1523986444",
                "MaxCheckAttempts": "3",
                "Name": "jumphost",
                "Output": "OK",
                "State": "0",
                "StateType": "1",
            }
        ],
    )
    mocker.patch.object(Centreon, "httpPost", return_value={"authToken": "authToken"})

    entry = Centreon.get_host_status_command()

    assert "### Centreon Hosts status" in entry.get("HumanReadable")


def test_get_service_status_command(mocker):
    """
    Given: Demisto args and params.
    When:  Running a get_service_status_command normally.
    Then:  ensures the expected result is returned
    """

    mocker.patch.object(
        demisto, "params", return_value={"server": "server", "credentials": {"identifier": "identifier", "password": "password"}}
    )
    mocker.patch.object(demisto, "args", return_value={"service_request_id": "service_request_id"})

    import Centreon

    mocker.patch.object(
        Centreon,
        "httpRequest",
        return_value=[
            {
                "Acknowledged": "0",
                "CheckAttempt": "1",
                "Criticality": "",
                "Description": "Ping",
                "HostId": "37",
                "LastCheck": "1524487467",
                "LastHardStateChange": "1523986444",
                "LastStateChange": "1523986444",
                "MaxCheckAttempts": "3",
                "Name": "jumphost",
                "Output": "OK",
                "Perfdata": "rta=0",
                "ServiceId": "132",
                "State": "0",
                "StateType": "1",
            }
        ],
    )
    mocker.patch.object(Centreon, "httpPost", return_value={"authToken": "authToken"})

    entry = Centreon.get_service_status_command()

    assert "### Centreon Services" in entry.get("HumanReadable")