Fix disk utilization and backlog charts (#10705)
Vladimir Kobal committed
Mar 3, 2021 at 16:02 UTC
9b48ae8690586d8fdba9c7e482bd4afe89461d36
3 files changed
+48
-7
collectors/all.h
+5
-4
@@ -105,10 +105,11 @@
105
#define NETDATA_CHART_PRIO_DISK_OPS 2001
106
#define NETDATA_CHART_PRIO_DISK_QOPS 2002
107
#define NETDATA_CHART_PRIO_DISK_BACKLOG 2003
108
-#define NETDATA_CHART_PRIO_DISK_UTIL 2004
109
-#define NETDATA_CHART_PRIO_DISK_AWAIT 2005
110
-#define NETDATA_CHART_PRIO_DISK_AVGSZ 2006
111
-#define NETDATA_CHART_PRIO_DISK_SVCTM 2007
108
+#define NETDATA_CHART_PRIO_DISK_BUSY 2004
109
+#define NETDATA_CHART_PRIO_DISK_UTIL 2005
110
+#define NETDATA_CHART_PRIO_DISK_AWAIT 2006
111
+#define NETDATA_CHART_PRIO_DISK_AVGSZ 2007
112
+#define NETDATA_CHART_PRIO_DISK_SVCTM 2008
113
#define NETDATA_CHART_PRIO_DISK_MOPS 2021
114
#define NETDATA_CHART_PRIO_DISK_IOTIME 2022
115
#define NETDATA_CHART_PRIO_BCACHE_CACHE_ALLOC 2120
collectors/proc.plugin/proc_diskstats.c
+38
-3
@@ -73,6 +73,9 @@ static struct disk {
73
RRDSET *st_backlog;
74
RRDDIM *rd_backlog_backlog;
75
76
+ RRDSET *st_busy;
77
+ RRDDIM *rd_busy_busy;
78
+
79
RRDSET *st_util;
80
RRDDIM *rd_util_utilization;
81
@@ -1094,7 +1097,7 @@ int do_proc_diskstats(int update_every, usec_t dt) {
1097
1098
rrdset_flag_set(d->st_backlog, RRDSET_FLAG_DETAIL);
1099
1097
- d->rd_backlog_backlog = rrddim_add(d->st_backlog, "backlog", NULL, 1, 10, RRD_ALGORITHM_INCREMENTAL);
1100
+ d->rd_backlog_backlog = rrddim_add(d->st_backlog, "backlog", NULL, 1, 1, RRD_ALGORITHM_INCREMENTAL);
1101
}
1102
else rrdset_next(d->st_backlog);
1103
@@ -1108,6 +1111,34 @@ int do_proc_diskstats(int update_every, usec_t dt) {
1111
(busy_ms || netdata_zero_metrics_enabled == CONFIG_BOOLEAN_YES))) {
1112
d->do_util = CONFIG_BOOLEAN_YES;
1113
1114
+ if(unlikely(!d->st_busy)) {
1115
+ d->st_busy = rrdset_create_localhost(
1116
+ "disk_busy"
1117
+ , d->device
1118
+ , d->disk
1119
+ , family
1120
+ , "disk.busy"
1121
+ , "Disk Busy Time"
1122
+ , "milliseconds"
1123
+ , PLUGIN_PROC_NAME
1124
+ , PLUGIN_PROC_MODULE_DISKSTATS_NAME
1125
+ , NETDATA_CHART_PRIO_DISK_BUSY
1126
+ , update_every
1127
+ , RRDSET_TYPE_AREA
1128
+ );
1129
+
1130
+ rrdset_flag_set(d->st_busy, RRDSET_FLAG_DETAIL);
1131
+
1132
+ d->rd_busy_busy =
1133
+ rrddim_add(d->st_busy, "busy", NULL, 1, 1, RRD_ALGORITHM_INCREMENTAL);
1134
+ }
1135
+ else rrdset_next(d->st_busy);
1136
+
1137
+ last_busy_ms = rrddim_set_by_pointer(d->st_busy, d->rd_busy_busy, busy_ms);
1138
+ rrdset_done(d->st_busy);
1139
+
1140
+ // --------------------------------------------------------------------
1141
+
1142
if(unlikely(!d->st_util)) {
1143
d->st_util = rrdset_create_localhost(
1144
"disk_util"
@@ -1126,11 +1157,15 @@ int do_proc_diskstats(int update_every, usec_t dt) {
1157
1158
rrdset_flag_set(d->st_util, RRDSET_FLAG_DETAIL);
1159
1129
- d->rd_util_utilization = rrddim_add(d->st_util, "utilization", NULL, 1, 10, RRD_ALGORITHM_INCREMENTAL);
1160
+ d->rd_util_utilization = rrddim_add(d->st_util, "utilization", NULL, 1, 1, RRD_ALGORITHM_ABSOLUTE);
1161
}
1162
else rrdset_next(d->st_util);
1163
1133
- last_busy_ms = rrddim_set_by_pointer(d->st_util, d->rd_util_utilization, busy_ms);
1164
+ collected_number disk_utilization = (busy_ms - last_busy_ms) / (10 * update_every);
1165
+ if (disk_utilization > 100)
1166
+ disk_utilization = 100;
1167
+
1168
+ rrddim_set_by_pointer(d->st_util, d->rd_util_utilization, disk_utilization);
1169
rrdset_done(d->st_util);
1170
}
1171
web/gui/dashboard_info.js
+5
@@ -1342,6 +1342,11 @@ netdataDashboard.context = {
1342
info: 'Disk Utilization measures the amount of time the disk was busy with something. This is not related to its performance. 100% means that the system always had an outstanding operation on the disk. Keep in mind that depending on the underlying technology of the disk, 100% here may or may not be an indication of congestion.'
1343
},
1344
1345
+ 'disk.busy': {
1346
+ colors: '#FF5588',
1347
+ info: 'Disk Busy Time measures the amount of time the disk was busy with something.'
1348
+ },
1349
+
1350
'disk.backlog': {
1351
colors: '#0099CC',
1352
info: 'Backlog is an indication of the duration of pending disk operations. On every I/O event the system is multiplying the time spent doing I/O since the last update of this field with the number of pending operations. While not accurate, this metric can provide an indication of the expected completion time of the operations in progress.'