sensu-plugins / sensu-plugins-haproxy

This plugin provides native HAProxy instrumentation for monitoring and metrics collection, including: service health and backend server metrics.
http://sensu-plugins.io
MIT License
11 stars 37 forks source link

2.0.1 checks doesn't work properly with '# frozen_string_literal: true' #47

Closed jindraj closed 4 years ago

jindraj commented 4 years ago

both check-haproxy.rb and metrics-haproxy.rb doesn't work properly with # frozen_string_literal: true

sensu-plugins-haproxy: 2.0.1 sensu-version: 1.0.2-1~xenial ruby: embedded

/opt/sensu/embedded/bin/check-haproxy.rb -S /tmp/haproxy.sock -c 100 -b 75 -B 90 -X1 -s '^.*_noop$'
Check failed to run: can't modify frozen String, ["/opt/sensu/embedded/lib/ruby/gems/2.4.0/gems/mixlib-cli-1.7.0/lib/mixlib/cli.rb:315:in `build_option_arguments'", "/opt/sensu/embedded/lib/ruby/gems/2.4.0/gems/mixlib-cli-1.7.0/lib/mixlib/cli.rb:269:in `block (2 levels) in opt_parser'", "/opt/sensu/embedded/lib/ruby/gems/2.4.0/gems/mixlib-cli-1.7.0/lib/mixlib/cli.rb:268:in `each'", "/opt/sensu/embedded/lib/ruby/gems/2.4.0/gems/mixlib-cli-1.7.0/lib/mixlib/cli.rb:268:in `block in opt_parser'", "/opt/sensu/embedded/lib/ruby/2.4.0/optparse.rb:1062:in `initialize'", "/opt/sensu/embedded/lib/ruby/gems/2.4.0/gems/mixlib-cli-1.7.0/lib/mixlib/cli.rb:263:in `new'", "/opt/sensu/embedded/lib/ruby/gems/2.4.0/gems/mixlib-cli-1.7.0/lib/mixlib/cli.rb:263:in `opt_parser'", "/opt/sensu/embedded/lib/ruby/gems/2.4.0/gems/mixlib-cli-1.7.0/lib/mixlib/cli.rb:230:in `parse_options'", "/opt/sensu/embedded/lib/ruby/gems/2.4.0/gems/sensu-plugin-4.0.0/lib/sensu-plugin/cli.rb:16:in `initialize'", "/opt/sensu/embedded/lib/ruby/gems/2.4.0/gems/sensu-plugin-4.0.0/lib/sensu-plugin/cli.rb:58:in `new'", "/opt/sensu/embedded/lib/ruby/gems/2.4.0/gems/sensu-plugin-4.0.0/lib/sensu-plugin/cli.rb:58:in `block in <class:CLI>'"]

It works fine after changing true to false. Is there any other way how to run the checks other then editing check files?

LarsErikP commented 4 years ago

I am seing this as well..

jspaleta commented 4 years ago

2.0.2 is now released with a fix. Please re-open if you are still having problems using the checks.