Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

enh(doc): enhancement to BSM api-v2 #1200

Open
wants to merge 8 commits into
base: master
Choose a base branch
from

Conversation

psamecentreon
Copy link
Contributor

@psamecentreon psamecentreon commented Dec 16, 2021

Description

Enhancement of the BSM stream connector implementation in api-v2

@psamecentreon psamecentreon added documentation Improvements or additions to documentation enhancement New feature or request integration labels Dec 16, 2021
@psamecentreon psamecentreon self-assigned this Dec 16, 2021
Comment on lines +112 to +114
```shell
luarocks install luaxml
```
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this dependency is made using C, does it works on el7 and el8 ? (should be, because i've tested on el8 and it worked and obviously the stream connector has been made using el7 when first created). It's just a comment to about testing things and the issues we can have we dependencies

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This install is OK.
I'll have to continue my test with the stream connector code

en/integrations/event-management/sc-bsm.md Outdated Show resolved Hide resolved
en/integrations/event-management/sc-bsm.md Outdated Show resolved Hide resolved
Comment on lines 148 to 154
| String | `http_server_url` | URL de votre plateforme BSM | `https://<my.bsm.server>:30005/bsmc/rest/events/<my-webservice>/` |
| 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 |
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you need to split this part into two chapters. One about mandatory parameters. and one about optional parameters. Those two chapters must only talk about BSM dedicated parameters. Others such as max_buffer_xxx logs and so on must be explained in another chapter

please, use only english


```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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

according to the code, it is

Comment on lines 190 to 204
```xml
{
"<event_data>"
"<hostname>" hostname "</hostname>"
"<svc_desc>" service_description "</svc_desc>"
"<state>" self.sc_event.event.state "</state>"
"<last_update>" self.sc_event.event.last_update "</last_update>"
"<output>" string.match(e.output, "^(.*)\n") "</output>"
xml_service_severity
"<url>" xml_url "</url>"
"<source_host_id>" ifnil_or_empty(self.sc_event.event.host_id, '0') "</source_host_id>"
"<source_svc_id>" ifnil_or_empty(self.sc_event.event.service_id, '0') "</source_svc_id>"
"<scheduled_downtime_depth>" ifnil_or_empty(self.sc_event.event.scheduled_downtime_depth, '0') "</scheduled_downtime_depth>"
"</event_data>"
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is a copy paste from the code, this is not the xml that is sent 😈

this stream connector handles services and hosts, you need to provide the example for both kind of events

```

The Stream Connector is not loaded anymore!
### Custom event format
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you'll need to test this one

Comment on lines 225 to 257
### 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 '{"<event_data>" "<hostname>" 'srv-vp-central01' "</hostname>" \
"<svc_desc>" 'Swap' "</svc_desc>" \
"<state>" 'Critical' "</state>" \
"<last_update>" '12/16/2021 1:14 PM' "</last_update>" \
"<output>" 'Critical: Swap Total: 1.60 GB Used: 1.51 GB (94.44%) Free: 1.25 MB (5.56%)\n' "</output>" \
'0' \
"<url>" 'no action url for this host' "</url>" \
"<source_host_id>" '3450' "</source_host_id>" \
"<source_svc_id>" '1245' "</source_svc_id>" \
"<scheduled_downtime_depth>" '0' "</scheduled_downtime_depth>" \
"</event_data>"}'
```

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 '{"<event_data>" "<hostname>" 'srv-vp-central01' "</hostname>" \
"<svc_desc>" 'Swap' "</svc_desc>" \
"<state>" 'OK' "</state>" \
"<last_update>" '12/16/2021 1:45 PM' "</last_update>" \
"<output>" 'OK: Swap Total: 1.60 GB Used: 91.25 MB (5.56%) Free: 1.51 GB (94.44%)\n' "</output>" \
'0' \
"<url>" 'no action url for this host' "</url>" \
"<source_host_id>" '3450' "</source_host_id>" \
"<source_svc_id>" '1245' "</source_svc_id>" \
"<scheduled_downtime_depth>" '0' "</scheduled_downtime_depth>" \
"</event_data>"}'
```
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

there is too much things from another documentation to feel like it is the curl that is send. This is the hardest part when refactoring a stream connector. You have to guess the curl command from the code.

@sonarqube-decoration
Copy link

SonarQube Quality Gate:
Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
No Duplication information No Duplication information

@sonarqube-decoration
Copy link

SonarQube Quality Gate:
Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
No Duplication information No Duplication information

@Sims24
Copy link
Contributor

Sims24 commented Mar 29, 2022

Pending validation from @tanguyvda centreon/centreon-stream-connector-scripts#91

@Sims24
Copy link
Contributor

Sims24 commented Oct 3, 2022

@tanguyvda please update review status of the stream connector PR. This PR will soon celebrate its first birthday which is not a good thing IMHO

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/connectors documentation Improvements or additions to documentation enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants