sensu-plugins / sensu-plugins-jolokia

This plugin provides instrumentation for monitoring Java [Jboss/Wildfly], including: memory percentage and application deployment status via jolokia.
http://sensu-plugins.io
MIT License
0 stars 2 forks source link

enable ssl connection options #3

Open codepattern opened 6 years ago

codepattern commented 6 years ago

Hello, thanks for delivering this plugin. I was wondering if there's an option to add the SSL or possibly, more importantly, enabling insecure connections like the check-http.rb.

option :insecure, short: '-k', boolean: true, description: 'Enabling insecure connections', default: false

Currently, the following error is received when trying to connect locally to a ssl port

Command: /opt/sensu/embedded/bin/check-jvm-thread-count-pcnt.rb -w 80 -c 90 -u https://localhost:8090/plugins/servlet/jolokia/list

Result: CheckJvmThreadCountPcnt UNKNOWN: hostname "127.0.0.1" does not match the server certificate

majormoses commented 6 years ago

Taking a look there is no exposed option in the check. I did a quick scan of the upstream library and while it does not expose it directly it uses faraday under the hood so it should be relatively easy to implement upstream and then add here: https://github.com/towerhe/jolokia/blob/484868f75e6da906fe5cc9c23c6f5bb28fd9af04/lib/jolokia/client.rb#L63-L72. Here is the upstream faraday code: https://github.com/lostisland/faraday/blob/v0.13.1/lib/faraday/options.rb#L216-L226