Open TomaszUrugOlszewski opened 6 years ago
I ran into this today as well with check-rabbitmq-consumers.rb, same error (can't modify frozen String). I disabled the frozen_string_literal header and the heck was able to generate the appropriate output.
# frozen_string_literal: false
I'm seeing the same with check-rabbitmq-node-usage.rb. Full stack trace is:
["/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-1.4.5/lib/sensu-plugin/cli.rb:13:in
initialize'", "/opt/sensu/embedded/lib/ruby/gems/2.4.0/gems/sensu-plugin-1.4.5/lib/sensu-plugin/cli.rb:57:in new'", "/opt/sensu/embedded/lib/ruby/gems/2.4.0/gems/sensu-plugin-1.4.5/lib/sensu-plugin/cli.rb:57:in
block in '"]`
With both Sensu 1.2.1 and 1.3.1, and sensu-plugins-rabbitmq v4.1.1.
@kalemeow where did you disable that string?
@rtkmhart The header is set at the top of the check script itself, ie https://github.com/sensu-plugins/sensu-plugins-rabbitmq/blob/master/bin/check-rabbitmq-node-usage.rb#L2 . Set it to false to disable (and enable your check to alert properly).
For anyone stumbling upon this issue years later I was able to work around this issue by modifying the #frozen_string_literal
from true
to false
in this manor:
check-rabbitmq-node-usage.rb -u sensu -p sensu --type mem
is failing with the similar error. cd /opt/sensu
find . -name "*rabbitmq-node-usage*"
found two results:
./embedded/lib/ruby/gems/2.4.0/gems/sensu-plugins-rabbitmq-8.1.0/bin/check-rabbitmq-node-usage.rb
./embedded/bin/check-rabbitmq-node-usage.rb
looking at the file ./embedded/bin/check-rabbitmq-node-usage.rb
it does not contain the # frozen_string_literal: false
section
looking at the file ./embedded/lib/ruby/gems/2.4.0/gems/sensu-plugins-rabbitmq-8.1.0/bin/check-rabbitmq-node-usage.rb
it does have this.
Changed it from true
to false
, saved the file
Ran the check to confirm its working with the following command. In my case it was memory:
/opt/sensu/embedded/bin/check-rabbitmq-node-usage.rb -u sensu -p sensu --type mem
output:
CheckRabbitMQNodeUsage OK: Memory usage is at: 2.96%
Waited for the check to run via sensu and it worked:
This was just a test to see if the suggested workaround does work. In my case im running in docker so ill need a to create a new image if i want these changes to persist. 👍
Examples:
Correct servers:
One server is invalid:
Versions: