Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cluster Health - Can't modify frozen String #86

Open
TomaszUrugOlszewski opened this issue Apr 10, 2018 · 4 comments
Open

Cluster Health - Can't modify frozen String #86

TomaszUrugOlszewski opened this issue Apr 10, 2018 · 4 comments

Comments

@TomaszUrugOlszewski
Copy link

Examples:

Correct servers:

/opt/sensu/embedded/bin/check-rabbitmq-cluster-health.rb -w 10.0.0.6 -u monitoring -p pass -n rabbit1,rabbit2,rabbit3
CheckRabbitMQCluster OK: 3 healthy cluster nodes

One server is invalid:

/opt/sensu/embedded/bin/check-rabbitmq-cluster-health.rb -w 10.0.0.6 -u monitoring -p pass -n rabbit1,rabbit2,incorrect
CheckRabbitMQCluster UNKNOWN: can't modify frozen String

Versions:

  • Sensu 1.2.1
  • sensu-plugins-rabbitmq-4.1.0
@kalemeow
Copy link

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

@rtkmhart
Copy link

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?

@kalemeow
Copy link

@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).

@matthewmedway
Copy link

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:

  1. Notice in my sensu console that the command being run is check-rabbitmq-node-usage.rb -u sensu -p sensu --type mem is failing with the similar error.

image

  1. Try to find the check-rabbitmq-node-usage.rb file to be modified from the command field of my 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
  1. Examine found files.

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.

  1. Change the frozen_string_literal value

Changed it from true to false, saved the file

  1. Manually verify its working

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%
  1. Verify within sensu

Waited for the check to run via sensu and it worked:
image

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. 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants