Add ZFS rate charts (#13757)
Vladimir Kobal committed
Oct 4, 2022 at 15:08 UTC
08c3d24f79a14722e5a60998a2b487218abd54b9
2 files changed
+246
-6
collectors/all.h
+5
-5
@@ -195,11 +195,11 @@
195
#define NETDATA_CHART_PRIO_ZFS_IO 2700
196
#define NETDATA_CHART_PRIO_ZFS_HITS 2520
197
#define NETDATA_CHART_PRIO_ZFS_DHITS 2530
198
-#define NETDATA_CHART_PRIO_ZFS_DEMAND_DATA_HITS 2531
199
-#define NETDATA_CHART_PRIO_ZFS_PREFETCH_DATA_HITS 2532
200
-#define NETDATA_CHART_PRIO_ZFS_PHITS 2540
201
-#define NETDATA_CHART_PRIO_ZFS_MHITS 2550
202
-#define NETDATA_CHART_PRIO_ZFS_L2HITS 2560
198
+#define NETDATA_CHART_PRIO_ZFS_DEMAND_DATA_HITS 2540
199
+#define NETDATA_CHART_PRIO_ZFS_PREFETCH_DATA_HITS 2550
200
+#define NETDATA_CHART_PRIO_ZFS_PHITS 2560
201
+#define NETDATA_CHART_PRIO_ZFS_MHITS 2570
202
+#define NETDATA_CHART_PRIO_ZFS_L2HITS 2580
203
#define NETDATA_CHART_PRIO_ZFS_LIST_HITS 2600
204
#define NETDATA_CHART_PRIO_ZFS_HASH_ELEMENTS 2800
205
#define NETDATA_CHART_PRIO_ZFS_HASH_CHAINS 2810
collectors/proc.plugin/zfs_common.c
+241
-1
@@ -233,6 +233,36 @@ void generate_charts_arcstats(const char *plugin, const char *module, int show_z
233
rrddim_set_by_pointer(st_ahits, rd_ahits, arcstats.hits);
234
rrddim_set_by_pointer(st_ahits, rd_amisses, arcstats.misses);
235
rrdset_done(st_ahits);
236
+
237
+ static RRDSET *st_ahits_rate = NULL;
238
+ static RRDDIM *rd_ahits_rate = NULL;
239
+ static RRDDIM *rd_amisses_rate = NULL;
240
+
241
+ if (unlikely(!st_ahits_rate)) {
242
+ st_ahits_rate = rrdset_create_localhost(
243
+ "zfs"
244
+ , "hits_rate"
245
+ , NULL
246
+ , ZFS_FAMILY_EFFICIENCY
247
+ , NULL
248
+ , "ZFS ARC Hits Rate"
249
+ , "events/s"
250
+ , plugin
251
+ , module
252
+ , NETDATA_CHART_PRIO_ZFS_HITS + 1
253
+ , update_every
254
+ , RRDSET_TYPE_STACKED
255
+ );
256
+
257
+ rd_ahits_rate = rrddim_add(st_ahits_rate, "hits", NULL, 1, 1, RRD_ALGORITHM_INCREMENTAL);
258
+ rd_amisses_rate = rrddim_add(st_ahits_rate, "misses", NULL, 1, 1, RRD_ALGORITHM_INCREMENTAL);
259
+ }
260
+ else
261
+ rrdset_next(st_ahits_rate);
262
+
263
+ rrddim_set_by_pointer(st_ahits_rate, rd_ahits_rate, arcstats.hits);
264
+ rrddim_set_by_pointer(st_ahits_rate, rd_amisses_rate, arcstats.misses);
265
+ rrdset_done(st_ahits_rate);
266
}
267
268
// --------------------------------------------------------------------
@@ -269,6 +299,36 @@ void generate_charts_arcstats(const char *plugin, const char *module, int show_z
299
rrddim_set_by_pointer(st_dhits, rd_dhits, dhit);
300
rrddim_set_by_pointer(st_dhits, rd_dmisses, dmiss);
301
rrdset_done(st_dhits);
302
+
303
+ static RRDSET *st_dhits_rate = NULL;
304
+ static RRDDIM *rd_dhits_rate = NULL;
305
+ static RRDDIM *rd_dmisses_rate = NULL;
306
+
307
+ if (unlikely(!st_dhits_rate)) {
308
+ st_dhits_rate = rrdset_create_localhost(
309
+ "zfs"
310
+ , "dhits_rate"
311
+ , NULL
312
+ , ZFS_FAMILY_EFFICIENCY
313
+ , NULL
314
+ , "ZFS Demand Hits Rate"
315
+ , "events/s"
316
+ , plugin
317
+ , module
318
+ , NETDATA_CHART_PRIO_ZFS_DHITS + 1
319
+ , update_every
320
+ , RRDSET_TYPE_STACKED
321
+ );
322
+
323
+ rd_dhits_rate = rrddim_add(st_dhits_rate, "hits", NULL, 1, 1, RRD_ALGORITHM_INCREMENTAL);
324
+ rd_dmisses_rate = rrddim_add(st_dhits_rate, "misses", NULL, 1, 1, RRD_ALGORITHM_INCREMENTAL);
325
+ }
326
+ else
327
+ rrdset_next(st_dhits_rate);
328
+
329
+ rrddim_set_by_pointer(st_dhits_rate, rd_dhits_rate, dhit);
330
+ rrddim_set_by_pointer(st_dhits_rate, rd_dmisses_rate, dmiss);
331
+ rrdset_done(st_dhits_rate);
332
}
333
334
// --------------------------------------------------------------------
@@ -305,6 +365,36 @@ void generate_charts_arcstats(const char *plugin, const char *module, int show_z
365
rrddim_set_by_pointer(st_phits, rd_phits, phit);
366
rrddim_set_by_pointer(st_phits, rd_pmisses, pmiss);
367
rrdset_done(st_phits);
368
+
369
+ static RRDSET *st_phits_rate = NULL;
370
+ static RRDDIM *rd_phits_rate = NULL;
371
+ static RRDDIM *rd_pmisses_rate = NULL;
372
+
373
+ if (unlikely(!st_phits_rate)) {
374
+ st_phits_rate = rrdset_create_localhost(
375
+ "zfs"
376
+ , "phits_rate"
377
+ , NULL
378
+ , ZFS_FAMILY_EFFICIENCY
379
+ , NULL
380
+ , "ZFS Prefetch Hits Rate"
381
+ , "events/s"
382
+ , plugin
383
+ , module
384
+ , NETDATA_CHART_PRIO_ZFS_PHITS + 1
385
+ , update_every
386
+ , RRDSET_TYPE_STACKED
387
+ );
388
+
389
+ rd_phits_rate = rrddim_add(st_phits_rate, "hits", NULL, 1, 1, RRD_ALGORITHM_INCREMENTAL);
390
+ rd_pmisses_rate = rrddim_add(st_phits_rate, "misses", NULL, 1, 1, RRD_ALGORITHM_INCREMENTAL);
391
+ }
392
+ else
393
+ rrdset_next(st_phits_rate);
394
+
395
+ rrddim_set_by_pointer(st_phits_rate, rd_phits_rate, phit);
396
+ rrddim_set_by_pointer(st_phits_rate, rd_pmisses_rate, pmiss);
397
+ rrdset_done(st_phits_rate);
398
}
399
400
// --------------------------------------------------------------------
@@ -341,6 +431,36 @@ void generate_charts_arcstats(const char *plugin, const char *module, int show_z
431
rrddim_set_by_pointer(st_mhits, rd_mhits, mhit);
432
rrddim_set_by_pointer(st_mhits, rd_mmisses, mmiss);
433
rrdset_done(st_mhits);
434
+
435
+ static RRDSET *st_mhits_rate = NULL;
436
+ static RRDDIM *rd_mhits_rate = NULL;
437
+ static RRDDIM *rd_mmisses_rate = NULL;
438
+
439
+ if (unlikely(!st_mhits_rate)) {
440
+ st_mhits_rate = rrdset_create_localhost(
441
+ "zfs"
442
+ , "mhits_rate"
443
+ , NULL
444
+ , ZFS_FAMILY_EFFICIENCY
445
+ , NULL
446
+ , "ZFS Metadata Hits Rate"
447
+ , "events/s"
448
+ , plugin
449
+ , module
450
+ , NETDATA_CHART_PRIO_ZFS_MHITS + 1
451
+ , update_every
452
+ , RRDSET_TYPE_STACKED
453
+ );
454
+
455
+ rd_mhits_rate = rrddim_add(st_mhits_rate, "hits", NULL, 1, 1, RRD_ALGORITHM_INCREMENTAL);
456
+ rd_mmisses_rate = rrddim_add(st_mhits_rate, "misses", NULL, 1, 1, RRD_ALGORITHM_INCREMENTAL);
457
+ }
458
+ else
459
+ rrdset_next(st_mhits_rate);
460
+
461
+ rrddim_set_by_pointer(st_mhits_rate, rd_mhits_rate, mhit);
462
+ rrddim_set_by_pointer(st_mhits_rate, rd_mmisses_rate, mmiss);
463
+ rrdset_done(st_mhits_rate);
464
}
465
466
// --------------------------------------------------------------------
@@ -377,6 +497,36 @@ void generate_charts_arcstats(const char *plugin, const char *module, int show_z
497
rrddim_set_by_pointer(st_l2hits, rd_l2hits, l2hit);
498
rrddim_set_by_pointer(st_l2hits, rd_l2misses, l2miss);
499
rrdset_done(st_l2hits);
500
+
501
+ static RRDSET *st_l2hits_rate = NULL;
502
+ static RRDDIM *rd_l2hits_rate = NULL;
503
+ static RRDDIM *rd_l2misses_rate = NULL;
504
+
505
+ if (unlikely(!st_l2hits_rate)) {
506
+ st_l2hits_rate = rrdset_create_localhost(
507
+ "zfs"
508
+ , "l2hits_rate"
509
+ , NULL
510
+ , ZFS_FAMILY_EFFICIENCY
511
+ , NULL
512
+ , "ZFS L2 Hits Rate"
513
+ , "events/s"
514
+ , plugin
515
+ , module
516
+ , NETDATA_CHART_PRIO_ZFS_L2HITS + 1
517
+ , update_every
518
+ , RRDSET_TYPE_STACKED
519
+ );
520
+
521
+ rd_l2hits_rate = rrddim_add(st_l2hits_rate, "hits", NULL, 1, 1, RRD_ALGORITHM_INCREMENTAL);
522
+ rd_l2misses_rate = rrddim_add(st_l2hits_rate, "misses", NULL, 1, 1, RRD_ALGORITHM_INCREMENTAL);
523
+ }
524
+ else
525
+ rrdset_next(st_l2hits_rate);
526
+
527
+ rrddim_set_by_pointer(st_l2hits_rate, rd_l2hits_rate, l2hit);
528
+ rrddim_set_by_pointer(st_l2hits_rate, rd_l2misses_rate, l2miss);
529
+ rrdset_done(st_l2hits_rate);
530
}
531
532
// --------------------------------------------------------------------
@@ -620,6 +770,36 @@ void generate_charts_arc_summary(const char *plugin, const char *module, int sho
770
rrddim_set_by_pointer(st_actual_hits, rd_actual_hits, real_hits);
771
rrddim_set_by_pointer(st_actual_hits, rd_actual_misses, real_misses);
772
rrdset_done(st_actual_hits);
773
+
774
+ static RRDSET *st_actual_hits_rate = NULL;
775
+ static RRDDIM *rd_actual_hits_rate = NULL;
776
+ static RRDDIM *rd_actual_misses_rate = NULL;
777
+
778
+ if (unlikely(!st_actual_hits_rate)) {
779
+ st_actual_hits_rate = rrdset_create_localhost(
780
+ "zfs"
781
+ , "actual_hits_rate"
782
+ , NULL
783
+ , ZFS_FAMILY_EFFICIENCY
784
+ , NULL
785
+ , "ZFS Actual Cache Hits Rate"
786
+ , "events/s"
787
+ , plugin
788
+ , module
789
+ , NETDATA_CHART_PRIO_ZFS_ACTUAL_HITS + 1
790
+ , update_every
791
+ , RRDSET_TYPE_STACKED
792
+ );
793
+
794
+ rd_actual_hits_rate = rrddim_add(st_actual_hits_rate, "hits", NULL, 1, 1, RRD_ALGORITHM_INCREMENTAL);
795
+ rd_actual_misses_rate = rrddim_add(st_actual_hits_rate, "misses", NULL, 1, 1, RRD_ALGORITHM_INCREMENTAL);
796
+ }
797
+ else
798
+ rrdset_next(st_actual_hits_rate);
799
+
800
+ rrddim_set_by_pointer(st_actual_hits_rate, rd_actual_hits_rate, real_hits);
801
+ rrddim_set_by_pointer(st_actual_hits_rate, rd_actual_misses_rate, real_misses);
802
+ rrdset_done(st_actual_hits_rate);
803
}
804
805
// --------------------------------------------------------------------
@@ -656,6 +836,36 @@ void generate_charts_arc_summary(const char *plugin, const char *module, int sho
836
rrddim_set_by_pointer(st_demand_data_hits, rd_demand_data_hits, arcstats.demand_data_hits);
837
rrddim_set_by_pointer(st_demand_data_hits, rd_demand_data_misses, arcstats.demand_data_misses);
838
rrdset_done(st_demand_data_hits);
839
+
840
+ static RRDSET *st_demand_data_hits_rate = NULL;
841
+ static RRDDIM *rd_demand_data_hits_rate = NULL;
842
+ static RRDDIM *rd_demand_data_misses_rate = NULL;
843
+
844
+ if (unlikely(!st_demand_data_hits_rate)) {
845
+ st_demand_data_hits_rate = rrdset_create_localhost(
846
+ "zfs"
847
+ , "demand_data_hits_rate"
848
+ , NULL
849
+ , ZFS_FAMILY_EFFICIENCY
850
+ , NULL
851
+ , "ZFS Data Demand Efficiency Rate"
852
+ , "events/s"
853
+ , plugin
854
+ , module
855
+ , NETDATA_CHART_PRIO_ZFS_DEMAND_DATA_HITS + 1
856
+ , update_every
857
+ , RRDSET_TYPE_STACKED
858
+ );
859
+
860
+ rd_demand_data_hits_rate = rrddim_add(st_demand_data_hits_rate, "hits", NULL, 1, 1, RRD_ALGORITHM_INCREMENTAL);
861
+ rd_demand_data_misses_rate = rrddim_add(st_demand_data_hits_rate, "misses", NULL, 1, 1, RRD_ALGORITHM_INCREMENTAL);
862
+ }
863
+ else
864
+ rrdset_next(st_demand_data_hits_rate);
865
+
866
+ rrddim_set_by_pointer(st_demand_data_hits_rate, rd_demand_data_hits_rate, arcstats.demand_data_hits);
867
+ rrddim_set_by_pointer(st_demand_data_hits_rate, rd_demand_data_misses_rate, arcstats.demand_data_misses);
868
+ rrdset_done(st_demand_data_hits_rate);
869
}
870
871
// --------------------------------------------------------------------
@@ -693,6 +903,36 @@ void generate_charts_arc_summary(const char *plugin, const char *module, int sho
903
rrddim_set_by_pointer(st_prefetch_data_hits, rd_prefetch_data_hits, arcstats.prefetch_data_hits);
904
rrddim_set_by_pointer(st_prefetch_data_hits, rd_prefetch_data_misses, arcstats.prefetch_data_misses);
905
rrdset_done(st_prefetch_data_hits);
906
+
907
+ static RRDSET *st_prefetch_data_hits_rate = NULL;
908
+ static RRDDIM *rd_prefetch_data_hits_rate = NULL;
909
+ static RRDDIM *rd_prefetch_data_misses_rate = NULL;
910
+
911
+ if (unlikely(!st_prefetch_data_hits_rate)) {
912
+ st_prefetch_data_hits_rate = rrdset_create_localhost(
913
+ "zfs"
914
+ , "prefetch_data_hits_rate"
915
+ , NULL
916
+ , ZFS_FAMILY_EFFICIENCY
917
+ , NULL
918
+ , "ZFS Data Prefetch Efficiency Rate"
919
+ , "events/s"
920
+ , plugin
921
+ , module
922
+ , NETDATA_CHART_PRIO_ZFS_PREFETCH_DATA_HITS + 1
923
+ , update_every
924
+ , RRDSET_TYPE_STACKED
925
+ );
926
+
927
+ rd_prefetch_data_hits_rate = rrddim_add(st_prefetch_data_hits_rate, "hits", NULL, 1, 1, RRD_ALGORITHM_INCREMENTAL);
928
+ rd_prefetch_data_misses_rate = rrddim_add(st_prefetch_data_hits_rate, "misses", NULL, 1, 1, RRD_ALGORITHM_INCREMENTAL);
929
+ }
930
+ else
931
+ rrdset_next(st_prefetch_data_hits_rate);
932
+
933
+ rrddim_set_by_pointer(st_prefetch_data_hits_rate, rd_prefetch_data_hits_rate, arcstats.prefetch_data_hits);
934
+ rrddim_set_by_pointer(st_prefetch_data_hits_rate, rd_prefetch_data_misses_rate, arcstats.prefetch_data_misses);
935
+ rrdset_done(st_prefetch_data_hits_rate);
936
}
937
938
// --------------------------------------------------------------------
@@ -769,4 +1009,4 @@ void generate_charts_arc_summary(const char *plugin, const char *module, int sho
1009
1010
// --------------------------------------------------------------------
1011
772
-}
\ No newline at end of file
1012
+}