This site is in read only mode. Please continue to browse, but replying, likes, and other actions are disabled for now.

⚠️ We've moved!

Hi there!

To reduce project dependency on 3rd party paid services the StackStorm TSC has decided to move the Q/A from this forum to Github Discussions. This will make user experience better integrated with the native Github flow, as well as the questions closer to the community where they can provide answers.

Use 🔗 Github Discussions to ask your questions.

Icinga2 Package Usage Sample Req

Hello All,

Can anyone help me to use Icinga2 Package. I have installed/Registered the package. However i don’t see icinga events at stackstorm.

Here is the sensor request in debug mode.

Note: IP/User Name are masked

2018-12-20 06:26:45,450 INFO [-] Icinga2StateChangeSensor initialized with URL: https://IP:MASKED:5665/v1/events?queue=state_change&types=StateChange User: ****** Password: *****
2018-12-20 06:26:45,450 INFO [-] Running sensor in passive mode
2018-12-20 06:26:45,450 INFO [-] Setting up API connection params.
2018-12-20 06:26:45,451 INFO [-] Starting connection to API endpoint.
2018-12-20 06:26:45,451 INFO [-] pyCurl started.
2018-12-20 06:26:45,451 INFO [-] keep trying = 1
*   Trying *******...
* Connected to ******* (*******) port 5665 (#0)
* found 148 certificates in /etc/ssl/certs/ca-certificates.crt
* found 594 certificates in /etc/ssl/certs
* ALPN, offering http/1.1
* SSL connection using TLS1.2 / RSA_AES_256_GCM_SHA384
*        server certificate verification SKIPPED
*        server certificate status verification SKIPPED
*        common name: icinga2-master1(does not match '*******')
*        server certificate expiration date OK
*        server certificate activation date OK
*        certificate public key: RSA
*        certificate version: #3
*        subject: CN=icinga2-master1
*        start date: Thu, 04 Oct 2018 09:30:25 GMT
*        expire date: Fri, 30 Sep 2033 09:30:25 GMT
*        issuer: CN=Icinga CA
*        compression: NULL
* ALPN, server did not agree to a protocol
* Server auth using Basic with user '*******'
> POST /v1/events?queue=state_change&types=StateChange HTTP/1.1
Host: *******:5665
Authorization: Basic 
User-Agent: PycURL/7.43.0.2 libcurl/7.47.0 GnuTLS/3.4.10 zlib/1.2.8 libidn/1.32 librtmp/2.3
Accept: application/json
Content-Length: 0
Content-Type: application/x-www-form-urlencoded

< HTTP/1.1 200 OK
< Content-Type: application/json
2018-12-20 06:26:49,654 DEBUG [-] 1 active sensor(s)
2018-12-20 06:26:54,655 DEBUG [-] 1 active sensor(s)
2018-12-20 06:26:59,656 DEBUG [-] 1 active sensor(s)
2018-12-20 06:27:04,656 DEBUG [-] 1 active sensor(s)
2018-12-20 06:27:09,657 DEBUG [-] 1 active sensor(s)
2018-12-20 06:27:14,657 DEBUG [-] 1 active sensor(s)
2018-12-20 06:27:19,658 DEBUG [-] 1 active sensor(s)

That part looks like it’s probably OK. Is your Sensu system creating any StateChange events?

I have not configured sensu. But i did manually triggered many host/service state change in icinga. And i do not see any events for the same. Maybe my understanding about plugin is wrong. Can you brief on correct usage please

This is the error i see on debug mode.

2018-12-25 05:41:58,330 ERROR [-] Traceback (most recent call last):

2018-12-25 05:41:58,330 ERROR [-]   File "/opt/stackstorm/packs/icinga2/sensors/lib/client.py", line 64, in on_receive

2018-12-25 05:41:58,331 ERROR [-]
2018-12-25 05:41:58,331 ERROR [-] self._sensor.process_event(event)

2018-12-25 05:41:58,331 ERROR [-]   File "/opt/stackstorm/packs/icinga2/sensors/icinga2_state_change_events.py", line 24, in process_event

2018-12-25 05:41:58,331 ERROR [-]
2018-12-25 05:41:58,331 ERROR [-] payload['service'] = event['service']

2018-12-25 05:41:58,332 ERROR [-] KeyError
2018-12-25 05:41:58,332 ERROR [-] :
2018-12-25 05:41:58,332 ERROR [-] 'service'
2018-12-25 05:41:58,332 ERROR [-]

* Failed writing body (0 != 1)
* Failed writing data
* Closing connection 0

It looks like the issue is related to the sensor code.

For some reason the “event” dictionary doesn’t contain “service” attribute / key. The best way to troubleshoot this would be to augment / update the sensor code, add some debug logging which logs the whole “event” object so we can see which attributes are present and what is going on.

EDIT: It looks like we already log the whole event object in the sensor code - stackstorm-icinga2/icinga2_state_change_events.py at master · StackStorm-Exchange/stackstorm-icinga2 · GitHub

So please include the whole sensor container log file so we can see how the event object looks like.

@kami: Are you referring to below log file? Let me know…

/var/log/st2/st2sensorcontainer.log