In this case, you can use B<ID_COLLECTD> attribute that is provided by
I<contrib/99-storage-collectd.rules> udev rule file instead.
+=item B<ReportDiscard> B<true>|B<false>
+
+Whether to submit discard metrics (/proc/diskstats 15-18), on Linux only.
+Requires Linux Kernel version > 4.18+.
+
+=item B<ReportFlush> B<true>|B<false>
+
+Whether to submit flush metrics (/proc/diskstats 19-20), on Linux only.
+Requires Linux Kernel version > 5.5+.
+
=back
=head2 Plugin C<dns>
} diskstats_t;
static diskstats_t *disklist;
+
+static bool report_discard;
+static bool report_flush;
/* #endif KERNEL_LINUX */
#elif KERNEL_FREEBSD
static struct gmesh geom_tree;
static struct udev *handle_udev;
#endif
-static const char *config_keys[] = {"Disk", "UseBSDName", "IgnoreSelected",
- "UdevNameAttr"};
+static const char *config_keys[] = {"Disk", "UseBSDName",
+ "IgnoreSelected", "UdevNameAttr",
+ "ReportDiscard", "ReportFlush"};
static int config_keys_num = STATIC_ARRAY_SIZE(config_keys);
static ignorelist_t *ignorelist;
#else
WARNING("disk plugin: The \"UdevNameAttr\" option is only supported "
"if collectd is built with libudev support");
+#endif
+ } else if (strcasecmp("ReportDiscard", key) == 0) {
+#if KERNEL_LINUX
+ report_discard = IS_TRUE(value);
+#else
+ WARNING("disk plugin: The \"ReportDiscard\" option is only supported "
+ "on Linux and will be ignored.");
+#endif
+ } else if (strcasecmp("ReportFlush", key) == 0) {
+#if KERNEL_LINUX
+ report_flush = IS_TRUE(value);
+#else
+ WARNING("disk plugin: The \"ReportFlush\" option is only supported "
+ "on Linux and will be ignored.");
#endif
} else {
return -1;
submit_in_progress(output_name, in_progress);
if (ds->has_io_time)
submit_io_time(output_name, io_time, weighted_time);
- if (ds->has_discard) {
+ if (report_discard && ds->has_discard) {
disk_submit_single(output_name, "disk_discard_ops", discard_ops);
disk_submit_single(output_name, "disk_discard_merged", discard_merged);
disk_submit_single(output_name, "disk_discard_sectors",
discard_sectors);
disk_submit_single(output_name, "disk_discard_time", discard_time);
}
- if (ds->has_flush) {
+ if (report_flush && ds->has_flush) {
disk_submit_single(output_name, "disk_flush_ops", flush_ops);
disk_submit_single(output_name, "disk_flush_time", flush_time);
}