1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 |
Influxdb Metrics for ZFS PoolsThe zpool_influxdb program produces influxdb line protocol
compatible metrics from zpools. In the UNIX tradition,
zpool_influxdb does one thing: read statistics from a pool and
print them to stdout. In many ways, this is a metrics-friendly output of
statistics normally observed via the UsageWhen run without arguments, zpool_influxdb runs once, reading data from all imported pools, and prints to stdout.
If no poolname is specified, then all pools are sampled.
Histogram Bucket ValuesThe histogram data collected by ZFS is stored as independent bucket values. This works well out-of-the-box with an influxdb data source and grafana's heatmap visualization. The influxdb query for a grafana heatmap visualization looks like:
Another method for storing histogram data sums the values for
lower-value buckets. For example, a latency bucket tagged "le=10"
includes the values in the bucket "le=1". This method is often used for
prometheus histograms. The
MeasurementsThe following measurements are collected:
zpool_stats Descriptionzpool_stats contains top-level summary statistics for the pool. Performance counters measure the I/Os to the pool's devices. zpool_stats Tags
zpool_stats Fields
zpool_scan_stats DescriptionOnce a pool has been scrubbed, resilvered, or rebuilt, the zpool_scan_stats contain information about the status and performance of the operation. Otherwise, the zpool_scan_stats do not exist in the kernel, and therefore cannot be reported by this collector. zpool_scan_stats Tags
zpool_scan_stats Fields
zpool_vdev_stats DescriptionThe ZFS I/O (ZIO) scheduler uses five queues to schedule I/Os to each vdev. These queues are further divided into active and pending states. An I/O is pending prior to being issued to the vdev. An active I/O has been issued to the vdev. The scheduler and its tunable parameters are described at the [ZFS documentation for ZIO Scheduler] (https://openzfs.github.io/openzfs-docs/Performance%20and%20Tuning/ZIO%20Scheduler.html) The ZIO scheduler reports the queue depths as gauges where the value represents an instantaneous snapshot of the queue depth at the sample time. Therefore, it is not unusual to see all zeroes for an idle pool. zpool_vdev_stats Tags
zpool_vdev_stats Fields
zpool_latency HistogramZFS tracks the latency of each I/O in the ZIO pipeline. This latency can be useful for observing latency-related issues that are not easily observed using the averaged latency statistics. The histogram fields show cumulative values from lowest to highest. The largest bucket is tagged "le=+Inf", representing the total count of I/Os by type and vdev. zpool_latency Histogram Tags
zpool_latency Histogram Fields
zpool_io_size HistogramZFS tracks I/O throughout the ZIO pipeline. The size of each I/O is used to create a histogram of the size by I/O type and vdev. For example, a 4KiB write to mirrored pool will show a 4KiB write to the top-level vdev (root) and a 4KiB write to each of the mirror leaf vdevs. The ZIO pipeline can aggregate I/O operations. For example, a contiguous series of writes can be aggregated into a single, larger I/O to the leaf vdev. The independent I/O operations reflect the logical operations and the aggregated I/O operations reflect the physical operations. The histogram fields show cumulative values from lowest to highest. The largest bucket is tagged "le=+Inf", representing the total count of I/Os by type and vdev. Note: trim I/Os can be larger than 16MiB, but the larger sizes are accounted in the 16MiB bucket. zpool_io_size Histogram Tags
zpool_io_size Histogram Fields
About unsigned integersTelegraf v1.6.2 and later support unsigned 64-bit integers which more
closely matches the uint64_t values used by ZFS. By default,
zpool_influxdb uses ZFS' uint64_t values and influxdb line protocol
unsigned integer type. If you are using old telegraf or influxdb where
unsigned integers are not available, use the Using zpool_influxdbThe simplest method is to use the execd input agent in telegraf. For older versions of telegraf which lack execd, the exec input agent can be used. For convenience, one of the sample config files below can be placed in the telegraf config-directory (often /etc/telegraf/telegraf.d). Telegraf can be restarted to read the config-directory files. Example telegraf execd configuration
Example telegraf exec configuration
Caveat Emptor
Other collectorsThere are a few other collectors for zpool statistics roaming around
the Internet. Many attempt to screen-scrape Feedback EncouragedPull requests and issues are greatly appreciated at https://github.com/openzfs/zfs |