#include "common.h"
-void rrd_stats_api_v1_chart(RRDSET *st, BUFFER *wb)
+inline void rrd_stats_api_v1_chart_with_data(RRDSET *st, BUFFER *wb, size_t *dimensions_count, size_t *memory_used)
{
pthread_rwlock_rdlock(&st->rwlock);
unsigned long memory = st->memsize;
- int c = 0;
+ size_t c = 0;
RRDDIM *rd;
for(rd = st->dimensions; rd ; rd = rd->next) {
if(rd->flags & RRDDIM_FLAG_HIDDEN) continue;
c++;
}
+ if(dimensions_count) *dimensions_count += c;
+ if(memory_used) *memory_used += memory;
buffer_strcat(wb, "\n\t\t\t},\n\t\t\t\"green\": ");
buffer_rrd_value(wb, st->green);
pthread_rwlock_unlock(&st->rwlock);
}
+void rrd_stats_api_v1_chart(RRDSET *st, BUFFER *wb) {
+ rrd_stats_api_v1_chart_with_data(st, wb, NULL, NULL);
+}
+
void rrd_stats_api_v1_charts(BUFFER *wb)
{
- long c;
+ size_t c, dimensions = 0, memory = 0;
RRDSET *st;
buffer_sprintf(wb, "{\n"
buffer_strcat(wb, "\n\t\t\"");
buffer_strcat(wb, st->id);
buffer_strcat(wb, "\": ");
- rrd_stats_api_v1_chart(st, wb);
+ rrd_stats_api_v1_chart_with_data(st, wb, &dimensions, &memory);
c++;
}
}
pthread_rwlock_unlock(&localhost.rrdset_root_rwlock);
- buffer_strcat(wb, "\n\t}\n}\n");
+ buffer_sprintf(wb, "\n\t}"
+ ",\n\t\"charts_count\": %zu"
+ ",\n\t\"dimensions_count\": %zu"
+ ",\n\t\"rrd_memory_bytes\": %zu"
+ "\n}\n"
+ , c
+ , dimensions
+ , memory
+ );
}
dashboard_css: NETDATA.serverDefault + 'dashboard.css?v20161002-1',
background: '#FFFFFF',
foreground: '#000000',
- grid: '#DDDDDD',
- axis: '#CCCCCC',
+ grid: '#F0F0F0',
+ axis: '#F0F0F0',
colors: [ '#3366CC', '#DC3912', '#109618', '#FF9900', '#990099', '#DD4477',
'#3B3EAC', '#66AA00', '#0099C6', '#B82E2E', '#AAAA11', '#5574A6',
'#994499', '#22AA99', '#6633CC', '#E67300', '#316395', '#8B0707',
html += mhead + shtml + '</div></div><hr role="separator"/>';
}
+ sidebar += '<li class="" style="padding-top:15px;"><a href="https://github.com/firehol/netdata/wiki/Add-more-charts-to-netdata" target="_blank"><i class="fa fa-plus" aria-hidden="true"></i> add more charts</a></li>';
+ sidebar += '<li class="" style="margin:20px;color:#666;"><small>netdata on <b>' + data.hostname.toString() + '</b>, collects every ' + ((data.update_every == 1)?'second':data.update_every.toString() + ' seconds') + ', <b>' + data.dimensions_count.toLocaleString() + '</b> metrics presented in <b>' + data.charts_count.toLocaleString() + '</b> charts, using ' + Math.round(data.rrd_memory_bytes / 1024 / 1024).toLocaleString() + ' MB of memory, for ' + Math.round(data.history / 3600).toLocaleString() + ' ' + ((data.history == 3600)?'hour':'hours').toString() + ' of real-time history.</small></li>';
sidebar += '</ul>';
div.innerHTML = html;
document.getElementById('sidebar').innerHTML = sidebar;
</div>
</body>
</html>
-<script type="text/javascript" src="dashboard.js?v20161112-1"></script>
+<script type="text/javascript" src="dashboard.js?v20161126-1"></script>