Skip to content

Commit

Permalink
Merge pull request #114 from betrZHAW/no-services-for-down-hosts-show…
Browse files Browse the repository at this point in the history
…-display-name-for-services-and-hosts

no-services-for-down-hosts-show-display-name-for-services-and-hosts
  • Loading branch information
mocdaniel authored Dec 8, 2020
2 parents 65d15d2 + 0be254e commit d7fd55d
Show file tree
Hide file tree
Showing 3 changed files with 183 additions and 63 deletions.
109 changes: 66 additions & 43 deletions dashboards/icinga2.erb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ $(function() {
Dashing.widget_base_dimensions = [300,300]
//Experimental: widget size based on window size.
//Dashing.widget_base_dimensions = [$( window ).width()/5, $( window ).height()/2.2];
Dashing.numColumns = 5
Dashing.numColumns = 4
});
</script>

Expand All @@ -18,6 +18,26 @@ $(function() {
</li>

<li data-row="1" data-col="2" data-sizex="1" data-sizey="1">
<div data-id="icinga-stats" data-view="List" data-unordered="true" data-title="Statistics"></div>
</li>

<!-- <li data-row="1" data-col="3" data-sizex="1" data-sizey="1">
<div
data-id="bar-chart-acks"
data-view="Chartjs"
data-type="horizontalBar"
data-header="Acknowledgements"
data-title="Acknowledgements"
data-labels="Hosts,Services"
data-colornames="blue,green"
data-datasets="42,404"
data-height="300"
data-width="300"
></div>
</li> -->


<!-- <li data-row="2" data-col="1" data-sizex="1" data-sizey="1">
<div
data-id="doughnut-pie-hosts"
data-view="Chartjs"
Expand All @@ -30,7 +50,7 @@ $(function() {
data-width="300"
></div>
</li>
<li data-row="1" data-col="3" data-sizex="1" data-sizey="1">
<li data-row="2" data-col="2" data-sizex="1" data-sizey="1">
<div
data-id="doughnut-pie-services"
data-view="Chartjs"
Expand All @@ -42,42 +62,28 @@ $(function() {
data-height="300"
data-width="300"
></div>
</li>
<li data-row="1" data-col="4" data-sizex="1" data-sizey="1">
<div
data-id="bar-chart-endpoints"
data-view="Chartjs"
data-type="bar"
data-header="Endpoints"
data-title="Endpoints"
data-labels="Connected,Not Connected"
data-colornames="green,red"
data-datasets="42,404"
data-height="300"
data-width="300"
></div>
</li>
</li> -->

<!-- Service and Hosts wie im alten Dashboard -->
<li data-row="2" data-col="1" data-sizex="1" data-sizey="1">
<div data-id="icinga-stats" data-view="List" data-unordered="true" data-title="Statistics"></div>
<div
data-id="icinga-host-meter"
data-view="Meter"
data-title="Host Problems"
data-min="0"
data-max="100"
></div>
</li>

<li data-row="2" data-col="2" data-sizex="1" data-sizey="1">
<div
data-id="bar-chart-checks"
data-view="Chartjs"
data-type="horizontalBar"
data-header="Active Checks"
data-title="Active Checks"
data-labels="Hosts/min,Services/min"
data-colornames="aqua,lime"
data-datasets="42,404"
data-height="300"
data-width="300"
<div
data-id="icinga-service-meter"
data-view="Meter"
data-title="Service Problems"
data-min="0" data-max="100"
></div>
</li>

<li data-row="2" data-col="3" data-sizex="1" data-sizey="1">
<!-- <li data-row="2" data-col="3" data-sizex="1" data-sizey="1">
<div
data-id="bar-chart-downtimes"
data-view="Chartjs"
Expand All @@ -90,22 +96,39 @@ $(function() {
data-height="300"
data-width="300"
></div>
</li>
</li> -->

<li data-row="2" data-col="4" data-sizex="1" data-sizey="1">
<!-- <li data-row="2" data-col="3" data-sizex="1" data-sizey="1">
<div
data-id="bar-chart-acks"
data-id="bar-chart-endpoints"
data-view="Chartjs"
data-type="bar"
data-header="Endpoints"
data-title="Endpoints"
data-labels="Connected,Not Connected"
data-colornames="green,red"
data-datasets="42,404"
data-height="300"
data-width="300"
></div>
</li> -->



<!-- <li data-row="2" data-col="1" data-sizex="1" data-sizey="1">
<div
data-id="bar-chart-checks"
data-view="Chartjs"
data-type="horizontalBar"
data-header="Acknowledgements"
data-title="Acknowledgements"
data-labels="Hosts,Services"
data-colornames="blue,green"
data-header="Active Checks"
data-title="Active Checks"
data-labels="Hosts/min,Services/min"
data-colornames="aqua,lime"
data-datasets="42,404"
data-height="300"
data-width="300"
></div>
</li>
</li> -->

<!-- Problems -->
<!--
Expand Down Expand Up @@ -134,17 +157,17 @@ $(function() {
-->

<!-- Takes two rows for all service problems by severity -->
<li data-row="1" data-col="5" data-sizex="1" data-sizey="3">
<div class="scrollable" data-id="icinga-severity" data-view="List" data-unordered="true" data-title="Problems"></div>
<li data-row="1" data-col="3" data-sizex="2" data-sizey="2">
<div data-id="icinga-severity" data-view="List" data-unordered="true" data-title="Service and Host Problems"></div>
</li>

<!-- Icinga Web 2 iFrame. getIcingaWeb2Url() is defined in config.ru and reads from config/icinga2*.json -->
<li data-row="3" data-col="1" data-sizex="2" data-sizey="2">
<!-- <li data-row="3" data-col="1" data-sizex="2" data-sizey="2">
<div data-id="iframe" data-view="Iframe" data-title="Icinga Web Host Problems" data-url="<%=getIcingaWeb2Url()%>/monitoring/list/hosts?host_problem=1&sort=host_severity&showFullscreen&showCompact"></div>
</li>
<li data-row="3" data-col="3" data-sizex="2" data-sizey="2">
<div data-id="iframe" data-view="Iframe" data-title="Icinga Web Service Problems" data-url="<%=getIcingaWeb2Url()%>/monitoring/list/services?service_problem=1&sort=service_severity&dir=desc&showFullscreen&showCompact"></div>
</li>
</li>-->
</ul>

</div>
21 changes: 16 additions & 5 deletions jobs/icinga2.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
# run data provider
icinga.run

puts "App Info: " + icinga.app_data.to_s + " Version: " + icinga.version
#puts "App Info: " + icinga.app_data.to_s + " Version: " + icinga.version
#puts "CIB Info: " + icinga.cib_data.to_s

# meter widget
Expand All @@ -36,7 +36,7 @@
service_meter = icinga.service_count_problems.to_f
service_meter_max = icinga.service_count_all

puts "Meter widget: Hosts " + host_meter.to_s + "/" + host_meter_max.to_s + " Services " + service_meter.to_s + "/" + service_meter_max.to_s
#puts "Meter widget: Hosts " + host_meter.to_s + "/" + host_meter_max.to_s + " Services " + service_meter.to_s + "/" + service_meter_max.to_s

# icinga stats
icinga_stats = [
Expand All @@ -53,12 +53,23 @@
# icinga_stats.push( { "label" => name, "value" => "%0.2f" % value } )
#end

puts "Stats: " + icinga_stats.to_s
#puts "Stats: " + icinga_stats.to_s

### Events
send_event('icinga-host-meter', {
value: host_meter,
max: host_meter_max,
moreinfo: "Total hosts: " + host_meter_max.to_s,
color: 'blue' })

send_event('icinga-service-meter', {
value: service_meter,
max: service_meter_max,
moreinfo: "Total services: " + service_meter_max.to_s,
color: 'blue' })

send_event('icinga-stats', {
title: icinga.version,
title: "Icinga " + icinga.version,
items: icinga_stats,
moreinfo: "Avg latency: " + icinga.avg_latency.to_s + "s",
color: 'blue' })
Expand Down Expand Up @@ -147,7 +158,7 @@
order.index(a['state']) <=> order.index(b['state'])
end

puts "Severity: " + result.to_s
#puts "Severity: " + result.to_s

send_event('icinga-severity', {
items: result,
Expand Down
Loading

0 comments on commit d7fd55d

Please sign in to comment.