From 77b8480ef8bf6c6973718d461681bd654d59892c Mon Sep 17 00:00:00 2001 From: psame <44295022+psamecentreon@users.noreply.github.com> Date: Thu, 16 Dec 2021 14:42:19 +0100 Subject: [PATCH 1/8] enh(doc): enhancement to BSM api-v2 --- en/integrations/event-management/sc-bsm.md | 285 +++++++++++++++------ 1 file changed, 209 insertions(+), 76 deletions(-) diff --git a/en/integrations/event-management/sc-bsm.md b/en/integrations/event-management/sc-bsm.md index bbef5425bc9f..f731e31d5429 100644 --- a/en/integrations/event-management/sc-bsm.md +++ b/en/integrations/event-management/sc-bsm.md @@ -3,124 +3,257 @@ id: sc-hp-bsm title: BSM --- -## BSM + Centreon Integration Benefits +> Hello community! We're looking for a contributor to help us to translate the content in french. If it's you, let us know and ping us on [slack](https://centreon.slack.com). -BSM Stream Connector sends events related data from **Centreon** to **Micro Focus BSM** (Business Service Management). +## Before starting -## How it Works +- You can send events from a central server, a remote server or a poller. +- By default, this stream connector sends **host_status** and **service_status** events. The event format is shown **[there](#event-format)**. +- Aformentioned events are fired each time a host or a service is checked. Various parameters let you filter out events. -* Every time a service or a host's state is checked, the event passes through Centreon Broker, which uses the functions defined in the Stream Connector to send state changes to BSM. +## Installation -## Requirements +### Dependencies -* Integration with BSM requires the ability to access a **webservice on you BSM platform**. Please contact your BSM expert for this part. -* A Centreon account is required with either **admin privileges** or **Export configuration** and **Broker configuration** menu access in the WUI. -* A **`root` access in command-line interface on Centreon central server** is required as well. + + -## Support +Install **Epel** repository. -If you need help with this integration, depending on how you are using Centreon, you can: +```shell +yum -y install epel-release +``` + +Install dependencies. + +```shell +yum install luarocks make gcc lua-curl lua-devel +``` + + + +Install dnf plugins package. + +```shell +dnf -y install dnf-plugins-core +``` + +Install **Powertools** repository. -* **Commercial Edition customers**: please contact the [Centreon Support team](mailto:support@centreon.com). -* **Open Source Edition users** or **Centreon IT-100 users** (free versions): please reach our [Community Slack](https://centreon.github.io) where our users and staff will try to help you. +```shell +dnf config-manager --set-enabled powertools +``` -## Integration Walkthrough +Install **Epel** repository. -### Installation +```shell +dnf -y install epel-release +``` + +Install dependencies. + +```shell +dnf install make gcc libcurl-devel lua-devel luarocks +``` -Login as `root` on the Centreon central server using your favorite SSH client. + -In case your Centreon central server must use a proxy server to reach the Internet, you will have to export the `https_proxy` environment variable and configure `yum` to be able to install everything. +Install dnf plugins package. -```bash -export https_proxy=http://my.proxy.server:3128 -echo "proxy=http://my.proxy.server:3128" >> /etc/yum.conf +```shell +dnf -y install dnf-plugins-core ``` -Now that your Centreon central server is able to reach the Internet, you can run: +Install **Epel** repository. -```bash -yum install -y lua-curl epel-release -yum install -y luarocks +```shell +dnf -y install https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm +``` + +Enable **Codeready** repository. + +```shell +subscription-manager repos --enable codeready-builder-for-rhel-8-x86_64-rpms +``` + +Install dependencies. + +```shell +dnf install make gcc libcurl-devel lua-devel luarocks +``` + + + +### Lua modules + + + + +Install **luaxml**. + +```shell luarocks install luaxml ``` -This package is necessary for the script to run. Now let's download the script: +Install Centreon lua modules. -```bash -wget -O /usr/share/centreon-broker/lua/bsm_connector.lua https://raw.githubusercontent.com/centreon/centreon-stream-connector-scripts/master/centreon-certified/bsm/bsm_connector-apiv1.lua -chmod 644 /usr/share/centreon-broker/lua/bsm_connector.lua +```shell +luarocks install centreon-stream-connectors-lib ``` -The BSM StreamConnnector is now installed on your Centreon central server! + -### Broker configuration +Install **lua-curl**. -1. Login to the Centreon WUI using an administrator account. -2. Navigate to the **Configuration** > **Pollers** menu and select **Broker configuration**. -3. Click on the **central-broker-master** broker configuration object and navigate to the **Output** tab. -4. Add a new **Generic - Stream connector** output. -5. Name it as you want (eg. **BSM**) and set the right path for the LUA script: `/usr/share/centreon-broker/lua/bsm_connector.lua`. -6. The parameter `http_server_url` has to be set according to your BSM platforms characteristics: +```shell +luarocks install Lua-cURL +``` -| Name | Type | Value | -|-------------------|--------|-------------------------------------------------------------------| -| `http_server_url` | String | `https://:30005/bsmc/rest/events//` | +Install **luaxml**. -7. Save your configuration, then navigate to the **Configuration** > **Pollers** menu and select **Pollers**. -8. Select the **Central** poller and click on **Export configuration**. -9. Keep **Generate Configuration Files** and **Run monitoring engine debug (-v)** checked and select **Move Export Files** and then click on the **Export** button. -10. Restart the `cbd` service: +```shell +luarocks install luaxml +``` + +Install Centreon lua modules. + +```shell +luarocks install centreon-stream-connectors-lib +``` + + + +### Download BSM stream connector -```bash -systemctl restart cbd +```shell +wget -O /usr/share/centreon-broker/lua/bsm_connector-apiv2.lua https://raw.githubusercontent.com/centreon/centreon-stream-connector-scripts/master/centreon-certified/bsm/bsm_connector-apiv2.lua +chmod 644 /usr/share/centreon-broker/lua/bsm_connector-apiv2.lua ``` -Now your central server has loaded the BSM Stream Connector and has started to send data! +## Configuration + +To configure your stream connector, you must **head over** the **Configuration --> Poller --> Broker configuration** menu. **Select** the **central-broker-master** configuration (or the appropriate broker configuration if it is a poller or a remote server that will send events) and **click** the **Output tab** when the broker form is displayed. + +**Add** a new **generic - stream connector** output and **set** the following fields as follow: + +| Field | Value | +| --------------- | ------------------------------------------------------ | +| Name | BSM | +| Path | /usr/share/centreon-broker/lua/bsm_connector-apiv2.lua | + +### Add BSM optional parameters + +Some stream connectors have a set of optional parameters dedicated to the Software that they are associated with. To add them you must **click** on the **+Add a new entry** button located **below** the **filter category** input. + +| Type | Name | Value (explanation) | defaultvalue | +|--------|---------------------|------------------------------------------------------------------------------------------------------------------------| ----------------------------------------------------------------- | +| String | `http_server_url` | URL de votre plateforme BSM | `https://:30005/bsmc/rest/events//` | +| String | `http_proxy_string` | Paramétrage du proxy permettant de sortir vers Internet en HTTP/HTTPS | `http://your.proxy.server:3128` | +| String | `source_ci` | Nom permettant d'identifier l'émetteur | `Centreon` | +| Number | `log_level` | Niveau de verbosité des logs 0: errors seulement, 1: +warnings, 2: +verbose, 3: +debug | 2 | +| String | `log_path` | Chemin complet du fichier de log | `/var/log/centreon-broker/my-custom-logfile.log` | +| Number | `max_buffer_size` | Nombre maximum d'événements à stocker en mémoire tampon en attendant de les transmettre en un seul envoi | 1 | +| Number | `max_buffer_age` | Temps d'attente maximum avant d'envoyer les événements en mémoire tampon si `max_buffer_size` n'est pas encore atteint | 5 | -> To make sure that everything goes fine, you should have a look at `central-broker-master.log` and `stream-connector-bsm.log`, both located in `/var/log/centreon-broker`. +### Proxy configuration -#### Advanced configuration +When using a proxy to connect to the BSM endpoint, you can use additional parameters to configure it: -**Parameters table** +| Type | Name | Value explanation | +| -------- | ------------------ | ----------------------------------------------------- | +| string | proxy_address | Proxy address | +| number | proxy_port | Proxy port (mandatory when proxy_address is set) | +| string | proxy_username | Proxy username the file in which logs are written | +| password | proxy_password | Proxy password (mandatory when proxy_username is set) | -| Name | Type | Value example | Explanation | -|---------------------|--------|-------------------------------------------------------------------|----------------------------------------------------------------------------------------------| -| `http_server_url` | String | `https://:30005/bsmc/rest/events//` | URL of your BSM platform | -| `http_proxy_string` | String | `http://your.proxy.server:3128` | Proxy string needed to reach the Internet in HTTP/HTTPS | -| `source_ci` | String | `Centreon` (default value) | Name used to identify the transmitter | -| `log_level` | Number | 2 (default value) | Verbosity level for logs 0: errors only 1: +warnings, 2: +verbose, 3: +debug | -| `log_path` | String | `/var/log/centreon-broker/my-custom-logfile.log` | Log file full path and name | -| `max_buffer_size` | Number | 1 (default value) | Number of events to enqueue in buffer before sending | -| `max_buffer_age` | Number | 5 (default value) | Maximum number of seconds before sending an event when `max_buffer_size` hasn't been reached | +### Standard parameters -**Remarks** +All stream connectors can use a set of optional parameters that are made available through Centreon stream connectors lua modules. -* The default value of 2 for `log_level` is fine for initial troubleshooting, but can generate a huge amount of logs if you monitor a lot of hosts. In order to get less log messages, you should tune this parameter. -* The default value of 1 for `max_buffer_size` works fine and ensures the best response times. You might want to tune it (*ie.* increase it) if you have an important amount of data to send to BSM. +All those parameters are documented **[here](https://github.com/centreon/centreon-stream-connector-scripts/blob/master/modules/docs/sc_param.md#default-parameters)**. ---------------- +Some of them are overridden by this stream connector. -## How to Uninstall +| Type | Name | Default value for the stream connector | +| ------ | ------------------- | -------------------------------------- | +| string | accepted_categories | neb | +| string | accepted_elements | host_status,service_status | -1. Login to the Centreon WUI using an administrator account. -2. Navigate to the **Configuration** > **Pollers** menu and select **Broker configuration**. -3. Click on the **central-broker-master** broker configuration object and navigate to the **Output** tab. -4. Delete the **Generic - Stream connector** output by clicking on the red circled cross at the end of the line. -5. Save your configuration, then navigate to the **Configuration** > **Pollers** menu and select **Pollers**. -6. Select the **Central** poller and click on **Export configuration**. -7. Keep **Generate Configuration Files** and **Run monitoring engine debug (-v)** checked and select **Move Export Files** and then click on the **Export** button. -8. Restart the `cbd` service: +## Event bulking -```bash -systemctl restart cbd +This stream connector is not compatible with event bulking. Meaning that the option `max_buffer_size` can't be higher than 1 + +## Event format + +This stream connector will send event with the following format. + +### status event + +```xml +{ + "" + "" hostname "" + "" service_description "" + "" self.sc_event.event.state "" + "" self.sc_event.event.last_update "" + "" string.match(e.output, "^(.*)\n") "" + xml_service_severity + "" xml_url "" + "" ifnil_or_empty(self.sc_event.event.host_id, '0') "" + "" ifnil_or_empty(self.sc_event.event.service_id, '0') "" + "" ifnil_or_empty(self.sc_event.event.scheduled_downtime_depth, '0') "" + "" +} ``` -The Stream Connector is not loaded anymore! +### Custom event format + +This stream connector allows you to change the format of the event to suit your needs. Only the **event** part of the json is customisable. It also allows you to handle events type that are not handled by default such as **ba_status events**. + +In order to use this feature you need to configure a json event format file and add a new stream connector parameter. + +| Type | Name | Value | +| ------ | ----------- | ------------------------------------------------------- | +| string | format_file | /etc/centreon-broker/lua-conf/bsm-events-format.json | -9. Optionally, you can even delete the script file: +> The event format configuration file must be readable by the centreon-broker user -```bash -rm -f /usr/share/centreon-broker/lua/bsm_connector.lua +To learn more about custom event format and templating file, head over the following **[documentation](https://github.com/centreon/centreon-stream-connector-scripts/blob/master/modules/docs/templating.md#templating-documentation)**. + +## Curl commands + +Here is the list of all the curl commands that are used by the stream connector. + +### Send events + +You can trigger a signal with the following command: + +```shell +curl -X POST -H 'content-type: application/xml' 'https://centreon.bsm.server:30005/bsmc/rest/events/myCentreon/' -d '{"" "" 'srv-vp-central01' "" \ + "" 'Swap' "" \ + "" 'Critical' "" \ + "" '12/16/2021 1:14 PM' "" \ + "" 'Critical: Swap Total: 1.60 GB Used: 1.51 GB (94.44%) Free: 1.25 MB (5.56%)\n' "" \ + '0' \ + "" 'no action url for this host' "" \ + "" '3450' "" \ + "" '1245' "" \ + "" '0' "" \ + ""}' ``` +You can then close this signal with the following command: + +```shell +curl -X POST -H 'content-type: application/xml' 'https://centreon.bsm.server:30005/bsmc/rest/events/myCentreon/' -d '{"" "" 'srv-vp-central01' "" \ + "" 'Swap' "" \ + "" 'OK' "" \ + "" '12/16/2021 1:45 PM' "" \ + "" 'OK: Swap Total: 1.60 GB Used: 91.25 MB (5.56%) Free: 1.51 GB (94.44%)\n' "" \ + '0' \ + "" 'no action url for this host' "" \ + "" '3450' "" \ + "" '1245' "" \ + "" '0' "" \ + ""}' +``` From 5c063ff7b79ed01f1168125f379bb0db1c3dddc3 Mon Sep 17 00:00:00 2001 From: psame <44295022+psamecentreon@users.noreply.github.com> Date: Thu, 16 Dec 2021 14:44:59 +0100 Subject: [PATCH 2/8] Update sc-bsm.md --- en/integrations/event-management/sc-bsm.md | 2 -- 1 file changed, 2 deletions(-) diff --git a/en/integrations/event-management/sc-bsm.md b/en/integrations/event-management/sc-bsm.md index f731e31d5429..09b171d955ce 100644 --- a/en/integrations/event-management/sc-bsm.md +++ b/en/integrations/event-management/sc-bsm.md @@ -3,8 +3,6 @@ id: sc-hp-bsm title: BSM --- -> Hello community! We're looking for a contributor to help us to translate the content in french. If it's you, let us know and ping us on [slack](https://centreon.slack.com). - ## Before starting - You can send events from a central server, a remote server or a poller. From d286e7c3d2572ea86f43f63ca247fda5fc41d5fd Mon Sep 17 00:00:00 2001 From: psame <44295022+psamecentreon@users.noreply.github.com> Date: Wed, 29 Dec 2021 18:13:34 +0100 Subject: [PATCH 3/8] First review of documentation --- en/integrations/event-management/sc-bsm.md | 29 ++++++++++++++-------- 1 file changed, 18 insertions(+), 11 deletions(-) diff --git a/en/integrations/event-management/sc-bsm.md b/en/integrations/event-management/sc-bsm.md index 09b171d955ce..1bdd642d9d0f 100644 --- a/en/integrations/event-management/sc-bsm.md +++ b/en/integrations/event-management/sc-bsm.md @@ -124,8 +124,8 @@ luarocks install centreon-stream-connectors-lib ### Download BSM stream connector ```shell -wget -O /usr/share/centreon-broker/lua/bsm_connector-apiv2.lua https://raw.githubusercontent.com/centreon/centreon-stream-connector-scripts/master/centreon-certified/bsm/bsm_connector-apiv2.lua -chmod 644 /usr/share/centreon-broker/lua/bsm_connector-apiv2.lua +wget -O /usr/share/centreon-broker/lua/bsm-events-apiv2.lua https://raw.githubusercontent.com/centreon/centreon-stream-connector-scripts/master/centreon-certified/bsm/bsm-events-apiv2.lua +chmod 644 /usr/share/centreon-broker/lua/bsm-events-apiv2.lua ``` ## Configuration @@ -137,21 +137,28 @@ To configure your stream connector, you must **head over** the **Configuration - | Field | Value | | --------------- | ------------------------------------------------------ | | Name | BSM | -| Path | /usr/share/centreon-broker/lua/bsm_connector-apiv2.lua | +| Path | /usr/share/centreon-broker/lua/bsm-events-apiv2.lua | + +### Add BSM mandatory parameters + +Stream connectors have a set of mandotory parameters dedicated to the Software that they are associated with. To add them you must **click** on the **+Add a new entry** button located **below** the **filter category** input. + +| Type | Name | Value (explanation) | defaultvalue | +|--------|---------------------|------------------------------------------------------------------------------------------------------------------------| ----------------------------------------------------------------- | +| String | `http_server_url` | URL of your BSM platform | `https://:30005/bsmc/rest/events//` | ### Add BSM optional parameters -Some stream connectors have a set of optional parameters dedicated to the Software that they are associated with. To add them you must **click** on the **+Add a new entry** button located **below** the **filter category** input. +Some stream connectors have a set of optional parameters dedicated to the Software that they are associated with. To add them you follow the same process as for the mandatory parameters. | Type | Name | Value (explanation) | defaultvalue | |--------|---------------------|------------------------------------------------------------------------------------------------------------------------| ----------------------------------------------------------------- | -| String | `http_server_url` | URL de votre plateforme BSM | `https://:30005/bsmc/rest/events//` | -| String | `http_proxy_string` | Paramétrage du proxy permettant de sortir vers Internet en HTTP/HTTPS | `http://your.proxy.server:3128` | -| String | `source_ci` | Nom permettant d'identifier l'émetteur | `Centreon` | -| Number | `log_level` | Niveau de verbosité des logs 0: errors seulement, 1: +warnings, 2: +verbose, 3: +debug | 2 | -| String | `log_path` | Chemin complet du fichier de log | `/var/log/centreon-broker/my-custom-logfile.log` | -| Number | `max_buffer_size` | Nombre maximum d'événements à stocker en mémoire tampon en attendant de les transmettre en un seul envoi | 1 | -| Number | `max_buffer_age` | Temps d'attente maximum avant d'envoyer les événements en mémoire tampon si `max_buffer_size` n'est pas encore atteint | 5 | +| String | `http_proxy_string` | Setting the proxy to output to the Internet in HTTP/HTTPS | `http://your.proxy.server:3128` | +| String | `source_ci` | Name to identify the sender | `Centreon` | +| Number | `log_level` | Log verbosity level 0: errors only, 1: +warnings, 2: +verbose, 3: +debug | 2 | +| String | `log_path` | Full path of the log file | `/var/log/centreon-broker/my-custom-logfile.log` | +| Number | `max_buffer_size` | Maximum number of events to be buffered while waiting to be transmitted in one transmission | 1 | +| Number | `max_buffer_age` | Maximum time to wait before sending events to the buffer if `max_buffer_size` is not yet reached | 5 | ### Proxy configuration From fcc25b6663a4acff3b4549262f28cda5588343ca Mon Sep 17 00:00:00 2001 From: psame <44295022+psamecentreon@users.noreply.github.com> Date: Thu, 30 Dec 2021 15:36:14 +0100 Subject: [PATCH 4/8] Update r2nd review of docs --- en/integrations/event-management/sc-bsm.md | 71 ++++++++++------------ 1 file changed, 31 insertions(+), 40 deletions(-) diff --git a/en/integrations/event-management/sc-bsm.md b/en/integrations/event-management/sc-bsm.md index 1bdd642d9d0f..b459ccf66a84 100644 --- a/en/integrations/event-management/sc-bsm.md +++ b/en/integrations/event-management/sc-bsm.md @@ -192,25 +192,41 @@ This stream connector is not compatible with event bulking. Meaning that the opt This stream connector will send event with the following format. -### status event +### Service status event ```xml { "" - "" hostname "" - "" service_description "" - "" self.sc_event.event.state "" - "" self.sc_event.event.last_update "" - "" string.match(e.output, "^(.*)\n") "" - xml_service_severity - "" xml_url "" - "" ifnil_or_empty(self.sc_event.event.host_id, '0') "" - "" ifnil_or_empty(self.sc_event.event.service_id, '0') "" - "" ifnil_or_empty(self.sc_event.event.scheduled_downtime_depth, '0') "" + "" Central "" + "" Ping "" + "" 0 "" + "" 1640862289 "" + "" OK - 10.30.2.31 rta 0.285ms lost 0% "" + "" 0 "" no url for this service "" + "" 19 "" + "" 546 "" + "" 0 "" "" } ``` +### Host status event + +```xml +{ + "" + "" Central "" + "" 0 "" + "" no notes found on host "" + "" no action url for this host "" + "" Centreon "" + "" 0 "" + "" 0 "" + "" +} +``` + ### Custom event format This stream connector allows you to change the format of the event to suit your needs. Only the **event** part of the json is customisable. It also allows you to handle events type that are not handled by default such as **ba_status events**. @@ -231,34 +247,9 @@ Here is the list of all the curl commands that are used by the stream connector. ### Send events -You can trigger a signal with the following command: - -```shell -curl -X POST -H 'content-type: application/xml' 'https://centreon.bsm.server:30005/bsmc/rest/events/myCentreon/' -d '{"" "" 'srv-vp-central01' "" \ - "" 'Swap' "" \ - "" 'Critical' "" \ - "" '12/16/2021 1:14 PM' "" \ - "" 'Critical: Swap Total: 1.60 GB Used: 1.51 GB (94.44%) Free: 1.25 MB (5.56%)\n' "" \ - '0' \ - "" 'no action url for this host' "" \ - "" '3450' "" \ - "" '1245' "" \ - "" '0' "" \ - ""}' -``` - -You can then close this signal with the following command: - ```shell -curl -X POST -H 'content-type: application/xml' 'https://centreon.bsm.server:30005/bsmc/rest/events/myCentreon/' -d '{"" "" 'srv-vp-central01' "" \ - "" 'Swap' "" \ - "" 'OK' "" \ - "" '12/16/2021 1:45 PM' "" \ - "" 'OK: Swap Total: 1.60 GB Used: 91.25 MB (5.56%) Free: 1.51 GB (94.44%)\n' "" \ - '0' \ - "" 'no action url for this host' "" \ - "" '3450' "" \ - "" '1245' "" \ - "" '0' "" \ - ""}' +curl -X POST https://centreon.bsm.server:30005/bsmc/rest/events/myCentreon/ + -H "Content-Type: application/xml" + -H "Accept: application/xml" + -d "CentralPing01640862289OK - 10.30.2.31 rta 0.285ms lost 0%0no url for this service195460" ``` From d71a399b41bfedd7e3f6022234310c02d98cfea9 Mon Sep 17 00:00:00 2001 From: psame <44295022+psamecentreon@users.noreply.github.com> Date: Thu, 30 Dec 2021 18:56:52 +0100 Subject: [PATCH 5/8] Update sc-bsm.md --- en/integrations/event-management/sc-bsm.md | 4 ---- 1 file changed, 4 deletions(-) diff --git a/en/integrations/event-management/sc-bsm.md b/en/integrations/event-management/sc-bsm.md index b459ccf66a84..e60d42b00760 100644 --- a/en/integrations/event-management/sc-bsm.md +++ b/en/integrations/event-management/sc-bsm.md @@ -184,10 +184,6 @@ Some of them are overridden by this stream connector. | string | accepted_categories | neb | | string | accepted_elements | host_status,service_status | -## Event bulking - -This stream connector is not compatible with event bulking. Meaning that the option `max_buffer_size` can't be higher than 1 - ## Event format This stream connector will send event with the following format. From 172136709cc6376b86c186c02aed32c77019523d Mon Sep 17 00:00:00 2001 From: psame <44295022+psamecentreon@users.noreply.github.com> Date: Thu, 30 Dec 2021 18:58:43 +0100 Subject: [PATCH 6/8] Update sc-bsm.md --- en/integrations/event-management/sc-bsm.md | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/en/integrations/event-management/sc-bsm.md b/en/integrations/event-management/sc-bsm.md index e60d42b00760..fa5eb58bb7b4 100644 --- a/en/integrations/event-management/sc-bsm.md +++ b/en/integrations/event-management/sc-bsm.md @@ -184,6 +184,16 @@ Some of them are overridden by this stream connector. | string | accepted_categories | neb | | string | accepted_elements | host_status,service_status | +## Event bulking + +This stream connector is compatible with event bulking. Meaning that it is able to send more that one event in each call to the Splunk REST API. + +To use this feature you must add the following parameter in your stream connector configuration. + +| Type | Name | Value | +| ------ | --------------- | --------------- | +| number | max_buffer_size | `more than one` | + ## Event format This stream connector will send event with the following format. From de370b7099b0d97fd3d380548ada9133e7fcc686 Mon Sep 17 00:00:00 2001 From: psame <44295022+psamecentreon@users.noreply.github.com> Date: Thu, 27 Jan 2022 18:38:46 +0100 Subject: [PATCH 7/8] Update sc-bsm.md --- en/integrations/event-management/sc-bsm.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/en/integrations/event-management/sc-bsm.md b/en/integrations/event-management/sc-bsm.md index fa5eb58bb7b4..114b879e30a3 100644 --- a/en/integrations/event-management/sc-bsm.md +++ b/en/integrations/event-management/sc-bsm.md @@ -186,7 +186,7 @@ Some of them are overridden by this stream connector. ## Event bulking -This stream connector is compatible with event bulking. Meaning that it is able to send more that one event in each call to the Splunk REST API. +This stream connector is compatible with event bulking. Meaning that it is able to send more that one event in each call to the BSM REST API. To use this feature you must add the following parameter in your stream connector configuration. From 47c7029f7a00062d889a32f22d038e39e8c6fd29 Mon Sep 17 00:00:00 2001 From: psamecentreon Date: Tue, 1 Feb 2022 16:01:42 +0000 Subject: [PATCH 8/8] Review translate FR version --- fr/integrations/event-management/sc-bsm.md | 267 +++++++++++++++------ 1 file changed, 188 insertions(+), 79 deletions(-) diff --git a/fr/integrations/event-management/sc-bsm.md b/fr/integrations/event-management/sc-bsm.md index 863433a43b36..bc173d208138 100644 --- a/fr/integrations/event-management/sc-bsm.md +++ b/fr/integrations/event-management/sc-bsm.md @@ -3,126 +3,235 @@ id: sc-hp-bsm title: BSM --- -## Ce qu'apporte l'intégration de BSM + Centreon +## Installation -Le Stream Connector BSM envoie les données de **Centreon** vers le gestionnaire de service **Micro Focus BSM** (Business Service Management). +### Dépendances -## Comment ça marche + + -* Chaque fois qu'un service ou un hôte est vérifié par le moteur de supervision, le résultat passe par *Centreon Broker*, qui utilise les fonctions définies dans le script du Stream Connector pour transmettre les changements d'état à BSM. +Installer le dépôt **Epel**. -## Prérequis +```shell +yum -y install epel-release +``` -* Pour pouvoir transmettre des données vers BSM, il faut avoir créé un webservice au préalable. Veuillez contacter votre expert BSM pour cette partie. -* L'intégration d'un Stream Connector nécessite un **compte Centreon avec des privilèges d'administrateur** ou bien les accès aux menus **Exporter la configuration** et **Configuration de Centreon Broker**. -* Un **accès `root` en ligne de commande sur le serveur Centreon central** est également requis. +Installer les dépendances. -## Support +```shell +yum install luarocks make gcc lua-curl lua-devel +``` -Si vous avez besoin d'aide, vous pourrez en trouver via deux canaux, suivant votre statut : + -* **Clients de Centreon titulaires d'un contrat de support** : vous pouvez vous adresser directement à [l'équipe du Support de Centreon](mailto:support@centreon.com). -* **Utilisateurs de l'édition Open Source** ou de **Centreon IT-100** (versions gratuites) : nous vous invitons à rejoindre notre [communauté sur Slack](https://centreon.github.io) où nos utilisateurs et nos équipes feront de leur mieux pour vous aider. +Installez le paquet dnf plugins. -## Procédure d'intégration +```shell +dnf -y install dnf-plugins-core +``` -### Installation +Installer le dépôt **Powertools**. -Se connecter en tant que `root` au serveur central Centreon avec votre client SSH favori. +```shell +dnf config-manager --set-enabled powertools +``` -Dans le cas où votre serveur doit passer par un proxy pour accéder à Internet, il faudra exporter la variable d'environnement `https_proxy` et configurer `yum` pour être en mesure d'installer toutes les dépendances. +Installer le dépôt **Epel**. -```bash -export https_proxy=http://my.proxy.server:3128 -echo "proxy=http://my.proxy.server:3128" >> /etc/yum.conf +```shell +dnf -y install epel-release ``` -Maintenant que le serveur peut accéder à Internet, lancer les commandes : +Installer les dépendances. -```bash -yum install -y lua-curl epel-release -yum install -y luarocks -luarocks install luaxml +```shell +dnf install make gcc libcurl-devel lua-devel luarocks ``` -Ce paquet est nécessaire au bon fonctionnement du script LUA qu'il ne reste plus qu'à télécharger : + -```bash -wget -O /usr/share/centreon-broker/lua/bsm_connector.lua https://raw.githubusercontent.com/centreon/centreon-stream-connector-scripts/master/centreon-certified/bsm/bsm_connector-apiv1.lua -chmod 644 /usr/share/centreon-broker/lua/bsm_connector.lua -``` +Installez le paquet dnf plugins. -Le Stream Connector BSM est maintenant installé sur votre serveur Centreon central ! +```shell +dnf -y install dnf-plugins-core +``` -### Configuration +Installer le dépôt **Epel**. -#### Configuration de *Centreon Broker* +```shell +dnf -y install https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm +``` -1. Se connecter à l'interface Web de Centreon avec un compte administrateur. -2. Naviguer vers **Configuration** > **Collecteurs** et choisir **Configuration de Centreon Broker**. -3. Cliquer sur l'objet de configuration **central-broker-master** et naviguer dans l'onglet **Output**. -4. Sélectionner **Generic - Stream connector** et cliquer sur **Ajouter** pour créer une nouvelle sortie. -5. Choisir son nom (**Name**) par exemple **BSM** et saisir l'emplacement (**Path**) où le script a été installé : `/usr/share/centreon-broker/lua/bsm_connector.lua`. -6. Le paramètre `http_server_url` est à personnaliser dans tous les cas : +Activez le dépôt **Codeready**. -| Name | Type | Value | -|-------------------|--------|-------------------------------------------------------------------| -| `http_server_url` | String | `https://:30005/bsmc/rest/events//` | +```shell +subscription-manager repos --enable codeready-builder-for-rhel-8-x86_64-rpms +``` -7. Sauvegarder la configuration, puis naviguer vers le menu **Configuration** > **Collecteurs** et choisir **Collecteurs**. -8. Sélectionner le collecteur **Central** et cliquer sur **Exporter la configuration**. -9. Conserver les cases **Générer les fichiers de configuration** et **Lancer le débogage du moteur de supervision (-v)** et cocher également **Deplacer les fichiers générés** puis cliquer sur le bouton **Exporter**. -10. Redémarrer le service `cbd` : +Installer les dépendances. -```bash -systemctl restart cbd +```shell +dnf install make gcc libcurl-devel lua-devel luarocks ``` -Votre serveur central a maintenant chargé le Stream Connector et commence à envoyer des données vers BSM ! + + +### Lua modules -> Pour s'assurer que tout fonctionne bien, on consultera les fichiers `central-broker-master.log` et `stream-connector-bsm.log`, tous deux situés à l'emplacement `/var/log/centreon-broker` du serveur central. + + -#### Configuration avancée +Installer les modules lua de Centreon. -**Tableau des paramètres** +```shell +luarocks install centreon-stream-connectors-lib +``` -| Name | Type | Value (exemple) | Explication | -|---------------------|--------|-------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------| -| `http_server_url` | String | `https://:30005/bsmc/rest/events//` | URL de votre plateforme BSM | -| `http_proxy_string` | String | `http://your.proxy.server:3128` | Paramétrage du proxy permettant de sortir vers Internet en HTTP/HTTPS | -| `source_ci` | String | `Centreon` (valeur par défaut) | Nom permettant d'identifier l'émetteur | -| `log_level` | Number | 2 (valeur par défaut) | Niveau de verbosité des logs 0: errors seulement, 1: +warnings, 2: +verbose, 3: +debug | -| `log_path` | String | `/var/log/centreon-broker/my-custom-logfile.log` | Chemin complet du fichier de log | -| `max_buffer_size` | Number | 1 (valeur par défaut) | Nombre maximum d'événements à stocker en mémoire tampon en attendant de les transmettre en un seul envoi | -| `max_buffer_age` | Number | 5 (valeur par défaut) | Temps d'attente maximum avant d'envoyer les événements en mémoire tampon si `max_buffer_size` n'est pas encore atteint | + -**Remarques** +Installer **lua-curl**. -* La valeur par défaut de 2 pour le paramètre `log_level` est adaptée à la mise en place et au *troubleshooting* initial éventuel, cela peut cependant générer un volume important de logs. Il est donc recommandé, une fois la mise en place validée, de l'abaisser à 1. -* La valeur par défaut de 1 pour le paramètre `max_buffer_size` fonctionne bien et garantit une latence réduite au minimum entre l'apparition d'une alerte et sa transmission à BSM. Il pourrait s'avérer utile de l'augmenter dans le cas où le flux à transmettre comporterait en continu plusieurs événements par seconde et au-delà. +```shell +luarocks install Lua-cURL +``` ---------------- +Installer les modules lua de Centreon. -## Désinstallation +```shell +luarocks install centreon-stream-connectors-lib +``` -1. Se connecter à l'interface Web de Centreon avec un compte administrateur. -2. Naviguer vers **Configuration** > **Collecteurs** et choisir **Configuration de Centreon Broker**. -3. Cliquer sur l'objet de configuration **central-broker-master** et naviguer dans l'onglet **Output**. -4. Supprimer la sortie **Generic - Stream connector** en cliquant sur la croix rouge entourée d'un cercle à la fin de la ligne. -5. Sauvegarder la configuration, puis naviguer vers le menu **Configuration** > **Collecteurs** et choisir **Collecteurs**. -6. Sélectionner le collecteur **Central** et cliquer sur **Exporter la configuration**. -7. Conserver les cases **Générer les fichiers de configuration** et **Lancer le débogage du moteur de supervision (-v)** et cocher également **Deplacer les fichiers générés** puis cliquer sur le bouton **Exporter**. -8. Redémarrer le service `cbd` : + -```bash -systemctl restart cbd +### Télécharger le Stream Connector BSM events + +```shell +wget -O /usr/share/centreon-broker/lua/bsm-events-apiv2.lua https://raw.githubusercontent.com/centreon/centreon-stream-connector-scripts/master/centreon-certified/bsm/bsm-events-apiv2.lua +chmod 644 /usr/share/centreon-broker/lua/bsm-events-apiv2.lua ``` -Le Stream Connector n'est plus chargé par `centreon-broker`. +## Configuration + +Pour configurer votre Stream Connector, vous devez **allez** dans le menu **Configuration --> Poller --> Broker configuration**. **Sélectionner** la configuration **central-broker-master** (ou la configuration de broker appropriée s'il s'agit d'un poller ou d'un serveur distant qui enverra des événements) et **cliquer** sur l'onglet **Output** lorsque le formulaire du broker s'affiche. + +**Ajouter** une nouvelle sortie **généric - stream connector** et **régler** les champs suivants comme suit : + +| Field | Value | +| --------------- | ------------------------------------------------------ | +| Name | BSM | +| Path | /usr/share/centreon-broker/lua/bsm-events-apiv2.lua | + +### Ajouter les paramètres obligatoires de BSM + +Chaque Stream Connector dispose d'un ensemble de paramètres obligatoires. Pour les ajouter, vous devez **cliquer** sur le bouton **+Add a new entry** situé **sous** l'entrée **filter category**. + +| Type | Name | Value (explanation) | defaultvalue | +|--------|---------------------|------------------------------------------------------------------------------------------------------------------------| ----------------------------------------------------------------- | +| String | `http_server_url` | URL of your BSM platform | `https://:30005/bsmc/rest/events//` | + +### Ajouter les paramètres optionnels de BSM + +Certains Stream Connector disposent d'un ensemble de paramètres optionnels dédiés au logiciel auquel ils sont associés. Pour les ajouter, vous devez **cliquer** sur le bouton **+Add a new entry** situé **sous** l'entrée **filter category**. + +| Type | Name | Value (explanation) | defaultvalue | +|--------|---------------------|------------------------------------------------------------------------------------------------------------------------| ----------------------------------------------------------------- | +| String | `http_proxy_string` | Setting the proxy to output to the Internet in HTTP/HTTPS | `http://your.proxy.server:3128` | +| String | `source_ci` | Name to identify the sender | `Centreon` | +| Number | `log_level` | Log verbosity level 0: errors only, 1: +warnings, 2: +verbose, 3: +debug | 2 | +| String | `log_path` | Full path of the log file | `/var/log/centreon-broker/my-custom-logfile.log` | +| Number | `max_buffer_size` | Maximum number of events to be buffered while waiting to be transmitted in one transmission | 1 | +| Number | `max_buffer_age` | Maximum time to wait before sending events to the buffer if `max_buffer_size` is not yet reached | 5 | + +### Configuration du proxy -9. Ce n'est pas nécessaire, mais vous pouvez également supprimer le script pour désinstaller complètement le Stream Connector : +Lorsque vous utilisez un proxy pour vous connecter au système BSM, vous pouvez utiliser des paramètres supplémentaires pour le configurer : -```bash -rm -f /usr/share/centreon-broker/lua/bsm_connector.lua +| Type | Name | Value explanation | +| -------- | ------------------ | ----------------------------------------------------- | +| string | proxy_address | Proxy address | +| number | proxy_port | Proxy port (mandatory when proxy_address is set) | +| string | proxy_username | Proxy username the file in which logs are written | +| password | proxy_password | Proxy password (mandatory when proxy_username is set) | + +### Paramètres standard + +Tous les Stream Connectors peuvent utiliser un ensemble de paramètres optionnels qui sont mis à disposition par les modules lua des Stream Connector Centreon. + +Tous ces paramètres sont documentés **[ici](https://github.com/centreon/centreon-stream-connector-scripts/blob/master/modules/docs/sc_param.md#default-parameters)**. + +Certains d'entre eux sont remplacés par ce Stream Connector. + +| Type | Name | Default value for the stream connector | +| ------ | ------------------- | -------------------------------------- | +| string | accepted_categories | neb | +| string | accepted_elements | host_status,service_status | + +## Regroupement d'événements + +Ce Stream Connector n'est pas compatible avec le groupage d'événements. Cela signifie que l'option `max_buffer_size` ne peut pas être supérieure à 1. + +## Format de l'événement + +Ce Stream Connetor enverra l'évenement au format suivant. + +### Service status event + +```xml +{ + "" + "" Central "" + "" Ping "" + "" 0 "" + "" 1640862289 "" + "" OK - 10.30.2.31 rta 0.285ms lost 0% "" + "" 0 "" no url for this service "" + "" 19 "" + "" 546 "" + "" 0 "" + "" +} ``` +### Host status event + +```xml +{ + "" + "" Central "" + "" 0 "" + "" no notes found on host "" + "" no action url for this host "" + "" Centreon "" + "" 0 "" + "" 0 "" + "" +} +``` + +### Format d'événement personnalisé + +Ce Stream Connector vous permet de modifier le format de l'événement en fonction de vos besoins. Seule la partie **event** du json est personnalisable. Il vous permet également de gérer des types d'événements qui ne sont pas gérés par défaut tels que les événements **ba_status**. + +Afin d'utiliser cette fonctionnalité, vous devez configurer un fichier de format d'événement json et ajouter un nouveau paramètre du Stream Connector. + +| Type | Name | Value | +| ------ | ----------- | ------------------------------------------------------- | +| string | format_file | /etc/centreon-broker/lua-conf/bsm-events-format.json | + +> Le fichier de configuration du format des événements doit être lisible par l'utilisateur de *centreon-broker*. + +Pour en savoir plus sur le format d'événement personnalisé et le fichier modèle, consultez cette **[documentation](https://github.com/centreon/centreon-stream-connector-scripts/blob/master/modules/docs/templating.md#templating-documentation)**. + +## Commande curl + +Voici la liste de toutes les commandes curl qui sont utilisées par le Stream Connector. + +### Envoie d'évenements + +```shell +curl -X POST https://centreon.bsm.server:30005/bsmc/rest/events/myCentreon/ + -H "Content-Type: application/xml" + -H "Accept: application/xml" + -d "CentralPing01640862289OK - 10.30.2.31 rta 0.285ms lost 0%0no url for this service195460" +``` \ No newline at end of file