theforeman / smart_proxy_monitoring

Smart proxy plugin for monitoring system integration
GNU General Public License v3.0
7 stars 10 forks source link

renaming a host doesn't work #14

Closed hboetes closed 7 years ago

hboetes commented 7 years ago

While trying to rename a host I noticed the change was blocked, so examining the logs I noticed smart_proxy_monitoring was objecting. So I first removed the hosts' monitoring proxy entry, renamed the host succesfully, and then tried adding the host again. And then I noticed adding the new hostname was impossible and I got this error message in the logfiles.

What's going on here?

I, [2017-08-21T18:34:48.727623 ]  INFO -- : Icinga2 Event API Monitor: Observed 1 events in the last 413.73 seconds. 0 items queued. 1 threads waiting.
I, [2017-08-21T18:34:48.728016 ]  INFO -- : Icinga2 Result Uploader: Observed 1 events in the last 413.73 seconds. 0 items queued. 0 threads waiting.
D, [2017-08-21T18:35:56.619202 ] DEBUG -- : accept: 172.31.10.129:38876
D, [2017-08-21T18:35:56.622329 ] DEBUG -- : Rack::Handler::WEBrick is invoked.
D, [2017-08-21T18:35:56.622941 ] DEBUG -- : verifying remote client 172.31.10.129 against trusted_hosts ["foreman01.example.org"]
D, [2017-08-21T18:35:56.623138 ] DEBUG -- : IcingaDirector: GET request to host?name=wikivi01.example.org
E, [2017-08-21T18:35:56.656320 ] ERROR -- : 500 Internal Server Error
D, [2017-08-21T18:35:56.656361 ] DEBUG -- : 500 Internal Server Error (RestClient::InternalServerError)
/usr/lib/ruby/vendor_ruby/restclient/abstract_response.rb:74:in `return!'
/usr/lib/ruby/vendor_ruby/restclient/request.rb:495:in `process_result'
/usr/lib/ruby/vendor_ruby/restclient/request.rb:421:in `block in transmit'
/usr/lib/ruby/2.3.0/net/http.rb:853:in `start'
/usr/lib/ruby/vendor_ruby/restclient/request.rb:413:in `transmit'
/usr/lib/ruby/vendor_ruby/restclient/request.rb:176:in `execute'
/usr/lib/ruby/vendor_ruby/restclient/request.rb:41:in `execute'
/usr/lib/ruby/vendor_ruby/restclient/resource.rb:51:in `get'
/var/lib/gems/2.3.0/gems/smart_proxy_monitoring-0.1.0/lib/smart_proxy_monitoring_icingadirector/director_client.rb:25:in `get'
/var/lib/gems/2.3.0/gems/smart_proxy_monitoring-0.1.0/lib/smart_proxy_monitoring_icingadirector/monitoring_icingadirector_main.rb:8:in `query_host'
/var/lib/gems/2.3.0/gems/smart_proxy_monitoring-0.1.0/lib/smart_proxy_monitoring/monitoring_api.rb:20:in `block in <class:Api>'
/usr/lib/ruby/vendor_ruby/sinatra/base.rb:1610:in `call'
/usr/lib/ruby/vendor_ruby/sinatra/base.rb:1610:in `block in compile!'
/usr/lib/ruby/vendor_ruby/sinatra/base.rb:975:in `block (3 levels) in route!'
/usr/lib/ruby/vendor_ruby/sinatra/base.rb:994:in `route_eval'
/usr/lib/ruby/vendor_ruby/sinatra/base.rb:975:in `block (2 levels) in route!'
/usr/lib/ruby/vendor_ruby/sinatra/base.rb:1015:in `block in process_route'
/usr/lib/ruby/vendor_ruby/sinatra/base.rb:1013:in `catch'
/usr/lib/ruby/vendor_ruby/sinatra/base.rb:1013:in `process_route'
/usr/lib/ruby/vendor_ruby/sinatra/base.rb:973:in `block in route!'
/usr/lib/ruby/vendor_ruby/sinatra/base.rb:972:in `each'
/usr/lib/ruby/vendor_ruby/sinatra/base.rb:972:in `route!'
/usr/lib/ruby/vendor_ruby/sinatra/base.rb:1085:in `block in dispatch!'
/usr/lib/ruby/vendor_ruby/sinatra/base.rb:1067:in `block in invoke'
/usr/lib/ruby/vendor_ruby/sinatra/base.rb:1067:in `catch'
/usr/lib/ruby/vendor_ruby/sinatra/base.rb:1067:in `invoke'
/usr/lib/ruby/vendor_ruby/sinatra/base.rb:1082:in `dispatch!'
/usr/lib/ruby/vendor_ruby/sinatra/base.rb:907:in `block in call!'
/usr/lib/ruby/vendor_ruby/sinatra/base.rb:1067:in `block in invoke'
/usr/lib/ruby/vendor_ruby/sinatra/base.rb:1067:in `catch'
/usr/lib/ruby/vendor_ruby/sinatra/base.rb:1067:in `invoke'
/usr/lib/ruby/vendor_ruby/sinatra/base.rb:907:in `call!'
/usr/lib/ruby/vendor_ruby/sinatra/base.rb:895:in `call'
/usr/lib/ruby/vendor_ruby/rack/commonlogger.rb:33:in `call'
/usr/lib/ruby/vendor_ruby/sinatra/base.rb:219:in `call'
/usr/share/foreman-proxy/lib/proxy/log.rb:109:in `call'
/usr/share/foreman-proxy/lib/proxy/request_id_middleware.rb:9:in `call'
/usr/lib/ruby/vendor_ruby/rack/protection/xss_header.rb:18:in `call'
/usr/lib/ruby/vendor_ruby/rack/protection/path_traversal.rb:16:in `call'
/usr/lib/ruby/vendor_ruby/rack/protection/json_csrf.rb:18:in `call'
/usr/lib/ruby/vendor_ruby/rack/protection/base.rb:49:in `call'
/usr/lib/ruby/vendor_ruby/rack/protection/base.rb:49:in `call'
/usr/lib/ruby/vendor_ruby/rack/protection/frame_options.rb:31:in `call'
/usr/lib/ruby/vendor_ruby/rack/nulllogger.rb:9:in `call'
/usr/lib/ruby/vendor_ruby/rack/head.rb:13:in `call'
/usr/lib/ruby/vendor_ruby/sinatra/show_exceptions.rb:25:in `call'
/usr/lib/ruby/vendor_ruby/sinatra/base.rb:182:in `call'
/usr/lib/ruby/vendor_ruby/sinatra/base.rb:2013:in `call'
/usr/lib/ruby/vendor_ruby/sinatra/base.rb:1487:in `block in call'
/usr/lib/ruby/vendor_ruby/sinatra/base.rb:1787:in `synchronize'
/usr/lib/ruby/vendor_ruby/sinatra/base.rb:1487:in `call'
/usr/lib/ruby/vendor_ruby/rack/urlmap.rb:66:in `block in call'
/usr/lib/ruby/vendor_ruby/rack/urlmap.rb:50:in `each'
/usr/lib/ruby/vendor_ruby/rack/urlmap.rb:50:in `call'
/usr/lib/ruby/vendor_ruby/rack/builder.rb:153:in `call'
/usr/lib/ruby/vendor_ruby/rack/handler/webrick.rb:88:in `service'
/usr/lib/ruby/2.3.0/webrick/httpserver.rb:140:in `service'
/usr/lib/ruby/2.3.0/webrick/httpserver.rb:96:in `run'
/usr/lib/ruby/2.3.0/webrick/server.rb:296:in `block in start_thread'
I, [2017-08-21T18:35:56.657201 ]  INFO -- : 172.31.10.129 - - [21/Aug/2017:18:35:56 +0200] "GET /monitoring/host/wikivi01.example.org HTTP/1.1" 400 25 0.0344

D, [2017-08-21T18:35:56.697716 ] DEBUG -- : close: 172.31.10.129:38876
hboetes commented 7 years ago

I also checked the debuglog on the icinga host and there was no mention of wikivi01 or anything else. Removing and readding any other host works OK.

This is the latest foreman, latest icinga, latest your plugins from git. The latest version from icinga-director from git.

hboetes commented 7 years ago

I guess this is a problem with the latest version of icinga-director, since opening a url like: https://icinga01.example.org/icingaweb2/director/host?name=nonexistant returns an error.

timogoebel commented 7 years ago

@hboetes : Does this work for you with the fix @Thomas-Gelf provided?

hboetes commented 7 years ago

Yes it does. Sorry for the noise. Sometimes it's hard to pinpoint the exact culprit when two projects are working together.