Class: Proxy::Monitoring::Icinga2::Provider
- Includes:
- Log, Util
- Defined in:
- lib/smart_proxy_monitoring_icinga2/monitoring_icinga2_main.rb
Instance Method Summary collapse
- #remove_downtime_host(host, author, comment) ⇒ Object
- #remove_host(host) ⇒ Object
- #set_downtime_host(host, author, comment, start_time, end_time) ⇒ Object
Instance Method Details
#remove_downtime_host(host, author, comment) ⇒ Object
15 16 17 18 19 20 21 22 23 |
# File 'lib/smart_proxy_monitoring_icinga2/monitoring_icinga2_main.rb', line 15 def remove_downtime_host(host, , comment) request_url = "/actions/remove-downtime?type=Host&filter=host.name==\"#{host}\"\&\&author==\"#{}\"\&\&comment=\"#{comment}\"" data = {} result = with_errorhandling("Remove downtime from #{host}") do Icinga2Client.post(request_url, data.to_json) end result.to_json end |
#remove_host(host) ⇒ Object
6 7 8 9 10 11 12 13 |
# File 'lib/smart_proxy_monitoring_icinga2/monitoring_icinga2_main.rb', line 6 def remove_host(host) request_url = "/objects/hosts/#{host}?cascade=1" result = with_errorhandling("Remove #{host}") do Icinga2Client.delete(request_url) end result.to_json end |
#set_downtime_host(host, author, comment, start_time, end_time) ⇒ Object
25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/smart_proxy_monitoring_icinga2/monitoring_icinga2_main.rb', line 25 def set_downtime_host(host, , comment, start_time, end_time) request_url = "/actions/schedule-downtime?type=Host&filter=host.name==\"#{host}\"" data = { 'author' => , 'comment' => comment, 'start_time' => start_time, 'end_time' => end_time, 'duration' => 1000 } result = with_errorhandling("Set downtime on #{host}") do Icinga2Client.post(request_url, data.to_json) end result.to_json end |