sensu-plugins / sensu-plugins-mysql

This plugin provides native MySQL instrumentation for monitoring and metrics collection, including: service health, database connectivity, `InnoDB` locks, replication status, metrics collection, and sending metrics to a MySQL database.
http://sensu-plugins.io
MIT License
18 stars 62 forks source link

Check failed to run: undefined method `[]' for nil:NilClass #132

Open pandaatrail opened 3 years ago

pandaatrail commented 3 years ago

Presentation

Launching an agent to check for mysql health, I get an error I don't know how to solve.

The context

I use Docker images with ruby shared runtime. According to sensuctl asset list, the check I've created is:

---
type: CheckConfig
api_version: core/v2
metadata:
  created_by: global
  name: mysql_is_alive
  namespace: prod
spec:
  check_hooks: null
  command: check-mysql-alive.rb --ini /checks/my.cnf --ini-section=prod
  env_vars: null
  handlers: []
  high_flap_threshold: 0
  interval: 30
  low_flap_threshold: 0
  output_metric_format: ""
  output_metric_handlers: null
  proxy_entity_name: ""
  publish: true
  round_robin: false
  runtime_assets:
  - sensu-ruby
  - sensu-mysql
  secrets: null
  stdin: false
  subdue: null
  subscriptions:
  - mysql
  timeout: 20
  ttl: 0

The /checks/my.cnf directory is on the host, and shared through a volume into a Docker service.

The error

Here is the output I get from the agent executing the check:

Check failed to run: undefined method `[]' for nil:NilClass, ["/var/lib/sensu/2a68686cce9a58fffd7e384ede7538621a77d5930bba05c3296eb2a3b5f87d7caf20d0405099b2f9c81a5d86da7384b888e387dd84661b52ef23dc56e35431d8/lib/ruby/2.4.0/bundler/gems/sensu-plugins-mysql-a20e9500620b/bin/check-mysql-alive.rb:86:in `run'", "/var/lib/sensu/2a68686cce9a58fffd7e384ede7538621a77d5930bba05c3296eb2a3b5f87d7caf20d0405099b2f9c81a5d86da7384b888e387dd84661b52ef23dc56e35431d8/lib/ruby/2.4.0/gems/sensu-plugin-4.0.0/lib/sensu-plugin/cli.rb:59:in `block in <class:CLI>'"]
pandaatrail commented 3 years ago

Up ?