mocdaniel / dashing-icinga2

Dashing dashboard for Icinga 2 using the REST API
MIT License
204 stars 47 forks source link

Not working (stale information, information does not updated) after icinga2 update to version 2.11 #83

Closed MarkYSA closed 5 years ago

MarkYSA commented 5 years ago

Hi.

In log I see the following:

scheduler caught exception: undefined method first' for nil:NilClass /usr/share/dashing-icinga2/lib/icinga2.rb:603:infetchVersion' /usr/share/dashing-icinga2/lib/icinga2.rb:665:in run' /usr/share/dashing-icinga2/jobs/icinga2.rb:27:inblock in <top (required)>' /usr/local/share/gems/gems/rufus-scheduler-2.0.24/lib/rufus/sc/jobs.rb:230:in call' /usr/local/share/gems/gems/rufus-scheduler-2.0.24/lib/rufus/sc/jobs.rb:230:intrigger_block' /usr/local/share/gems/gems/rufus-scheduler-2.0.24/lib/rufus/sc/jobs.rb:204:in block in trigger' /usr/local/share/gems/gems/rufus-scheduler-2.0.24/lib/rufus/sc/scheduler.rb:430:incall' /usr/local/share/gems/gems/rufus-scheduler-2.0.24/lib/rufus/sc/scheduler.rb:430:in `block in trigger_job'

Your Environment

xElesde commented 5 years ago

Hi

I seem to have the exact same Issue with my installation, updated icinga2 to 2.11 and now the dashing can't be started. Interestingly it starts on my system when I manually start it in foreground with environment variables. ICINGA2_API_HOST=localhost ICINGA2_API_PORT=5665 ICINGA2_API_USERNAME=dashing ICINGA2_API_PASSWORD=**** dashing start

Environment

Output from dashing start -p 8005

/usr/local/lib/ruby/gems/2.6.0/gems/thin-1.6.4/lib/thin/server.rb:107: warning: constant ::Fixnum is deprecated /usr/local/lib/ruby/gems/2.6.0/gems/rufus-scheduler-2.0.24/lib/rufus/sc/jobs.rb:368: warning: constant ::Fixnum is deprecated First trying to read environment variables Environment variables not found, falling back to configuration file config/icinga2.json Detecting local config file '/usr/share/dashing-icinga2/config/icinga2.local.json'. Using config file '/usr/share/dashing-icinga2/config/icinga2.local.json'. bundler: failed to load command: thin (/usr/local/bin/thin) NoMethodError: undefined method[]' for nil:NilClass /usr/share/dashing-icinga2/lib/icinga2.rb:159:in getConfFile' /usr/share/dashing-icinga2/lib/icinga2.rb:89:inrescue in initialize' /usr/share/dashing-icinga2/lib/icinga2.rb:84:in initialize' /usr/share/dashing-icinga2/jobs/icinga2.rb:23:innew' /usr/share/dashing-icinga2/jobs/icinga2.rb:23:in <top (required)>' /usr/local/lib/ruby/gems/2.6.0/gems/backports-3.15.0/lib/backports/std_lib.rb:9:inrequire' /usr/local/lib/ruby/gems/2.6.0/gems/backports-3.15.0/lib/backports/std_lib.rb:9:in require_with_backports' /usr/local/lib/ruby/gems/2.6.0/gems/dashing-1.3.7/lib/dashing/app.rb:171:inblock in require_glob' /usr/local/lib/ruby/gems/2.6.0/gems/dashing-1.3.7/lib/dashing/app.rb:170:in each' /usr/local/lib/ruby/gems/2.6.0/gems/dashing-1.3.7/lib/dashing/app.rb:170:inrequire_glob' /usr/local/lib/ruby/gems/2.6.0/gems/dashing-1.3.7/lib/dashing/app.rb:181:in <top (required)>' /usr/local/lib/ruby/gems/2.6.0/gems/dashing-1.3.7/lib/dashing.rb:3:inrequire' /usr/local/lib/ruby/gems/2.6.0/gems/dashing-1.3.7/lib/dashing.rb:3:in <top (required)>' config.ru:1:inrequire' config.ru:1:in block in <main>' /usr/local/lib/ruby/gems/2.6.0/gems/rack-1.5.5/lib/rack/builder.rb:55:ininstance_eval' /usr/local/lib/ruby/gems/2.6.0/gems/rack-1.5.5/lib/rack/builder.rb:55:in initialize' config.ru:1:innew' config.ru:1:in <main>' /usr/local/lib/ruby/gems/2.6.0/gems/thin-1.6.4/lib/rack/adapter/loader.rb:33:ineval' /usr/local/lib/ruby/gems/2.6.0/gems/thin-1.6.4/lib/rack/adapter/loader.rb:33:in load' /usr/local/lib/ruby/gems/2.6.0/gems/thin-1.6.4/lib/thin/controllers/controller.rb:182:inload_rackup_config' /usr/local/lib/ruby/gems/2.6.0/gems/thin-1.6.4/lib/thin/controllers/controller.rb:72:in start' /usr/local/lib/ruby/gems/2.6.0/gems/thin-1.6.4/lib/thin/runner.rb:200:inrun_command' /usr/local/lib/ruby/gems/2.6.0/gems/thin-1.6.4/lib/thin/runner.rb:156:in run!' /usr/local/lib/ruby/gems/2.6.0/gems/thin-1.6.4/bin/thin:6:in<top (required)>' /usr/local/bin/thin:23:in load' /usr/local/bin/thin:23:in<top (required)>'`

dnsmichi commented 5 years ago

Seems the version regex returns a null/nil value whereas the call the first/last then fails - from #81. Can you query the REST API manually and extract the /v1/status/IcingaApplication endpoint and post it here?

curl -k -s -u root:icinga 'https://localhost:5665/v1/status/IcingaApplication?pretty=1'
MarkYSA commented 5 years ago

Thank you for the fast reply!

Output here:

{ "results": [ { "name": "IcingaApplication", "perfdata": [], "status": { "icingaapplication": { "app": { "enable_event_handlers": true, "enable_flapping": true, "enable_host_checks": true, "enable_notifications": true, "enable_perfdata": true, "enable_service_checks": true, "environment": "", "node_name": "hidden", "pid": 28711.0, "program_start": 1570621608.853022, "version": "2.11.0-1" } } } } ] }

dnsmichi commented 5 years ago

Hmm, looks sane and in my tests, this version works as well. Can you both please share the content of the config/ directory? Please replace sensitive credentials.

dnsmichi commented 5 years ago

I see, I made a programming mistake. I haven't coded Ruby for like a year now. The config reading is wrong with the new hard state option and old or local configs. Quickfix for you - add the new 'dashboard' option from the pull configuration file into the local modified version.