sensu / sandbox

The place to get started for new Sensu users
MIT License
21 stars 13 forks source link

Lesson 3 gem not found #38

Closed tmonk42 closed 5 years ago

tmonk42 commented 5 years ago

Working through the tutorial here: https://github.com/sensu/sandbox/tree/master/sensu-go/core

[sensu_go_sandbox]$ sensuctl version sensuctl version 5.0.1#af7d1d0, build af7d1d041092c130653cc8e2ca4b8aef479cb05a, built '2018-12-11T21:25:30+0000'

On Lesson 3, step 2 when I run the command by hand, it appears to work correctly: [sensu_go_sandbox]$ /opt/sensu-plugins-ruby/embedded/bin/metrics-curl.rb -u "http://localhost" sensu-go-sandbox.curl_timings.time_total 0.005 1545160704 sensu-go-sandbox.curl_timings.time_namelookup 0.004 1545160704 sensu-go-sandbox.curl_timings.time_connect 0.004 1545160704 sensu-go-sandbox.curl_timings.time_pretransfer 0.004 1545160704 sensu-go-sandbox.curl_timings.time_redirect 0.000 1545160704 sensu-go-sandbox.curl_timings.time_starttransfer 0.005 1545160704 sensu-go-sandbox.curl_timings.http_code 200 1545160704

Lesson 3, step 3 however is showing a gem error:

"output": "/opt/sensu-plugins-ruby/embedded/lib/ruby/site_ruby/2.4.0/rubygems.rb:270:infind_spec_for_exe': can't find gem sensu-plugins-http (>= 0.a) (Gem::GemNotFoundException)\n\tfrom /opt/sensu-plugins-ruby/embedded/lib/ruby/site_ruby/2.4.0/rubygems.rb:298:in activate_bin_path'\n\tfrom /opt/sensu-plugins-ruby/embedded/bin/metrics-curl.rb:22:in

'\n",`

More complete output follows: [sensu_go_sandbox]$ sensuctl check list Name Command Interval Cron Timeout TTL Subscriptions Handlers Assets Hooks Publish? Stdin? Metric Format Metric Handlers ────────────── ──────────────────────────────────────────────────────────────────────────── ────────── ────── ───────── ───── ───────────────────────── ────────── ──────── ─────── ────────── ──────── ──────────────────── ───────────────── curl_timings /opt/sensu-plugins-ruby/embedded/bin/metrics-curl.rb -u "http://localhost" 10 0 0 entity:sensu-go-sandbox true false graphite_plaintext influx-db [sensu_go_sandbox]$ sensuctl event info sensu-go-sandbox curl_timings --format json | jq . { "timestamp": 1545160787, "entity": { "entity_class": "agent", "system": { "hostname": "sensu-go-sandbox", "os": "linux", "platform": "centos", "platform_family": "rhel", "platform_version": "7.5.1804", "network": { "interfaces": [ { "name": "lo", "addresses": [ "127.0.0.1/8", "::1/128" ] }, { "name": "eth0", "mac": "08:00:27:8b:c9:3f", "addresses": [ "10.0.2.15/24", "fe80::ba78:f7f9:4f10:2caf/64" ] } ] }, "arch": "amd64" }, "subscriptions": [ "entity:sensu-go-sandbox" ], "last_seen": 1545159490, "deregister": false, "deregistration": {}, "user": "agent", "redact": [ "password", "passwd", "pass", "api_key", "api_token", "access_key", "secret_key", "private_key", "secret" ], "metadata": { "name": "sensu-go-sandbox", "namespace": "default" } }, "check": { "command": "/opt/sensu-plugins-ruby/embedded/bin/metrics-curl.rb -u \"http://localhost\"", "handlers": [], "high_flap_threshold": 0, "interval": 10, "low_flap_threshold": 0, "publish": true, "runtime_assets": [], "subscriptions": [ "entity:sensu-go-sandbox" ], "proxy_entity_name": "", "check_hooks": null, "stdin": false, "subdue": null, "ttl": 0, "timeout": 0, "round_robin": false, "duration": 0.043199088, "executed": 1545160787, "history": [ { "status": 1, "executed": 1545160587 }, { "status": 1, "executed": 1545160597 }, { "status": 1, "executed": 1545160607 }, { "status": 1, "executed": 1545160617 }, { "status": 1, "executed": 1545160627 }, { "status": 1, "executed": 1545160637 }, { "status": 1, "executed": 1545160647 }, { "status": 1, "executed": 1545160657 }, { "status": 1, "executed": 1545160667 }, { "status": 1, "executed": 1545160677 }, { "status": 1, "executed": 1545160687 }, { "status": 1, "executed": 1545160697 }, { "status": 1, "executed": 1545160707 }, { "status": 1, "executed": 1545160717 }, { "status": 1, "executed": 1545160727 }, { "status": 1, "executed": 1545160737 }, { "status": 1, "executed": 1545160747 }, { "status": 1, "executed": 1545160757 }, { "status": 1, "executed": 1545160767 }, { "status": 1, "executed": 1545160777 }, { "status": 1, "executed": 1545160787 } ], "issued": 1545160787, "output": "/opt/sensu-plugins-ruby/embedded/lib/ruby/site_ruby/2.4.0/rubygems.rb:270:infind_spec_for_exe': can't find gem sensu-plugins-http (>= 0.a) (Gem::GemNotFoundException)\n\tfrom /opt/sensu-plugins-ruby/embedded/lib/ruby/site_ruby/2.4.0/rubygems.rb:298:in activate_bin_path'\n\tfrom /opt/sensu-plugins-ruby/embedded/bin/metrics-curl.rb:22:in

'\n", "state": "failing", "status": 1, "total_state_change": 0, "last_ok": 0, "occurrences": 53, "occurrences_watermark": 53, "output_metric_format": "graphite_plaintext", "output_metric_handlers": [ "influx-db" ], "env_vars": null, "metadata": { "name": "curl_timings", "namespace": "default" } }, "metrics": { "handlers": [ "influx-db" ], "points": null }, "metadata": { "namespace": "default" } }`

rgeniesse commented 5 years ago

I was able to reproduce this issue as well:

"/opt/sensu-plugins-ruby/embedded/lib/ruby/site_ruby/2.4.0/rubygems.rb:270:in `find_spec_for_exe': can't find gem sensu-plugins-http (>= 0.a) (Gem::GemNotFoundException)\n\tfrom /opt/sensu-plugins-ruby/embedded/lib/ruby/site_ruby/2.4.0/rubygems.rb:298:in `activate_bin_path'\n\tfrom /opt/sensu-plugins-ruby/embedded/bin/metrics-curl.rb:22:in `<main>'\n",

Running the command as the Sensu user works too:

sudo -u sensu /opt/sensu-plugins-ruby/embedded/bin/metrics-curl.rb
sensu-go-sandbox.curl_timings.time_total 0.001 1545162358
sensu-go-sandbox.curl_timings.time_namelookup 0.000 1545162358
sensu-go-sandbox.curl_timings.time_connect 0.001 1545162358
sensu-go-sandbox.curl_timings.time_pretransfer 0.001 1545162358
sensu-go-sandbox.curl_timings.time_redirect 0.000 1545162358
sensu-go-sandbox.curl_timings.time_starttransfer 0.001 1545162358
sensu-go-sandbox.curl_timings.http_code 200 1545162358
jspaleta commented 5 years ago

thanks for the report.

Can you provide me the version of sensu-agent that is installed in the sandbox rpm -qa |grep sensu

jspaleta commented 5 years ago

I just commited a change that should help.

Can you retest against latest master branch and confirm that its working?

tmonk42 commented 5 years ago

[sensu_go_sandbox]$ rpm -qa | grep sensu sensu-go-backend-5.0.1-1.x86_64 sensu-plugins-ruby-0.2.0-1.el7.x86_64 sensu-go-cli-5.0.1-1.x86_64 sensu-go-agent-5.0.1-1.x86_64

tmonk42 commented 5 years ago

Updated against master, works now!