check_for_new_mountpoints_every = update_every;
RRDSET *stcpu_thread = NULL, *st_duration = NULL;
+ RRDDIM *rd_user = NULL, *rd_system = NULL, *rd_duration = NULL;
struct rusage thread;
usec_t last = 0, dt = 0;
if(!stcpu_thread) {
stcpu_thread = rrdset_find("netdata.plugin_diskspace");
- if(!stcpu_thread) {
- stcpu_thread = rrdset_create("netdata", "plugin_diskspace", NULL, "diskspace", NULL
+ if(!stcpu_thread) stcpu_thread = rrdset_create("netdata", "plugin_diskspace", NULL, "diskspace", NULL
, "NetData Disk Space Plugin CPU usage", "milliseconds/s", 132020
, update_every, RRDSET_TYPE_STACKED);
- rrddim_add(stcpu_thread, "user", NULL, 1, 1000, RRDDIM_INCREMENTAL);
- rrddim_add(stcpu_thread, "system", NULL, 1, 1000, RRDDIM_INCREMENTAL);
- }
+ rd_user = rrddim_add(stcpu_thread, "user", NULL, 1, 1000, RRDDIM_INCREMENTAL);
+ rd_system = rrddim_add(stcpu_thread, "system", NULL, 1, 1000, RRDDIM_INCREMENTAL);
}
else
rrdset_next(stcpu_thread);
- rrddim_set(stcpu_thread, "user", thread.ru_utime.tv_sec * 1000000ULL + thread.ru_utime.tv_usec);
- rrddim_set(stcpu_thread, "system", thread.ru_stime.tv_sec * 1000000ULL + thread.ru_stime.tv_usec);
+ rrddim_set_by_pointer(stcpu_thread, rd_user, thread.ru_utime.tv_sec * 1000000ULL + thread.ru_utime.tv_usec);
+ rrddim_set_by_pointer(stcpu_thread, rd_system, thread.ru_stime.tv_sec * 1000000ULL + thread.ru_stime.tv_usec);
rrdset_done(stcpu_thread);
// ----------------------------------------------------------------
if(!st_duration) {
st_duration = rrdset_find("netdata.plugin_diskspace_dt");
- if(!st_duration) {
- st_duration = rrdset_create("netdata", "plugin_diskspace_dt", NULL, "diskspace", NULL
+ if(!st_duration) st_duration = rrdset_create("netdata", "plugin_diskspace_dt", NULL, "diskspace", NULL
, "NetData Disk Space Plugin Duration", "milliseconds/run", 132021
, update_every, RRDSET_TYPE_AREA);
- rrddim_add(st_duration, "duration", NULL, 1, 1000, RRDDIM_ABSOLUTE);
- }
+ rd_duration = rrddim_add(st_duration, "duration", NULL, 1, 1000, RRDDIM_ABSOLUTE);
}
else
rrdset_next(st_duration);
- rrddim_set(st_duration, "duration", dt);
+ rrddim_set_by_pointer(st_duration, rd_duration, dt);
rrdset_done(st_duration);
// ----------------------------------------------------------------
if(unlikely(!d->st_bandwidth)) {
d->st_bandwidth = rrdset_find_bytype("net", d->name);
- if(!d->st_bandwidth) {
+ if(!d->st_bandwidth)
d->st_bandwidth = rrdset_create("net", d->name, NULL, d->name, "net.net", "Bandwidth", "kilobits/s", 7000, update_every, RRDSET_TYPE_AREA);
- d->rd_rbytes = rrddim_add(d->st_bandwidth, "received", NULL, 8, 1024, RRDDIM_INCREMENTAL);
- d->rd_tbytes = rrddim_add(d->st_bandwidth, "sent", NULL, -8, 1024, RRDDIM_INCREMENTAL);
- }
+
+ d->rd_rbytes = rrddim_add(d->st_bandwidth, "received", NULL, 8, 1024, RRDDIM_INCREMENTAL);
+ d->rd_tbytes = rrddim_add(d->st_bandwidth, "sent", NULL, -8, 1024, RRDDIM_INCREMENTAL);
}
else rrdset_next(d->st_bandwidth);
if(unlikely(!d->st_packets)) {
d->st_packets = rrdset_find_bytype("net_packets", d->name);
- if(!d->st_packets) {
+ if(!d->st_packets)
d->st_packets = rrdset_create("net_packets", d->name, NULL, d->name, "net.packets", "Packets", "packets/s", 7001, update_every, RRDSET_TYPE_LINE);
- d->st_packets->isdetail = 1;
- d->rd_rpackets = rrddim_add(d->st_packets, "received", NULL, 1, 1, RRDDIM_INCREMENTAL);
- d->rd_tpackets = rrddim_add(d->st_packets, "sent", NULL, -1, 1, RRDDIM_INCREMENTAL);
- d->rd_rmulticast = rrddim_add(d->st_packets, "multicast", NULL, 1, 1, RRDDIM_INCREMENTAL);
- }
+ d->st_packets->isdetail = 1;
+
+ d->rd_rpackets = rrddim_add(d->st_packets, "received", NULL, 1, 1, RRDDIM_INCREMENTAL);
+ d->rd_tpackets = rrddim_add(d->st_packets, "sent", NULL, -1, 1, RRDDIM_INCREMENTAL);
+ d->rd_rmulticast = rrddim_add(d->st_packets, "multicast", NULL, 1, 1, RRDDIM_INCREMENTAL);
}
else rrdset_next(d->st_packets);
if(unlikely(!d->st_errors)) {
d->st_errors = rrdset_find_bytype("net_errors", d->name);
- if(!d->st_errors) {
+ if(!d->st_errors)
d->st_errors = rrdset_create("net_errors", d->name, NULL, d->name, "net.errors", "Interface Errors", "errors/s", 7002, update_every, RRDSET_TYPE_LINE);
- d->st_errors->isdetail = 1;
- d->rd_rerrors = rrddim_add(d->st_errors, "inbound", NULL, 1, 1, RRDDIM_INCREMENTAL);
- d->rd_terrors = rrddim_add(d->st_errors, "outbound", NULL, -1, 1, RRDDIM_INCREMENTAL);
- }
+ d->st_errors->isdetail = 1;
+
+ d->rd_rerrors = rrddim_add(d->st_errors, "inbound", NULL, 1, 1, RRDDIM_INCREMENTAL);
+ d->rd_terrors = rrddim_add(d->st_errors, "outbound", NULL, -1, 1, RRDDIM_INCREMENTAL);
}
else rrdset_next(d->st_errors);
if(unlikely(!d->st_drops)) {
d->st_drops = rrdset_find_bytype("net_drops", d->name);
- if(!d->st_drops) {
+ if(!d->st_drops)
d->st_drops = rrdset_create("net_drops", d->name, NULL, d->name, "net.drops", "Interface Drops", "drops/s", 7003, update_every, RRDSET_TYPE_LINE);
- d->st_drops->isdetail = 1;
- d->rd_rdrops = rrddim_add(d->st_drops, "inbound", NULL, 1, 1, RRDDIM_INCREMENTAL);
- d->rd_tdrops = rrddim_add(d->st_drops, "outbound", NULL, -1, 1, RRDDIM_INCREMENTAL);
- }
+ d->st_drops->isdetail = 1;
+
+ d->rd_rdrops = rrddim_add(d->st_drops, "inbound", NULL, 1, 1, RRDDIM_INCREMENTAL);
+ d->rd_tdrops = rrddim_add(d->st_drops, "outbound", NULL, -1, 1, RRDDIM_INCREMENTAL);
}
else rrdset_next(d->st_drops);
if(unlikely(!d->st_fifo)) {
d->st_fifo = rrdset_find_bytype("net_fifo", d->name);
- if(!d->st_fifo) {
+ if(!d->st_fifo)
d->st_fifo = rrdset_create("net_fifo", d->name, NULL, d->name, "net.fifo", "Interface FIFO Buffer Errors", "errors", 7004, update_every, RRDSET_TYPE_LINE);
- d->st_fifo->isdetail = 1;
- d->rd_rfifo = rrddim_add(d->st_fifo, "receive", NULL, 1, 1, RRDDIM_INCREMENTAL);
- d->rd_tfifo = rrddim_add(d->st_fifo, "transmit", NULL, -1, 1, RRDDIM_INCREMENTAL);
- }
+ d->st_fifo->isdetail = 1;
+
+ d->rd_rfifo = rrddim_add(d->st_fifo, "receive", NULL, 1, 1, RRDDIM_INCREMENTAL);
+ d->rd_tfifo = rrddim_add(d->st_fifo, "transmit", NULL, -1, 1, RRDDIM_INCREMENTAL);
}
else rrdset_next(d->st_fifo);
if(d->do_compressed == CONFIG_ONDEMAND_YES) {
if(unlikely(!d->st_compressed)) {
d->st_compressed = rrdset_find_bytype("net_compressed", d->name);
- if(!d->st_compressed) {
+ if(!d->st_compressed)
d->st_compressed = rrdset_create("net_compressed", d->name, NULL, d->name, "net.compressed", "Compressed Packets", "packets/s", 7005, update_every, RRDSET_TYPE_LINE);
- d->st_compressed->isdetail = 1;
- d->rd_rcompressed = rrddim_add(d->st_compressed, "received", NULL, 1, 1, RRDDIM_INCREMENTAL);
- d->rd_tcompressed = rrddim_add(d->st_compressed, "sent", NULL, -1, 1, RRDDIM_INCREMENTAL);
- }
+ d->st_compressed->isdetail = 1;
+
+ d->rd_rcompressed = rrddim_add(d->st_compressed, "received", NULL, 1, 1, RRDDIM_INCREMENTAL);
+ d->rd_tcompressed = rrddim_add(d->st_compressed, "sent", NULL, -1, 1, RRDDIM_INCREMENTAL);
}
else rrdset_next(d->st_compressed);
if(d->do_events == CONFIG_ONDEMAND_YES) {
if(unlikely(!d->st_events)) {
d->st_events = rrdset_find_bytype("net_events", d->name);
- if(!d->st_events) {
+ if(!d->st_events)
d->st_events = rrdset_create("net_events", d->name, NULL, d->name, "net.events", "Network Interface Events", "events/s", 7006, update_every, RRDSET_TYPE_LINE);
- d->st_events->isdetail = 1;
- d->rd_rframe = rrddim_add(d->st_events, "frames", NULL, 1, 1, RRDDIM_INCREMENTAL);
- d->rd_tcollisions = rrddim_add(d->st_events, "collisions", NULL, -1, 1, RRDDIM_INCREMENTAL);
- d->rd_tcarrier = rrddim_add(d->st_events, "carrier", NULL, -1, 1, RRDDIM_INCREMENTAL);
- }
+ d->st_events->isdetail = 1;
+
+ d->rd_rframe = rrddim_add(d->st_events, "frames", NULL, 1, 1, RRDDIM_INCREMENTAL);
+ d->rd_tcollisions = rrddim_add(d->st_events, "collisions", NULL, -1, 1, RRDDIM_INCREMENTAL);
+ d->rd_tcarrier = rrddim_add(d->st_events, "carrier", NULL, -1, 1, RRDDIM_INCREMENTAL);
}
else rrdset_next(d->st_events);