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 error on stackstorm

Hi,

I’m not getting events from icinga2 to stackstorm. Here is the error logs from sensors.

2018-12-17 12:07:27,553 DEBUG [-] Starting new HTTPS connection (1): xx.xx.xx.xx
2018-12-17 12:07:27,621 DEBUG [-] https://xx.xx.xx.xx:5665 “POST /v1/events?queue=m&types=CheckResult&filter=event.check_result.vars_after.state_type==1.0 HTTP/1.1” 401 None
2018-12-17 12:07:27,623 INFO [-] Icinga2ReqSensor status_code: 401

But if i run the post call through curl i get the result. Not sure what’s wrong.

Note: IP has been masked for security purpose.

Any insight will be of great help.

Icinga Pack Used: icinga2req

Are you referring to this pack? GitHub - twalk6/icinga2req: Stackstorm Requests Based Icinga2 Sensor

Might be worth posting an issue on that repo, see if the original author is maintaining it.

But if it works when you use curl but not when configured in Icinga, then I would be looking at the Icinga configuration closely. Check things like connectivity, certificate validation.

@ihill:
Yes i’m referring to the same package.

Connectivity is available. And i have removed certificate from configuration.

looks like there is almost no activity on the original package.

That pack was never contributed to the StackStorm Exchange, and I don’t know what the author does with it these days. But you could still log an issue, the author may see the notification.

Thinking about it more, if you’re seeing a 401 on the Icinga side, then that does mean connectivity plus certificate validation has passed. It means that your Icinga config is not passing authentication through properly. Have you configured whatever authentication that sensor needs?

The developer did not give any usage sample. Below is the authentication for sensor.

Place configuration data for your pack here.


eventstream_type: ‘CheckResult’ #StateChange or CheckResult
api_url: ‘https://xx.xx.xx.xx:5665/v1
api_user: ‘me’
api_password: ‘xxxxxxxxxxx’
api_queue: ‘m’
#comment out cert_file run without cert validation (less secure)

Have you tried logging an issue against that repo?

Yes i did. But no reply yet. Do you have any timeline to fix default icinga package with stackstorm?

Which issue needs fixing?

It’s an Open Source pack - anyone can contribute

Currently on using default icinga package (st2 pack install icinga2) we have pycurl installation issue and installation fails.

I see in package the below TODO:

  • Re-write actions & sensors to use requests instead of pycurl

    Failed to build pycurl
    Installing collected packages: pycurl
    Running setup.py install for pycurl: started
    Running setup.py install for pycurl: finished with status ‘error’
    Complete output from command /opt/stackstorm/virtualenvs/icinga2/bin/python -u -c “import setuptools, tokenize;file=’/tmp/pip-build-8hEXM1/pycurl/setup.py’;f=getattr(tokenize, ‘open’, open)(file);code=f.read().replace(’
    ', ’
    ');f.close();exec(compile(code, file, ‘exec’))” install --record /tmp/pip-np3xxv-record/install-record.txt --single-version-externally-managed --compile --install-headers /opt/stackstorm/virtualenvs/icinga2/include/site/python2.7/pycurl:
    Using curl-config (libcurl 7.47.0)
    running install
    running build
    running build_py
    creating build
    creating build/lib.linux-x86_64-2.7
    creating build/lib.linux-x86_64-2.7/curl
    copying python/curl/init.py -> build/lib.linux-x86_64-2.7/curl
    running build_ext
    building ‘pycurl’ extension
    creating build/temp.linux-x86_64-2.7
    creating build/temp.linux-x86_64-2.7/src
    x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fno-strict-aliasing -Wdate-time -D_FORTIFY_SOURCE=2 -g -fstack-protector-strong -Wformat -Werror=format-security -fPIC -DHAVE_CURL_GNUTLS=1 -DHAVE_CURL_SSL=1 -I/usr/include/python2.7 -c src/pycurl.c -o build/temp.linux-x86_64-2.7/src/pycurl.o
    src/pycurl.c:464:15: warning: gcry_thread_cbs is deprecated [-Wdeprecated-declarations]
    static struct gcry_thread_cbs pycurl_gnutls_tsl = {
    ^
    In file included from src/pycurl.c:83:0:
    /usr/include/gcrypt.h:211:8: note: declared here
    struct gcry_thread_cbs
    ^
    src/pycurl.c:467:5: warning: excess elements in struct initializer
    pycurl_ssl_mutex_create,
    ^
    src/pycurl.c:467:5: note: (near initialization for pycurl_gnutls_tsl)
    src/pycurl.c:468:5: warning: excess elements in struct initializer
    pycurl_ssl_mutex_destroy,
    ^
    src/pycurl.c:468:5: note: (near initialization for pycurl_gnutls_tsl)
    src/pycurl.c:469:5: warning: excess elements in struct initializer
    pycurl_ssl_mutex_lock,
    ^
    src/pycurl.c:469:5: note: (near initialization for pycurl_gnutls_tsl)
    src/pycurl.c:470:5: warning: excess elements in struct initializer
    pycurl_ssl_mutex_unlock
    ^
    src/pycurl.c:470:5: note: (near initialization for pycurl_gnutls_tsl)
    src/pycurl.c: In function multi_socket_callback:
    src/pycurl.c:2351:9: warning: variable ret set but not used [-Wunused-but-set-variable]
    int ret;
    ^
    src/pycurl.c: In function initpycurl:
    src/pycurl.c:3453:31: warning: macro “DATE” might prevent reproducible builds [-Wdate-time]
    insstr(d, “COMPILE_DATE”, DATE " " TIME);
    ^
    src/pycurl.c:3453:44: warning: macro “TIME” might prevent reproducible builds [-Wdate-time]
    insstr(d, “COMPILE_DATE”, DATE " " TIME);
    ^
    x86_64-linux-gnu-gcc -pthread -shared -Wl,-O1 -Wl,-Bsymbolic-functions -Wl,-Bsymbolic-functions -Wl,-z,relro -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -Wdate-time -D_FORTIFY_SOURCE=2 -g -fstack-protector-strong -Wformat -Werror=format-security -Wl,-Bsymbolic-functions -Wl,-z,relro -Wdate-time -D_FORTIFY_SOURCE=2 -g -fstack-protector-strong -Wformat -Werror=format-security build/temp.linux-x86_64-2.7/src/pycurl.o -L/usr/lib/x86_64-linux-gnu -L/usr/lib/x86_64-linux-gnu/mit-krb5 -lcurl -lidn -lrtmp -lnettle -lgnutls -lgssapi_krb5 -lkrb5 -lk5crypto -lcom_err -llber -llber -lldap -lz -o build/lib.linux-x86_64-2.7/pycurl.so /usr/lib/x86_64-linux-gnu/libcurl.a -Wl,-Bsymbolic-functions -fPIE -pie -Wl,-z,relro -Wl,-z,now -Wl,–as-needed -Wl,-Bsymbolic-functions -Wl,-z,relro
    /usr/bin/ld: cannot find -lrtmp
    collect2: error: ld returned 1 exit status
    error: command ‘x86_64-linux-gnu-gcc’ failed with exit status 1

To be able to install pycurl package you need libcurl and libcurl development headers installed on the system where you are installing that pack - http://pycurl.io/docs/latest/install.html

On a related note, as per pack TODO, it would indeed be good to port pack from pycurl to requests. requests should work out of the box.

Thanks All.

There was an issue with api password. Fixing it fixed the issue on icinga package. Now i see the events.

GitHub - twalk6/icinga2req: Stackstorm Requests Based Icinga2 Sensor

1 Like

Great to hear you got it working.

It would also be a good idea to contact the pack author and ask them to submit their pack to the StackStorm Exchange so it’s more easily discoverable - GitHub - StackStorm-Exchange/exchange-incubator: Submit your StackStorm integration and automation packs here.