Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

colored and sorted problems by severity #41

Merged
merged 2 commits into from
Jan 20, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -296,6 +296,7 @@ cp tools/logrotate/dashing-icinga2 /etc/logrotate.d

Thanks to all contributors! :)

* [marconett](https://github.com/marconett) for the [colorized and sorted problem list widget](https://github.com/Icinga/dashing-icinga2/pull/41).
* [tutabeier](https://github.com/tutabeier) for [environment variables](https://github.com/Icinga/dashing-icinga2/pull/35) inspiration instead of a local configuration file.
* [mcktr](https://github.com/mcktr) for helping out with [unhandled problems](https://github.com/Icinga/dashing-icinga2/pull/18).
* [tachtler](https://github.com/tachtler) for the [Systemd service and logrotate](https://github.com/Icinga/dashing-icinga2/pull/6) additions.
Expand Down
8 changes: 6 additions & 2 deletions jobs/icinga2.rb
Original file line number Diff line number Diff line change
Expand Up @@ -88,9 +88,13 @@
# problem services
severity_stats = []
icinga.service_problems_severity.each do |name, state|
#severity_stats.push({ "label" => icinga.formatService(name), "color" => icinga.stateToColor(state.to_int, false)})
severity_stats.push({ "label" => icinga.formatService(name) })
severity_stats.push({
"label" => icinga.formatService(name),
"color" => icinga.stateToColor(state.to_int, false),
"state" => icinga.stateToString(state)
})
end
severity_stats = severity_stats.sort_by{|stat| stat["state"]}
puts "Severity: " + severity_stats.to_s

send_event('icinga-severity', {
Expand Down
4 changes: 2 additions & 2 deletions widgets/list/list.html
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
<div class="header" data-bind="title"></div>
<div class="content">
<ol>
<li data-foreach-item="items">
<li data-foreach-item="items" data-bind-class="item.color">
<span class="label" data-bind-class="item.color" data-bind="item.label"></span>
<span class="value" data-bind-class="item.color" data-bind="item.value"></span>
</li>
</ol>

<ul class="list-nostyle">
<li data-foreach-item="items">
<li data-foreach-item="items" data-bind-class="item.color">
<span class="label" data-bind-class="item.color" data-bind="item.label"></span>
<span class="value" data-bind-class="item.color" data-bind="item.value"></span>
</li>
Expand Down
12 changes: 8 additions & 4 deletions widgets/list/list.scss
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@ $label-color: rgba(255, 255, 255, 0.7);
color: $label-color;
}

ul {
color: #ffffff;
}

ol {
list-style-position: inside;
}
Expand All @@ -41,19 +45,19 @@ $label-color: rgba(255, 255, 255, 0.7);
}

.green {
color: #44bb77;
background-color: #44bb77;
font-size: 15px;
}
.yellow {
color: #ffaa44;
background-color: #ffaa44;
font-size: 15px;
}
.red {
color: #ff5566;
background-color: #ff5566;
font-size: 15px;
}
.purple {
color: #aa44ff;
background-color: #aa44ff;
font-size: 15px;
}
}