sensu-plugins / sensu-plugins-sensu

This plugin provides monitoring and metrics for Sensu.
http://sensu-plugins.io
MIT License
12 stars 35 forks source link

check-stale-results.rb errors out when parsing results #41

Open asachs01 opened 6 years ago

asachs01 commented 6 years ago

We've recently encountered an error when running a check using check-stale-results.rb. It appears as the following:

{"timestamp":"2017-09-21T11:23:49.169000-0500","level":"info","message":"handler extension output","extension":{"type":"extension","name":"debug"},"event":{"id":"1475d37d-eaa2-483c-8629-a72f212e162a"},"output":"{\"client\":{\"name\":\"khalkotauroi.local\",\"address\":\"192.168.156.237\",\"environment\":\"production\",\"subscriptions\":[\"production\",\"client:khalkotauroi.local\"],\"version\":\"1.0.2\",\"timestamp\":1506011026},\"check\":{\"command\":\"/opt/sensu/embedded/bin/check-stale-results.rb -s 3d -c 5 -w 1\",\"subscribers\":[\"production\"],\"interval\":10,\"name\":\"results\",\"issued\":1506011028,\"executed\":1506011028,\"duration\":0.159,\"output\":\"Check failed to run: wrong number of arguments (given 2, expected 3), [\\\"/opt/sensu/embedded/lib/ruby/gems/2.4.0/gems/sensu-plugins-sensu-2.2.0/bin/check-stale-results.rb:63:in `api_request'\\\", \\\"/opt/sensu/embedded/lib/ruby/gems/2.4.0/gems/sensu-plugins-sensu-2.2.0/bin/check-stale-results.rb:78:in `results'\\\", \\\"/opt/sensu/embedded/lib/ruby/gems/2.4.0/gems/sensu-plugins-sensu-2.2.0/bin/check-stale-results.rb:51: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 <class:CLI>'\\\"]\\n\",\"status\":2,\"type\":\"standard\",\"history\":[\"2\",\"2\",\"2\",\"2\",\"2\"],\"total_state_change\":0},\"occurrences\":5,\"occurrences_watermark\":5,\"action\":\"create\",\"timestamp\":1506011029,\"id\":\"1475d37d-eaa2-483c-8629-a72f212e162a\",\"last_state_change\":1506010619,\"last_ok\":1506010619,\"silenced\":false,\"silenced_by\":[]}","status":0}

Something that's perhaps a bit more readable:

$/opt/sensu/embedded/bin/ruby check-stale-results.rb -c 5 -w 1 -s 
Check failed to run: wrong number of arguments (given 2, expected 3), ["/opt/sensu/embedded/lib/ruby/gems/2.4.0/gems/sensu-plugins-sensu-2.2.0/bin/check-stale-results.rb:63:in 
`api_request'", "/opt/sensu/embedded/lib/ruby/gems/2.4.0/gems/sensu-plugins-sensu-2.2.0/bin/check-stale-results.rb:78:in `results'", "/opt/sensu/embedded/lib/ruby/gems/2.4.0/ge
ms/sensu-plugins-sensu-2.2.0/bin/check-stale-results.rb:51: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 <class:CLI>'"]

I'd include some expected output here, but since we're not able to run the check successfully, we don't have any to provide.

majormoses commented 6 years ago

Thanks for reporting this, there were some recent bug fixes that we merged and released. I am not sure if this problem is the same. Could you try updating to the most recent version of this gem and retest?

majormoses commented 6 years ago

Did you delete some issue comments? My email shows that you did some more triage but I am not seeing it on github. Should I repost it or investigate what I see in the email?

robertlabrie commented 6 years ago

@majormoses yes, I did, and I should have mentioned it, sorry. My problem turned out to not be related to Sensu at all, and I didn't want it cluttering up the thread. My apologies.

majormoses commented 6 years ago

No worries I will ignore them. Can you please try testing with the latest released version before trying to triage a possibly fixed issue?