@cryptotaxi247 / netdata-1 / commits / c3babf4dd

btrfs detailed physical disk stats for data, metadata and system

Costa Tsaousis (ktsaou) committed Dec 18, 2017 at 23:10 UTC c3babf4dd222480e0569432d3b0ffd37c189d64a
1 file changed +19 -8
src/sys_fs_btrfs.c
+19 -8
@@ -35,9 +35,13 @@ typedef struct btrfs_node {
35 unsigned long long int allocation_ ## FIELD;
36
37 RRDSET *st_allocation_disks;
38 - RRDDIM *rd_allocation_disks_used;
38 RRDDIM *rd_allocation_disks_unallocated;
40 - RRDDIM *rd_allocation_disks_free;
39 + RRDDIM *rd_allocation_disks_data_used;
40 + RRDDIM *rd_allocation_disks_data_free;
41 + RRDDIM *rd_allocation_disks_metadata_used;
42 + RRDDIM *rd_allocation_disks_metadata_free;
43 + RRDDIM *rd_allocation_disks_system_used;
44 + RRDDIM *rd_allocation_disks_system_free;
45 unsigned long long all_disks_total;
46
47 RRDSET *st_allocation_data;
@@ -549,19 +553,26 @@ int do_sys_fs_btrfs(int update_every, usec_t dt) {
553 );
554
555 node->rd_allocation_disks_unallocated = rrddim_add(node->st_allocation_disks, "unallocated", NULL, 1, 1024 * 1024, RRD_ALGORITHM_ABSOLUTE);
552 - node->rd_allocation_disks_used = rrddim_add(node->st_allocation_disks, "used", NULL, 1, 1024 * 1024, RRD_ALGORITHM_ABSOLUTE);
553 - node->rd_allocation_disks_free = rrddim_add(node->st_allocation_disks, "free", NULL, 1, 1024 * 1024, RRD_ALGORITHM_ABSOLUTE);
556 + node->rd_allocation_disks_data_used = rrddim_add(node->st_allocation_disks, "data_used", "data used", 1, 1024 * 1024, RRD_ALGORITHM_ABSOLUTE);
557 + node->rd_allocation_disks_data_free = rrddim_add(node->st_allocation_disks, "data_free", "data free", 1, 1024 * 1024, RRD_ALGORITHM_ABSOLUTE);
558 + node->rd_allocation_disks_metadata_used = rrddim_add(node->st_allocation_disks, "meta_used", "meta used", 1, 1024 * 1024, RRD_ALGORITHM_ABSOLUTE);
559 + node->rd_allocation_disks_metadata_free = rrddim_add(node->st_allocation_disks, "meta_free", "meta free", 1, 1024 * 1024, RRD_ALGORITHM_ABSOLUTE);
560 + node->rd_allocation_disks_system_used = rrddim_add(node->st_allocation_disks, "sys_used", "sys used", 1, 1024 * 1024, RRD_ALGORITHM_ABSOLUTE);
561 + node->rd_allocation_disks_system_free = rrddim_add(node->st_allocation_disks, "sys_free", "sys free", 1, 1024 * 1024, RRD_ALGORITHM_ABSOLUTE);
562 }
563 else rrdset_next(node->st_allocation_disks);
564
557 -
558 - unsigned long long disk_used = node->allocation_data_disk_used + node->allocation_metadata_disk_used + node->allocation_system_disk_used;
565 + // unsigned long long disk_used = node->allocation_data_disk_used + node->allocation_metadata_disk_used + node->allocation_system_disk_used;
566 unsigned long long disk_total = node->allocation_data_disk_total + node->allocation_metadata_disk_total + node->allocation_system_disk_total;
567 unsigned long long disk_unallocated = node->all_disks_total - disk_total;
568
569 rrddim_set_by_pointer(node->st_allocation_disks, node->rd_allocation_disks_unallocated, disk_unallocated);
563 - rrddim_set_by_pointer(node->st_allocation_disks, node->rd_allocation_disks_used, disk_used);
564 - rrddim_set_by_pointer(node->st_allocation_disks, node->rd_allocation_disks_free, disk_total - disk_used);
570 + rrddim_set_by_pointer(node->st_allocation_disks, node->rd_allocation_disks_data_used, node->allocation_data_disk_used);
571 + rrddim_set_by_pointer(node->st_allocation_disks, node->rd_allocation_disks_data_free, node->allocation_data_disk_total - node->allocation_data_disk_used);
572 + rrddim_set_by_pointer(node->st_allocation_disks, node->rd_allocation_disks_metadata_used, node->allocation_metadata_disk_used);
573 + rrddim_set_by_pointer(node->st_allocation_disks, node->rd_allocation_disks_metadata_free, node->allocation_metadata_disk_total - node->allocation_metadata_disk_used);
574 + rrddim_set_by_pointer(node->st_allocation_disks, node->rd_allocation_disks_system_used, node->allocation_system_disk_used);
575 + rrddim_set_by_pointer(node->st_allocation_disks, node->rd_allocation_disks_system_free, node->allocation_system_disk_total - node->allocation_system_disk_used);
576 rrdset_done(node->st_allocation_disks);
577 }
578