/proc/net/dev
(all network interfaces for all their values)/proc/diskstats
(all disks for all their values)/proc/mdstat
(status of RAID arrays)/proc/net/snmp
(total IPv4, TCP and UDP usage)/proc/net/snmp6
(total IPv6 usage)/proc/net/netstat
(more IPv4 usage)/proc/net/stat/nf_conntrack
(connection tracking performance)/proc/net/stat/synproxy
(synproxy performance)/proc/net/ip_vs/stats
(IPVS connection statistics)/proc/stat
(CPU utilization and attributes)/proc/meminfo
(memory information)/proc/vmstat
(system performance)/proc/net/rpc/nfsd
(NFS server statistics for both v3 and v4 NFS servers)/sys/fs/cgroup
(Control Groups - Linux Containers)/proc/self/mountinfo
(mount points)/proc/interrupts
(total and per core hardware interrupts)/proc/softirqs
(total and per core software interrupts)/proc/loadavg
(system load and total processes running)/proc/sys/kernel/random/entropy_avail
(random numbers pool availability - used in cryptography)ksm
Kernel Same-Page Merging performance (several files under /sys/kernel/mm/ksm
).netdata
(internal netdata resources utilization)Live demo of disk monitoring at: http://london.netdata.rocks
Performance monitoring for Linux disks is quite complicated. The main reason is the plethora of disk technologies available. There are many different hardware disk technologies, but there are even more virtual disk technologies that can provide additional storage features.
Hopefully, the Linux kernel provides many metrics that can provide deep insights of what our disks our doing. The kernel measures all these metrics on all layers of storage: virtual disks, physical disks and partitions of disks.
netdata will automatically set the name of disks on the dashboard, from the mount point they are mounted, of course only when they are mounted. Changes in mount points are not currently detected (you will have to restart netdata to change the name of the disk).
By default netdata will enable monitoring metrics only when they are not zero. If they are constantly zero they are ignored. Metrics that will start having values, after netdata is started, will be detected and charts will be automatically added to the dashboard (a refresh of the dashboard is needed for them to appear though).
netdata categorizes all block devices in 3 categories:
Performance metrics are enabled by default for all disk devices, except partitions and not-mounted virtual disks. Of course, you can enable/disable monitoring any block device by editing the netdata configuration file.
You can get the running netdata configuration using this:
cd /etc/netdata
curl "http://localhost:19999/netdata.conf" >netdata.conf.new
mv netdata.conf.new netdata.conf
Then edit netdata.conf
and find the following section. This is the basic plugin configuration.
[plugin:proc:/proc/diskstats]
# enable new disks detected at runtime = yes
# performance metrics for physical disks = auto
# performance metrics for virtual disks = no
# performance metrics for partitions = no
# performance metrics for mounted filesystems = no
# performance metrics for mounted virtual disks = auto
# space metrics for mounted filesystems = auto
# bandwidth for all disks = auto
# operations for all disks = auto
# merged operations for all disks = auto
# i/o time for all disks = auto
# queued operations for all disks = auto
# utilization percentage for all disks = auto
# backlog for all disks = auto
# space usage for all disks = auto
# inodes usage for all disks = auto
# filename to monitor = /proc/diskstats
# path to get block device infos = /sys/dev/block/%lu:%lu/%s
# path to get h/w sector size = /sys/block/%s/queue/hw_sector_size
# path to get h/w sector size for partitions = /sys/dev/block/%lu:%lu/subsystem/%s/../queue
/hw_sector_size
For each virtual disk, physical disk and partition you will have a section like this:
[plugin:proc:/proc/diskstats:sda]
# enable = yes
# enable performance metrics = auto
# bandwidth = auto
# operations = auto
# merged operations = auto
# i/o time = auto
# queued operations = auto
# utilization percentage = auto
# backlog = auto
For all configuration options:
auto
= enable monitoring if the collected values are not zeroyes
= enable monitoringno
= disable monitoringOf course, to set options, you will have to uncomment them. The comments show the internal defaults.
After saving /etc/netdata/netdata.conf
, restart your netdata to apply them.
You can pretty easy disable performance metrics for individual device, for ex.:
[plugin:proc:/proc/diskstats:sda]
enable performance metrics = no
But sometimes you need disable performance metrics for all devices with the same type, to do it you need to figure out device type from /proc/diskstats
for ex.:
7 0 loop0 1651 0 3452 168 0 0 0 0 0 8 168
7 1 loop1 4955 0 11924 880 0 0 0 0 0 64 880
7 2 loop2 36 0 216 4 0 0 0 0 0 4 4
7 6 loop6 0 0 0 0 0 0 0 0 0 0 0
7 7 loop7 0 0 0 0 0 0 0 0 0 0 0
251 2 zram2 27487 0 219896 188 79953 0 639624 1640 0 1828 1828
251 3 zram3 27348 0 218784 152 79952 0 639616 1960 0 2060 2104
All zram devices starts with 251
number and all loop devices starts with 7
.
So, to disable performance metrics for all loop devices you could add performance metrics for disks with major 7 = no
to [plugin:proc:/proc/diskstats]
section.
[plugin:proc:/proc/diskstats]
performance metrics for disks with major 7 = no
Health Number of failed disks in every array (aggregate chart).
Disks stats
Mismatch count
Current status
Operation status (if resync/recovery/reshape/check is active)
[plugin:proc:/proc/mdstat]
# mismatch_cnt filename to monitor = /sys/block/%s/md/mismatch_cnt
# filename to monitor = /proc/mdstat
The /proc/stat
module monitors CPU utilization, interrupts, context switches, processes started/running, thermal throttling, frequency, and idle states. It gathers this information from multiple files.
If more than 50 cores are present in a system then CPU thermal throttling, frequency, and idle state charts are disabled.
keep per core files open
option in the [plugin:proc:/proc/stat]
configuration section allows reducing the number of file operations on multiple files.
The module shows the current CPU frequency as set by the cpufreq
kernel
module.
Requirement:
You need to have CONFIG_CPU_FREQ
and (optionally) CONFIG_CPU_FREQ_STAT
enabled in your kernel.
cpufreq
interface provides two different ways of getting the information through /sys/devices/system/cpu/cpu*/cpufreq/scaling_cur_freq
and /sys/devices/system/cpu/cpu*/cpufreq/stats/time_in_state
files. The latter is more accurate so it is preferred in the module. scaling_cur_freq
represents only the current CPU frequency, and doesn't account for any state changes which happen between updates. The module switches back and forth between these two methods if governor is changed.
It produces one chart with multiple lines (one line per core).
scaling_cur_freq filename to monitor
and time_in_state filename to monitor
in the [plugin:proc:/proc/stat]
configuration section
The module monitors the usage of CPU idle states.
Requirement:
Your kernel needs to have CONFIG_CPU_IDLE
enabled.
It produces one stacked chart per CPU, showing the percentage of time spent in each state.
schedstat filename to monitor
, cpuidle name filename to monitor
, and cpuidle time filename to monitor
in the [plugin:proc:/proc/stat]
configuration section
SYNPROXY is a TCP SYN packets proxy. It can be used to protect any TCP server (like a web server) from SYN floods and similar DDos attacks.
SYNPROXY is a netfilter module, in the Linux kernel (since version 3.12). It is optimized to handle millions of packets per second utilizing all CPUs available without any concurrency locking between the connections.
The net effect of this, is that the real servers will not notice any change during the attack. The valid TCP connections will pass through and served, while the attack will be stopped at the firewall.
Netdata does not enable SYNPROXY. It just uses the SYNPROXY metrics exposed by your kernel, so you will first need to configure it. The hard way is to run iptables SYNPROXY commands directly on the console. An easier way is to use FireHOL, which, is a firewall manager for iptables. FireHOL can configure SYNPROXY using the following setup guides:
netdata is able to monitor in real-time (per second updates) the operation of the Linux Anti-DDoS protection.
It visualizes 4 charts:
Example image:
See Linux Anti-DDoS in action at: netdata demo site (with SYNPROXY enabled)