Skip to content

Commit

Permalink
Merge pull request #45 from Icinga/feature/simplemon-green-if-zero
Browse files Browse the repository at this point in the history
Render Undhandled Problems green if count is zero
  • Loading branch information
Michael Friedrich committed Oct 6, 2017
2 parents 14bc597 + c800bfd commit ccb6e03
Showing 1 changed file with 32 additions and 4 deletions.
36 changes: 32 additions & 4 deletions jobs/icinga2.rb
Original file line number Diff line number Diff line change
Expand Up @@ -99,28 +99,56 @@

# down, critical, warning, unknown
puts "Host Down: " + icinga.host_count_problems_down.to_s

if icinga.host_count_problems_down > 0
color = 'red'
else
color = 'green'
end

send_event('icinga-host-problems-down', {
value: icinga.host_count_problems_down.to_s,
moreinfo: "All Problems: " + icinga.host_count_down.to_s,
color: 'red' })
color: color })

puts "Service Critical: " + icinga.service_count_problems_critical.to_s

if icinga.service_count_problems_critical > 0
color = 'red'
else
color = 'green'
end

send_event('icinga-service-problems-critical', {
value: icinga.service_count_problems_critical.to_s,
moreinfo: "All Problems: " + icinga.service_count_critical.to_s,
color: 'red' })
color: color })

puts "Service Warning: " + icinga.service_count_problems_warning.to_s

if icinga.service_count_problems_warning > 0
color = 'yellow'
else
color = 'green'
end

send_event('icinga-service-problems-warning', {
value: icinga.service_count_problems_warning.to_s,
moreinfo: "All Problems: " + icinga.service_count_warning.to_s,
color: 'yellow' })
color: color })

puts "Service Unknown: " + icinga.service_count_problems_unknown.to_s

if icinga.service_count_problems_unknown > 0
color = 'purple'
else
color = 'green'
end

send_event('icinga-service-problems-unknown', {
value: icinga.service_count_problems_unknown.to_s,
moreinfo: "All Problems: " + icinga.service_count_unknown.to_s,
color: 'purple' })
color: color })


end
Expand Down

0 comments on commit ccb6e03

Please sign in to comment.