Vonage / Grafana_Status_panel

A panel plugin for Grafana to monitor multiple parameters at once
Other
179 stars 109 forks source link

Threshold for numbers is not working #43

Closed bashnesnos closed 7 years ago

bashnesnos commented 7 years ago

Hi guys,

Thanks for the great work, it seems this status panel is the only one which can aggregate multiple metrics.

Though it doesn't fire thresholds if I specify them as numbers. I've found out that it happens due to incorrect propagation of the threshold values into the parseThresholds method, i.e. they are passed as strings anyway, so when you do the checking of angular.isNumber it's always a string. I'm on grafana 4.2.2 by the way.

Here is a work around that helped to fix it in meanwhile:

{
    key: "parseThresholds",
    value: function parseThresholds(metricOptions) {
        var res = {};

        res.warnIsNumber = NUMBER_REGEXP.test(res.warn);
        if (res.warnIsNumber) {
            res.warn = parseFloat(metricOptions.warn);
        } else {
            res.warn = metricOptions.warn;
        }

        res.critIsNumber = NUMBER_REGEXP.test(res.crit);
        if (res.critIsNumber) {
            res.crit = parseFloat(metricOptions.crit);
        } else {
            res.crit = metricOptions.crit;
        }
        return res;
    }
}
tomer-amir-vonage commented 7 years ago

Thanks! We're on it. Expect a fix soon

YehonatanVonage commented 7 years ago

Hi, Thanks for finding this bug. A fix already pushed to master, and will be available in the new release (1.0.3) in Grafana soon.

bashnesnos commented 7 years ago

Thanks guys, works like a charm now. Should I close the issue, or it's up to you?

tomer-amir-vonage commented 7 years ago

We waited until Grafana published our changes (release 1.0.3), which now they did, so I'll close it.

Thanks again 😄