// check our thresholds and update color
var lastValue = datum[j][datum[j].length - 1].y;
var warning = metrics[j].warning;
var critical = metrics[j].critical;
if (critical > warning) {
if (lastValue > critical) {
graphs[j].series[0].color = '#d59295';
} else if (lastValue > warning) {
graphs[j].series[0].color = '#f5cb56';
} else {
graphs[j].series[0].color = '#afdab1';
}
} else {
if (lastValue < critical) {
graphs[j].series[0].color = '#d59295';
} else if (lastValue < warning) {
graphs[j].series[0].color = '#f5cb56';
} else {
graphs[j].series[0].color = '#afdab1';
}
}
So in if (critical > warning) { statement everything looks fine. But in else statement for this if the logic is broken (bad colors are inserted to those threshold values).
Instead of fixing this else statement I suggest adding replacing whole if-else statement with:
js/tasseo.js:
So in
if (critical > warning) {
statement everything looks fine. But inelse
statement for this if the logic is broken (bad colors are inserted to those threshold values).Instead of fixing this else statement I suggest adding replacing whole if-else statement with:
This way we are not doubling the logic needed for handling this color - managing statement