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

Error: exception: Client id cannot be nil #12

Open
nordickiwi opened this issue Mar 28, 2017 · 5 comments
Open

Error: exception: Client id cannot be nil #12

nordickiwi opened this issue Mar 28, 2017 · 5 comments

Comments

@nordickiwi
Copy link

Multiple attempts return same error.

# check-azurerm-cores-d-usage.rb -t "my_data" -c "my_data" -S "my_data" -s "my_data" -l "SoutheastAsia" -w 80 -c 90
Error: exception: Client id cannot be nil
CheckAzureRMCoresDUsage CRITICAL

Using Id's from following this instruction - https://docs.bmc.com/docs/cloudlifecyclemanagement/46/setting-up-a-tenant-id-client-id-and-client-secret-for-azure-resource-manager-provisioning-669202145.html

Any help in sorting this is appreciated.

@majormoses
Copy link
Member

@tombuildsstuff any ideas?

@falmada
Copy link

falmada commented Jul 3, 2020

Just saw this, running into same issue, tried both with -c and -client_id as per documentation. This is for sensu-go.

type: CheckConfig
api_version: core/v2
metadata:
  name: check-azurerm-core-usage
  namespace: default
spec:
  command: check-azurerm-core-usage.rb
    - -tenant "edited"
    - -client_id "edited"
    - -client_secret "edited"
    - -subscription "edited"
    - -location "edited"
    - -warning_percentage 80
    - -critical_percentage 90
  interval: 30
  publish: true
  round_robin: true
  runtime_assets:
  - sensu-plugins-azurerm
  - sensu-ruby-runtime
  subscriptions:
  - proxy

Checked the code for check-azurerm-core-usage.rb and found below:

option :client_id,
         description: 'ARM Client ID. Either set ENV[\'ARM_CLIENT_ID\'] or provide it as an option',
         short: '-c ID',
         long: '--client ID',
         default: ENV['ARM_CLIENT_ID']

So in theory -c, -client_id or --client should work, but unfortunately none of them do.

Was anyone able to get this working?

Thanks!

@majormoses
Copy link
Member

Is there any more in the stacktrace? I don't have anything in azure to test with.

@falmada
Copy link

falmada commented Jul 4, 2020

Thanks for your response @majormoses!

Providing some output below

Quick script to get necessary values to run script

[root@agentvm ~]# ruby=$(find /var/cache/sensu/sensu-agent -name ruby | grep bin)
[root@agentvm ~]# script=$(find /var/cache/sensu/sensu-agent -name check-azurerm-core-usage.rb | grep bin | grep -v lib)
[root@agentvm ~]# rubypath=$(dirname "${ruby}")
[root@agentvm ~]# export PATH=$PATH:$rubypath
[root@agentvm ~]# scriptPath=$(dirname "${script}")
[root@agentvm ~]# cd $scriptPath

Verbose run

Would this be the right way to produce the stack trace?

ruby -d ${script} -tenant_id "redacted" -client_id "redacted" -client_secret "redacted" -subscription "redacted" -location "westus" -warning_percentage 80 -critical_percentage 90

Output

[root@agentvm bin]# ruby -d ${script} -tenant_id "redacted" -client_id "redacted" -client_secret "redacted" -subscription "redacted" -location "westus" -warning_percentage 80 -critical_percentage 90
Exception `LoadError' at /var/cache/sensu/sensu-agent/338b88b568a3213fa234640da2e037d1487fc3c639bc62340f2fb71eac8af9a90566cffc768d15035406ac5c049350006d73f3a07ae15f9528e1c6a9af2944cb/lib/ruby/2.4.0/rubygems.rb:1347 - cannot load such file -- rubygems/defaults/operating_system
Exception `LoadError' at /var/cache/sensu/sensu-agent/338b88b568a3213fa234640da2e037d1487fc3c639bc62340f2fb71eac8af9a90566cffc768d15035406ac5c049350006d73f3a07ae15f9528e1c6a9af2944cb/lib/ruby/2.4.0/rubygems.rb:1356 - cannot load such file -- rubygems/defaults/ruby
Using Ext extension for JSON.
/var/cache/sensu/sensu-agent/2bdedd65077d0e8df8f96c77b5ceae080b5a41a21462a97f2a9989fc00db4b2a8907c7b15484bb8c84cb3e2e569a2def30b1aa51202507c86640ae52200a6941/lib/ruby/2.4.0/gems/timeliness-0.4.4/lib/timeliness/definitions.rb:203: warning: method redefined; discarding old date_format_set
/var/cache/sensu/sensu-agent/2bdedd65077d0e8df8f96c77b5ceae080b5a41a21462a97f2a9989fc00db4b2a8907c7b15484bb8c84cb3e2e569a2def30b1aa51202507c86640ae52200a6941/lib/ruby/2.4.0/gems/timeliness-0.4.4/lib/timeliness/definitions.rb:209: warning: method redefined; discarding old datetime_format_set
Exception `SyntaxError' at /var/cache/sensu/sensu-agent/338b88b568a3213fa234640da2e037d1487fc3c639bc62340f2fb71eac8af9a90566cffc768d15035406ac5c049350006d73f3a07ae15f9528e1c6a9af2944cb/lib/ruby/2.4.0/forwardable/impl.rb:6 - <compiled>: syntax error, unexpected end-of-input
().default_timezone=
                    ^
Exception `SyntaxError' at /var/cache/sensu/sensu-agent/338b88b568a3213fa234640da2e037d1487fc3c639bc62340f2fb71eac8af9a90566cffc768d15035406ac5c049350006d73f3a07ae15f9528e1c6a9af2944cb/lib/ruby/2.4.0/forwardable/impl.rb:6 - <compiled>: syntax error, unexpected end-of-input
().date_for_time_type=
                      ^
Exception `SyntaxError' at /var/cache/sensu/sensu-agent/338b88b568a3213fa234640da2e037d1487fc3c639bc62340f2fb71eac8af9a90566cffc768d15035406ac5c049350006d73f3a07ae15f9528e1c6a9af2944cb/lib/ruby/2.4.0/forwardable/impl.rb:6 - <compiled>: syntax error, unexpected end-of-input
().ambiguous_date_format=
                         ^
Exception `SyntaxError' at /var/cache/sensu/sensu-agent/338b88b568a3213fa234640da2e037d1487fc3c639bc62340f2fb71eac8af9a90566cffc768d15035406ac5c049350006d73f3a07ae15f9528e1c6a9af2944cb/lib/ruby/2.4.0/forwardable/impl.rb:6 - <compiled>: syntax error, unexpected end-of-input
().ambiguous_year_threshold=
                            ^
/var/cache/sensu/sensu-agent/2bdedd65077d0e8df8f96c77b5ceae080b5a41a21462a97f2a9989fc00db4b2a8907c7b15484bb8c84cb3e2e569a2def30b1aa51202507c86640ae52200a6941/lib/ruby/2.4.0/gems/timeliness-0.4.4/lib/timeliness.rb:23: warning: method redefined; discarding old configuration
Exception `SyntaxError' at /var/cache/sensu/sensu-agent/338b88b568a3213fa234640da2e037d1487fc3c639bc62340f2fb71eac8af9a90566cffc768d15035406ac5c049350006d73f3a07ae15f9528e1c6a9af2944cb/lib/ruby/2.4.0/forwardable/impl.rb:6 - <compiled>: syntax error, unexpected end-of-input
().scheme=
          ^
Exception `SyntaxError' at /var/cache/sensu/sensu-agent/338b88b568a3213fa234640da2e037d1487fc3c639bc62340f2fb71eac8af9a90566cffc768d15035406ac5c049350006d73f3a07ae15f9528e1c6a9af2944cb/lib/ruby/2.4.0/forwardable/impl.rb:6 - <compiled>: syntax error, unexpected end-of-input
().host=
        ^
Exception `SyntaxError' at /var/cache/sensu/sensu-agent/338b88b568a3213fa234640da2e037d1487fc3c639bc62340f2fb71eac8af9a90566cffc768d15035406ac5c049350006d73f3a07ae15f9528e1c6a9af2944cb/lib/ruby/2.4.0/forwardable/impl.rb:6 - <compiled>: syntax error, unexpected end-of-input
().port=
        ^
Exception `SyntaxError' at /var/cache/sensu/sensu-agent/338b88b568a3213fa234640da2e037d1487fc3c639bc62340f2fb71eac8af9a90566cffc768d15035406ac5c049350006d73f3a07ae15f9528e1c6a9af2944cb/lib/ruby/2.4.0/forwardable/impl.rb:6 - <compiled>: syntax error, unexpected end-of-input
().path=
        ^
Exception `SyntaxError' at /var/cache/sensu/sensu-agent/338b88b568a3213fa234640da2e037d1487fc3c639bc62340f2fb71eac8af9a90566cffc768d15035406ac5c049350006d73f3a07ae15f9528e1c6a9af2944cb/lib/ruby/2.4.0/forwardable/impl.rb:6 - <compiled>: syntax error, unexpected end-of-input
().scheme=
          ^
Exception `SyntaxError' at /var/cache/sensu/sensu-agent/338b88b568a3213fa234640da2e037d1487fc3c639bc62340f2fb71eac8af9a90566cffc768d15035406ac5c049350006d73f3a07ae15f9528e1c6a9af2944cb/lib/ruby/2.4.0/forwardable/impl.rb:6 - <compiled>: syntax error, unexpected end-of-input
().host=
        ^
Exception `SyntaxError' at /var/cache/sensu/sensu-agent/338b88b568a3213fa234640da2e037d1487fc3c639bc62340f2fb71eac8af9a90566cffc768d15035406ac5c049350006d73f3a07ae15f9528e1c6a9af2944cb/lib/ruby/2.4.0/forwardable/impl.rb:6 - <compiled>: syntax error, unexpected end-of-input
().port=
        ^
Exception `LoadError' at /var/cache/sensu/sensu-agent/338b88b568a3213fa234640da2e037d1487fc3c639bc62340f2fb71eac8af9a90566cffc768d15035406ac5c049350006d73f3a07ae15f9528e1c6a9af2944cb/lib/ruby/2.4.0/rubygems/core_ext/kernel_require.rb:55 - cannot load such file -- concurrent/concurrent_ruby_ext
Exception `LoadError' at /var/cache/sensu/sensu-agent/338b88b568a3213fa234640da2e037d1487fc3c639bc62340f2fb71eac8af9a90566cffc768d15035406ac5c049350006d73f3a07ae15f9528e1c6a9af2944cb/lib/ruby/2.4.0/rubygems/core_ext/kernel_require.rb:135 - cannot load such file -- concurrent/concurrent_ruby_ext
Exception `LoadError' at /var/cache/sensu/sensu-agent/338b88b568a3213fa234640da2e037d1487fc3c639bc62340f2fb71eac8af9a90566cffc768d15035406ac5c049350006d73f3a07ae15f9528e1c6a9af2944cb/lib/ruby/2.4.0/rubygems/core_ext/kernel_require.rb:55 - cannot load such file -- concurrent/2.4/concurrent_ruby_ext
Exception `LoadError' at /var/cache/sensu/sensu-agent/338b88b568a3213fa234640da2e037d1487fc3c639bc62340f2fb71eac8af9a90566cffc768d15035406ac5c049350006d73f3a07ae15f9528e1c6a9af2944cb/lib/ruby/2.4.0/rubygems/core_ext/kernel_require.rb:135 - cannot load such file -- concurrent/2.4/concurrent_ruby_ext
/var/cache/sensu/sensu-agent/2bdedd65077d0e8df8f96c77b5ceae080b5a41a21462a97f2a9989fc00db4b2a8907c7b15484bb8c84cb3e2e569a2def30b1aa51202507c86640ae52200a6941/lib/ruby/2.4.0/gems/ms_rest-0.6.4/lib/ms_rest/http_operation_error.rb:66: warning: assigned but unused variable - ex
/var/cache/sensu/sensu-agent/2bdedd65077d0e8df8f96c77b5ceae080b5a41a21462a97f2a9989fc00db4b2a8907c7b15484bb8c84cb3e2e569a2def30b1aa51202507c86640ae52200a6941/lib/ruby/2.4.0/gems/ms_rest_azure-0.6.2/lib/ms_rest_azure/polling_state.rb:52: warning: mismatched indentations at 'end' with 'case' at 45
Exception `ArgumentError' at /var/cache/sensu/sensu-agent/2bdedd65077d0e8df8f96c77b5ceae080b5a41a21462a97f2a9989fc00db4b2a8907c7b15484bb8c84cb3e2e569a2def30b1aa51202507c86640ae52200a6941/lib/ruby/2.4.0/gems/ms_rest_azure-0.6.2/lib/ms_rest_azure/credentials/application_token_provider.rb:51 - Client id cannot be nil
Error: exception: Client id cannot be nil
/var/cache/sensu/sensu-agent/2bdedd65077d0e8df8f96c77b5ceae080b5a41a21462a97f2a9989fc00db4b2a8907c7b15484bb8c84cb3e2e569a2def30b1aa51202507c86640ae52200a6941/lib/ruby/2.4.0/gems/sensu-plugin-4.0.0/lib/sensu-plugin/check/cli.rb:23: warning: instance variable @message not initialized
/var/cache/sensu/sensu-agent/2bdedd65077d0e8df8f96c77b5ceae080b5a41a21462a97f2a9989fc00db4b2a8907c7b15484bb8c84cb3e2e569a2def30b1aa51202507c86640ae52200a6941/lib/ruby/2.4.0/gems/sensu-plugin-4.0.0/lib/sensu-plugin/check/cli.rb:14: warning: instance variable @check_name not initialized
CheckAzureRMCoreUsage CRITICAL
[root@agentvm bin]#

Same but without verbose

[root@agentvm bin]# ruby ${script} -tenant_id "redacted" -client_id "redacted" -client_secret "redacted" -subscription "redacted" -location "westus" -warning_percentage 80 -critical_percentage 90
Error: exception: Client id cannot be nil
CheckAzureRMCoreUsage CRITICAL
[root@agentvm bin]#

Test without -tenant_id

It's actually taking the parameters as it complains with another error when "tenant" is missing, so assuming that -client_id is failing due to something else, not because it's missing or wrong. The error is quite cryptic though.

[root@agentvm bin]# ruby ${script} -client_id "redacted" -client_secret "redacted" -subscription "redacted" -location "westus" -warning_percentage 80 -critical_percentage 90
Error: exception: Tenant id cannot be nil
CheckAzureRMCoreUsage CRITICAL
[root@agentvm bin]#

Is there any other way to debug/troubleshoot this?

Thanks!

@majormoses
Copy link
Member

majormoses commented Jul 18, 2020

Hmm can you try running this locally without the context of bonsai? It looks like it may possibly be an issue with how that is packaged.

Exception `LoadError' at /var/cache/sensu/sensu-agent/338b88b568a3213fa234640da2e037d1487fc3c639bc62340f2fb71eac8af9a90566cffc768d15035406ac5c049350006d73f3a07ae15f9528e1c6a9af2944cb/lib/ruby/2.4.0/rubygems.rb:1347 - cannot load such file -- rubygems/defaults/operating_system
Exception `LoadError' at /var/cache/sensu/sensu-agent/338b88b568a3213fa234640da2e037d1487fc3c639bc62340f2fb71eac8af9a90566cffc768d15035406ac5c049350006d73f3a07ae15f9528e1c6a9af2944cb/lib/ruby/2.4.0/rubygems.rb:1356 - cannot load such file -- rubygems/defaults/ruby

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

3 participants