Sensu Core 1.5 - Influxdb2 extension error


#1

Issue:
I’m using sensu-extensions-influxdb2 with bare-metal configs.

Commands run:

  1. sudo /opt/sensu/embedded/bin/gem install sensu-extensions-influxdb2 -v 0.1.1
  2. sudo systemctl restart sensu-{server,api,client}

Conf Files in place:

cat extensions.json
{
“extensions”: {
“influxdb”: {
“gem”: “sensu-extensions-influxdb2”
},
“history”: {
“gem”: “sensu-extensions-history”
}
}
}

cat handlers.json
{
“handlers”: {
“metrics”: {
“type”: “set”,
“handlers”: [“influxdb_extension”]
}
}
}

Using sensu 1.5/centos 7

Observation:
On sensu -server restart - I’m seeing the below error:

{“timestamp”:“2018-12-01T09:09:29.157630+0000”,“level”:“warn”,“message”:“loading config file”,“file”:"/etc/sensu/config.json"}
{“timestamp”:“2018-12-01T09:09:29.157833+0000”,“level”:“warn”,“message”:“loading config files from directory”,“directory”:"/etc/sensu/conf.d"}
{“timestamp”:“2018-12-01T09:09:29.157894+0000”,“level”:“warn”,“message”:“loading config file”,“file”:"/etc/sensu/conf.d/handlers.json"}
{“timestamp”:“2018-12-01T09:09:29.157965+0000”,“level”:“warn”,“message”:“config file applied changes”,“file”:"/etc/sensu/conf.d/handlers.json",“changes”:{“handlers”:{“metrics”:[null,{“type”:“set”,“handlers”:[“influxdb_extension”]}]}}}
{“timestamp”:“2018-12-01T09:09:29.158029+0000”,“level”:“warn”,“message”:“loading config file”,“file”:"/etc/sensu/conf.d/client.json"}
{“timestamp”:“2018-12-01T09:09:29.158134+0000”,“level”:“warn”,“message”:“config file applied changes”,“file”:"/etc/sensu/conf.d/client.json",“changes”:{“client”:{“name”:[null,“mue1monitoringsensupocsim00”],“address”:[null,“10.82.130.54”],“subscriptions”:[null,[“linux”,“Sensu”]],“tags”:[null,{“host”:“mue1monitoringsensupocsim00”}]}}}
{“timestamp”:“2018-12-01T09:09:29.158194+0000”,“level”:“warn”,“message”:“loading config file”,“file”:"/etc/sensu/conf.d/checks.json"}
{“timestamp”:“2018-12-01T09:09:29.158306+0000”,“level”:“warn”,“message”:“config file applied changes”,“file”:"/etc/sensu/conf.d/checks.json",“changes”:{“checks”:{“metrics-load”:[null,{“command”:"/opt/sensu/embedded/bin/metrics-load.rb --scheme cpu_load",“handler”:“metrics”,“interval”:10,“subscribers”:[“linux”],“type”:“metric”}],“metrics-disk”:[null,{“command”:"/opt/sensu/embedded/bin/metrics-disk.rb --scheme disk_metrics",“handler”:“metrics”,“interval”:10,“subscribers”:[“linux”],“type”:“metric”}],“metrics-iostat”:[null,{“command”:"/opt/sensu/embedded/bin/metrics-iostat-extended.rb --scheme iostat",“handler”:“metrics”,“interval”:10,“subscribers”:[“linux”],“type”:“metric”}],“metrics-disk-usage”:[null,{“command”:"/opt/sensu/embedded/bin/metrics-disk-usage.rb --scheme disk_usage",“handler”:“metrics”,“interval”:10,“subscribers”:[“linux”],“type”:“metric”}],“metrics-memory-percentage”:[null,{“command”:"/opt/sensu/embedded/bin/metrics-memory-percent.rb --scheme memory_percent",“handler”:“metrics”,“interval”:10,“subscribers”:[“linux”],“type”:“metric”}],“metrics-uptime”:[null,{“command”:"/opt/sensu/embedded/bin/metrics-uptime.rb --scheme uptime",“handler”:“metrics”,“interval”:10,“subscribers”:[“linux”],“type”:“metric”}],“metrics-cpu”:[null,{“command”:"/opt/sensu/embedded/bin/metrics-cpu.rb --scheme cpu",“handler”:“metrics”,“interval”:10,“subscribers”:[“linux”],“type”:“metric”}],“metrics-tcp”:[null,{“command”:"/opt/sensu/embedded/bin/metrics-netstat-tcp.rb --scheme tcp",“handler”:“metrics”,“interval”:10,“subscribers”:[“linux”],“type”:“metric”}],“metrics-ping”:[null,{“command”:"/opt/sensu/embedded/bin/metrics-ping.rb --scheme ping",“handler”:“metrics”,“interval”:10,“subscribers”:[“linux”],“type”:“metric”}],“metrics-interface”:[null,{“command”:"/opt/sensu/embedded/bin/metrics-interface.rb --scheme interface",“handler”:“metrics”,“interval”:10,“subscribers”:[“linux”],“type”:“metric”}],“metrics-threads”:[null,{“command”:"/opt/sensu/embedded/bin/metrics-processes-threads-count.rb --scheme threads",“handler”:“metrics”,“interval”:10,“subscribers”:[“linux”],“type”:“metric”}]}}}
{“timestamp”:“2018-12-01T09:09:29.158456+0000”,“level”:“warn”,“message”:“loading config file”,“file”:"/etc/sensu/conf.d/rabbitmq.json"}
{“timestamp”:“2018-12-01T09:09:29.158511+0000”,“level”:“warn”,“message”:“config file applied changes”,“file”:"/etc/sensu/conf.d/rabbitmq.json",“changes”:{“rabbitmq”:{“heartbeat”:[null,30],“prefetch”:[null,50],“reconnect_on_error”:[null,true],“auto_reconnect”:[null,true]}}}
{“timestamp”:“2018-12-01T09:09:29.158556+0000”,“level”:“warn”,“message”:“loading config file”,“file”:"/etc/sensu/conf.d/transport.json"}
{“timestamp”:“2018-12-01T09:09:29.158601+0000”,“level”:“warn”,“message”:“config file applied changes”,“file”:"/etc/sensu/conf.d/transport.json",“changes”:{“rabbitmq”:{“host”:[“127.0.0.1”,“10.82.130.54”]}}}
{“timestamp”:“2018-12-01T09:09:29.158644+0000”,“level”:“warn”,“message”:“loading config file”,“file”:"/etc/sensu/conf.d/influxdb_extension.json"}
{“timestamp”:“2018-12-01T09:09:29.158691+0000”,“level”:“warn”,“message”:“config file applied changes”,“file”:"/etc/sensu/conf.d/influxdb_extension.json",“changes”:{“influxdb_extension”:[null,{“database”:“sensudatabase”,“host”:“10.82.130.54”,“port”:“8086”,“username”:“influxdbadmin”,“password”:“REDACTED”}]}}
{“timestamp”:“2018-12-01T09:09:29.158777+0000”,“level”:“warn”,“message”:“loading config file”,“file”:"/etc/sensu/conf.d/extensions.json"}
{“timestamp”:“2018-12-01T09:09:29.158845+0000”,“level”:“warn”,“message”:“config file applied changes”,“file”:"/etc/sensu/conf.d/extensions.json",“changes”:{“extensions”:{“influxdb”:[null,{“gem”:“sensu-extensions-influxdb2”}],“history”:[null,{“gem”:“sensu-extensions-history”}]}}}
{“timestamp”:“2018-12-01T09:09:29.194772+0000”,“level”:“warn”,“message”:“loading extension files from directory”,“directory”:"/etc/sensu/extensions"}
{“timestamp”:“2018-12-01T09:09:29.194858+0000”,“level”:“warn”,“message”:“loading extension gem”,“gem”:“sensu-extensions-influxdb2”,“version”:null}
{“timestamp”:“2018-12-01T09:09:29.194917+0000”,“level”:“warn”,“message”:“requiring extension gem”,“require”:“sensu/extensions/influxdb2”}
{“timestamp”:“2018-12-01T09:09:29.194973+0000”,“level”:“warn”,“message”:“failed to require extension”,“gem”:“sensu-extensions-influxdb2”,“version”:null,“error”:{“path”:“sensu/extensions/influxdb2”,"~bt_locations":"#Thread::Backtrace:0x000000000158ecf0","~mesg":“cannot load such file – sensu/extensions/influxdb2”,"~bt":["/opt/sensu/embedded/lib/ruby/site_ruby/2.4.0/rubygems/core_ext/kernel_require.rb:55:in require'","/opt/sensu/embedded/lib/ruby/site_ruby/2.4.0/rubygems/core_ext/kernel_require.rb:55:inrequire’","/opt/sensu/embedded/lib/ruby/gems/2.4.0/gems/sensu-extensions-1.10.0/lib/sensu/extensions/loader.rb:117:in load_gem'","/opt/sensu/embedded/lib/ruby/gems/2.4.0/gems/sensu-extensions-1.10.0/lib/sensu/extensions.rb:30:inblock in load’","/opt/sensu/embedded/lib/ruby/gems/2.4.0/gems/sensu-extensions-1.10.0/lib/sensu/extensions.rb:28:in each'","/opt/sensu/embedded/lib/ruby/gems/2.4.0/gems/sensu-extensions-1.10.0/lib/sensu/extensions.rb:28:inload’","/opt/sensu/embedded/lib/ruby/gems/2.4.0/gems/sensu-extensions-1.10.0/lib/sensu/extensions.rb:44:in get'","/opt/sensu/embedded/lib/ruby/gems/2.4.0/gems/sensu-1.5.0/lib/sensu/daemon.rb:158:inload_extensions’","/opt/sensu/embedded/lib/ruby/gems/2.4.0/gems/sensu-1.5.0/lib/sensu/daemon.rb:58:in initialize'","/opt/sensu/embedded/lib/ruby/gems/2.4.0/gems/sensu-1.5.0/lib/sensu/server/process.rb:45:ininitialize’","/opt/sensu/embedded/lib/ruby/gems/2.4.0/gems/sensu-1.5.0/lib/sensu/server/process.rb:33:in new'","/opt/sensu/embedded/lib/ruby/gems/2.4.0/gems/sensu-1.5.0/lib/sensu/server/process.rb:33:inrun’","/opt/sensu/embedded/lib/ruby/gems/2.4.0/gems/sensu-1.5.0/exe/sensu-server:10:in <top (required)>'","/opt/sensu/bin/sensu-server:22:inload’","/opt/sensu/bin/sensu-server:22:in <main>'"]}} {"timestamp":"2018-12-01T09:09:29.195367+0000","level":"warn","message":"ignoring extension","gem":"sensu-extensions-influxdb2"} {"timestamp":"2018-12-01T09:09:29.195433+0000","level":"warn","message":"loading extension gem","gem":"sensu-extensions-history","version":null} {"timestamp":"2018-12-01T09:09:29.195491+0000","level":"warn","message":"requiring extension gem","require":"sensu/extensions/history"} {"timestamp":"2018-12-01T09:09:29.195530+0000","level":"warn","message":"loaded extension","type":"bridge","name":"history","description":"Sends check result data to influxdb"} {"timestamp":"2018-12-01T09:09:29.195570+0000","level":"warn","message":"loaded extension","type":"filter","name":"occurrences","description":"filter events using event occurrences"} {"timestamp":"2018-12-01T09:09:29.195609+0000","level":"warn","message":"loaded extension","type":"filter","name":"check_dependencies","description":"filter events when an event exists for a check dependency"} {"timestamp":"2018-12-01T09:09:29.195649+0000","level":"warn","message":"loaded extension","type":"mutator","name":"only_check_output","description":"returns check output"} {"timestamp":"2018-12-01T09:09:29.195688+0000","level":"warn","message":"loaded extension","type":"mutator","name":"ruby_hash","description":"returns ruby hash event data"} {"timestamp":"2018-12-01T09:09:29.195774+0000","level":"warn","message":"loaded extension","type":"mutator","name":"json","description":"returns JSON formatted event data"} {"timestamp":"2018-12-01T09:09:29.195831+0000","level":"warn","message":"loaded extension","type":"handler","name":"debug","description":"returns raw event data"} {"timestamp":"2018-12-01T09:09:29.195910+0000","level":"info","message":"configuring sensu spawn","settings":{"limit":12}} {"timestamp":"2018-12-01T09:09:29.251505+0000","level":"error","message":"Failed to parse History settings undefined method’ for nil:NilClass"}
/opt/sensu/embedded/lib/ruby/gems/2.4.0/gems/sensu-extensions-influxdb2-0.1.1/lib/sensu/extensions/history.rb:63:in stop': undefined methodflush_buffer’ for nil:NilClass (NoMethodError)
from /opt/sensu/embedded/lib/ruby/gems/2.4.0/gems/sensu-extension-1.5.2/lib/sensu/extension.rb:22:in block in initialize' from /opt/sensu/embedded/lib/ruby/gems/2.4.0/gems/eventmachine-1.2.5/lib/eventmachine.rb:199:inensure in run’
from /opt/sensu/embedded/lib/ruby/gems/2.4.0/gems/eventmachine-1.2.5/lib/eventmachine.rb:205:in run' from /opt/sensu/embedded/lib/ruby/gems/2.4.0/gems/sensu-1.5.0/lib/sensu/server/process.rb:34:inrun’
from /opt/sensu/embedded/lib/ruby/gems/2.4.0/gems/sensu-1.5.0/exe/sensu-server:10:in <top (required)>' from /opt/sensu/bin/sensu-server:22:inload’
from /opt/sensu/bin/sensu-server:22:in `’

  1. I did play around installing and uninstalling sensu-extensions-influxdb2 and sensu-extensions-influxdb. I completely uninstalled both gems and installed the sensu-extensions-influxdb2 gem.

What am I doing wrong?


#2

Cameron in slack helped figure this one out with with you. The config should look like this:

{
  "influxdb_extension": {
    "database": "sensudatabase",
    "host": "10.82.130.54",
    "port": "8086",
    "username": "---------",
    "password": "----------"
  }
}

I included the actual content because we do not pay for slack for the community so the links wont last forever but here it is anyways: https://sensucommunity.slack.com/archives/C68LV5M9U/p1543689019023400