-
Notifications
You must be signed in to change notification settings - Fork 111
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
base: master
Are you sure you want to change the base?
Conversation
```shell | ||
luarocks install luaxml | ||
``` |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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
| 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 | |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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
```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>" | ||
} |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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
### 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>"}' | ||
``` |
There was a problem hiding this comment.
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.
Pending validation from @tanguyvda centreon/centreon-stream-connector-scripts#91 |
@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 |
Description
Enhancement of the BSM stream connector implementation in api-v2