This widget is based on the standard Dashing List widget and the Hotness Widget created by Rowanu.
With this widget, you can display a list that will change color depending on its content. It can be useful to display a set of metrics and use the color to materialize the "global state". If you refer to the thumbnail, you'll see an example of application around a server pool.
Copy
- hotlist.coffee
- hotlist.html
- hotlist.scss
in a "hotlist" folder in your dashing widget directory.
Its use is close to the standard List widget.
Add the following attributes in your dashboard elements declaration :
- data-cool : all values below this will display the "cool" colour. Use it to symbolize the "good" range of values. Remember that you can set a negative data-cool value (-1 will make the widget go green if all is ok)
- data-warm : all values greater than this will display the "hot" colour. Use it to symbolize the "bad" range of values.
Examples :
For Dashing-js
li(data-row='1', data-col='1', data-sizex='1', data-sizey='1')
div(data-id='serverstatus', data-view='Hotlist', data-title='Server pool status', data-unordered="true", data-moreinfo="Production pool", data-cool="-1", data-warm="3")
For regular Dashing
<li data-row="1" data-col="1" data-sizex="1" data-sizey="1">
<div data-id="serverstatus" data-view="Hotlist" data-title="Server pool status" data-unordered="true" data-moreinfo="Production pool" data-cool="-1" data-warm="3"></div>
</li>
The standard list widget accept a JSON structure with items array to feed the list. Add to this a field named hotnessvalue to compute the "state of hotness" of your list.
See this example that
- evaluates the states of three imaginay servers
- count the number of them set to "down" value
Code :
var itemarray = [
{label: 'Server #1', value: (isServer1Ok() ? 'up' : 'down')},
{label: 'Server #2', value: (isServer2Ok() ? 'up' : 'down')},
{label: 'Server #3', value: (isServer3Ok() ? 'up' : 'down')}
];
var numberOfSystemsDown = countNumberOfServerDown(itemarray);
var datastruct = {
items: itemarray,
hotnessvalue:numberOfSystemsDown // Here you set the value of "hotness"
};
send_event('etatsyspic', datastruct);
The important part is the hotness attribute.
Licenced under the Creative Commons Attribution 4.0