summaryrefslogtreecommitdiffstats
path: root/collectors/proc.plugin
diff options
context:
space:
mode:
Diffstat (limited to 'collectors/proc.plugin')
-rw-r--r--collectors/proc.plugin/README.md17
-rw-r--r--collectors/proc.plugin/ipc.c8
-rw-r--r--collectors/proc.plugin/metrics.csv271
-rw-r--r--collectors/proc.plugin/proc_diskstats.c46
-rw-r--r--collectors/proc.plugin/proc_interrupts.c2
-rw-r--r--collectors/proc.plugin/proc_loadavg.c2
-rw-r--r--collectors/proc.plugin/proc_mdstat.c6
-rw-r--r--collectors/proc.plugin/proc_net_dev.c4
-rw-r--r--collectors/proc.plugin/proc_net_rpc_nfs.c20
-rw-r--r--collectors/proc.plugin/proc_net_rpc_nfsd.c38
-rw-r--r--collectors/proc.plugin/proc_pagetypeinfo.c10
-rw-r--r--collectors/proc.plugin/proc_pressure.c15
-rw-r--r--collectors/proc.plugin/proc_softirqs.c2
-rw-r--r--collectors/proc.plugin/proc_spl_kstat_zfs.c11
-rw-r--r--collectors/proc.plugin/proc_stat.c38
-rw-r--r--collectors/proc.plugin/proc_sys_kernel_random_entropy_avail.c2
-rw-r--r--collectors/proc.plugin/proc_vmstat.c503
-rw-r--r--collectors/proc.plugin/sys_block_zram.c32
-rw-r--r--collectors/proc.plugin/sys_class_infiniband.c9
-rw-r--r--collectors/proc.plugin/sys_class_power_supply.c4
-rw-r--r--collectors/proc.plugin/sys_devices_system_edac_mc.c4
-rw-r--r--collectors/proc.plugin/sys_devices_system_node.c2
-rw-r--r--collectors/proc.plugin/sys_fs_btrfs.c542
-rw-r--r--collectors/proc.plugin/sys_kernel_mm_ksm.c8
24 files changed, 1396 insertions, 200 deletions
diff --git a/collectors/proc.plugin/README.md b/collectors/proc.plugin/README.md
index f03550604..6c1335a70 100644
--- a/collectors/proc.plugin/README.md
+++ b/collectors/proc.plugin/README.md
@@ -1,13 +1,10 @@
-<!--
-title: "OS provided metrics (proc.plugin)"
-custom_edit_url: "https://github.com/netdata/netdata/edit/master/collectors/proc.plugin/README.md"
-sidebar_label: "OS provided metrics (proc.plugin)"
-learn_status: "Published"
-learn_topic_type: "References"
-learn_rel_path: "References/Collectors references/System metrics"
--->
-
-# proc.plugin
+# OS provided metrics (proc.plugin)
+
+`proc.plugin` gathers metrics from the /proc and /sys folders in Linux systems, along with a few other endpoints, and is responsible for the bulk of the system metrics collected and visualized by Netdata.
+
+This plugin is not an external plugin, but one of Netdata's threads.
+
+In detail, it collects metrics from:
- `/proc/net/dev` (all network interfaces for all their values)
- `/proc/diskstats` (all disks for all their values)
diff --git a/collectors/proc.plugin/ipc.c b/collectors/proc.plugin/ipc.c
index adfc15be5..b166deba6 100644
--- a/collectors/proc.plugin/ipc.c
+++ b/collectors/proc.plugin/ipc.c
@@ -212,7 +212,7 @@ int ipc_msq_get_info(char *msg_filename, struct message_queue **message_queue_ro
// find the id in the linked list or create a new structure
int found = 0;
- unsigned long long id = str2ull(procfile_lineword(ff, l, 1));
+ unsigned long long id = str2ull(procfile_lineword(ff, l, 1), NULL);
for(msq = *message_queue_root; msq ; msq = msq->next) {
if(unlikely(id == msq->id)) {
found = 1;
@@ -227,8 +227,8 @@ int ipc_msq_get_info(char *msg_filename, struct message_queue **message_queue_ro
msq->id = id;
}
- msq->messages = str2ull(procfile_lineword(ff, l, 4));
- msq->bytes = str2ull(procfile_lineword(ff, l, 3));
+ msq->messages = str2ull(procfile_lineword(ff, l, 4), NULL);
+ msq->bytes = str2ull(procfile_lineword(ff, l, 3), NULL);
msq->found = 1;
}
@@ -268,7 +268,7 @@ int ipc_shm_get_info(char *shm_filename, struct shm_stats *shm) {
}
shm->segments++;
- shm->bytes += str2ull(procfile_lineword(ff, l, 3));
+ shm->bytes += str2ull(procfile_lineword(ff, l, 3), NULL);
}
return 0;
diff --git a/collectors/proc.plugin/metrics.csv b/collectors/proc.plugin/metrics.csv
new file mode 100644
index 000000000..ea0d1b364
--- /dev/null
+++ b/collectors/proc.plugin/metrics.csv
@@ -0,0 +1,271 @@
+metric,scope,dimensions,unit,description,chart_type,labels,plugin,module
+system.cpu,,"guest_nice, guest, steal, softirq, irq, user, system, nice, iowait, idle",percentage,Total CPU utilization,stacked,,proc.plugin,/proc/stat
+cpu.cpu,cpu core,"guest_nice, guest, steal, softirq, irq, user, system, nice, iowait, idle",percentage,Core utilization,stacked,cpu,proc.plugin,/proc/stat
+system.intr,,interrupts,interrupts/s,CPU Interrupts,line,,proc.plugin,/proc/stat
+system.ctxt,,switches,context switches/s,CPU Context Switches,line,,proc.plugin,/proc/stat
+system.forks,,started,processes/s,Started Processes,line,,proc.plugin,/proc/stat
+system.processes,,"running, blocked",processes,System Processes,line,,proc.plugin,/proc/stat
+cpu.core_throttling,,a dimension per cpu core,events/s,Core Thermal Throttling Events,line,,proc.plugin,/proc/stat
+cpu.package_throttling,,a dimension per package,events/s,Package Thermal Throttling Events,line,,proc.plugin,/proc/stat
+cpu.cpufreq,,a dimension per cpu core,MHz,Current CPU Frequency,line,,proc.plugin,/proc/stat
+cpuidle.cpu_cstate_residency_time,cpu core,a dimension per c-state,percentage,C-state residency time,stacked,cpu,proc.plugin,/proc/stat
+system.entropy,,entropy,entropy,Available Entropy,line,,proc.plugin,/proc/sys/kernel/random/entropy_avail
+system.uptime,,uptime,seconds,System Uptime,line,,proc.plugin,/proc/uptime
+system.swapio,,"in, out",KiB/s,Swap I/O,area,,proc.plugin,/proc/vmstat
+system.pgpgio,,"in, out",KiB/s,Memory Paged from/to disk,area,,proc.plugin,/proc/vmstat
+system.pgfaults,,"minor, major",faults/s,Memory Page Faults,line,,proc.plugin,/proc/vmstat
+system.interrupts,,a dimension per device,interrupts/s,System interrupts,stacked,,proc.plugin,/proc/interrupts
+cpu.interrupts,cpu core,a dimension per device,interrupts/s,CPU interrupts,stacked,cpu,proc.plugin,/proc/interrupts
+system.load,,"load1, load5, load15",load,System Load Average,line,,proc.plugin,/proc/loadavg
+system.active_processes,,active,processes,System Active Processes,line,,proc.plugin,/proc/loadavg
+system.cpu_some_pressure,,"some10, some60, some300",percentage,"CPU some pressure",line,,proc.plugin,/proc/pressure
+system.cpu_some_pressure_stall_time,,time,ms,"CPU some pressure stall time",line,,proc.plugin,/proc/pressure
+system.cpu_full_pressure,,"some10, some60, some300",percentage,"CPU full pressure",line,,proc.plugin,/proc/pressure
+system.cpu_full_pressure_stall_time,,time,ms,"CPU full pressure stall time",line,,proc.plugin,/proc/pressure
+system.memory_some_pressure,,"some10, some60, some300",percentage,"Memory some pressure",line,,proc.plugin,/proc/pressure
+system.memory_some_pressure_stall_time,,time,ms,"Memory some pressure stall time",line,,proc.plugin,/proc/pressure
+system.memory_full_pressure,,"some10, some60, some300",percentage,"Memory full pressure",line,,proc.plugin,/proc/pressure
+system.memory_full_pressure_stall_time,,time,ms,"Memory full pressure stall time",line,,proc.plugin,/proc/pressure
+system.io_some_pressure,,"some10, some60, some300",percentage,"I/O some pressure",line,,proc.plugin,/proc/pressure
+system.io_some_pressure_stall_time,,time,ms,"I/O some pressure stall time",line,,proc.plugin,/proc/pressure
+system.io_full_pressure,,"some10, some60, some300",percentage,"I/O some pressure",line,,proc.plugin,/proc/pressure
+system.io_full_pressure_stall_time,,time,ms,"I/O some pressure stall time",line,,proc.plugin,/proc/pressure
+system.softirqs,,a dimension per softirq,softirqs/s,System softirqs,stacked,,proc.plugin,/proc/softirqs
+cpu.softirqs,cpu core,a dimension per softirq,softirqs/s,CPU softirqs,stacked,cpu,proc.plugin,/proc/softirqs
+system.softnet_stat,,"processed, dropped, squeezed, received_rps, flow_limit_count",events/s,System softnet_stat,line,,proc.plugin,/proc/net/softnet_stat
+cpu.softnet_stat,cpu core,"processed, dropped, squeezed, received_rps, flow_limit_count",events/s,CPU softnet_stat,line,,proc.plugin,/proc/net/softnet_stat
+system.ram,,"free, used, cached, buffers",MiB,System RAM,stacked,,proc.plugin,/proc/meminfo
+mem.available,,avail,MiB,Available RAM for applications,area,,proc.plugin,/proc/meminfo
+system.swap,,"free, used",MiB,System Swap,stacked,,proc.plugin,/proc/meminfo
+mem.hwcorrupt,,HardwareCorrupted,MiB,Corrupted Memory detected by ECC,line,,proc.plugin,/proc/meminfo
+mem.commited,,Commited_AS,MiB,Committed (Allocated) Memory,area,,proc.plugin,/proc/meminfo
+mem.writeback,,"Dirty, Writeback, FuseWriteback, NfsWriteback, Bounce",MiB,Writeback Memory,line,,proc.plugin,/proc/meminfo
+mem.kernel,,"Slab, KernelStack, PageTables, VmallocUsed, Percpu",MiB,Memory Used by Kernel,stacked,,proc.plugin,/proc/meminfo
+mem.slab,,"reclaimable, unreclaimable",MiB,Reclaimable Kernel Memory,stacked,,proc.plugin,/proc/meminfo
+mem.hugepage,,"free, used, surplus, reserved",MiB,Dedicated HugePages Memory,stacked,,proc.plugin,/proc/meminfo
+mem.transparent_hugepages,,"anonymous, shmem",MiB,Transparent HugePages Memory,stacked,,proc.plugin,/proc/meminfo
+mem.balloon,,"inflate, deflate, migrate",KiB/s,Memory Ballooning Operations,line,,proc.plugin,/proc/vmstat
+mem.zswapio,,"in, out",KiB/s,ZSwap I/O,area,,proc.plugin,/proc/vmstat
+mem.ksm_cow,,"swapin, write",KiB/s,KSM Copy On Write Operations,line,,proc.plugin,/proc/vmstat
+mem.thp_faults,,"alloc, fallback, fallback_charge",events/s,Transparent Huge Page Fault Allocations,line,,proc.plugin,/proc/vmstat
+mem.thp_file,,"alloc, fallback, mapped, fallback_charge",events/s,Transparent Huge Page File Allocations,line,,proc.plugin,/proc/vmstat
+mem.thp_zero,,"alloc, failed",events/s,Transparent Huge Zero Page Allocations,line,,proc.plugin,/proc/vmstat
+mem.thp_collapse,,"alloc, failed",events/s,Transparent Huge Pages Collapsed by khugepaged,line,,proc.plugin,/proc/vmstat
+mem.thp_split,,"split, failed, split_pmd, split_deferred",events/s,Transparent Huge Page Splits,line,,proc.plugin,/proc/vmstat
+mem.thp_swapout,,"swapout, fallback",events/s,Transparent Huge Pages Swap Out,line,,proc.plugin,/proc/vmstat
+mem.thp_compact,,"success, fail, stall",events/s,Transparent Huge Pages Compaction,line,,proc.plugin,/proc/vmstat
+mem.pagetype_global,,a dimension per pagesize,B,System orders available,stacked,,proc.plugin,/proc/pagetypeinfo
+mem.pagetype,"node, zone, type",a dimension per pagesize,B,"pagetype_Node{node}_{zone}_{type}",stacked,"node_id, node_zone, node_type",proc.plugin,/proc/pagetypeinfo
+mem.oom_kill,,kills,kills/s,Out of Memory Kills,line,,proc.plugin,/proc/vmstat
+mem.numa,,"local, foreign, interleave, other, pte_updates, huge_pte_updates, hint_faults, hint_faults_local, pages_migrated",events/s,NUMA events,line,,proc.plugin,/proc/vmstat
+mem.ecc_ce,,a dimension per mem controller,errors,ECC Memory Correctable Errors,line,,proc.plugin,/sys/devices/system/edac/mc
+mem.ecc_ue,,a dimension per mem controller,errors,ECC Memory Uncorrectable Errors,line,,proc.plugin,/sys/devices/system/edac/mc
+mem.numa_nodes,numa node,"hit, miss, local, foreign, interleave, other",events/s,NUMA events,line,numa_node,proc.plugin,/sys/devices/system/node
+mem.ksm,,"shared, unshared, sharing, volatile",MiB,Kernel Same Page Merging,stacked,,proc.plugin,/sys/kernel/mm/ksm
+mem.ksm_savings,,"savings, offered",MiB,Kernel Same Page Merging Savings,area,,proc.plugin,/sys/kernel/mm/ksm
+mem.ksm_ratios,,savings,percentage,Kernel Same Page Merging Effectiveness,line,,proc.plugin,/sys/kernel/mm/ksm
+mem.zram_usage,zram device,"compressed, metadata",MiB,ZRAM Memory Usage,area,device,proc.plugin,/sys/block/zram
+mem.zram_savings,zram device,"savings, original",MiB,ZRAM Memory Savings,area,device,proc.plugin,/sys/block/zram
+mem.zram_ratio,zram device,ratio,ratio,ZRAM Compression Ratio (original to compressed),line,device,proc.plugin,/sys/block/zram
+mem.zram_efficiency,zram device,percent,percentage,ZRAM Efficiency,line,device,proc.plugin,/sys/block/zram
+system.ipc_semaphores,,semaphores,semaphores,IPC Semaphores,area,,proc.plugin,ipc
+system.ipc_semaphore_arrays,,arrays,arrays,IPC Semaphore Arrays,area,,proc.plugin,ipc
+system.message_queue_message,,a dimension per queue,messages,IPC Message Queue Number of Messages,stacked,,proc.plugin,ipc
+system.message_queue_bytes,,a dimension per queue,bytes,IPC Message Queue Used Bytes,stacked,,proc.plugin,ipc
+system.shared_memory_segments,,segments,segments,IPC Shared Memory Number of Segments,stacked,,proc.plugin,ipc
+system.shared_memory_bytes,,bytes,bytes,IPC Shared Memory Used Bytes,stacked,,proc.plugin,ipc
+system.io,,"in, out",KiB/s,Disk I/O,area,,proc.plugin,/proc/diskstats
+disk.io,disk,"reads, writes",KiB/s,Disk I/O Bandwidth,area,"device, mount_point, device_type",proc.plugin,/proc/diskstats
+disk_ext.io,disk,discards,KiB/s,Amount of Discarded Data,area,"device, mount_point, device_type",proc.plugin,/proc/diskstats
+disk.ops,disk,"reads, writes",operations/s,Disk Completed I/O Operations,line,"device, mount_point, device_type",proc.plugin,/proc/diskstats
+disk_ext.ops,disk,"discards, flushes",operations/s,Disk Completed Extended I/O Operations,line,"device, mount_point, device_type",proc.plugin,/proc/diskstats
+disk.qops,disk,operations,operations,Disk Current I/O Operations,line,"device, mount_point, device_type",proc.plugin,/proc/diskstats
+disk.backlog,disk,backlog,milliseconds,Disk Backlog,area,"device, mount_point, device_type",proc.plugin,/proc/diskstats
+disk.busy,disk,busy,milliseconds,Disk Busy Time,area,"device, mount_point, device_type",proc.plugin,/proc/diskstats
+disk.util,disk,utilization,% of time working,Disk Utilization Time,area,"device, mount_point, device_type",proc.plugin,/proc/diskstats
+disk.mops,disk,"reads, writes",merged operations/s,Disk Merged Operations,line,"device, mount_point, device_type",proc.plugin,/proc/diskstats
+disk_ext.mops,disk,discards,merged operations/s,Disk Merged Discard Operations,line,"device, mount_point, device_type",proc.plugin,/proc/diskstats
+disk.iotime,disk,"reads, writes",milliseconds/s,Disk Total I/O Time,line,"device, mount_point, device_type",proc.plugin,/proc/diskstats
+disk_ext.iotime,disk,"discards, flushes",milliseconds/s,Disk Total I/O Time for Extended Operations,line,"device, mount_point, device_type",proc.plugin,/proc/diskstats
+disk.await,disk,"reads, writes",milliseconds/operation,Average Completed I/O Operation Time,line,"device, mount_point, device_type",proc.plugin,/proc/diskstats
+disk_ext.await,disk,"discards, flushes",milliseconds/operation,Average Completed Extended I/O Operation Time,line,"device, mount_point, device_type",proc.plugin,/proc/diskstats
+disk.avgsz,disk,"reads, writes",KiB/operation,Average Completed I/O Operation Bandwidth,area,"device, mount_point, device_type",proc.plugin,/proc/diskstats
+disk_ext.avgsz,disk,discards,KiB/operation,Average Amount of Discarded Data,area,"device, mount_point, device_type",proc.plugin,/proc/diskstats
+disk.svctm,disk,svctm,milliseconds/operation,Average Service Time,line,"device, mount_point, device_type",proc.plugin,/proc/diskstats
+disk.bcache_cache_alloc,disk,"ununsed, dirty, clean, metadata, undefined",percentage,BCache Cache Allocations,stacked,,proc.plugin,/proc/diskstats
+disk.bcache_hit_ratio,disk,"5min, 1hour, 1day, ever",percentage,BCache Cache Hit Ratio,line,"device, mount_point, device_type",proc.plugin,/proc/diskstats
+disk.bcache_rates,disk,"congested, writeback",KiB/s,BCache Rates,area,"device, mount_point, device_type",proc.plugin,/proc/diskstats
+disk.bcache_size,disk,dirty,MiB,BCache Cache Sizes,area,"device, mount_point, device_type",proc.plugin,/proc/diskstats
+disk.bcache_usage,disk,avail,percentage,BCache Cache Usage,area,"device, mount_point, device_type",proc.plugin,/proc/diskstats
+disk.bcache_cache_read_races,disk,"races, errors",operations/s,BCache Cache Read Races,line,"device, mount_point, device_type",proc.plugin,/proc/diskstats
+disk.bcache,disk,"hits, misses, collisions, readaheads",operations/s,BCache Cache I/O Operations,line,"device, mount_point, device_type",proc.plugin,/proc/diskstats
+disk.bcache_bypass,disk,"hits, misses",operations/s,BCache Cache Bypass I/O Operations,line,"device, mount_point, device_type",proc.plugin,/proc/diskstats
+md.health,,a dimension per md array,failed disks,Faulty Devices In MD,line,,proc.plugin,/proc/mdstat
+md.disks,md array,"inuse, down",disks,Disks Stats,stacked,"device, raid_level",proc.plugin,/proc/mdstat
+md.mismatch_cnt,md array,count,unsynchronized blocks,Mismatch Count,line,"device, raid_level",proc.plugin,/proc/mdstat
+md.status,md array,"check, resync, recovery, reshape",percent,Current Status,line,"device, raid_level",proc.plugin,/proc/mdstat
+md.expected_time_until_operation_finish,md array,finish_in,seconds,Approximate Time Until Finish,line,"device, raid_level",proc.plugin,/proc/mdstat
+md.operation_speed,md array,speed,KiB/s,Operation Speed,line,"device, raid_level",proc.plugin,/proc/mdstat
+md.nonredundant,md array,available,boolean,Nonredundant Array Availability,line,"device, raid_level",proc.plugin,/proc/mdstat
+system.net,,"received, sent",kilobits/s,Physical Network Interfaces Aggregated Bandwidth,area,,proc.plugin,/proc/net/dev
+net.net,network device,"received, sent",kilobits/s,Bandwidth,area,"interface_type, device",proc.plugin,/proc/net/dev
+net.speed,network device,speed,kilobits/s,Interface Speed,line,"interface_type, device",proc.plugin,/proc/net/dev
+net.duplex,network device,"full, half, unknown",state,Interface Duplex State,line,"interface_type, device",proc.plugin,/proc/net/dev
+net.operstate,network device,"up, down, notpresent, lowerlayerdown, testing, dormant, unknown",state,Interface Operational State,line,"interface_type, device",proc.plugin,/proc/net/dev
+net.carrier,network device,"up, down",state,Interface Physical Link State,line,"interface_type, device",proc.plugin,/proc/net/dev
+net.mtu,network device,mtu,octets,Interface MTU,line,"interface_type, device",proc.plugin,/proc/net/dev
+net.packets,network device,"received, sent, multicast",packets/s,Packets,line,"interface_type, device",proc.plugin,/proc/net/dev
+net.errors,network device,"inbound, outbound",errors/s,Interface Errors,line,"interface_type, device",proc.plugin,/proc/net/dev
+net.drops,network device,"inbound, outbound",drops/s,Interface Drops,line,"interface_type, device",proc.plugin,/proc/net/dev
+net.fifo,network device,"receive, transmit",errors,Interface FIFO Buffer Errors,line,"interface_type, device",proc.plugin,/proc/net/dev
+net.compressed,network device,"received, sent",packets/s,Compressed Packets,line,"interface_type, device",proc.plugin,/proc/net/dev
+net.events,network device,"frames, collisions, carrier",events/s,Network Interface Events,line,"interface_type, device",proc.plugin,/proc/net/dev
+wireless.status,wireless device,status,status,Internal status reported by interface.,line,,proc.plugin,/proc/net/wireless
+wireless.link_quality,wireless device,link_quality,value,"Overall quality of the link. This is an aggregate value, and depends on the driver and hardware.",line,,proc.plugin,/proc/net/wireless
+wireless.signal_level,wireless device,signal_level,dBm,"The signal level is the wireless signal power level received by the wireless client. The closer the value is to 0, the stronger the signal.",line,,proc.plugin,/proc/net/wireless
+wireless.noise_level,wireless device,noise_level,dBm,"The noise level indicates the amount of background noise in your environment. The closer the value to 0, the greater the noise level.",line,,proc.plugin,/proc/net/wireless
+wireless.discarded_packets,wireless device,"nwid, crypt, frag, retry, misc",packets/s,"Packet discarded in the wireless adapter due to wireless specific problems.",line,,proc.plugin,/proc/net/wireless
+wireless.missed_beacons,wireless device,missed_beacons,frames/s,Number of missed beacons.,line,,proc.plugin,/proc/net/wireless
+ib.bytes,infiniband port,"Received, Sent",kilobits/s,Bandwidth usage,area,,proc.plugin,/sys/class/infiniband
+ib.packets,infiniband port,"Received, Sent, Mcast_rcvd, Mcast_sent, Ucast_rcvd, Ucast_sent",packets/s,Packets Statistics,area,,proc.plugin,/sys/class/infiniband
+ib.errors,infiniband port,"Pkts_malformated, Pkts_rcvd_discarded, Pkts_sent_discarded, Tick_Wait_to_send, Pkts_missed_resource, Buffer_overrun, Link_Downed, Link_recovered, Link_integrity_err, Link_minor_errors, Pkts_rcvd_with_EBP, Pkts_rcvd_discarded_by_switch, Pkts_sent_discarded_by_switch",errors/s,Error Counters,line,,proc.plugin,/sys/class/infiniband
+ib.hwerrors,infiniband port,"Duplicated_packets, Pkt_Seq_Num_gap, Ack_timer_expired, Drop_missing_buffer, Drop_out_of_sequence, NAK_sequence_rcvd, CQE_err_Req, CQE_err_Resp, CQE_Flushed_err_Req, CQE_Flushed_err_Resp, Remote_access_err_Req, Remote_access_err_Resp, Remote_invalid_req, Local_length_err_Resp, RNR_NAK_Packets, CNP_Pkts_ignored, RoCE_ICRC_Errors",errors/s,Hardware Errors,line,,proc.plugin,/sys/class/infiniband
+ib.hwpackets,infiniband port,"RoCEv2_Congestion_sent, RoCEv2_Congestion_rcvd, IB_Congestion_handled, ATOMIC_req_rcvd, Connection_req_rcvd, Read_req_rcvd, Write_req_rcvd, RoCE_retrans_adaptive, RoCE_retrans_timeout, RoCE_slow_restart, RoCE_slow_restart_congestion, RoCE_slow_restart_count",packets/s,Hardware Packets Statistics,line,,proc.plugin,/sys/class/infiniband
+system.ip,,"received, sent",kilobits/s,IP Bandwidth,area,,proc.plugin,/proc/net/netstat
+ip.inerrors,,"noroutes, truncated, checksum",packets/s,IP Input Errors,line,,proc.plugin,/proc/net/netstat
+ip.mcast,,"received, sent",kilobits/s,IP Multicast Bandwidth,area,,proc.plugin,/proc/net/netstat
+ip.bcast,,"received, sent",kilobits/s,IP Broadcast Bandwidth,area,,proc.plugin,/proc/net/netstat
+ip.mcastpkts,,"received, sent",packets/s,IP Multicast Packets,line,,proc.plugin,/proc/net/netstat
+ip.bcastpkts,,"received, sent",packets/s,IP Broadcast Packets,line,,proc.plugin,/proc/net/netstat
+ip.ecnpkts,,"CEP, NoECTP, ECTP0, ECTP1",packets/s,IP ECN Statistics,line,,proc.plugin,/proc/net/netstat
+ip.tcpmemorypressures,,pressures,events/s,TCP Memory Pressures,line,,proc.plugin,/proc/net/netstat
+ip.tcpconnaborts,,"baddata, userclosed, nomemory, timeout, linger, failed",connections/s,TCP Connection Aborts,line,,proc.plugin,/proc/net/netstat
+ip.tcpreorders,,"timestamp, sack, fack, reno",packets/s,TCP Reordered Packets by Detection Method,line,,proc.plugin,/proc/net/netstat
+ip.tcpofo,,"inqueue, dropped, merged, pruned",packets/s,TCP Out-Of-Order Queue,line,,proc.plugin,/proc/net/netstat
+ip.tcpsyncookies,,"received, sent, failed",packets/s,TCP SYN Cookies,line,,proc.plugin,/proc/net/netstat
+ip.tcp_syn_queue,,"drops, cookies",packets/s,TCP SYN Queue Issues,line,,proc.plugin,/proc/net/netstat
+ip.tcp_accept_queue,,"overflows, drops",packets/s,TCP Accept Queue Issues,line,,proc.plugin,/proc/net/netstat
+ipv4.packets,,"received, sent, forwarded, delivered",packets/s,IPv4 Packets,line,,proc.plugin,/proc/net/netstat
+ipv4.fragsout,,"ok, failed, created",packets/s,IPv4 Fragments Sent,line,,proc.plugin,/proc/net/netstat
+ipv4.fragsin,,"ok, failed, all",packets/s,IPv4 Fragments Reassembly,line,,proc.plugin,/proc/net/netstat
+ipv4.errors,,"InDiscards, OutDiscards, InHdrErrors, OutNoRoutes, InAddrErrors, InUnknownProtos",packets/s,IPv4 Errors,line,,proc.plugin,/proc/net/netstat
+ipv4.icmp,,"received, sent",packets/s,IPv4 ICMP Packets,line,,proc.plugin,/proc/net/netstat
+ipv4.icmp_errors,,"InErrors, OutErrors, InCsumErrors",packets/s,IPv4 ICMP Errors,line,,proc.plugin,/proc/net/netstat
+ipv4.icmpmsg,,"InEchoReps, OutEchoReps, InDestUnreachs, OutDestUnreachs, InRedirects, OutRedirects, InEchos, OutEchos, InRouterAdvert, OutRouterAdvert, InRouterSelect, OutRouterSelect, InTimeExcds, OutTimeExcds, InParmProbs, OutParmProbs, InTimestamps, OutTimestamps, InTimestampReps, OutTimestampReps",packets/s,IPv4 ICMP Messages,line,,proc.plugin,/proc/net/netstat
+ipv4.tcpsock,,connections,active connections,IPv4 TCP Connections,line,,proc.plugin,/proc/net/netstat
+ipv4.tcppackets,,"received, sent",packets/s,IPv4 TCP Packets,line,,proc.plugin,/proc/net/netstat
+ipv4.tcperrors,,"InErrs, InCsumErrors, RetransSegs",packets/s,IPv4 TCP Errors,line,,proc.plugin,/proc/net/netstat
+ipv4.tcpopens,,"active, passive",connections/s,IPv4 TCP Opens,line,,proc.plugin,/proc/net/netstat
+ipv4.tcphandshake,,"EstabResets, OutRsts, AttemptFails, SynRetrans",events/s,IPv4 TCP Handshake Issues,line,,proc.plugin,/proc/net/netstat
+ipv4.udppackets,,"received, sent",packets/s,IPv4 UDP Packets,line,,proc.plugin,/proc/net/netstat
+ipv4.udperrors,,"RcvbufErrors, SndbufErrors, InErrors, NoPorts, InCsumErrors, IgnoredMulti",events/s,IPv4 UDP Errors,line,,proc.plugin,/proc/net/netstat
+ipv4.udplite,,"received, sent",packets/s,IPv4 UDPLite Packets,line,,proc.plugin,/proc/net/netstat
+ipv4.udplite_errors,,"RcvbufErrors, SndbufErrors, InErrors, NoPorts, InCsumErrors, IgnoredMulti",packets/s,IPv4 UDPLite Errors,line,,proc.plugin,/proc/net/netstat
+system.ipv6,,"received, sent",kilobits/s,IPv6 Bandwidth,area,,proc.plugin,/proc/net/netstat
+system.ipv6,,"received, sent, forwarded, delivers",packets/s,IPv6 Packets,line,,proc.plugin,/proc/net/netstat
+ipv6.fragsout,,"ok, failed, all",packets/s,IPv6 Fragments Sent,line,,proc.plugin,/proc/net/netstat
+ipv6.fragsin,,"ok, failed, timeout, all",packets/s,IPv6 Fragments Reassembly,line,,proc.plugin,/proc/net/netstat
+ipv6.errors,,"InDiscards, OutDiscards, InHdrErrors, InAddrErrors, InUnknownProtos, InTooBigErrors, InTruncatedPkts, InNoRoutes, OutNoRoutes",packets/s,IPv6 Errors,line,,proc.plugin,/proc/net/netstat
+ipv6.udppackets,,"received, sent",packets/s,IPv6 UDP Packets,line,,proc.plugin,/proc/net/netstat
+ipv6.udperrors,,"RcvbufErrors, SndbufErrors, InErrors, NoPorts, InCsumErrors, IgnoredMulti",events/s,IPv6 UDP Errors,line,,proc.plugin,/proc/net/netstat
+ipv6.udplitepackets,,"received, sent",packets/s,IPv6 UDPlite Packets,line,,proc.plugin,/proc/net/netstat
+ipv6.udpliteerrors,,"RcvbufErrors, SndbufErrors, InErrors, NoPorts, InCsumErrors",events/s,IPv6 UDP Lite Errors,line,,proc.plugin,/proc/net/netstat
+ipv6.mcast,,"received, sent",kilobits/s,IPv6 Multicast Bandwidth,area,,proc.plugin,/proc/net/netstat
+ipv6.bcast,,"received, sent",kilobits/s,IPv6 Broadcast Bandwidth,area,,proc.plugin,/proc/net/netstat
+ipv6.mcastpkts,,"received, sent",packets/s,IPv6 Multicast Packets,line,,proc.plugin,/proc/net/netstat
+ipv6.icmp,,"received, sent",messages/s,IPv6 ICMP Messages,line,,proc.plugin,/proc/net/netstat
+ipv6.icmpredir,,"received, sent",redirects/s,IPv6 ICMP Redirects,line,,proc.plugin,/proc/net/netstat
+ipv6.icmperrors,,"InErrors, OutErrors, InCsumErrors, InDestUnreachs, InPktTooBigs, InTimeExcds, InParmProblems, OutDestUnreachs, OutPktTooBigs, OutTimeExcds, OutParmProblems",errors/s,IPv6 ICMP Errors,line,,proc.plugin,/proc/net/netstat
+ipv6.icmpechos,,"InEchos, OutEchos, InEchoReplies, OutEchoReplies",messages/s,IPv6 ICMP Echo,line,,proc.plugin,/proc/net/netstat
+ipv6.groupmemb,,"InQueries, OutQueries, InResponses, OutResponses, InReductions, OutReductions",messages/s,IPv6 ICMP Group Membership,line,,proc.plugin,/proc/net/netstat
+ipv6.icmprouter,,"InSolicits, OutSolicits, InAdvertisements, OutAdvertisements",messages/s,IPv6 Router Messages,line,,proc.plugin,/proc/net/netstat
+ipv6.icmpneighbor,,"InSolicits, OutSolicits, InAdvertisements, OutAdvertisements",messages/s,IPv6 Neighbor Messages,line,,proc.plugin,/proc/net/netstat
+ipv6.icmpmldv2,,"received, sent",reports/s,IPv6 ICMP MLDv2 Reports,line,,proc.plugin,/proc/net/netstat
+ipv6.icmptypes,,"InType1, InType128, InType129, InType136, OutType1, OutType128, OutType129, OutType133, OutType135, OutType143",messages/s,IPv6 ICMP Types,line,,proc.plugin,/proc/net/netstat
+ipv6.ect,,"InNoECTPkts, InECT1Pkts, InECT0Pkts, InCEPkts",packets/s,IPv6 ECT Packets,line,,proc.plugin,/proc/net/netstat
+ipv6.ect,,"InNoECTPkts, InECT1Pkts, InECT0Pkts, InCEPkts",packets/s,IPv6 ECT Packets,line,,proc.plugin,/proc/net/netstat
+ipv4.sockstat_sockets,,used,sockets,IPv4 Sockets Used,line,,proc.plugin,/proc/net/sockstat
+ipv4.sockstat_tcp_sockets,,"alloc, orphan, inuse, timewait",sockets,IPv4 TCP Sockets,line,,proc.plugin,/proc/net/sockstat
+ipv4.sockstat_tcp_mem,,mem,KiB,IPv4 TCP Sockets Memory,area,,proc.plugin,/proc/net/sockstat
+ipv4.sockstat_udp_sockets,,inuse,sockets,IPv4 UDP Sockets,line,,proc.plugin,/proc/net/sockstat
+ipv4.sockstat_udp_mem,,mem,sockets,IPv4 UDP Sockets Memory,line,,proc.plugin,/proc/net/sockstat
+ipv4.sockstat_udplite_sockets,,inuse,sockets,IPv4 UDPLITE Sockets,line,,proc.plugin,/proc/net/sockstat
+ipv4.sockstat_raw_sockets,,inuse,sockets,IPv4 RAW Sockets,line,,proc.plugin,/proc/net/sockstat
+ipv4.sockstat_frag_sockets,,inuse,fragments,IPv4 FRAG Sockets,line,,proc.plugin,/proc/net/sockstat
+ipv4.sockstat_frag_mem,,mem,KiB,IPv4 FRAG Sockets Memory,area,,proc.plugin,/proc/net/sockstat
+ipv6.sockstat6_tcp_sockets,,inuse,sockets,IPv6 TCP Sockets,line,,proc.plugin,/proc/net/sockstat6
+ipv6.sockstat6_udp_sockets,,inuse,sockets,IPv6 UDP Sockets,line,,proc.plugin,/proc/net/sockstat6
+ipv6.sockstat6_udplite_sockets,,inuse,sockets,IPv6 UDPLITE Sockets,line,,proc.plugin,/proc/net/sockstat6
+ipv6.sockstat6_raw_sockets,,inuse,sockets,IPv6 RAW Sockets,line,,proc.plugin,/proc/net/sockstat6
+ipv6.sockstat6_frag_sockets,,inuse,fragments,IPv6 FRAG Sockets,line,,proc.plugin,/proc/net/sockstat6
+ipvs.sockets,,connections,connections/s,IPVS New Connections,line,,proc.plugin,/proc/net/ip_vs_stats
+ipvs.packets,,"received, sent",packets/s,IPVS Packets,line,,proc.plugin,/proc/net/ip_vs_stats
+ipvs.net,,"received, sent",kilobits/s,IPVS Bandwidth,area,,proc.plugin,/proc/net/ip_vs_stats
+nfs.net,,"udp, tcp",operations/s,NFS Client Network,stacked,,proc.plugin,/proc/net/rpc/nfs
+nfs.rpc,,"calls, retransmits, auth_refresh",calls/s,NFS Client Remote Procedure Calls Statistics,line,,proc.plugin,/proc/net/rpc/nfs
+nfs.proc2,,a dimension per proc2 call,calls/s,NFS v2 Client Remote Procedure Calls,stacked,,proc.plugin,/proc/net/rpc/nfs
+nfs.proc3,,a dimension per proc3 call,calls/s,NFS v3 Client Remote Procedure Calls,stacked,,proc.plugin,/proc/net/rpc/nfs
+nfs.proc4,,a dimension per proc4 call,calls/s,NFS v4 Client Remote Procedure Calls,stacked,,proc.plugin,/proc/net/rpc/nfs
+nfsd.readcache,,"hits, misses, nocache",reads/s,NFS Server Read Cache,stacked,,proc.plugin,/proc/net/rpc/nfsd
+nfsd.filehandles,,stale,handles/s,NFS Server File Handles,line,,proc.plugin,/proc/net/rpc/nfsd
+nfsd.io,,"read, write",kilobytes/s,NFS Server I/O,area,,proc.plugin,/proc/net/rpc/nfsd
+nfsd.threads,,threads,threads,NFS Server Threads,line,,proc.plugin,/proc/net/rpc/nfsd
+nfsd.net,,"udp, tcp",packets/s,NFS Server Network Statistics,line,,proc.plugin,/proc/net/rpc/nfsd
+nfsd.rpc,,"calls, bad_format, bad_auth",calls/s,NFS Server Remote Procedure Calls Statistics,line,,proc.plugin,/proc/net/rpc/nfsd
+nfsd.proc2,,a dimension per proc2 call,calls/s,NFS v2 Server Remote Procedure Calls,stacked,,proc.plugin,/proc/net/rpc/nfsd
+nfsd.proc3,,a dimension per proc3 call,calls/s,NFS v3 Server Remote Procedure Calls,stacked,,proc.plugin,/proc/net/rpc/nfsd
+nfsd.proc4,,a dimension per proc4 call,calls/s,NFS v4 Server Remote Procedure Calls,stacked,,proc.plugin,/proc/net/rpc/nfsd
+nfsd.proc4ops,,a dimension per proc4 operation,operations/s,NFS v4 Server Operations,stacked,,proc.plugin,/proc/net/rpc/nfsd
+sctp.established,,established,associations,SCTP current total number of established associations,line,,proc.plugin,/proc/net/sctp/snmp
+sctp.transitions,,"active, passive, aborted, shutdown",transitions/s,SCTP Association Transitions,line,,proc.plugin,/proc/net/sctp/snmp
+sctp.packets,,"received, sent",packets/s,SCTP Packets,line,,proc.plugin,/proc/net/sctp/snmp
+sctp.packet_errors,,"invalid, checksum",packets/s,SCTP Packet Errors,line,,proc.plugin,/proc/net/sctp/snmp
+sctp.fragmentation,,"reassembled, fragmented",packets/s,SCTP Fragmentation,line,,proc.plugin,/proc/net/sctp/snmp
+netfilter.conntrack_sockets,,connections,active connections,Connection Tracker Connections,line,,proc.plugin,/proc/net/stat/nf_conntrack
+netfilter.conntrack_new,,"new, ignore, invalid",connections/s,Connection Tracker New Connections,line,,proc.plugin,/proc/net/stat/nf_conntrack
+netfilter.conntrack_changes,,"inserted, deleted, delete_list",changes/s,Connection Tracker Changes,line,,proc.plugin,/proc/net/stat/nf_conntrack
+netfilter.conntrack_expect,,"created, deleted, new",expectations/s,Connection Tracker Expectations,line,,proc.plugin,/proc/net/stat/nf_conntrack
+netfilter.conntrack_search,,"searched, restarted, found",searches/s,Connection Tracker Searches,line,,proc.plugin,/proc/net/stat/nf_conntrack
+netfilter.conntrack_errors,,"icmp_error, error_failed, drop, early_drop",events/s,Connection Tracker Errors,line,,proc.plugin,/proc/net/stat/nf_conntrack
+netfilter.synproxy_syn_received,,received,packets/s,SYNPROXY SYN Packets received,line,,proc.plugin,/proc/net/stat/synproxy
+netfilter.synproxy_conn_reopened,,reopened,connections/s,SYNPROXY Connections Reopened,line,,proc.plugin,/proc/net/stat/synproxy
+netfilter.synproxy_cookies,,"valid, invalid, retransmits",cookies/s,SYNPROXY TCP Cookies,line,,proc.plugin,/proc/net/stat/synproxy
+zfspool.state,zfs pool,"online, degraded, faulted, offline, removed, unavail, suspended",boolean,"ZFS pool state",line,pool,proc.plugin,/proc/spl/kstat/zfs
+zfs.arc_size,,"arcsz, target, min, max",MiB,"ZFS ARC Size",area,,proc.plugin,/proc/spl/kstat/zfs/arcstats
+zfs.l2_size,,"actual, size",MiB,"ZFS L2 ARC Size",area,,proc.plugin,/proc/spl/kstat/zfs/arcstats
+zfs.reads,,"arc, demand, prefetch, metadata, l2",reads/s,"ZFS Reads",area,,proc.plugin,/proc/spl/kstat/zfs/arcstats
+zfs.bytes,,"read, write",KiB/s,"ZFS ARC L2 Read/Write Rate",area,,proc.plugin,/proc/spl/kstat/zfs/arcstats
+zfs.hits,,"hits, misses",percentage,"ZFS ARC Hits",stacked,,proc.plugin,/proc/spl/kstat/zfs/arcstats
+zfs.hits_rate,,"hits, misses",events/s,"ZFS ARC Hits Rate",stacked,,proc.plugin,/proc/spl/kstat/zfs/arcstats
+zfs.dhits,,"hits, misses",percentage,"ZFS Demand Hits",stacked,,proc.plugin,/proc/spl/kstat/zfs/arcstats
+zfs.dhits_rate,,"hits, misses",events/s,"ZFS Demand Hits Rate",stacked,,proc.plugin,/proc/spl/kstat/zfs/arcstats
+zfs.phits,,"hits, misses",percentage,"ZFS Prefetch Hits",stacked,,proc.plugin,/proc/spl/kstat/zfs/arcstats
+zfs.phits_rate,,"hits, misses",events/s,"ZFS Prefetch Hits Rate",stacked,,proc.plugin,/proc/spl/kstat/zfs/arcstats
+zfs.mhits,,"hits, misses",percentage,"ZFS Metadata Hits",stacked,,proc.plugin,/proc/spl/kstat/zfs/arcstats
+zfs.mhits_rate,,"hits, misses",events/s,"ZFS Metadata Hits Rate",stacked,,proc.plugin,/proc/spl/kstat/zfs/arcstats
+zfs.l2hits,,"hits, misses",percentage,"ZFS L2 Hits",stacked,,proc.plugin,/proc/spl/kstat/zfs/arcstats
+zfs.l2hits_rate,,"hits, misses",events/s,"ZFS L2 Hits Rate",stacked,,proc.plugin,/proc/spl/kstat/zfs/arcstats
+zfs.list_hits,,"mfu, mfu_ghost, mru, mru_ghost",hits/s,"ZFS List Hits",area,,proc.plugin,/proc/spl/kstat/zfs/arcstats
+zfs.arc_size_breakdown,,"recent, frequent",percentage,"ZFS ARC Size Breakdown",stacked,,proc.plugin,/proc/spl/kstat/zfs/arcstats
+zfs.memory_ops,,"direct, throttled, indirect",operations/s,"ZFS Memory Operations",line,,proc.plugin,/proc/spl/kstat/zfs/arcstats
+zfs.important_ops,,"evict_skip, deleted, mutex_miss, hash_collisions",operations/s,"ZFS Important Operations",line,,proc.plugin,/proc/spl/kstat/zfs/arcstats
+zfs.actual_hits,,"hits, misses",percentage,"ZFS Actual Cache Hits",stacked,,proc.plugin,/proc/spl/kstat/zfs/arcstats
+zfs.actual_hits_rate,,"hits, misses",events/s,"ZFS Actual Cache Hits Rate",stacked,,proc.plugin,/proc/spl/kstat/zfs/arcstats
+zfs.demand_data_hits,,"hits, misses",percentage,"ZFS Data Demand Efficiency",stacked,,proc.plugin,/proc/spl/kstat/zfs/arcstats
+zfs.demand_data_hits_rate,,"hits, misses",events/s,"ZFS Data Demand Efficiency Rate",stacked,,proc.plugin,/proc/spl/kstat/zfs/arcstats
+zfs.prefetch_data_hits,,"hits, misses",percentage,"ZFS Data Prefetch Efficiency",stacked,,proc.plugin,/proc/spl/kstat/zfs/arcstats
+zfs.prefetch_data_hits_rate,,"hits, misses",events/s,"ZFS Data Prefetch Efficiency Rate",stacked,,proc.plugin,/proc/spl/kstat/zfs/arcstats
+zfs.hash_elements,,"current, max",elements,"ZFS ARC Hash Elements",line,,proc.plugin,/proc/spl/kstat/zfs/arcstats
+zfs.hash_chains,,"current, max",chains,"ZFS ARC Hash Chains",line,,proc.plugin,/proc/spl/kstat/zfs/arcstats
+btrfs.disk,btrfs filesystem,"unallocated, data_free, data_used, meta_free, meta_used, sys_free, sys_used",MiB,"BTRFS Physical Disk Allocation",stacked,"filesystem_uuid, filesystem_label",proc.plugin,/sys/fs/btrfs
+btrfs.data,btrfs filesystem,"free, used",MiB,"BTRFS Data Allocation",stacked,"filesystem_uuid, filesystem_label",proc.plugin,/sys/fs/btrfs
+btrfs.metadata,btrfs filesystem,"free, used, reserved",MiB,"BTRFS Metadata Allocation",stacked,"filesystem_uuid, filesystem_label",proc.plugin,/sys/fs/btrfs
+btrfs.system,btrfs filesystem,"free, used",MiB,"BTRFS System Allocation",stacked,"filesystem_uuid, filesystem_label",proc.plugin,/sys/fs/btrfs
+btrfs.commits,btrfs filesystem,commits,commits,"BTRFS Commits",line,"filesystem_uuid, filesystem_label",proc.plugin,/sys/fs/btrfs
+btrfs.commits_perc_time,btrfs filesystem,commits,percentage,"BTRFS Commits Time Share",line,"filesystem_uuid, filesystem_label",proc.plugin,/sys/fs/btrfs
+btrfs.commit_timings,btrfs filesystem,"last, max",ms,"BTRFS Commit Timings",line,"filesystem_uuid, filesystem_label",proc.plugin,/sys/fs/btrfs
+btrfs.device_errors,btrfs device,"write_errs, read_errs, flush_errs, corruption_errs, generation_errs",errors,"BTRFS Device Errors",line,"device_id, filesystem_uuid, filesystem_label",proc.plugin,/sys/fs/btrfs
+powersupply.capacity,power device,capacity,percentage,Battery capacity,line,device,proc.plugin,/sys/class/power_supply
+powersupply.charge,power device,"empty_design, empty, now, full, full_design",Ah,Battery charge,line,device,proc.plugin,/sys/class/power_supply
+powersupply.energy,power device,"empty_design, empty, now, full, full_design",Wh,Battery energy,line,device,proc.plugin,/sys/class/power_supply
+powersupply.voltage,power device,"min_design, min, now, max, max_design",V,Power supply voltage,line,device,proc.plugin,/sys/class/power_supply \ No newline at end of file
diff --git a/collectors/proc.plugin/proc_diskstats.c b/collectors/proc.plugin/proc_diskstats.c
index b487f2910..2a4fe4f8c 100644
--- a/collectors/proc.plugin/proc_diskstats.c
+++ b/collectors/proc.plugin/proc_diskstats.c
@@ -934,16 +934,12 @@ int do_proc_diskstats(int update_every, usec_t dt) {
name_disks_by_id = config_get_boolean(CONFIG_SECTION_PLUGIN_PROC_DISKSTATS, "name disks by id", name_disks_by_id);
preferred_ids = simple_pattern_create(
- config_get(CONFIG_SECTION_PLUGIN_PROC_DISKSTATS, "preferred disk ids", DEFAULT_PREFERRED_IDS)
- , NULL
- , SIMPLE_PATTERN_EXACT
- );
+ config_get(CONFIG_SECTION_PLUGIN_PROC_DISKSTATS, "preferred disk ids", DEFAULT_PREFERRED_IDS), NULL,
+ SIMPLE_PATTERN_EXACT, true);
excluded_disks = simple_pattern_create(
- config_get(CONFIG_SECTION_PLUGIN_PROC_DISKSTATS, "exclude disks", DEFAULT_EXCLUDED_DISKS)
- , NULL
- , SIMPLE_PATTERN_EXACT
- );
+ config_get(CONFIG_SECTION_PLUGIN_PROC_DISKSTATS, "exclude disks", DEFAULT_EXCLUDED_DISKS), NULL,
+ SIMPLE_PATTERN_EXACT, true);
}
// --------------------------------------------------------------------------
@@ -993,35 +989,35 @@ int do_proc_diskstats(int update_every, usec_t dt) {
// # of reads completed # of writes completed
// This is the total number of reads or writes completed successfully.
- reads = str2ull(procfile_lineword(ff, l, 3)); // rd_ios
- writes = str2ull(procfile_lineword(ff, l, 7)); // wr_ios
+ reads = str2ull(procfile_lineword(ff, l, 3), NULL); // rd_ios
+ writes = str2ull(procfile_lineword(ff, l, 7), NULL); // wr_ios
// # of reads merged # of writes merged
// Reads and writes which are adjacent to each other may be merged for
// efficiency. Thus two 4K reads may become one 8K read before it is
// ultimately handed to the disk, and so it will be counted (and queued)
- mreads = str2ull(procfile_lineword(ff, l, 4)); // rd_merges_or_rd_sec
- mwrites = str2ull(procfile_lineword(ff, l, 8)); // wr_merges
+ mreads = str2ull(procfile_lineword(ff, l, 4), NULL); // rd_merges_or_rd_sec
+ mwrites = str2ull(procfile_lineword(ff, l, 8), NULL); // wr_merges
// # of sectors read # of sectors written
// This is the total number of sectors read or written successfully.
- readsectors = str2ull(procfile_lineword(ff, l, 5)); // rd_sec_or_wr_ios
- writesectors = str2ull(procfile_lineword(ff, l, 9)); // wr_sec
+ readsectors = str2ull(procfile_lineword(ff, l, 5), NULL); // rd_sec_or_wr_ios
+ writesectors = str2ull(procfile_lineword(ff, l, 9), NULL); // wr_sec
// # of milliseconds spent reading # of milliseconds spent writing
// This is the total number of milliseconds spent by all reads or writes (as
// measured from __make_request() to end_that_request_last()).
- readms = str2ull(procfile_lineword(ff, l, 6)); // rd_ticks_or_wr_sec
- writems = str2ull(procfile_lineword(ff, l, 10)); // wr_ticks
+ readms = str2ull(procfile_lineword(ff, l, 6), NULL); // rd_ticks_or_wr_sec
+ writems = str2ull(procfile_lineword(ff, l, 10), NULL); // wr_ticks
// # of I/Os currently in progress
// The only field that should go to zero. Incremented as requests are
// given to appropriate struct request_queue and decremented as they finish.
- queued_ios = str2ull(procfile_lineword(ff, l, 11)); // ios_pgr
+ queued_ios = str2ull(procfile_lineword(ff, l, 11), NULL); // ios_pgr
// # of milliseconds spent doing I/Os
// This field increases so long as field queued_ios is nonzero.
- busy_ms = str2ull(procfile_lineword(ff, l, 12)); // tot_ticks
+ busy_ms = str2ull(procfile_lineword(ff, l, 12), NULL); // tot_ticks
// weighted # of milliseconds spent doing I/Os
// This field is incremented at each I/O start, I/O completion, I/O
@@ -1029,27 +1025,27 @@ int do_proc_diskstats(int update_every, usec_t dt) {
// (field queued_ios) times the number of milliseconds spent doing I/O since the
// last update of this field. This can provide an easy measure of both
// I/O completion time and the backlog that may be accumulating.
- backlog_ms = str2ull(procfile_lineword(ff, l, 13)); // rq_ticks
+ backlog_ms = str2ull(procfile_lineword(ff, l, 13), NULL); // rq_ticks
if (unlikely(words > 13)) {
do_dc_stats = 1;
// # of discards completed
// This is the total number of discards completed successfully.
- discards = str2ull(procfile_lineword(ff, l, 14)); // dc_ios
+ discards = str2ull(procfile_lineword(ff, l, 14), NULL); // dc_ios
// # of discards merged
// See the description of mreads/mwrites
- mdiscards = str2ull(procfile_lineword(ff, l, 15)); // dc_merges
+ mdiscards = str2ull(procfile_lineword(ff, l, 15), NULL); // dc_merges
// # of sectors discarded
// This is the total number of sectors discarded successfully.
- discardsectors = str2ull(procfile_lineword(ff, l, 16)); // dc_sec
+ discardsectors = str2ull(procfile_lineword(ff, l, 16), NULL); // dc_sec
// # of milliseconds spent discarding
// This is the total number of milliseconds spent by all discards (as
// measured from __make_request() to end_that_request_last()).
- discardms = str2ull(procfile_lineword(ff, l, 17)); // dc_ticks
+ discardms = str2ull(procfile_lineword(ff, l, 17), NULL); // dc_ticks
}
if (unlikely(words > 17)) {
@@ -1059,10 +1055,10 @@ int do_proc_diskstats(int update_every, usec_t dt) {
// These values increment when an flush I/O request completes.
// Block layer combines flush requests and executes at most one at a time.
// This counts flush requests executed by disk. Not tracked for partitions.
- flushes = str2ull(procfile_lineword(ff, l, 18)); // fl_ios
+ flushes = str2ull(procfile_lineword(ff, l, 18), NULL); // fl_ios
// total wait time for flush requests
- flushms = str2ull(procfile_lineword(ff, l, 19)); // fl_ticks
+ flushms = str2ull(procfile_lineword(ff, l, 19), NULL); // fl_ticks
}
// --------------------------------------------------------------------------
diff --git a/collectors/proc.plugin/proc_interrupts.c b/collectors/proc.plugin/proc_interrupts.c
index 04d8c73ad..9a20700a3 100644
--- a/collectors/proc.plugin/proc_interrupts.c
+++ b/collectors/proc.plugin/proc_interrupts.c
@@ -120,7 +120,7 @@ int do_proc_interrupts(int update_every, usec_t dt) {
int c;
for(c = 0; c < cpus ;c++) {
if(likely((c + 1) < (int)words))
- irr->cpu[c].value = str2ull(procfile_lineword(ff, l, (uint32_t)(c + 1)));
+ irr->cpu[c].value = str2ull(procfile_lineword(ff, l, (uint32_t) (c + 1)), NULL);
else
irr->cpu[c].value = 0;
diff --git a/collectors/proc.plugin/proc_loadavg.c b/collectors/proc.plugin/proc_loadavg.c
index e833f69d2..106cf9087 100644
--- a/collectors/proc.plugin/proc_loadavg.c
+++ b/collectors/proc.plugin/proc_loadavg.c
@@ -45,7 +45,7 @@ int do_proc_loadavg(int update_every, usec_t dt) {
double load15 = strtod(procfile_lineword(ff, 0, 2), NULL);
//unsigned long long running_processes = str2ull(procfile_lineword(ff, 0, 3));
- unsigned long long active_processes = str2ull(procfile_lineword(ff, 0, 4));
+ unsigned long long active_processes = str2ull(procfile_lineword(ff, 0, 4), NULL);
//get system pid_max
unsigned long long max_processes = get_system_pid_max();
diff --git a/collectors/proc.plugin/proc_mdstat.c b/collectors/proc.plugin/proc_mdstat.c
index d6e87fd2d..c3d1793cb 100644
--- a/collectors/proc.plugin/proc_mdstat.c
+++ b/collectors/proc.plugin/proc_mdstat.c
@@ -231,8 +231,8 @@ int do_proc_mdstat(int update_every, usec_t dt)
continue;
}
- raid->inuse_disks = str2ull(str_inuse);
- raid->total_disks = str2ull(str_total);
+ raid->inuse_disks = str2ull(str_inuse, NULL);
+ raid->total_disks = str2ull(str_total, NULL);
raid->failed_disks = raid->total_disks - raid->inuse_disks;
}
@@ -300,7 +300,7 @@ int do_proc_mdstat(int update_every, usec_t dt)
word += 6; // skip leading "speed="
if (likely(s > word))
- raid->speed = str2ull(word);
+ raid->speed = str2ull(word, NULL);
}
}
diff --git a/collectors/proc.plugin/proc_net_dev.c b/collectors/proc.plugin/proc_net_dev.c
index 3ec8783bd..9e8127cb6 100644
--- a/collectors/proc.plugin/proc_net_dev.c
+++ b/collectors/proc.plugin/proc_net_dev.c
@@ -725,7 +725,9 @@ int do_proc_net_dev(int update_every, usec_t dt) {
do_carrier = config_get_boolean_ondemand(CONFIG_SECTION_PLUGIN_PROC_NETDEV, "carrier for all interfaces", CONFIG_BOOLEAN_AUTO);
do_mtu = config_get_boolean_ondemand(CONFIG_SECTION_PLUGIN_PROC_NETDEV, "mtu for all interfaces", CONFIG_BOOLEAN_AUTO);
- disabled_list = simple_pattern_create(config_get(CONFIG_SECTION_PLUGIN_PROC_NETDEV, "disable by default interfaces matching", "lo fireqos* *-ifb fwpr* fwbr* fwln*"), NULL, SIMPLE_PATTERN_EXACT);
+ disabled_list = simple_pattern_create(
+ config_get(CONFIG_SECTION_PLUGIN_PROC_NETDEV, "disable by default interfaces matching",
+ "lo fireqos* *-ifb fwpr* fwbr* fwln*"), NULL, SIMPLE_PATTERN_EXACT, true);
}
if(unlikely(!ff)) {
diff --git a/collectors/proc.plugin/proc_net_rpc_nfs.c b/collectors/proc.plugin/proc_net_rpc_nfs.c
index 0ab9d28b5..d6547636e 100644
--- a/collectors/proc.plugin/proc_net_rpc_nfs.c
+++ b/collectors/proc.plugin/proc_net_rpc_nfs.c
@@ -187,10 +187,10 @@ int do_proc_net_rpc_nfs(int update_every, usec_t dt) {
continue;
}
- net_count = str2ull(procfile_lineword(ff, l, 1));
- net_udp_count = str2ull(procfile_lineword(ff, l, 2));
- net_tcp_count = str2ull(procfile_lineword(ff, l, 3));
- net_tcp_connections = str2ull(procfile_lineword(ff, l, 4));
+ net_count = str2ull(procfile_lineword(ff, l, 1), NULL);
+ net_udp_count = str2ull(procfile_lineword(ff, l, 2), NULL);
+ net_tcp_count = str2ull(procfile_lineword(ff, l, 3), NULL);
+ net_tcp_connections = str2ull(procfile_lineword(ff, l, 4), NULL);
unsigned long long sum = net_count + net_udp_count + net_tcp_count + net_tcp_connections;
if(sum == 0ULL) do_net = -1;
@@ -202,9 +202,9 @@ int do_proc_net_rpc_nfs(int update_every, usec_t dt) {
continue;
}
- rpc_calls = str2ull(procfile_lineword(ff, l, 1));
- rpc_retransmits = str2ull(procfile_lineword(ff, l, 2));
- rpc_auth_refresh = str2ull(procfile_lineword(ff, l, 3));
+ rpc_calls = str2ull(procfile_lineword(ff, l, 1), NULL);
+ rpc_retransmits = str2ull(procfile_lineword(ff, l, 2), NULL);
+ rpc_auth_refresh = str2ull(procfile_lineword(ff, l, 3), NULL);
unsigned long long sum = rpc_calls + rpc_retransmits + rpc_auth_refresh;
if(sum == 0ULL) do_rpc = -1;
@@ -217,7 +217,7 @@ int do_proc_net_rpc_nfs(int update_every, usec_t dt) {
unsigned long long sum = 0;
unsigned int i, j;
for(i = 0, j = 2; j < words && nfs_proc2_values[i].name[0] ; i++, j++) {
- nfs_proc2_values[i].value = str2ull(procfile_lineword(ff, l, j));
+ nfs_proc2_values[i].value = str2ull(procfile_lineword(ff, l, j), NULL);
nfs_proc2_values[i].present = 1;
sum += nfs_proc2_values[i].value;
}
@@ -238,7 +238,7 @@ int do_proc_net_rpc_nfs(int update_every, usec_t dt) {
unsigned long long sum = 0;
unsigned int i, j;
for(i = 0, j = 2; j < words && nfs_proc3_values[i].name[0] ; i++, j++) {
- nfs_proc3_values[i].value = str2ull(procfile_lineword(ff, l, j));
+ nfs_proc3_values[i].value = str2ull(procfile_lineword(ff, l, j), NULL);
nfs_proc3_values[i].present = 1;
sum += nfs_proc3_values[i].value;
}
@@ -259,7 +259,7 @@ int do_proc_net_rpc_nfs(int update_every, usec_t dt) {
unsigned long long sum = 0;
unsigned int i, j;
for(i = 0, j = 2; j < words && nfs_proc4_values[i].name[0] ; i++, j++) {
- nfs_proc4_values[i].value = str2ull(procfile_lineword(ff, l, j));
+ nfs_proc4_values[i].value = str2ull(procfile_lineword(ff, l, j), NULL);
nfs_proc4_values[i].present = 1;
sum += nfs_proc4_values[i].value;
}
diff --git a/collectors/proc.plugin/proc_net_rpc_nfsd.c b/collectors/proc.plugin/proc_net_rpc_nfsd.c
index faa6b5c46..1d9127a03 100644
--- a/collectors/proc.plugin/proc_net_rpc_nfsd.c
+++ b/collectors/proc.plugin/proc_net_rpc_nfsd.c
@@ -286,9 +286,9 @@ int do_proc_net_rpc_nfsd(int update_every, usec_t dt) {
continue;
}
- rc_hits = str2ull(procfile_lineword(ff, l, 1));
- rc_misses = str2ull(procfile_lineword(ff, l, 2));
- rc_nocache = str2ull(procfile_lineword(ff, l, 3));
+ rc_hits = str2ull(procfile_lineword(ff, l, 1), NULL);
+ rc_misses = str2ull(procfile_lineword(ff, l, 2), NULL);
+ rc_nocache = str2ull(procfile_lineword(ff, l, 3), NULL);
unsigned long long sum = rc_hits + rc_misses + rc_nocache;
if(sum == 0ULL) do_rc = -1;
@@ -300,7 +300,7 @@ int do_proc_net_rpc_nfsd(int update_every, usec_t dt) {
continue;
}
- fh_stale = str2ull(procfile_lineword(ff, l, 1));
+ fh_stale = str2ull(procfile_lineword(ff, l, 1), NULL);
// other file handler metrics were never used and are always zero
@@ -313,8 +313,8 @@ int do_proc_net_rpc_nfsd(int update_every, usec_t dt) {
continue;
}
- io_read = str2ull(procfile_lineword(ff, l, 1));
- io_write = str2ull(procfile_lineword(ff, l, 2));
+ io_read = str2ull(procfile_lineword(ff, l, 1), NULL);
+ io_write = str2ull(procfile_lineword(ff, l, 2), NULL);
unsigned long long sum = io_read + io_write;
if(sum == 0ULL) do_io = -1;
@@ -326,7 +326,7 @@ int do_proc_net_rpc_nfsd(int update_every, usec_t dt) {
continue;
}
- th_threads = str2ull(procfile_lineword(ff, l, 1));
+ th_threads = str2ull(procfile_lineword(ff, l, 1), NULL);
// thread histogram has been disabled since 2009 (kernel 2.6.30)
// https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=8bbfa9f3889b643fc7de82c0c761ef17097f8faf
@@ -339,10 +339,10 @@ int do_proc_net_rpc_nfsd(int update_every, usec_t dt) {
continue;
}
- net_count = str2ull(procfile_lineword(ff, l, 1));
- net_udp_count = str2ull(procfile_lineword(ff, l, 2));
- net_tcp_count = str2ull(procfile_lineword(ff, l, 3));
- net_tcp_connections = str2ull(procfile_lineword(ff, l, 4));
+ net_count = str2ull(procfile_lineword(ff, l, 1), NULL);
+ net_udp_count = str2ull(procfile_lineword(ff, l, 2), NULL);
+ net_tcp_count = str2ull(procfile_lineword(ff, l, 3), NULL);
+ net_tcp_connections = str2ull(procfile_lineword(ff, l, 4), NULL);
unsigned long long sum = net_count + net_udp_count + net_tcp_count + net_tcp_connections;
if(sum == 0ULL) do_net = -1;
@@ -354,10 +354,10 @@ int do_proc_net_rpc_nfsd(int update_every, usec_t dt) {
continue;
}
- rpc_calls = str2ull(procfile_lineword(ff, l, 1));
- rpc_bad_format = str2ull(procfile_lineword(ff, l, 3));
- rpc_bad_auth = str2ull(procfile_lineword(ff, l, 4));
- rpc_bad_client = str2ull(procfile_lineword(ff, l, 5));
+ rpc_calls = str2ull(procfile_lineword(ff, l, 1), NULL);
+ rpc_bad_format = str2ull(procfile_lineword(ff, l, 3), NULL);
+ rpc_bad_auth = str2ull(procfile_lineword(ff, l, 4), NULL);
+ rpc_bad_client = str2ull(procfile_lineword(ff, l, 5), NULL);
unsigned long long sum = rpc_calls + rpc_bad_format + rpc_bad_auth + rpc_bad_client;
if(sum == 0ULL) do_rpc = -1;
@@ -370,7 +370,7 @@ int do_proc_net_rpc_nfsd(int update_every, usec_t dt) {
unsigned long long sum = 0;
unsigned int i, j;
for(i = 0, j = 2; j < words && nfsd_proc2_values[i].name[0] ; i++, j++) {
- nfsd_proc2_values[i].value = str2ull(procfile_lineword(ff, l, j));
+ nfsd_proc2_values[i].value = str2ull(procfile_lineword(ff, l, j), NULL);
nfsd_proc2_values[i].present = 1;
sum += nfsd_proc2_values[i].value;
}
@@ -391,7 +391,7 @@ int do_proc_net_rpc_nfsd(int update_every, usec_t dt) {
unsigned long long sum = 0;
unsigned int i, j;
for(i = 0, j = 2; j < words && nfsd_proc3_values[i].name[0] ; i++, j++) {
- nfsd_proc3_values[i].value = str2ull(procfile_lineword(ff, l, j));
+ nfsd_proc3_values[i].value = str2ull(procfile_lineword(ff, l, j), NULL);
nfsd_proc3_values[i].present = 1;
sum += nfsd_proc3_values[i].value;
}
@@ -412,7 +412,7 @@ int do_proc_net_rpc_nfsd(int update_every, usec_t dt) {
unsigned long long sum = 0;
unsigned int i, j;
for(i = 0, j = 2; j < words && nfsd_proc4_values[i].name[0] ; i++, j++) {
- nfsd_proc4_values[i].value = str2ull(procfile_lineword(ff, l, j));
+ nfsd_proc4_values[i].value = str2ull(procfile_lineword(ff, l, j), NULL);
nfsd_proc4_values[i].present = 1;
sum += nfsd_proc4_values[i].value;
}
@@ -433,7 +433,7 @@ int do_proc_net_rpc_nfsd(int update_every, usec_t dt) {
unsigned long long sum = 0;
unsigned int i, j;
for(i = 0, j = 2; j < words && nfsd4_ops_values[i].name[0] ; i++, j++) {
- nfsd4_ops_values[i].value = str2ull(procfile_lineword(ff, l, j));
+ nfsd4_ops_values[i].value = str2ull(procfile_lineword(ff, l, j), NULL);
nfsd4_ops_values[i].present = 1;
sum += nfsd4_ops_values[i].value;
}
diff --git a/collectors/proc.plugin/proc_pagetypeinfo.c b/collectors/proc.plugin/proc_pagetypeinfo.c
index e12c5bff8..e5318ce8f 100644
--- a/collectors/proc.plugin/proc_pagetypeinfo.c
+++ b/collectors/proc.plugin/proc_pagetypeinfo.c
@@ -120,10 +120,8 @@ int do_proc_pagetypeinfo(int update_every, usec_t dt) {
do_global = config_get_boolean(CONFIG_SECTION_PLUGIN_PROC_PAGETYPEINFO, "enable system summary", CONFIG_BOOLEAN_YES);
do_detail = config_get_boolean_ondemand(CONFIG_SECTION_PLUGIN_PROC_PAGETYPEINFO, "enable detail per-type", CONFIG_BOOLEAN_AUTO);
filter_types = simple_pattern_create(
- config_get(CONFIG_SECTION_PLUGIN_PROC_PAGETYPEINFO, "hide charts id matching", "")
- , NULL
- , SIMPLE_PATTERN_SUFFIX
- );
+ config_get(CONFIG_SECTION_PLUGIN_PROC_PAGETYPEINFO, "hide charts id matching", ""), NULL,
+ SIMPLE_PATTERN_SUFFIX, true);
pagelines_cnt = 0;
@@ -188,7 +186,7 @@ int do_proc_pagetypeinfo(int update_every, usec_t dt) {
pgl->type = typename;
pgl->zone = zonename;
for (o = 0; o < pageorders_cnt; o++)
- pgl->free_pages_size[o] = str2uint64_t(procfile_lineword(ff, l, o+6)) * 1 << o;
+ pgl->free_pages_size[o] = str2uint64_t(procfile_lineword(ff, l, o + 6), NULL) * 1 << o;
p++;
}
@@ -302,7 +300,7 @@ int do_proc_pagetypeinfo(int update_every, usec_t dt) {
systemorders[o].size = 0;
// Update orders of the current line
- pagelines[p].free_pages_size[o] = str2uint64_t(procfile_lineword(ff, l, o+6)) * 1 << o;
+ pagelines[p].free_pages_size[o] = str2uint64_t(procfile_lineword(ff, l, o + 6), NULL) * 1 << o;
// Update sum by order
systemorders[o].size += pagelines[p].free_pages_size[o];
diff --git a/collectors/proc.plugin/proc_pressure.c b/collectors/proc.plugin/proc_pressure.c
index 80b08d9ad..28e4c592d 100644
--- a/collectors/proc.plugin/proc_pressure.c
+++ b/collectors/proc.plugin/proc_pressure.c
@@ -114,7 +114,7 @@ static void proc_pressure_do_resource(procfile *ff, int res_idx, int some) {
pcs->total_time.rdtotal = rrddim_add(pcs->total_time.st, "time", NULL, 1, 1, RRD_ALGORITHM_INCREMENTAL);
}
- pcs->total_time.value_total = str2ull(procfile_lineword(ff, some ? 0 : 1, 8)) / 1000;
+ pcs->total_time.value_total = str2ull(procfile_lineword(ff, some ? 0 : 1, 8), NULL) / 1000;
}
static void proc_pressure_do_resource_some(procfile *ff, int res_idx) {
@@ -165,9 +165,16 @@ int do_proc_pressure(int update_every, usec_t dt) {
do_some = config_get_boolean(CONFIG_SECTION_PLUGIN_PROC_PRESSURE, config_key, CONFIG_BOOLEAN_YES);
resources[i].some.enabled = do_some;
- snprintfz(config_key, CONFIG_MAX_NAME, "enable %s full pressure", resource_info[i].name);
- do_full = config_get_boolean(CONFIG_SECTION_PLUGIN_PROC_PRESSURE, config_key, CONFIG_BOOLEAN_YES);
- resources[i].full.enabled = do_full;
+ // Disable CPU full pressure.
+ // See https://github.com/torvalds/linux/commit/890d550d7dbac7a31ecaa78732aa22be282bb6b8
+ if (i == 0) {
+ do_full = CONFIG_BOOLEAN_NO;
+ resources[i].full.enabled = do_full;
+ } else {
+ snprintfz(config_key, CONFIG_MAX_NAME, "enable %s full pressure", resource_info[i].name);
+ do_full = config_get_boolean(CONFIG_SECTION_PLUGIN_PROC_PRESSURE, config_key, CONFIG_BOOLEAN_YES);
+ resources[i].full.enabled = do_full;
+ }
ff = procfile_open(filename, " =", PROCFILE_FLAG_DEFAULT);
if (unlikely(!ff)) {
diff --git a/collectors/proc.plugin/proc_softirqs.c b/collectors/proc.plugin/proc_softirqs.c
index 0d5d8ef9c..ccf46cb8a 100644
--- a/collectors/proc.plugin/proc_softirqs.c
+++ b/collectors/proc.plugin/proc_softirqs.c
@@ -113,7 +113,7 @@ int do_proc_softirqs(int update_every, usec_t dt) {
int c;
for(c = 0; c < cpus ;c++) {
if(likely((c + 1) < (int)words))
- irr->cpu[c].value = str2ull(procfile_lineword(ff, l, (uint32_t)(c + 1)));
+ irr->cpu[c].value = str2ull(procfile_lineword(ff, l, (uint32_t) (c + 1)), NULL);
else
irr->cpu[c].value = 0;
diff --git a/collectors/proc.plugin/proc_spl_kstat_zfs.c b/collectors/proc.plugin/proc_spl_kstat_zfs.c
index 0db9970c3..428ef0d32 100644
--- a/collectors/proc.plugin/proc_spl_kstat_zfs.c
+++ b/collectors/proc.plugin/proc_spl_kstat_zfs.c
@@ -216,6 +216,7 @@ struct zfs_pool {
RRDDIM *rd_offline;
RRDDIM *rd_removed;
RRDDIM *rd_unavail;
+ RRDDIM *rd_suspended;
int updated;
int disabled;
@@ -226,6 +227,7 @@ struct zfs_pool {
int offline;
int removed;
int unavail;
+ int suspended;
};
struct deleted_zfs_pool {
@@ -248,6 +250,7 @@ void disable_zfs_pool_state(struct zfs_pool *pool)
pool->rd_offline = NULL;
pool->rd_removed = NULL;
pool->rd_unavail = NULL;
+ pool->rd_suspended = NULL;
pool->disabled = 1;
}
@@ -285,6 +288,7 @@ int update_zfs_pool_state_chart(const DICTIONARY_ITEM *item, void *pool_p, void
pool->rd_offline = rrddim_add(pool->st, "offline", NULL, 1, 1, RRD_ALGORITHM_ABSOLUTE);
pool->rd_removed = rrddim_add(pool->st, "removed", NULL, 1, 1, RRD_ALGORITHM_ABSOLUTE);
pool->rd_unavail = rrddim_add(pool->st, "unavail", NULL, 1, 1, RRD_ALGORITHM_ABSOLUTE);
+ pool->rd_suspended = rrddim_add(pool->st, "suspended", NULL, 1, 1, RRD_ALGORITHM_ABSOLUTE);
rrdlabels_add(pool->st->rrdlabels, "pool", name, RRDLABEL_SRC_AUTO);
}
@@ -295,6 +299,7 @@ int update_zfs_pool_state_chart(const DICTIONARY_ITEM *item, void *pool_p, void
rrddim_set_by_pointer(pool->st, pool->rd_offline, pool->offline);
rrddim_set_by_pointer(pool->st, pool->rd_removed, pool->removed);
rrddim_set_by_pointer(pool->st, pool->rd_unavail, pool->unavail);
+ rrddim_set_by_pointer(pool->st, pool->rd_suspended, pool->suspended);
rrdset_done(pool->st);
}
} else {
@@ -364,10 +369,10 @@ int do_proc_spl_kstat_zfs_pool_state(int update_every, usec_t dt)
pool->offline = 0;
pool->removed = 0;
pool->unavail = 0;
+ pool->suspended = 0;
char filename[FILENAME_MAX + 1];
- snprintfz(
- filename, FILENAME_MAX, "%s%s/%s/state", netdata_configured_host_prefix, dirname, de->d_name);
+ snprintfz(filename, FILENAME_MAX, "%s/%s/state", dirname, de->d_name);
char state[STATE_SIZE + 1];
int ret = read_file(filename, state, STATE_SIZE);
@@ -388,6 +393,8 @@ int do_proc_spl_kstat_zfs_pool_state(int update_every, usec_t dt)
pool->removed = 1;
} else if (!strcmp(state, "UNAVAIL\n")) {
pool->unavail = 1;
+ } else if (!strcmp(state, "SUSPENDED\n")) {
+ pool->suspended = 1;
} else {
disable_zfs_pool_state(pool);
diff --git a/collectors/proc.plugin/proc_stat.c b/collectors/proc.plugin/proc_stat.c
index 2ca7c42e1..f0f319351 100644
--- a/collectors/proc.plugin/proc_stat.c
+++ b/collectors/proc.plugin/proc_stat.c
@@ -182,8 +182,8 @@ static int read_per_core_time_in_state_files(struct cpu_chart *all_cpu_charts, s
collector_error("Cannot read time_in_state line. Expected 2 params, read %zu.", words);
continue;
}
- frequency = str2ull(procfile_lineword(tsf->ff, l, 0));
- ticks = str2ull(procfile_lineword(tsf->ff, l, 1));
+ frequency = str2ull(procfile_lineword(tsf->ff, l, 0), NULL);
+ ticks = str2ull(procfile_lineword(tsf->ff, l, 1), NULL);
// It is assumed that frequencies are static and sorted
ticks_since_last = ticks - tsf->last_ticks[l].ticks;
@@ -330,7 +330,7 @@ static int read_schedstat(char *schedstat_filename, struct per_core_cpuidle_char
cpuidle_charts_len = cores_found;
}
- cpuidle_charts[core].active_time = str2ull(procfile_lineword(ff, l, 7)) / 1000;
+ cpuidle_charts[core].active_time = str2ull(procfile_lineword(ff, l, 7), NULL) / 1000;
}
}
@@ -597,19 +597,19 @@ int do_proc_stat(int update_every, usec_t dt) {
unsigned long long user = 0, nice = 0, system = 0, idle = 0, iowait = 0, irq = 0, softirq = 0, steal = 0, guest = 0, guest_nice = 0;
id = row_key;
- user = str2ull(procfile_lineword(ff, l, 1));
- nice = str2ull(procfile_lineword(ff, l, 2));
- system = str2ull(procfile_lineword(ff, l, 3));
- idle = str2ull(procfile_lineword(ff, l, 4));
- iowait = str2ull(procfile_lineword(ff, l, 5));
- irq = str2ull(procfile_lineword(ff, l, 6));
- softirq = str2ull(procfile_lineword(ff, l, 7));
- steal = str2ull(procfile_lineword(ff, l, 8));
-
- guest = str2ull(procfile_lineword(ff, l, 9));
+ user = str2ull(procfile_lineword(ff, l, 1), NULL);
+ nice = str2ull(procfile_lineword(ff, l, 2), NULL);
+ system = str2ull(procfile_lineword(ff, l, 3), NULL);
+ idle = str2ull(procfile_lineword(ff, l, 4), NULL);
+ iowait = str2ull(procfile_lineword(ff, l, 5), NULL);
+ irq = str2ull(procfile_lineword(ff, l, 6), NULL);
+ softirq = str2ull(procfile_lineword(ff, l, 7), NULL);
+ steal = str2ull(procfile_lineword(ff, l, 8), NULL);
+
+ guest = str2ull(procfile_lineword(ff, l, 9), NULL);
user -= guest;
- guest_nice = str2ull(procfile_lineword(ff, l, 10));
+ guest_nice = str2ull(procfile_lineword(ff, l, 10), NULL);
nice -= guest_nice;
char *title, *type, *context, *family;
@@ -739,7 +739,7 @@ int do_proc_stat(int update_every, usec_t dt) {
if(likely(do_interrupts)) {
static RRDSET *st_intr = NULL;
static RRDDIM *rd_interrupts = NULL;
- unsigned long long value = str2ull(procfile_lineword(ff, l, 1));
+ unsigned long long value = str2ull(procfile_lineword(ff, l, 1), NULL);
if(unlikely(!st_intr)) {
st_intr = rrdset_create_localhost(
@@ -770,7 +770,7 @@ int do_proc_stat(int update_every, usec_t dt) {
if(likely(do_context)) {
static RRDSET *st_ctxt = NULL;
static RRDDIM *rd_switches = NULL;
- unsigned long long value = str2ull(procfile_lineword(ff, l, 1));
+ unsigned long long value = str2ull(procfile_lineword(ff, l, 1), NULL);
if(unlikely(!st_ctxt)) {
st_ctxt = rrdset_create_localhost(
@@ -796,13 +796,13 @@ int do_proc_stat(int update_every, usec_t dt) {
}
}
else if(unlikely(hash == hash_processes && !processes && strcmp(row_key, "processes") == 0)) {
- processes = str2ull(procfile_lineword(ff, l, 1));
+ processes = str2ull(procfile_lineword(ff, l, 1), NULL);
}
else if(unlikely(hash == hash_procs_running && !running && strcmp(row_key, "procs_running") == 0)) {
- running = str2ull(procfile_lineword(ff, l, 1));
+ running = str2ull(procfile_lineword(ff, l, 1), NULL);
}
else if(unlikely(hash == hash_procs_blocked && !blocked && strcmp(row_key, "procs_blocked") == 0)) {
- blocked = str2ull(procfile_lineword(ff, l, 1));
+ blocked = str2ull(procfile_lineword(ff, l, 1), NULL);
}
}
diff --git a/collectors/proc.plugin/proc_sys_kernel_random_entropy_avail.c b/collectors/proc.plugin/proc_sys_kernel_random_entropy_avail.c
index a04d43039..b32597bc4 100644
--- a/collectors/proc.plugin/proc_sys_kernel_random_entropy_avail.c
+++ b/collectors/proc.plugin/proc_sys_kernel_random_entropy_avail.c
@@ -17,7 +17,7 @@ int do_proc_sys_kernel_random_entropy_avail(int update_every, usec_t dt) {
ff = procfile_readall(ff);
if(unlikely(!ff)) return 0; // we return 0, so that we will retry to open it next time
- unsigned long long entropy = str2ull(procfile_lineword(ff, 0, 0));
+ unsigned long long entropy = str2ull(procfile_lineword(ff, 0, 0), NULL);
static RRDSET *st = NULL;
static RRDDIM *rd = NULL;
diff --git a/collectors/proc.plugin/proc_vmstat.c b/collectors/proc.plugin/proc_vmstat.c
index 638d1690c..ca56e900e 100644
--- a/collectors/proc.plugin/proc_vmstat.c
+++ b/collectors/proc.plugin/proc_vmstat.c
@@ -10,7 +10,7 @@ int do_proc_vmstat(int update_every, usec_t dt) {
(void)dt;
static procfile *ff = NULL;
- static int do_swapio = -1, do_io = -1, do_pgfaults = -1, do_oom_kill = -1, do_numa = -1;
+ static int do_swapio = -1, do_io = -1, do_pgfaults = -1, do_oom_kill = -1, do_numa = -1, do_thp = -1, do_zswapio = -1, do_balloon = -1, do_ksm = -1;
static int has_numa = -1;
static ARL_BASE *arl_base = NULL;
@@ -31,6 +31,103 @@ int do_proc_vmstat(int update_every, usec_t dt) {
static unsigned long long pswpout = 0ULL;
static unsigned long long oom_kill = 0ULL;
+ // THP page migration
+// static unsigned long long pgmigrate_success = 0ULL;
+// static unsigned long long pgmigrate_fail = 0ULL;
+// static unsigned long long thp_migration_success = 0ULL;
+// static unsigned long long thp_migration_fail = 0ULL;
+// static unsigned long long thp_migration_split = 0ULL;
+
+ // Compaction cost model
+ // https://lore.kernel.org/lkml/20121022080525.GB2198@suse.de/
+// static unsigned long long compact_migrate_scanned = 0ULL;
+// static unsigned long long compact_free_scanned = 0ULL;
+// static unsigned long long compact_isolated = 0ULL;
+
+ // THP defragmentation
+ static unsigned long long compact_stall = 0ULL; // incremented when an application stalls allocating THP
+ static unsigned long long compact_fail = 0ULL; // defragmentation events that failed
+ static unsigned long long compact_success = 0ULL; // defragmentation events that succeeded
+
+ // ?
+// static unsigned long long compact_daemon_wake = 0ULL;
+// static unsigned long long compact_daemon_migrate_scanned = 0ULL;
+// static unsigned long long compact_daemon_free_scanned = 0ULL;
+
+ // ?
+// static unsigned long long htlb_buddy_alloc_success = 0ULL;
+// static unsigned long long htlb_buddy_alloc_fail = 0ULL;
+
+ // ?
+// static unsigned long long cma_alloc_success = 0ULL;
+// static unsigned long long cma_alloc_fail = 0ULL;
+
+ // ?
+// static unsigned long long unevictable_pgs_culled = 0ULL;
+// static unsigned long long unevictable_pgs_scanned = 0ULL;
+// static unsigned long long unevictable_pgs_rescued = 0ULL;
+// static unsigned long long unevictable_pgs_mlocked = 0ULL;
+// static unsigned long long unevictable_pgs_munlocked = 0ULL;
+// static unsigned long long unevictable_pgs_cleared = 0ULL;
+// static unsigned long long unevictable_pgs_stranded = 0ULL;
+
+ // THP handling of page faults
+ static unsigned long long thp_fault_alloc = 0ULL; // is incremented every time a huge page is successfully allocated to handle a page fault. This applies to both the first time a page is faulted and for COW faults.
+ static unsigned long long thp_fault_fallback = 0ULL; // is incremented if a page fault fails to allocate a huge page and instead falls back to using small pages.
+ static unsigned long long thp_fault_fallback_charge = 0ULL; // is incremented if a page fault fails to charge a huge page and instead falls back to using small pages even though the allocation was successful.
+
+ // khugepaged collapsing of small pages into huge pages
+ static unsigned long long thp_collapse_alloc = 0ULL; // is incremented by khugepaged when it has found a range of pages to collapse into one huge page and has successfully allocated a new huge page to store the data.
+ static unsigned long long thp_collapse_alloc_failed = 0ULL; // is incremented if khugepaged found a range of pages that should be collapsed into one huge page but failed the allocation.
+
+ // THP handling of file allocations
+ static unsigned long long thp_file_alloc = 0ULL; // is incremented every time a file huge page is successfully allocated
+ static unsigned long long thp_file_fallback = 0ULL; // is incremented if a file huge page is attempted to be allocated but fails and instead falls back to using small pages
+ static unsigned long long thp_file_fallback_charge = 0ULL; // is incremented if a file huge page cannot be charged and instead falls back to using small pages even though the allocation was successful
+ static unsigned long long thp_file_mapped = 0ULL; // is incremented every time a file huge page is mapped into user address space
+
+ // THP splitting of huge pages into small pages
+ static unsigned long long thp_split_page = 0ULL;
+ static unsigned long long thp_split_page_failed = 0ULL;
+ static unsigned long long thp_deferred_split_page = 0ULL; // is incremented when a huge page is put onto split queue. This happens when a huge page is partially unmapped and splitting it would free up some memory. Pages on split queue are going to be split under memory pressure
+ static unsigned long long thp_split_pmd = 0ULL; // is incremented every time a PMD split into table of PTEs. This can happen, for instance, when application calls mprotect() or munmap() on part of huge page. It doesn’t split huge page, only page table entry
+
+ // ?
+// static unsigned long long thp_scan_exceed_none_pte = 0ULL;
+// static unsigned long long thp_scan_exceed_swap_pte = 0ULL;
+// static unsigned long long thp_scan_exceed_share_pte = 0ULL;
+// static unsigned long long thp_split_pud = 0ULL;
+
+ // THP Zero Huge Page
+ static unsigned long long thp_zero_page_alloc = 0ULL; // is incremented every time a huge zero page used for thp is successfully allocated. Note, it doesn’t count every map of the huge zero page, only its allocation
+ static unsigned long long thp_zero_page_alloc_failed = 0ULL; // is incremented if kernel fails to allocate huge zero page and falls back to using small pages
+
+ // THP Swap Out
+ static unsigned long long thp_swpout = 0ULL; // is incremented every time a huge page is swapout in one piece without splitting
+ static unsigned long long thp_swpout_fallback = 0ULL; // is incremented if a huge page has to be split before swapout. Usually because failed to allocate some continuous swap space for the huge page
+
+ // memory ballooning
+ // Current size of balloon is (balloon_inflate - balloon_deflate) pages
+ static unsigned long long balloon_inflate = 0ULL;
+ static unsigned long long balloon_deflate = 0ULL;
+ static unsigned long long balloon_migrate = 0ULL;
+
+ // ?
+// static unsigned long long swap_ra = 0ULL;
+// static unsigned long long swap_ra_hit = 0ULL;
+
+ static unsigned long long ksm_swpin_copy = 0ULL; // is incremented every time a KSM page is copied when swapping in
+ static unsigned long long cow_ksm = 0ULL; // is incremented every time a KSM page triggers copy on write (COW) when users try to write to a KSM page, we have to make a copy
+
+ // zswap
+ static unsigned long long zswpin = 0ULL;
+ static unsigned long long zswpout = 0ULL;
+
+ // ?
+// static unsigned long long direct_map_level2_splits = 0ULL;
+// static unsigned long long direct_map_level3_splits = 0ULL;
+// static unsigned long long nr_unstable = 0ULL;
+
if(unlikely(!ff)) {
char filename[FILENAME_MAX + 1];
snprintfz(filename, FILENAME_MAX, "%s%s", netdata_configured_host_prefix, "/proc/vmstat");
@@ -49,7 +146,10 @@ int do_proc_vmstat(int update_every, usec_t dt) {
do_pgfaults = config_get_boolean("plugin:proc:/proc/vmstat", "memory page faults", CONFIG_BOOLEAN_YES);
do_oom_kill = config_get_boolean("plugin:proc:/proc/vmstat", "out of memory kills", CONFIG_BOOLEAN_AUTO);
do_numa = config_get_boolean_ondemand("plugin:proc:/proc/vmstat", "system-wide numa metric summary", CONFIG_BOOLEAN_AUTO);
-
+ do_thp = config_get_boolean_ondemand("plugin:proc:/proc/vmstat", "transparent huge pages", CONFIG_BOOLEAN_AUTO);
+ do_zswapio = config_get_boolean_ondemand("plugin:proc:/proc/vmstat", "zswap i/o", CONFIG_BOOLEAN_AUTO);
+ do_balloon = config_get_boolean_ondemand("plugin:proc:/proc/vmstat", "memory ballooning", CONFIG_BOOLEAN_AUTO);
+ do_ksm = config_get_boolean_ondemand("plugin:proc:/proc/vmstat", "kernel same memory", CONFIG_BOOLEAN_AUTO);
arl_base = arl_create("vmstat", NULL, 60);
arl_expect(arl_base, "pgfault", &pgfault);
@@ -94,6 +194,56 @@ int do_proc_vmstat(int update_every, usec_t dt) {
has_numa = 0;
do_numa = CONFIG_BOOLEAN_NO;
}
+
+ if(do_thp == CONFIG_BOOLEAN_YES || do_thp == CONFIG_BOOLEAN_AUTO) {
+// arl_expect(arl_base, "pgmigrate_success", &pgmigrate_success);
+// arl_expect(arl_base, "pgmigrate_fail", &pgmigrate_fail);
+// arl_expect(arl_base, "thp_migration_success", &thp_migration_success);
+// arl_expect(arl_base, "thp_migration_fail", &thp_migration_fail);
+// arl_expect(arl_base, "thp_migration_split", &thp_migration_split);
+// arl_expect(arl_base, "compact_migrate_scanned", &compact_migrate_scanned);
+// arl_expect(arl_base, "compact_free_scanned", &compact_free_scanned);
+// arl_expect(arl_base, "compact_isolated", &compact_isolated);
+ arl_expect(arl_base, "compact_stall", &compact_stall);
+ arl_expect(arl_base, "compact_fail", &compact_fail);
+ arl_expect(arl_base, "compact_success", &compact_success);
+// arl_expect(arl_base, "compact_daemon_wake", &compact_daemon_wake);
+// arl_expect(arl_base, "compact_daemon_migrate_scanned", &compact_daemon_migrate_scanned);
+// arl_expect(arl_base, "compact_daemon_free_scanned", &compact_daemon_free_scanned);
+ arl_expect(arl_base, "thp_fault_alloc", &thp_fault_alloc);
+ arl_expect(arl_base, "thp_fault_fallback", &thp_fault_fallback);
+ arl_expect(arl_base, "thp_fault_fallback_charge", &thp_fault_fallback_charge);
+ arl_expect(arl_base, "thp_collapse_alloc", &thp_collapse_alloc);
+ arl_expect(arl_base, "thp_collapse_alloc_failed", &thp_collapse_alloc_failed);
+ arl_expect(arl_base, "thp_file_alloc", &thp_file_alloc);
+ arl_expect(arl_base, "thp_file_fallback", &thp_file_fallback);
+ arl_expect(arl_base, "thp_file_fallback_charge", &thp_file_fallback_charge);
+ arl_expect(arl_base, "thp_file_mapped", &thp_file_mapped);
+ arl_expect(arl_base, "thp_split_page", &thp_split_page);
+ arl_expect(arl_base, "thp_split_page_failed", &thp_split_page_failed);
+ arl_expect(arl_base, "thp_deferred_split_page", &thp_deferred_split_page);
+ arl_expect(arl_base, "thp_split_pmd", &thp_split_pmd);
+ arl_expect(arl_base, "thp_zero_page_alloc", &thp_zero_page_alloc);
+ arl_expect(arl_base, "thp_zero_page_alloc_failed", &thp_zero_page_alloc_failed);
+ arl_expect(arl_base, "thp_swpout", &thp_swpout);
+ arl_expect(arl_base, "thp_swpout_fallback", &thp_swpout_fallback);
+ }
+
+ if(do_balloon == CONFIG_BOOLEAN_YES || do_balloon == CONFIG_BOOLEAN_AUTO) {
+ arl_expect(arl_base, "balloon_inflate", &balloon_inflate);
+ arl_expect(arl_base, "balloon_deflate", &balloon_deflate);
+ arl_expect(arl_base, "balloon_migrate", &balloon_migrate);
+ }
+
+ if(do_ksm == CONFIG_BOOLEAN_YES || do_ksm == CONFIG_BOOLEAN_AUTO) {
+ arl_expect(arl_base, "ksm_swpin_copy", &ksm_swpin_copy);
+ arl_expect(arl_base, "cow_ksm", &cow_ksm);
+ }
+
+ if(do_zswapio == CONFIG_BOOLEAN_YES || do_zswapio == CONFIG_BOOLEAN_AUTO) {
+ arl_expect(arl_base, "zswpin", &zswpin);
+ arl_expect(arl_base, "zswpout", &zswpout);
+ }
}
arl_begin(arl_base);
@@ -306,6 +456,355 @@ int do_proc_vmstat(int update_every, usec_t dt) {
rrdset_done(st_numa);
}
+ // --------------------------------------------------------------------
+
+ if(do_balloon == CONFIG_BOOLEAN_YES || (do_balloon == CONFIG_BOOLEAN_AUTO && (balloon_inflate || balloon_deflate ||
+ balloon_migrate || netdata_zero_metrics_enabled == CONFIG_BOOLEAN_YES))) {
+ do_balloon = CONFIG_BOOLEAN_YES;
+
+ static RRDSET *st_balloon = NULL;
+ static RRDDIM *rd_inflate = NULL, *rd_deflate = NULL, *rd_migrate = NULL;
+
+ if(unlikely(!st_balloon)) {
+ st_balloon = rrdset_create_localhost(
+ "mem"
+ , "balloon"
+ , NULL
+ , "balloon"
+ , NULL
+ , "Memory Ballooning Operations"
+ , "KiB/s"
+ , PLUGIN_PROC_NAME
+ , PLUGIN_PROC_MODULE_VMSTAT_NAME
+ , NETDATA_CHART_PRIO_MEM_BALLOON
+ , update_every
+ , RRDSET_TYPE_LINE
+ );
+
+ rd_inflate = rrddim_add(st_balloon, "inflate", NULL, sysconf(_SC_PAGESIZE), 1024, RRD_ALGORITHM_INCREMENTAL);
+ rd_deflate = rrddim_add(st_balloon, "deflate", NULL, -sysconf(_SC_PAGESIZE), 1024, RRD_ALGORITHM_INCREMENTAL);
+ rd_migrate = rrddim_add(st_balloon, "migrate", NULL, sysconf(_SC_PAGESIZE), 1024, RRD_ALGORITHM_INCREMENTAL);
+ }
+
+ rrddim_set_by_pointer(st_balloon, rd_inflate, balloon_inflate);
+ rrddim_set_by_pointer(st_balloon, rd_deflate, balloon_deflate);
+ rrddim_set_by_pointer(st_balloon, rd_migrate, balloon_migrate);
+
+ rrdset_done(st_balloon);
+ }
+
+ // --------------------------------------------------------------------
+
+ if(do_zswapio == CONFIG_BOOLEAN_YES || (do_zswapio == CONFIG_BOOLEAN_AUTO &&
+ (zswpin || zswpout ||
+ netdata_zero_metrics_enabled == CONFIG_BOOLEAN_YES))) {
+ do_zswapio = CONFIG_BOOLEAN_YES;
+
+ static RRDSET *st_zswapio = NULL;
+ static RRDDIM *rd_in = NULL, *rd_out = NULL;
+
+ if(unlikely(!st_zswapio)) {
+ st_zswapio = rrdset_create_localhost(
+ "system"
+ , "zswapio"
+ , NULL
+ , "zswap"
+ , NULL
+ , "ZSwap I/O"
+ , "KiB/s"
+ , PLUGIN_PROC_NAME
+ , PLUGIN_PROC_MODULE_VMSTAT_NAME
+ , NETDATA_CHART_PRIO_SYSTEM_ZSWAPIO
+ , update_every
+ , RRDSET_TYPE_AREA
+ );
+
+ rd_in = rrddim_add(st_zswapio, "in", NULL, sysconf(_SC_PAGESIZE), 1024, RRD_ALGORITHM_INCREMENTAL);
+ rd_out = rrddim_add(st_zswapio, "out", NULL, -sysconf(_SC_PAGESIZE), 1024, RRD_ALGORITHM_INCREMENTAL);
+ }
+
+ rrddim_set_by_pointer(st_zswapio, rd_in, zswpin);
+ rrddim_set_by_pointer(st_zswapio, rd_out, zswpout);
+ rrdset_done(st_zswapio);
+ }
+
+ // --------------------------------------------------------------------
+
+ if(do_ksm == CONFIG_BOOLEAN_YES || (do_ksm == CONFIG_BOOLEAN_AUTO &&
+ (cow_ksm || ksm_swpin_copy ||
+ netdata_zero_metrics_enabled == CONFIG_BOOLEAN_YES))) {
+ do_ksm = CONFIG_BOOLEAN_YES;
+
+ static RRDSET *st_ksm_cow = NULL;
+ static RRDDIM *rd_swapin = NULL, *rd_write = NULL;
+
+ if(unlikely(!st_ksm_cow)) {
+ st_ksm_cow = rrdset_create_localhost(
+ "mem"
+ , "ksm_cow"
+ , NULL
+ , "ksm"
+ , NULL
+ , "KSM Copy On Write Operations"
+ , "KiB/s"
+ , PLUGIN_PROC_NAME
+ , PLUGIN_PROC_MODULE_VMSTAT_NAME
+ , NETDATA_CHART_PRIO_MEM_KSM_COW
+ , update_every
+ , RRDSET_TYPE_LINE
+ );
+
+ rd_swapin = rrddim_add(st_ksm_cow, "swapin", NULL, sysconf(_SC_PAGESIZE), 1024, RRD_ALGORITHM_INCREMENTAL);
+ rd_write = rrddim_add(st_ksm_cow, "write", NULL, sysconf(_SC_PAGESIZE), 1024, RRD_ALGORITHM_INCREMENTAL);
+ }
+
+ rrddim_set_by_pointer(st_ksm_cow, rd_swapin, ksm_swpin_copy);
+ rrddim_set_by_pointer(st_ksm_cow, rd_write, cow_ksm);
+
+ rrdset_done(st_ksm_cow);
+ }
+
+ // --------------------------------------------------------------------
+
+ if(do_thp == CONFIG_BOOLEAN_YES || do_thp == CONFIG_BOOLEAN_AUTO) {
+
+ if(do_thp == CONFIG_BOOLEAN_YES || (do_thp == CONFIG_BOOLEAN_AUTO &&
+ (netdata_zero_metrics_enabled == CONFIG_BOOLEAN_YES || thp_fault_alloc || thp_fault_fallback || thp_fault_fallback_charge))) {
+
+ static RRDSET *st_thp_fault = NULL;
+ static RRDDIM *rd_alloc = NULL, *rd_fallback = NULL, *rd_fallback_charge = NULL;
+
+ if(unlikely(!st_thp_fault)) {
+ st_thp_fault = rrdset_create_localhost(
+ "mem"
+ , "thp_faults"
+ , NULL
+ , "hugepages"
+ , NULL
+ , "Transparent Huge Page Fault Allocations"
+ , "events/s"
+ , PLUGIN_PROC_NAME
+ , PLUGIN_PROC_MODULE_VMSTAT_NAME
+ , NETDATA_CHART_PRIO_MEM_HUGEPAGES_FAULTS
+ , update_every
+ , RRDSET_TYPE_LINE
+ );
+
+ rd_alloc = rrddim_add(st_thp_fault, "alloc", NULL, 1, 1, RRD_ALGORITHM_INCREMENTAL);
+ rd_fallback = rrddim_add(st_thp_fault, "fallback", NULL, -1, 1, RRD_ALGORITHM_INCREMENTAL);
+ rd_fallback_charge = rrddim_add(st_thp_fault, "fallback_charge", NULL, -1, 1, RRD_ALGORITHM_INCREMENTAL);
+ }
+
+ rrddim_set_by_pointer(st_thp_fault, rd_alloc, thp_fault_alloc);
+ rrddim_set_by_pointer(st_thp_fault, rd_fallback, thp_fault_fallback);
+ rrddim_set_by_pointer(st_thp_fault, rd_fallback_charge, thp_fault_fallback_charge);
+
+ rrdset_done(st_thp_fault);
+ }
+
+ if(do_thp == CONFIG_BOOLEAN_YES || (do_thp == CONFIG_BOOLEAN_AUTO &&
+ (netdata_zero_metrics_enabled == CONFIG_BOOLEAN_YES || thp_fault_alloc || thp_fault_fallback || thp_fault_fallback_charge || thp_file_mapped))) {
+
+ static RRDSET *st_thp_file = NULL;
+ static RRDDIM *rd_alloc = NULL, *rd_fallback = NULL, *rd_fallback_charge = NULL, *rd_mapped = NULL;
+
+ if(unlikely(!st_thp_file)) {
+ st_thp_file = rrdset_create_localhost(
+ "mem"
+ , "thp_file"
+ , NULL
+ , "hugepages"
+ , NULL
+ , "Transparent Huge Page File Allocations"
+ , "events/s"
+ , PLUGIN_PROC_NAME
+ , PLUGIN_PROC_MODULE_VMSTAT_NAME
+ , NETDATA_CHART_PRIO_MEM_HUGEPAGES_FILE
+ , update_every
+ , RRDSET_TYPE_LINE
+ );
+
+ rd_alloc = rrddim_add(st_thp_file, "alloc", NULL, 1, 1, RRD_ALGORITHM_INCREMENTAL);
+ rd_fallback = rrddim_add(st_thp_file, "fallback", NULL, -1, 1, RRD_ALGORITHM_INCREMENTAL);
+ rd_mapped = rrddim_add(st_thp_file, "mapped", NULL, 1, 1, RRD_ALGORITHM_INCREMENTAL);
+ rd_fallback_charge = rrddim_add(st_thp_file, "fallback_charge", NULL, -1, 1, RRD_ALGORITHM_INCREMENTAL);
+ }
+
+ rrddim_set_by_pointer(st_thp_file, rd_alloc, thp_file_alloc);
+ rrddim_set_by_pointer(st_thp_file, rd_fallback, thp_file_fallback);
+ rrddim_set_by_pointer(st_thp_file, rd_mapped, thp_file_fallback_charge);
+ rrddim_set_by_pointer(st_thp_file, rd_fallback_charge, thp_file_fallback_charge);
+
+ rrdset_done(st_thp_file);
+ }
+
+ if(do_thp == CONFIG_BOOLEAN_YES || (do_thp == CONFIG_BOOLEAN_AUTO &&
+ (netdata_zero_metrics_enabled == CONFIG_BOOLEAN_YES || thp_zero_page_alloc || thp_zero_page_alloc_failed))) {
+
+ static RRDSET *st_thp_zero = NULL;
+ static RRDDIM *rd_alloc = NULL, *rd_failed = NULL;
+
+ if(unlikely(!st_thp_zero)) {
+ st_thp_zero = rrdset_create_localhost(
+ "mem"
+ , "thp_zero"
+ , NULL
+ , "hugepages"
+ , NULL
+ , "Transparent Huge Zero Page Allocations"
+ , "events/s"
+ , PLUGIN_PROC_NAME
+ , PLUGIN_PROC_MODULE_VMSTAT_NAME
+ , NETDATA_CHART_PRIO_MEM_HUGEPAGES_ZERO
+ , update_every
+ , RRDSET_TYPE_LINE
+ );
+
+ rd_alloc = rrddim_add(st_thp_zero, "alloc", NULL, 1, 1, RRD_ALGORITHM_INCREMENTAL);
+ rd_failed = rrddim_add(st_thp_zero, "failed", NULL, -1, 1, RRD_ALGORITHM_INCREMENTAL);
+ }
+
+ rrddim_set_by_pointer(st_thp_zero, rd_alloc, thp_zero_page_alloc);
+ rrddim_set_by_pointer(st_thp_zero, rd_failed, thp_zero_page_alloc_failed);
+
+ rrdset_done(st_thp_zero);
+ }
+
+ if(do_thp == CONFIG_BOOLEAN_YES || (do_thp == CONFIG_BOOLEAN_AUTO &&
+ (netdata_zero_metrics_enabled == CONFIG_BOOLEAN_YES || thp_collapse_alloc || thp_collapse_alloc_failed))) {
+
+ static RRDSET *st_khugepaged = NULL;
+ static RRDDIM *rd_alloc = NULL, *rd_failed = NULL;
+
+ if(unlikely(!st_khugepaged)) {
+ st_khugepaged = rrdset_create_localhost(
+ "mem"
+ , "thp_collapse"
+ , NULL
+ , "hugepages"
+ , NULL
+ , "Transparent Huge Pages Collapsed by khugepaged"
+ , "events/s"
+ , PLUGIN_PROC_NAME
+ , PLUGIN_PROC_MODULE_VMSTAT_NAME
+ , NETDATA_CHART_PRIO_MEM_HUGEPAGES_KHUGEPAGED
+ , update_every
+ , RRDSET_TYPE_LINE
+ );
+
+ rd_alloc = rrddim_add(st_khugepaged, "alloc", NULL, 1, 1, RRD_ALGORITHM_INCREMENTAL);
+ rd_failed = rrddim_add(st_khugepaged, "failed", NULL, -1, 1, RRD_ALGORITHM_INCREMENTAL);
+ }
+
+ rrddim_set_by_pointer(st_khugepaged, rd_alloc, thp_collapse_alloc);
+ rrddim_set_by_pointer(st_khugepaged, rd_failed, thp_collapse_alloc_failed);
+
+ rrdset_done(st_khugepaged);
+ }
+
+ if(do_thp == CONFIG_BOOLEAN_YES || (do_thp == CONFIG_BOOLEAN_AUTO &&
+ (netdata_zero_metrics_enabled == CONFIG_BOOLEAN_YES || thp_split_page || thp_split_page_failed || thp_deferred_split_page || thp_split_pmd))) {
+
+ static RRDSET *st_thp_split = NULL;
+ static RRDDIM *rd_split = NULL, *rd_failed = NULL, *rd_deferred_split = NULL, *rd_split_pmd = NULL;
+
+ if(unlikely(!st_thp_split)) {
+ st_thp_split = rrdset_create_localhost(
+ "mem"
+ , "thp_split"
+ , NULL
+ , "hugepages"
+ , NULL
+ , "Transparent Huge Page Splits"
+ , "events/s"
+ , PLUGIN_PROC_NAME
+ , PLUGIN_PROC_MODULE_VMSTAT_NAME
+ , NETDATA_CHART_PRIO_MEM_HUGEPAGES_SPLITS
+ , update_every
+ , RRDSET_TYPE_LINE
+ );
+
+ rd_split = rrddim_add(st_thp_split, "split", NULL, 1, 1, RRD_ALGORITHM_INCREMENTAL);
+ rd_failed = rrddim_add(st_thp_split, "failed", NULL, -1, 1, RRD_ALGORITHM_INCREMENTAL);
+ rd_split_pmd = rrddim_add(st_thp_split, "split_pmd", NULL, 1, 1, RRD_ALGORITHM_INCREMENTAL);
+ rd_deferred_split = rrddim_add(st_thp_split, "split_deferred", NULL, 1, 1, RRD_ALGORITHM_INCREMENTAL);
+ }
+
+ rrddim_set_by_pointer(st_thp_split, rd_split, thp_split_page);
+ rrddim_set_by_pointer(st_thp_split, rd_failed, thp_split_page_failed);
+ rrddim_set_by_pointer(st_thp_split, rd_split_pmd, thp_split_pmd);
+ rrddim_set_by_pointer(st_thp_split, rd_deferred_split, thp_deferred_split_page);
+
+ rrdset_done(st_thp_split);
+ }
+
+ if(do_thp == CONFIG_BOOLEAN_YES || (do_thp == CONFIG_BOOLEAN_AUTO &&
+ (netdata_zero_metrics_enabled == CONFIG_BOOLEAN_YES || thp_swpout || thp_swpout_fallback))) {
+
+ static RRDSET *st_tmp_swapout = NULL;
+ static RRDDIM *rd_swapout = NULL, *rd_fallback = NULL;
+
+ if(unlikely(!st_tmp_swapout)) {
+ st_tmp_swapout = rrdset_create_localhost(
+ "mem"
+ , "thp_swapout"
+ , NULL
+ , "hugepages"
+ , NULL
+ , "Transparent Huge Pages Swap Out"
+ , "events/s"
+ , PLUGIN_PROC_NAME
+ , PLUGIN_PROC_MODULE_VMSTAT_NAME
+ , NETDATA_CHART_PRIO_MEM_HUGEPAGES_SWAPOUT
+ , update_every
+ , RRDSET_TYPE_LINE
+ );
+
+ rd_swapout = rrddim_add(st_tmp_swapout, "swapout", NULL, 1, 1, RRD_ALGORITHM_INCREMENTAL);
+ rd_fallback = rrddim_add(st_tmp_swapout, "fallback", NULL, -1, 1, RRD_ALGORITHM_INCREMENTAL);
+ }
+
+ rrddim_set_by_pointer(st_tmp_swapout, rd_swapout, thp_swpout);
+ rrddim_set_by_pointer(st_tmp_swapout, rd_fallback, thp_swpout_fallback);
+
+ rrdset_done(st_tmp_swapout);
+ }
+
+ if(do_thp == CONFIG_BOOLEAN_YES || (do_thp == CONFIG_BOOLEAN_AUTO &&
+ (netdata_zero_metrics_enabled == CONFIG_BOOLEAN_YES || compact_stall || compact_fail || compact_success))) {
+
+ static RRDSET *st_thp_compact = NULL;
+ static RRDDIM *rd_success = NULL, *rd_fail = NULL, *rd_stall = NULL;
+
+ if(unlikely(!st_thp_compact)) {
+ st_thp_compact = rrdset_create_localhost(
+ "mem"
+ , "thp_compact"
+ , NULL
+ , "hugepages"
+ , NULL
+ , "Transparent Huge Pages Compaction"
+ , "events/s"
+ , PLUGIN_PROC_NAME
+ , PLUGIN_PROC_MODULE_VMSTAT_NAME
+ , NETDATA_CHART_PRIO_MEM_HUGEPAGES_COMPACT
+ , update_every
+ , RRDSET_TYPE_LINE
+ );
+
+ rd_success = rrddim_add(st_thp_compact, "success", NULL, 1, 1, RRD_ALGORITHM_INCREMENTAL);
+ rd_fail = rrddim_add(st_thp_compact, "fail", NULL, -1, 1, RRD_ALGORITHM_INCREMENTAL);
+ rd_stall = rrddim_add(st_thp_compact, "stall", NULL, 1, 1, RRD_ALGORITHM_INCREMENTAL);
+ }
+
+ rrddim_set_by_pointer(st_thp_compact, rd_success, compact_success);
+ rrddim_set_by_pointer(st_thp_compact, rd_fail, compact_fail);
+ rrddim_set_by_pointer(st_thp_compact, rd_stall, compact_stall);
+
+ rrdset_done(st_thp_compact);
+ }
+ }
+
return 0;
}
diff --git a/collectors/proc.plugin/sys_block_zram.c b/collectors/proc.plugin/sys_block_zram.c
index 1be725b10..f9166ace0 100644
--- a/collectors/proc.plugin/sys_block_zram.c
+++ b/collectors/proc.plugin/sys_block_zram.c
@@ -130,18 +130,20 @@ static inline void init_rrd(const char *name, ZRAM_DEVICE *d, int update_every)
static int init_devices(DICTIONARY *devices, unsigned int zram_id, int update_every) {
int count = 0;
- DIR *dir = opendir("/dev");
struct dirent *de;
struct stat st;
- char filename[FILENAME_MAX + 1];
procfile *ff = NULL;
ZRAM_DEVICE device;
+ char filename[FILENAME_MAX + 1];
+
+ snprintfz(filename, FILENAME_MAX, "%s%s", netdata_configured_host_prefix, "/dev");
+ DIR *dir = opendir(filename);
if (unlikely(!dir))
return 0;
while ((de = readdir(dir)))
{
- snprintfz(filename, FILENAME_MAX, "/dev/%s", de->d_name);
+ snprintfz(filename, FILENAME_MAX, "%s/dev/%s", netdata_configured_host_prefix, de->d_name);
if (unlikely(stat(filename, &st) != 0))
{
collector_error("ZRAM : Unable to stat %s: %s", filename, strerror(errno));
@@ -150,7 +152,7 @@ static int init_devices(DICTIONARY *devices, unsigned int zram_id, int update_ev
if (major(st.st_rdev) == zram_id)
{
collector_info("ZRAM : Found device %s", filename);
- snprintfz(filename, FILENAME_MAX, "/sys/block/%s/mm_stat", de->d_name);
+ snprintfz(filename, FILENAME_MAX, "%s/sys/block/%s/mm_stat", netdata_configured_host_prefix, de->d_name);
ff = procfile_open(filename, " \t:", PROCFILE_FLAG_DEFAULT);
if (ff == NULL)
{
@@ -191,13 +193,13 @@ static inline int read_mm_stat(procfile *ff, MM_STAT *stats) {
return -1;
}
- stats->orig_data_size = str2ull(procfile_word(ff, 0));
- stats->compr_data_size = str2ull(procfile_word(ff, 1));
- stats->mem_used_total = str2ull(procfile_word(ff, 2));
- stats->mem_limit = str2ull(procfile_word(ff, 3));
- stats->mem_used_max = str2ull(procfile_word(ff, 4));
- stats->same_pages = str2ull(procfile_word(ff, 5));
- stats->pages_compacted = str2ull(procfile_word(ff, 6));
+ stats->orig_data_size = str2ull(procfile_word(ff, 0), NULL);
+ stats->compr_data_size = str2ull(procfile_word(ff, 1), NULL);
+ stats->mem_used_total = str2ull(procfile_word(ff, 2), NULL);
+ stats->mem_limit = str2ull(procfile_word(ff, 3), NULL);
+ stats->mem_used_max = str2ull(procfile_word(ff, 4), NULL);
+ stats->same_pages = str2ull(procfile_word(ff, 5), NULL);
+ stats->pages_compacted = str2ull(procfile_word(ff, 6), NULL);
return 0;
}
@@ -249,10 +251,14 @@ int do_sys_block_zram(int update_every, usec_t dt) {
if (unlikely(!initialized))
{
initialized = 1;
- ff = procfile_open("/proc/devices", " \t:", PROCFILE_FLAG_DEFAULT);
+
+ char filename[FILENAME_MAX + 1];
+ snprintfz(filename, FILENAME_MAX, "%s%s", netdata_configured_host_prefix, "/proc/devices");
+
+ ff = procfile_open(filename, " \t:", PROCFILE_FLAG_DEFAULT);
if (ff == NULL)
{
- collector_error("Cannot read /proc/devices");
+ collector_error("Cannot read %s", filename);
return 1;
}
ff = procfile_readall(ff);
diff --git a/collectors/proc.plugin/sys_class_infiniband.c b/collectors/proc.plugin/sys_class_infiniband.c
index 5f5e53239..f0b7f9a52 100644
--- a/collectors/proc.plugin/sys_class_infiniband.c
+++ b/collectors/proc.plugin/sys_class_infiniband.c
@@ -327,8 +327,9 @@ int do_sys_class_infiniband(int update_every, usec_t dt)
enable_only_active = config_get_boolean_ondemand(
CONFIG_SECTION_PLUGIN_SYS_CLASS_INFINIBAND, "monitor only active ports", CONFIG_BOOLEAN_AUTO);
disabled_list = simple_pattern_create(
- config_get(CONFIG_SECTION_PLUGIN_SYS_CLASS_INFINIBAND, "disable by default interfaces matching", ""), NULL,
- SIMPLE_PATTERN_EXACT);
+ config_get(CONFIG_SECTION_PLUGIN_SYS_CLASS_INFINIBAND, "disable by default interfaces matching", ""),
+ NULL,
+ SIMPLE_PATTERN_EXACT, true);
dt_to_refresh_ports =
config_get_number(CONFIG_SECTION_PLUGIN_SYS_CLASS_INFINIBAND, "refresh ports state every seconds", 30) *
@@ -475,8 +476,8 @@ int do_sys_class_infiniband(int update_every, usec_t dt)
char *buffer_width = strstr(buffer_rate, "(");
buffer_width++;
// str2ull will stop on first non-decimal value
- p->speed = str2ull(buffer_rate);
- p->width = str2ull(buffer_width);
+ p->speed = str2ull(buffer_rate, NULL);
+ p->width = str2ull(buffer_width, NULL);
}
if (!p->discovered)
diff --git a/collectors/proc.plugin/sys_class_power_supply.c b/collectors/proc.plugin/sys_class_power_supply.c
index ec36a295f..8687ecb55 100644
--- a/collectors/proc.plugin/sys_class_power_supply.c
+++ b/collectors/proc.plugin/sys_class_power_supply.c
@@ -263,7 +263,7 @@ int do_sys_class_power_supply(int update_every, usec_t dt) {
}
else {
buffer[r] = '\0';
- ps->capacity->value = str2ull(buffer);
+ ps->capacity->value = str2ull(buffer, NULL);
if(unlikely(!keep_fds_open)) {
close(ps->capacity->fd);
@@ -307,7 +307,7 @@ int do_sys_class_power_supply(int update_every, usec_t dt) {
break;
}
buffer[r] = '\0';
- pd->value = str2ull(buffer);
+ pd->value = str2ull(buffer, NULL);
if(unlikely(!keep_fds_open)) {
close(pd->fd);
diff --git a/collectors/proc.plugin/sys_devices_system_edac_mc.c b/collectors/proc.plugin/sys_devices_system_edac_mc.c
index fe8250963..fdb6b51e9 100644
--- a/collectors/proc.plugin/sys_devices_system_edac_mc.c
+++ b/collectors/proc.plugin/sys_devices_system_edac_mc.c
@@ -97,7 +97,7 @@ int do_proc_sys_devices_system_edac_mc(int update_every, usec_t dt) {
if(unlikely(!m->ce_ff || procfile_lines(m->ce_ff) < 1 || procfile_linewords(m->ce_ff, 0) < 1))
continue;
- m->ce_count = str2ull(procfile_lineword(m->ce_ff, 0, 0));
+ m->ce_count = str2ull(procfile_lineword(m->ce_ff, 0, 0), NULL);
ce_sum += m->ce_count;
m->ce_updated = 1;
}
@@ -119,7 +119,7 @@ int do_proc_sys_devices_system_edac_mc(int update_every, usec_t dt) {
if(unlikely(!m->ue_ff || procfile_lines(m->ue_ff) < 1 || procfile_linewords(m->ue_ff, 0) < 1))
continue;
- m->ue_count = str2ull(procfile_lineword(m->ue_ff, 0, 0));
+ m->ue_count = str2ull(procfile_lineword(m->ue_ff, 0, 0), NULL);
ue_sum += m->ue_count;
m->ue_updated = 1;
}
diff --git a/collectors/proc.plugin/sys_devices_system_node.c b/collectors/proc.plugin/sys_devices_system_node.c
index 068d739db..d6db94a27 100644
--- a/collectors/proc.plugin/sys_devices_system_node.c
+++ b/collectors/proc.plugin/sys_devices_system_node.c
@@ -105,7 +105,7 @@ int do_proc_sys_devices_system_node(int update_every, usec_t dt) {
, m->name
, NULL
, "numa"
- , NULL
+ , "mem.numa_nodes"
, "NUMA events"
, "events/s"
, PLUGIN_PROC_NAME
diff --git a/collectors/proc.plugin/sys_fs_btrfs.c b/collectors/proc.plugin/sys_fs_btrfs.c
index 6abfd7852..da89411bd 100644
--- a/collectors/proc.plugin/sys_fs_btrfs.c
+++ b/collectors/proc.plugin/sys_fs_btrfs.c
@@ -10,13 +10,31 @@ typedef struct btrfs_disk {
int exists;
char *size_filename;
- char *hw_sector_size_filename;
unsigned long long size;
- unsigned long long hw_sector_size;
struct btrfs_disk *next;
} BTRFS_DISK;
+typedef struct btrfs_device {
+ int id;
+ int exists;
+
+ char *error_stats_filename;
+ RRDSET *st_error_stats;
+ RRDDIM *rd_write_errs;
+ RRDDIM *rd_read_errs;
+ RRDDIM *rd_flush_errs;
+ RRDDIM *rd_corruption_errs;
+ RRDDIM *rd_generation_errs;
+ collected_number write_errs;
+ collected_number read_errs;
+ collected_number flush_errs;
+ collected_number corruption_errs;
+ collected_number generation_errs;
+
+ struct btrfs_device *next;
+} BTRFS_DEVICE;
+
typedef struct btrfs_node {
int exists;
int logged_error;
@@ -26,10 +44,6 @@ typedef struct btrfs_node {
char *label;
- // unsigned long long int sectorsize;
- // unsigned long long int nodesize;
- // unsigned long long int quota_override;
-
#define declare_btrfs_allocation_section_field(SECTION, FIELD) \
char *allocation_ ## SECTION ## _ ## FIELD ## _filename; \
unsigned long long int allocation_ ## SECTION ## _ ## FIELD;
@@ -75,17 +89,130 @@ typedef struct btrfs_node {
declare_btrfs_allocation_section_field(system, disk_total)
declare_btrfs_allocation_section_field(system, disk_used)
+ // --------------------------------------------------------------------
+ // commit stats
+
+ char *commit_stats_filename;
+
+ RRDSET *st_commits;
+ RRDDIM *rd_commits;
+ long long commits_total;
+ collected_number commits_new;
+
+ RRDSET *st_commits_percentage_time;
+ RRDDIM *rd_commits_percentage_time;
+ long long commit_timings_total;
+ long long commits_percentage_time;
+
+ RRDSET *st_commit_timings;
+ RRDDIM *rd_commit_timings_last;
+ RRDDIM *rd_commit_timings_max;
+ collected_number commit_timings_last;
+ collected_number commit_timings_max;
+
BTRFS_DISK *disks;
+ BTRFS_DEVICE *devices;
+
struct btrfs_node *next;
} BTRFS_NODE;
static BTRFS_NODE *nodes = NULL;
+static inline int collect_btrfs_error_stats(BTRFS_DEVICE *device){
+ char buffer[120 + 1];
+
+ int ret = read_file(device->error_stats_filename, buffer, 120);
+ if(unlikely(ret)) {
+ collector_error("BTRFS: failed to read '%s'", device->error_stats_filename);
+ device->write_errs = 0;
+ device->read_errs = 0;
+ device->flush_errs = 0;
+ device->corruption_errs = 0;
+ device->generation_errs = 0;
+ return ret;
+ }
+
+ char *p = buffer;
+ while(p){
+ char *val = strsep_skip_consecutive_separators(&p, "\n");
+ if(unlikely(!val || !*val)) break;
+ char *key = strsep_skip_consecutive_separators(&val, " ");
+
+ if(!strcmp(key, "write_errs")) device->write_errs = str2ull(val, NULL);
+ else if(!strcmp(key, "read_errs")) device->read_errs = str2ull(val, NULL);
+ else if(!strcmp(key, "flush_errs")) device->flush_errs = str2ull(val, NULL);
+ else if(!strcmp(key, "corruption_errs")) device->corruption_errs = str2ull(val, NULL);
+ else if(!strcmp(key, "generation_errs")) device->generation_errs = str2ull(val, NULL);
+ }
+ return 0;
+}
+
+static inline int collect_btrfs_commits_stats(BTRFS_NODE *node, int update_every){
+ char buffer[120 + 1];
+
+ int ret = read_file(node->commit_stats_filename, buffer, 120);
+ if(unlikely(ret)) {
+ collector_error("BTRFS: failed to read '%s'", node->commit_stats_filename);
+ node->commits_total = 0;
+ node->commits_new = 0;
+ node->commit_timings_last = 0;
+ node->commit_timings_max = 0;
+ node->commit_timings_total = 0;
+ node->commits_percentage_time = 0;
+
+ return ret;
+ }
+
+ char *p = buffer;
+ while(p){
+ char *val = strsep_skip_consecutive_separators(&p, "\n");
+ if(unlikely(!val || !*val)) break;
+ char *key = strsep_skip_consecutive_separators(&val, " ");
+
+ if(!strcmp(key, "commits")){
+ long long commits_total_new = str2ull(val, NULL);
+ if(likely(node->commits_total)){
+ if((node->commits_new = commits_total_new - node->commits_total))
+ node->commits_total = commits_total_new;
+ } else node->commits_total = commits_total_new;
+ }
+ else if(!strcmp(key, "last_commit_ms")) node->commit_timings_last = str2ull(val, NULL);
+ else if(!strcmp(key, "max_commit_ms")) node->commit_timings_max = str2ull(val, NULL);
+ else if(!strcmp(key, "total_commit_ms")) {
+ long long commit_timings_total_new = str2ull(val, NULL);
+ if(likely(node->commit_timings_total)){
+ long time_delta = commit_timings_total_new - node->commit_timings_total;
+ if(time_delta){
+ node->commits_percentage_time = time_delta * 10 / update_every;
+ node->commit_timings_total = commit_timings_total_new;
+ } else node->commits_percentage_time = 0;
+
+ } else node->commit_timings_total = commit_timings_total_new;
+ }
+ }
+ return 0;
+}
+
+static inline void btrfs_free_commits_stats(BTRFS_NODE *node){
+ if(node->st_commits){
+ rrdset_is_obsolete(node->st_commits);
+ rrdset_is_obsolete(node->st_commit_timings);
+ }
+ freez(node->commit_stats_filename);
+ node->commit_stats_filename = NULL;
+}
+
static inline void btrfs_free_disk(BTRFS_DISK *d) {
freez(d->name);
freez(d->size_filename);
- freez(d->hw_sector_size_filename);
+ freez(d);
+}
+
+static inline void btrfs_free_device(BTRFS_DEVICE *d) {
+ if(d->st_error_stats)
+ rrdset_is_obsolete(d->st_error_stats);
+ freez(d->error_stats_filename);
freez(d);
}
@@ -113,12 +240,20 @@ static inline void btrfs_free_node(BTRFS_NODE *node) {
freez(node->allocation_system_bytes_used_filename);
freez(node->allocation_system_total_bytes_filename);
+ btrfs_free_commits_stats(node);
+
while(node->disks) {
BTRFS_DISK *d = node->disks;
node->disks = node->disks->next;
btrfs_free_disk(d);
}
+ while(node->devices) {
+ BTRFS_DEVICE *d = node->devices;
+ node->devices = node->devices->next;
+ btrfs_free_device(d);
+ }
+
freez(node->label);
freez(node->id);
freez(node);
@@ -175,19 +310,6 @@ static inline int find_btrfs_disks(BTRFS_NODE *node, const char *path) {
snprintfz(filename, FILENAME_MAX, "%s/%s/size", path, de->d_name);
d->size_filename = strdupz(filename);
- // for bcache
- snprintfz(filename, FILENAME_MAX, "%s/%s/bcache/../queue/hw_sector_size", path, de->d_name);
- struct stat sb;
- if(stat(filename, &sb) == -1) {
- // for disks
- snprintfz(filename, FILENAME_MAX, "%s/%s/queue/hw_sector_size", path, de->d_name);
- if(stat(filename, &sb) == -1)
- // for partitions
- snprintfz(filename, FILENAME_MAX, "%s/%s/../queue/hw_sector_size", path, de->d_name);
- }
-
- d->hw_sector_size_filename = strdupz(filename);
-
// link it
d->next = node->disks;
node->disks = d;
@@ -205,13 +327,11 @@ static inline int find_btrfs_disks(BTRFS_NODE *node, const char *path) {
continue;
}
- if(read_single_number_file(d->hw_sector_size_filename, &d->hw_sector_size) != 0) {
- collector_error("BTRFS: failed to read '%s'", d->hw_sector_size_filename);
- d->exists = 0;
- continue;
- }
-
- node->all_disks_total += d->size * d->hw_sector_size;
+ // /sys/block/<name>/size is in fixed-size sectors of 512 bytes
+ // https://github.com/torvalds/linux/blob/v6.2/block/genhd.c#L946-L950
+ // https://github.com/torvalds/linux/blob/v6.2/include/linux/types.h#L120-L121
+ // (also see #3481, #3483)
+ node->all_disks_total += d->size * 512;
}
closedir(dir);
@@ -245,8 +365,106 @@ static inline int find_btrfs_disks(BTRFS_NODE *node, const char *path) {
return 0;
}
+static inline int find_btrfs_devices(BTRFS_NODE *node, const char *path) {
+ char filename[FILENAME_MAX + 1];
+
+ BTRFS_DEVICE *d;
+ for(d = node->devices ; d ; d = d->next)
+ d->exists = 0;
+
+ DIR *dir = opendir(path);
+ if (!dir) {
+ if(!node->logged_error) {
+ collector_error("BTRFS: Cannot open directory '%s'.", path);
+ node->logged_error = 1;
+ }
+ return 1;
+ }
+ node->logged_error = 0;
+
+ struct dirent *de = NULL;
+ while ((de = readdir(dir))) {
+ if (de->d_type != DT_DIR
+ || !strcmp(de->d_name, ".")
+ || !strcmp(de->d_name, "..")
+ ) {
+ // collector_info("BTRFS: ignoring '%s'", de->d_name);
+ continue;
+ }
+
+ collector_info("BTRFS: device found '%s'", de->d_name);
+
+ // --------------------------------------------------------------------
+ // search for it
+
+ for(d = node->devices ; d ; d = d->next) {
+ if(str2ll(de->d_name, NULL) == d->id){
+ collector_info("BTRFS: existing device id '%d'", d->id);
+ break;
+ }
+ }
+
+ // --------------------------------------------------------------------
+ // did we find it?
+
+ if(!d) {
+ d = callocz(sizeof(BTRFS_DEVICE), 1);
+
+ d->id = str2ll(de->d_name, NULL);
+ collector_info("BTRFS: new device with id '%d'", d->id);
-static inline int find_all_btrfs_pools(const char *path) {
+ snprintfz(filename, FILENAME_MAX, "%s/%d/error_stats", path, d->id);
+ d->error_stats_filename = strdupz(filename);
+ collector_info("BTRFS: error_stats_filename '%s'", filename);
+
+ // link it
+ d->next = node->devices;
+ node->devices = d;
+ }
+
+ d->exists = 1;
+
+
+ // --------------------------------------------------------------------
+ // update the values
+
+ if(unlikely(collect_btrfs_error_stats(d)))
+ d->exists = 0; // 'd' will be garbaged collected in loop below
+ }
+ closedir(dir);
+
+ // ------------------------------------------------------------------------
+ // cleanup
+
+ BTRFS_DEVICE *last = NULL;
+ d = node->devices;
+
+ while(d) {
+ if(unlikely(!d->exists)) {
+ if(unlikely(node->devices == d)) {
+ node->devices = d->next;
+ btrfs_free_device(d);
+ d = node->devices;
+ last = NULL;
+ }
+ else {
+ last->next = d->next;
+ btrfs_free_device(d);
+ d = last->next;
+ }
+
+ continue;
+ }
+
+ last = d;
+ d = d->next;
+ }
+
+ return 0;
+}
+
+
+static inline int find_all_btrfs_pools(const char *path, int update_every) {
static int logged_error = 0;
char filename[FILENAME_MAX + 1];
@@ -292,6 +510,10 @@ static inline int find_all_btrfs_pools(const char *path) {
snprintfz(filename, FILENAME_MAX, "%s/%s/devices", path, de->d_name);
find_btrfs_disks(node, filename);
+ // update devices
+ snprintfz(filename, FILENAME_MAX, "%s/%s/devinfo", path, de->d_name);
+ find_btrfs_devices(node, filename);
+
continue;
}
@@ -324,27 +546,6 @@ static inline int find_all_btrfs_pools(const char *path) {
node->label = strdupz(node->id);
}
- //snprintfz(filename, FILENAME_MAX, "%s/%s/sectorsize", path, de->d_name);
- //if(read_single_number_file(filename, &node->sectorsize) != 0) {
- // collector_error("BTRFS: failed to read '%s'", filename);
- // btrfs_free_node(node);
- // continue;
- //}
-
- //snprintfz(filename, FILENAME_MAX, "%s/%s/nodesize", path, de->d_name);
- //if(read_single_number_file(filename, &node->nodesize) != 0) {
- // collector_error("BTRFS: failed to read '%s'", filename);
- // btrfs_free_node(node);
- // continue;
- //}
-
- //snprintfz(filename, FILENAME_MAX, "%s/%s/quota_override", path, de->d_name);
- //if(read_single_number_file(filename, &node->quota_override) != 0) {
- // collector_error("BTRFS: failed to read '%s'", filename);
- // btrfs_free_node(node);
- // continue;
- //}
-
// --------------------------------------------------------------------
// macros to simplify our life
@@ -399,6 +600,15 @@ static inline int find_all_btrfs_pools(const char *path) {
init_btrfs_allocation_section_field(system, disk_total);
init_btrfs_allocation_section_field(system, disk_used);
+ // --------------------------------------------------------------------
+ // commit stats
+
+ snprintfz(filename, FILENAME_MAX, "%s/%s/commit_stats", path, de->d_name);
+ if(!node->commit_stats_filename) node->commit_stats_filename = strdupz(filename);
+ if(unlikely(collect_btrfs_commits_stats(node, update_every))){
+ collector_error("BTRFS: failed to collect commit stats for '%s'", node->id);
+ btrfs_free_commits_stats(node);
+ }
// --------------------------------------------------------------------
// find all disks related to this node
@@ -407,6 +617,11 @@ static inline int find_all_btrfs_pools(const char *path) {
snprintfz(filename, FILENAME_MAX, "%s/%s/devices", path, de->d_name);
find_btrfs_disks(node, filename);
+ // --------------------------------------------------------------------
+ // find all devices related to this node
+
+ snprintfz(filename, FILENAME_MAX, "%s/%s/devinfo", path, de->d_name);
+ find_btrfs_devices(node, filename);
// --------------------------------------------------------------------
// link it
@@ -449,8 +664,8 @@ static inline int find_all_btrfs_pools(const char *path) {
}
static void add_labels_to_btrfs(BTRFS_NODE *n, RRDSET *st) {
- rrdlabels_add(st->rrdlabels, "device", n->id, RRDLABEL_SRC_AUTO);
- rrdlabels_add(st->rrdlabels, "device_label", n->label, RRDLABEL_SRC_AUTO);
+ rrdlabels_add(st->rrdlabels, "filesystem_uuid", n->id, RRDLABEL_SRC_AUTO);
+ rrdlabels_add(st->rrdlabels, "filesystem_label", n->label, RRDLABEL_SRC_AUTO);
}
int do_sys_fs_btrfs(int update_every, usec_t dt) {
@@ -458,7 +673,9 @@ int do_sys_fs_btrfs(int update_every, usec_t dt) {
, do_allocation_disks = CONFIG_BOOLEAN_AUTO
, do_allocation_system = CONFIG_BOOLEAN_AUTO
, do_allocation_data = CONFIG_BOOLEAN_AUTO
- , do_allocation_metadata = CONFIG_BOOLEAN_AUTO;
+ , do_allocation_metadata = CONFIG_BOOLEAN_AUTO
+ , do_commit_stats = CONFIG_BOOLEAN_AUTO
+ , do_error_stats = CONFIG_BOOLEAN_AUTO;
static usec_t refresh_delta = 0, refresh_every = 60 * USEC_PER_SEC;
static char *btrfs_path = NULL;
@@ -479,12 +696,14 @@ int do_sys_fs_btrfs(int update_every, usec_t dt) {
do_allocation_data = config_get_boolean_ondemand("plugin:proc:/sys/fs/btrfs", "data allocation", do_allocation_data);
do_allocation_metadata = config_get_boolean_ondemand("plugin:proc:/sys/fs/btrfs", "metadata allocation", do_allocation_metadata);
do_allocation_system = config_get_boolean_ondemand("plugin:proc:/sys/fs/btrfs", "system allocation", do_allocation_system);
+ do_commit_stats = config_get_boolean_ondemand("plugin:proc:/sys/fs/btrfs", "commit stats", do_commit_stats);
+ do_error_stats = config_get_boolean_ondemand("plugin:proc:/sys/fs/btrfs", "error stats", do_error_stats);
}
refresh_delta += dt;
if(refresh_delta >= refresh_every) {
refresh_delta = 0;
- find_all_btrfs_pools(btrfs_path);
+ find_all_btrfs_pools(btrfs_path, update_every);
}
BTRFS_NODE *node;
@@ -544,6 +763,25 @@ int do_sys_fs_btrfs(int update_every, usec_t dt) {
}
}
+ if(do_commit_stats != CONFIG_BOOLEAN_NO && node->commit_stats_filename) {
+ if (unlikely(collect_btrfs_commits_stats(node, update_every))) {
+ collector_error("BTRFS: failed to collect commit stats for '%s'", node->id);
+ btrfs_free_commits_stats(node);
+ }
+ }
+
+ if(do_error_stats != CONFIG_BOOLEAN_NO) {
+ for(BTRFS_DEVICE *d = node->devices ; d ; d = d->next) {
+ if(unlikely(collect_btrfs_error_stats(d))){
+ collector_error("BTRFS: failed to collect error stats for '%s', devid:'%d'", node->id, d->id);
+ /* make it refresh btrfs at the next iteration,
+ * btrfs_free_device(d) will be called in
+ * find_btrfs_devices() as part of the garbage collection */
+ refresh_delta = refresh_every;
+ }
+ }
+ }
+
// --------------------------------------------------------------------
// allocation/disks
@@ -555,9 +793,9 @@ int do_sys_fs_btrfs(int update_every, usec_t dt) {
if(unlikely(!node->st_allocation_disks)) {
char id[RRD_ID_LENGTH_MAX + 1], name[RRD_ID_LENGTH_MAX + 1], title[200 + 1];
- snprintf(id, RRD_ID_LENGTH_MAX, "disk_%s", node->id);
- snprintf(name, RRD_ID_LENGTH_MAX, "disk_%s", node->label);
- snprintf(title, 200, "BTRFS Physical Disk Allocation");
+ snprintfz(id, RRD_ID_LENGTH_MAX, "disk_%s", node->id);
+ snprintfz(name, RRD_ID_LENGTH_MAX, "disk_%s", node->label);
+ snprintfz(title, 200, "BTRFS Physical Disk Allocation");
netdata_fix_chart_id(id);
netdata_fix_chart_name(name);
@@ -614,9 +852,9 @@ int do_sys_fs_btrfs(int update_every, usec_t dt) {
if(unlikely(!node->st_allocation_data)) {
char id[RRD_ID_LENGTH_MAX + 1], name[RRD_ID_LENGTH_MAX + 1], title[200 + 1];
- snprintf(id, RRD_ID_LENGTH_MAX, "data_%s", node->id);
- snprintf(name, RRD_ID_LENGTH_MAX, "data_%s", node->label);
- snprintf(title, 200, "BTRFS Data Allocation");
+ snprintfz(id, RRD_ID_LENGTH_MAX, "data_%s", node->id);
+ snprintfz(name, RRD_ID_LENGTH_MAX, "data_%s", node->label);
+ snprintfz(title, 200, "BTRFS Data Allocation");
netdata_fix_chart_id(id);
netdata_fix_chart_name(name);
@@ -658,9 +896,9 @@ int do_sys_fs_btrfs(int update_every, usec_t dt) {
if(unlikely(!node->st_allocation_metadata)) {
char id[RRD_ID_LENGTH_MAX + 1], name[RRD_ID_LENGTH_MAX + 1], title[200 + 1];
- snprintf(id, RRD_ID_LENGTH_MAX, "metadata_%s", node->id);
- snprintf(name, RRD_ID_LENGTH_MAX, "metadata_%s", node->label);
- snprintf(title, 200, "BTRFS Metadata Allocation");
+ snprintfz(id, RRD_ID_LENGTH_MAX, "metadata_%s", node->id);
+ snprintfz(name, RRD_ID_LENGTH_MAX, "metadata_%s", node->label);
+ snprintfz(title, 200, "BTRFS Metadata Allocation");
netdata_fix_chart_id(id);
netdata_fix_chart_name(name);
@@ -704,9 +942,9 @@ int do_sys_fs_btrfs(int update_every, usec_t dt) {
if(unlikely(!node->st_allocation_system)) {
char id[RRD_ID_LENGTH_MAX + 1], name[RRD_ID_LENGTH_MAX + 1], title[200 + 1];
- snprintf(id, RRD_ID_LENGTH_MAX, "system_%s", node->id);
- snprintf(name, RRD_ID_LENGTH_MAX, "system_%s", node->label);
- snprintf(title, 200, "BTRFS System Allocation");
+ snprintfz(id, RRD_ID_LENGTH_MAX, "system_%s", node->id);
+ snprintfz(name, RRD_ID_LENGTH_MAX, "system_%s", node->label);
+ snprintfz(title, 200, "BTRFS System Allocation");
netdata_fix_chart_id(id);
netdata_fix_chart_name(name);
@@ -736,6 +974,180 @@ int do_sys_fs_btrfs(int update_every, usec_t dt) {
rrddim_set_by_pointer(node->st_allocation_system, node->rd_allocation_system_used, node->allocation_system_bytes_used);
rrdset_done(node->st_allocation_system);
}
+
+ // --------------------------------------------------------------------
+ // commit_stats
+
+ if(do_commit_stats == CONFIG_BOOLEAN_YES || (do_commit_stats == CONFIG_BOOLEAN_AUTO &&
+ (node->commits_total ||
+ netdata_zero_metrics_enabled == CONFIG_BOOLEAN_YES))) {
+ do_commit_stats = CONFIG_BOOLEAN_YES;
+
+ if(unlikely(!node->st_commits)) {
+ char id[RRD_ID_LENGTH_MAX + 1], name[RRD_ID_LENGTH_MAX + 1], title[200 + 1];
+
+ snprintfz(id, RRD_ID_LENGTH_MAX, "commits_%s", node->id);
+ snprintfz(name, RRD_ID_LENGTH_MAX, "commits_%s", node->label);
+ snprintfz(title, 200, "BTRFS Commits");
+
+ netdata_fix_chart_id(id);
+ netdata_fix_chart_name(name);
+
+ node->st_commits = rrdset_create_localhost(
+ "btrfs"
+ , id
+ , name
+ , node->label
+ , "btrfs.commits"
+ , title
+ , "commits"
+ , PLUGIN_PROC_NAME
+ , PLUGIN_PROC_MODULE_BTRFS_NAME
+ , NETDATA_CHART_PRIO_BTRFS_COMMITS
+ , update_every
+ , RRDSET_TYPE_LINE
+ );
+
+ node->rd_commits = rrddim_add(node->st_commits, "commits", NULL, 1, 1, RRD_ALGORITHM_ABSOLUTE);
+
+ add_labels_to_btrfs(node, node->st_commits);
+ }
+
+ rrddim_set_by_pointer(node->st_commits, node->rd_commits, node->commits_new);
+ rrdset_done(node->st_commits);
+
+ if(unlikely(!node->st_commits_percentage_time)) {
+ char id[RRD_ID_LENGTH_MAX + 1], name[RRD_ID_LENGTH_MAX + 1], title[200 + 1];
+
+ snprintfz(id, RRD_ID_LENGTH_MAX, "commits_perc_time_%s", node->id);
+ snprintfz(name, RRD_ID_LENGTH_MAX, "commits_perc_time_%s", node->label);
+ snprintfz(title, 200, "BTRFS Commits Time Share");
+
+ netdata_fix_chart_id(id);
+ netdata_fix_chart_name(name);
+
+ node->st_commits_percentage_time = rrdset_create_localhost(
+ "btrfs"
+ , id
+ , name
+ , node->label
+ , "btrfs.commits_perc_time"
+ , title
+ , "percentage"
+ , PLUGIN_PROC_NAME
+ , PLUGIN_PROC_MODULE_BTRFS_NAME
+ , NETDATA_CHART_PRIO_BTRFS_COMMITS_PERC_TIME
+ , update_every
+ , RRDSET_TYPE_LINE
+ );
+
+ node->rd_commits_percentage_time = rrddim_add(node->st_commits_percentage_time, "commits", NULL, 1, 100, RRD_ALGORITHM_ABSOLUTE);
+
+ add_labels_to_btrfs(node, node->st_commits_percentage_time);
+ }
+
+ rrddim_set_by_pointer(node->st_commits_percentage_time, node->rd_commits_percentage_time, node->commits_percentage_time);
+ rrdset_done(node->st_commits_percentage_time);
+
+
+ if(unlikely(!node->st_commit_timings)) {
+ char id[RRD_ID_LENGTH_MAX + 1], name[RRD_ID_LENGTH_MAX + 1], title[200 + 1];
+
+ snprintfz(id, RRD_ID_LENGTH_MAX, "commit_timings_%s", node->id);
+ snprintfz(name, RRD_ID_LENGTH_MAX, "commit_timings_%s", node->label);
+ snprintfz(title, 200, "BTRFS Commit Timings");
+
+ netdata_fix_chart_id(id);
+ netdata_fix_chart_name(name);
+
+ node->st_commit_timings = rrdset_create_localhost(
+ "btrfs"
+ , id
+ , name
+ , node->label
+ , "btrfs.commit_timings"
+ , title
+ , "ms"
+ , PLUGIN_PROC_NAME
+ , PLUGIN_PROC_MODULE_BTRFS_NAME
+ , NETDATA_CHART_PRIO_BTRFS_COMMIT_TIMINGS
+ , update_every
+ , RRDSET_TYPE_LINE
+ );
+
+ node->rd_commit_timings_last = rrddim_add(node->st_commit_timings, "last", NULL, 1, 1, RRD_ALGORITHM_ABSOLUTE);
+ node->rd_commit_timings_max = rrddim_add(node->st_commit_timings, "max", NULL, 1, 1, RRD_ALGORITHM_ABSOLUTE);
+
+ add_labels_to_btrfs(node, node->st_commit_timings);
+ }
+
+ rrddim_set_by_pointer(node->st_commit_timings, node->rd_commit_timings_last, node->commit_timings_last);
+ rrddim_set_by_pointer(node->st_commit_timings, node->rd_commit_timings_max, node->commit_timings_max);
+ rrdset_done(node->st_commit_timings);
+ }
+
+ // --------------------------------------------------------------------
+ // error_stats per device
+
+ if(do_error_stats == CONFIG_BOOLEAN_YES || (do_error_stats == CONFIG_BOOLEAN_AUTO &&
+ (node->devices ||
+ netdata_zero_metrics_enabled == CONFIG_BOOLEAN_YES))) {
+ do_error_stats = CONFIG_BOOLEAN_YES;
+
+ for(BTRFS_DEVICE *d = node->devices ; d ; d = d->next) {
+
+ if(unlikely(!d->st_error_stats)) {
+ char id[RRD_ID_LENGTH_MAX + 1], name[RRD_ID_LENGTH_MAX + 1], title[200 + 1];
+
+ snprintfz(id, RRD_ID_LENGTH_MAX, "device_errors_dev%d_%s", d->id, node->id);
+ snprintfz(name, RRD_ID_LENGTH_MAX, "device_errors_dev%d_%s", d->id, node->label);
+ snprintfz(title, 200, "BTRFS Device Errors");
+
+ netdata_fix_chart_id(id);
+ netdata_fix_chart_name(name);
+
+ d->st_error_stats = rrdset_create_localhost(
+ "btrfs"
+ , id
+ , name
+ , node->label
+ , "btrfs.device_errors"
+ , title
+ , "errors"
+ , PLUGIN_PROC_NAME
+ , PLUGIN_PROC_MODULE_BTRFS_NAME
+ , NETDATA_CHART_PRIO_BTRFS_ERRORS
+ , update_every
+ , RRDSET_TYPE_LINE
+ );
+
+ char rd_id[RRD_ID_LENGTH_MAX + 1];
+ snprintfz(rd_id, RRD_ID_LENGTH_MAX, "write_errs");
+ d->rd_write_errs = rrddim_add(d->st_error_stats, rd_id, NULL, 1, 1, RRD_ALGORITHM_ABSOLUTE);
+ snprintfz(rd_id, RRD_ID_LENGTH_MAX, "read_errs");
+ d->rd_read_errs = rrddim_add(d->st_error_stats, rd_id, NULL, 1, 1, RRD_ALGORITHM_ABSOLUTE);
+ snprintfz(rd_id, RRD_ID_LENGTH_MAX, "flush_errs");
+ d->rd_flush_errs = rrddim_add(d->st_error_stats, rd_id, NULL, 1, 1, RRD_ALGORITHM_ABSOLUTE);
+ snprintfz(rd_id, RRD_ID_LENGTH_MAX, "corruption_errs");
+ d->rd_corruption_errs = rrddim_add(d->st_error_stats, rd_id, NULL, 1, 1, RRD_ALGORITHM_ABSOLUTE);
+ snprintfz(rd_id, RRD_ID_LENGTH_MAX, "generation_errs");
+ d->rd_generation_errs = rrddim_add(d->st_error_stats, rd_id, NULL, 1, 1, RRD_ALGORITHM_ABSOLUTE);
+
+ char dev_id[5];
+ snprintfz(dev_id, 4, "%d", d->id);
+ rrdlabels_add(d->st_error_stats->rrdlabels, "device_id", dev_id, RRDLABEL_SRC_AUTO);
+ add_labels_to_btrfs(node, d->st_error_stats);
+ }
+
+ rrddim_set_by_pointer(d->st_error_stats, d->rd_write_errs, d->write_errs);
+ rrddim_set_by_pointer(d->st_error_stats, d->rd_read_errs, d->read_errs);
+ rrddim_set_by_pointer(d->st_error_stats, d->rd_flush_errs, d->flush_errs);
+ rrddim_set_by_pointer(d->st_error_stats, d->rd_corruption_errs, d->corruption_errs);
+ rrddim_set_by_pointer(d->st_error_stats, d->rd_generation_errs, d->generation_errs);
+
+ rrdset_done(d->st_error_stats);
+ }
+ }
}
return 0;
diff --git a/collectors/proc.plugin/sys_kernel_mm_ksm.c b/collectors/proc.plugin/sys_kernel_mm_ksm.c
index e586d5554..45f1ac330 100644
--- a/collectors/proc.plugin/sys_kernel_mm_ksm.c
+++ b/collectors/proc.plugin/sys_kernel_mm_ksm.c
@@ -68,19 +68,19 @@ int do_sys_kernel_mm_ksm(int update_every, usec_t dt) {
ff_pages_shared = procfile_readall(ff_pages_shared);
if(unlikely(!ff_pages_shared)) return 0; // we return 0, so that we will retry to open it next time
- pages_shared = str2ull(procfile_lineword(ff_pages_shared, 0, 0));
+ pages_shared = str2ull(procfile_lineword(ff_pages_shared, 0, 0), NULL);
ff_pages_sharing = procfile_readall(ff_pages_sharing);
if(unlikely(!ff_pages_sharing)) return 0; // we return 0, so that we will retry to open it next time
- pages_sharing = str2ull(procfile_lineword(ff_pages_sharing, 0, 0));
+ pages_sharing = str2ull(procfile_lineword(ff_pages_sharing, 0, 0), NULL);
ff_pages_unshared = procfile_readall(ff_pages_unshared);
if(unlikely(!ff_pages_unshared)) return 0; // we return 0, so that we will retry to open it next time
- pages_unshared = str2ull(procfile_lineword(ff_pages_unshared, 0, 0));
+ pages_unshared = str2ull(procfile_lineword(ff_pages_unshared, 0, 0), NULL);
ff_pages_volatile = procfile_readall(ff_pages_volatile);
if(unlikely(!ff_pages_volatile)) return 0; // we return 0, so that we will retry to open it next time
- pages_volatile = str2ull(procfile_lineword(ff_pages_volatile, 0, 0));
+ pages_volatile = str2ull(procfile_lineword(ff_pages_volatile, 0, 0), NULL);
//ff_pages_to_scan = procfile_readall(ff_pages_to_scan);
//if(unlikely(!ff_pages_to_scan)) return 0; // we return 0, so that we will retry to open it next time