auxesis / visage

Graph collectd metrics in the browser, backed by a JSON API
http://visage-app.com/
Other
381 stars 56 forks source link

Javascript error in 3.0 dev with flapjack curl_json rrds #133

Open jessereynolds opened 11 years ago

jessereynolds commented 11 years ago

Uncaught TypeError: Cannot call method 'replace' of undefined (graph.js:93)

I'm running collectd 5.3 on mac, so this error may not hold true on supported platforms. Other rrd files draw fine in visage but the ones i'm generating with the curl_json plugin don't draw any graphs in the ui, and throw a javascript error.

screen shot 2013-07-25 at 5 50 40 pm

screen shot 2013-07-25 at 5 51 12 pm

jessereynolds commented 11 years ago

json retrieved from visage for the missing graph is at the following gist: https://gist.github.com/jessereynolds/6077848

jessereynolds commented 11 years ago

I'm wondering if it's the second hyphen in the type-type_instance section of the metric address. Line 93 of graph.js is in here (stash.replace...) :

    else if ( plugin.test(/^curl_json/) ) {
        var stash = instance.split('-')[2];
        var stash = stash.replace(/[-|_]/, ' ');
        name = stash
    }

{"curl_json-flapjack":{"derive-all_time-action"

Actually it looks like it's trying to find three strings after splitting "curl_json-flapjack" by "-", and there are only 2, hence stash is undefined.