@cryptotaxi247 / netdata-1 / commits / de48d0354

added internal plugin for reading /proc/loadavg and disables charts.d/load_average.chart.sh

Costa Tsaousis (ktsaou) committed Feb 10, 2016 at 00:03 UTC de48d035429efb585e608739a709262a3c637b79
9 files changed +432 -152
charts.d/load_average.chart.sh
+7
@@ -3,6 +3,12 @@
3 load_average_update_every=5
4 load_priority=100
5
6 +# this is an example charts.d collector
7 +# it is disabled by default.
8 +# there is no point to enable it, since netdata already
9 +# collects this information using its internal plugins.
10 +load_average_enabled=0
11 +
12 load_average_check() {
13 # this should return:
14 # - 0 to enable the chart
@@ -15,6 +21,7 @@ load_average_check() {
21 load_average_update_every=5
22 fi
23
24 + [ ${load_average_enabled} -eq 0 ] && return 1
25 return 0
26 }
27
src/Makefile.am
+1
@@ -40,6 +40,7 @@ netdata_SOURCES = \
40 proc_diskstats.c \
41 proc_interrupts.c \
42 proc_softirqs.c \
43 + proc_loadavg.c \
44 proc_meminfo.c \
45 proc_net_dev.c \
46 proc_net_ip_vs_stats.c \
src/plugin_proc.c
+5 -8
@@ -51,6 +51,7 @@ void *proc_main(void *ptr)
51 int vdo_proc_sys_kernel_random_entropy_avail = !config_get_boolean("plugin:proc", "/proc/sys/kernel/random/entropy_avail", 1);
52 int vdo_proc_interrupts = !config_get_boolean("plugin:proc", "/proc/interrupts", 1);
53 int vdo_proc_softirqs = !config_get_boolean("plugin:proc", "/proc/softirqs", 1);
54 + int vdo_proc_loadavg = !config_get_boolean("plugin:proc", "/proc/loadavg", 1);
55 int vdo_sys_kernel_mm_ksm = !config_get_boolean("plugin:proc", "/sys/kernel/mm/ksm", 1);
56 int vdo_cpu_netdata = !config_get_boolean("plugin:proc", "netdata server resources", 1);
57
@@ -68,7 +69,10 @@ void *proc_main(void *ptr)
69 debug(D_PROCNETDEV_LOOP, "PROCNETDEV: calling do_sys_kernel_mm_ksm().");
70 vdo_sys_kernel_mm_ksm = do_sys_kernel_mm_ksm(rrd_update_every, usec+susec);
71 }
71 -
72 + if(!vdo_proc_loadavg) {
73 + debug(D_PROCNETDEV_LOOP, "PROCNETDEV: calling do_proc_loadavg().");
74 + vdo_proc_loadavg = do_proc_loadavg(rrd_update_every, usec+susec);
75 + }
76 if(!vdo_proc_interrupts) {
77 debug(D_PROCNETDEV_LOOP, "PROCNETDEV: calling do_proc_interrupts().");
78 vdo_proc_interrupts = do_proc_interrupts(rrd_update_every, usec+susec);
@@ -93,37 +97,30 @@ void *proc_main(void *ptr)
97 debug(D_PROCNETDEV_LOOP, "PROCNETDEV: calling do_proc_net_snmp().");
98 vdo_proc_net_snmp = do_proc_net_snmp(rrd_update_every, usec+susec);
99 }
96 -
100 if(!vdo_proc_net_netstat) {
101 debug(D_PROCNETDEV_LOOP, "PROCNETDEV: calling do_proc_net_netstat().");
102 vdo_proc_net_netstat = do_proc_net_netstat(rrd_update_every, usec+susec);
103 }
101 -
104 if(!vdo_proc_net_stat_conntrack) {
105 debug(D_PROCNETDEV_LOOP, "PROCNETDEV: calling do_proc_net_stat_conntrack().");
106 vdo_proc_net_stat_conntrack = do_proc_net_stat_conntrack(rrd_update_every, usec+susec);
107 }
106 -
108 if(!vdo_proc_net_ip_vs_stats) {
109 debug(D_PROCNETDEV_LOOP, "PROCNETDEV: calling vdo_proc_net_ip_vs_stats().");
110 vdo_proc_net_ip_vs_stats = do_proc_net_ip_vs_stats(rrd_update_every, usec+susec);
111 }
111 -
112 if(!vdo_proc_stat) {
113 debug(D_PROCNETDEV_LOOP, "PROCNETDEV: calling do_proc_stat().");
114 vdo_proc_stat = do_proc_stat(rrd_update_every, usec+susec);
115 }
116 -
116 if(!vdo_proc_meminfo) {
117 debug(D_PROCNETDEV_LOOP, "PROCNETDEV: calling vdo_proc_meminfo().");
118 vdo_proc_meminfo = do_proc_meminfo(rrd_update_every, usec+susec);
119 }
121 -
120 if(!vdo_proc_vmstat) {
121 debug(D_PROCNETDEV_LOOP, "PROCNETDEV: calling vdo_proc_vmstat().");
122 vdo_proc_vmstat = do_proc_vmstat(rrd_update_every, usec+susec);
123 }
126 -
124 if(!vdo_proc_net_rpc_nfsd) {
125 debug(D_PROCNETDEV_LOOP, "PROCNETDEV: calling do_proc_net_rpc_nfsd().");
126 vdo_proc_net_rpc_nfsd = do_proc_net_rpc_nfsd(rrd_update_every, usec+susec);
src/plugin_proc.h
+1
@@ -17,5 +17,6 @@ extern int do_proc_sys_kernel_random_entropy_avail(int update_every, unsigned lo
17 extern int do_proc_interrupts(int update_every, unsigned long long dt);
18 extern int do_proc_softirqs(int update_every, unsigned long long dt);
19 extern int do_sys_kernel_mm_ksm(int update_every, unsigned long long dt);
20 +extern int do_proc_loadavg(int update_every, unsigned long long dt);
21
22 #endif /* NETDATA_PLUGIN_PROC_H */
src/proc_net_snmp.c
+2 -2
@@ -91,10 +91,10 @@ int do_proc_net_snmp(int update_every, unsigned long long dt) {
91 // these are not counters
92 if(Forwarding) {}; // is forwarding enabled?
93 if(DefaultTTL) {}; // the default ttl on packets
94 - if(ReasmTimeout) {}; // reassemply timeout
94 + if(ReasmTimeout) {}; // Reassembly timeout
95
96 // this counter is not used
97 - if(InDelivers) {}; // total number of packets delivered to IP user-protcols
97 + if(InDelivers) {}; // total number of packets delivered to IP user-protocols
98
99 // --------------------------------------------------------------------
100
src/proc_stat.c
+2 -2
@@ -172,7 +172,7 @@ int do_proc_stat(int update_every, unsigned long long dt) {
172 if(do_forks) {
173 st = rrdset_find_bytype("system", "forks");
174 if(!st) {
175 - st = rrdset_create("system", "forks", NULL, "processes", NULL, "New Processes", "processes/s", 700, update_every, RRDSET_TYPE_LINE);
175 + st = rrdset_create("system", "forks", NULL, "processes", NULL, "Started Processes", "processes/s", 700, update_every, RRDSET_TYPE_LINE);
176 st->isdetail = 1;
177
178 rrddim_add(st, "started", NULL, 1, 1, RRDDIM_INCREMENTAL);
@@ -188,7 +188,7 @@ int do_proc_stat(int update_every, unsigned long long dt) {
188 if(do_processes) {
189 st = rrdset_find_bytype("system", "processes");
190 if(!st) {
191 - st = rrdset_create("system", "processes", NULL, "processes", NULL, "Processes", "processes", 600, update_every, RRDSET_TYPE_LINE);
191 + st = rrdset_create("system", "processes", NULL, "processes", NULL, "System Processes", "processes", 600, update_every, RRDSET_TYPE_LINE);
192
193 rrddim_add(st, "running", NULL, 1, 1, RRDDIM_ABSOLUTE);
194 rrddim_add(st, "blocked", NULL, -1, 1, RRDDIM_ABSOLUTE);
src/proc_sys_kernel_random_entropy_avail.c
+1 -1
@@ -29,7 +29,7 @@ int do_proc_sys_kernel_random_entropy_avail(int update_every, unsigned long long
29
30 RRDSET *st = rrdset_find_bytype("system", "entropy");
31 if(!st) {
32 - st = rrdset_create("system", "entropy", NULL, "cryptography", NULL, "Available Entropy", "entropy", 1000, update_every, RRDSET_TYPE_LINE);
32 + st = rrdset_create("system", "entropy", NULL, "entropy", NULL, "Available Entropy", "entropy", 1000, update_every, RRDSET_TYPE_LINE);
33 rrddim_add(st, "entropy", NULL, 1, 1, RRDDIM_ABSOLUTE);
34 }
35 else rrdset_next(st);
src/proc_vmstat.c
+408 -138
@@ -18,7 +18,196 @@
18
19 int do_proc_vmstat(int update_every, unsigned long long dt) {
20 static procfile *ff = NULL;
21 - static int do_swapio = -1, do_io = -1, do_pgfaults = -1;
21 + static int do_swapio = -1, do_io = -1, do_pgfaults = -1, gen_hashes = -1;
22 +
23 + // static uint32_t hash_allocstall = -1;
24 + // static uint32_t hash_compact_blocks_moved = -1;
25 + // static uint32_t hash_compact_fail = -1;
26 + // static uint32_t hash_compact_pagemigrate_failed = -1;
27 + // static uint32_t hash_compact_pages_moved = -1;
28 + // static uint32_t hash_compact_stall = -1;
29 + // static uint32_t hash_compact_success = -1;
30 + // static uint32_t hash_htlb_buddy_alloc_fail = -1;
31 + // static uint32_t hash_htlb_buddy_alloc_success = -1;
32 + // static uint32_t hash_kswapd_high_wmark_hit_quickly = -1;
33 + // static uint32_t hash_kswapd_inodesteal = -1;
34 + // static uint32_t hash_kswapd_low_wmark_hit_quickly = -1;
35 + // static uint32_t hash_kswapd_skip_congestion_wait = -1;
36 + // static uint32_t hash_nr_active_anon = -1;
37 + // static uint32_t hash_nr_active_file = -1;
38 + // static uint32_t hash_nr_anon_pages = -1;
39 + // static uint32_t hash_nr_anon_transparent_hugepages = -1;
40 + // static uint32_t hash_nr_bounce = -1;
41 + // static uint32_t hash_nr_dirtied = -1;
42 + // static uint32_t hash_nr_dirty = -1;
43 + // static uint32_t hash_nr_dirty_background_threshold = -1;
44 + // static uint32_t hash_nr_dirty_threshold = -1;
45 + // static uint32_t hash_nr_file_pages = -1;
46 + // static uint32_t hash_nr_free_pages = -1;
47 + // static uint32_t hash_nr_inactive_anon = -1;
48 + // static uint32_t hash_nr_inactive_file = -1;
49 + // static uint32_t hash_nr_isolated_anon = -1;
50 + // static uint32_t hash_nr_isolated_file = -1;
51 + // static uint32_t hash_nr_kernel_stack = -1;
52 + // static uint32_t hash_nr_mapped = -1;
53 + // static uint32_t hash_nr_mlock = -1;
54 + // static uint32_t hash_nr_page_table_pages = -1;
55 + // static uint32_t hash_nr_shmem = -1;
56 + // static uint32_t hash_nr_slab_reclaimable = -1;
57 + // static uint32_t hash_nr_slab_unreclaimable = -1;
58 + // static uint32_t hash_nr_unevictable = -1;
59 + // static uint32_t hash_nr_unstable = -1;
60 + // static uint32_t hash_nr_vmscan_immediate_reclaim = -1;
61 + // static uint32_t hash_nr_vmscan_write = -1;
62 + // static uint32_t hash_nr_writeback = -1;
63 + // static uint32_t hash_nr_writeback_temp = -1;
64 + // static uint32_t hash_nr_written = -1;
65 + // static uint32_t hash_pageoutrun = -1;
66 + // static uint32_t hash_pgactivate = -1;
67 + // static uint32_t hash_pgalloc_dma = -1;
68 + // static uint32_t hash_pgalloc_dma32 = -1;
69 + // static uint32_t hash_pgalloc_movable = -1;
70 + // static uint32_t hash_pgalloc_normal = -1;
71 + // static uint32_t hash_pgdeactivate = -1;
72 + static uint32_t hash_pgfault = -1;
73 + // static uint32_t hash_pgfree = -1;
74 + // static uint32_t hash_pginodesteal = -1;
75 + static uint32_t hash_pgmajfault = -1;
76 + static uint32_t hash_pgpgin = -1;
77 + static uint32_t hash_pgpgout = -1;
78 + // static uint32_t hash_pgrefill_dma = -1;
79 + // static uint32_t hash_pgrefill_dma32 = -1;
80 + // static uint32_t hash_pgrefill_movable = -1;
81 + // static uint32_t hash_pgrefill_normal = -1;
82 + // static uint32_t hash_pgrotated = -1;
83 + // static uint32_t hash_pgscan_direct_dma = -1;
84 + // static uint32_t hash_pgscan_direct_dma32 = -1;
85 + // static uint32_t hash_pgscan_direct_movable = -1;
86 + // static uint32_t hash_pgscan_direct_normal = -1;
87 + // static uint32_t hash_pgscan_kswapd_dma = -1;
88 + // static uint32_t hash_pgscan_kswapd_dma32 = -1;
89 + // static uint32_t hash_pgscan_kswapd_movable = -1;
90 + // static uint32_t hash_pgscan_kswapd_normal = -1;
91 + // static uint32_t hash_pgsteal_direct_dma = -1;
92 + // static uint32_t hash_pgsteal_direct_dma32 = -1;
93 + // static uint32_t hash_pgsteal_direct_movable = -1;
94 + // static uint32_t hash_pgsteal_direct_normal = -1;
95 + // static uint32_t hash_pgsteal_kswapd_dma = -1;
96 + // static uint32_t hash_pgsteal_kswapd_dma32 = -1;
97 + // static uint32_t hash_pgsteal_kswapd_movable = -1;
98 + // static uint32_t hash_pgsteal_kswapd_normal = -1;
99 + static uint32_t hash_pswpin = -1;
100 + static uint32_t hash_pswpout = -1;
101 + // static uint32_t hash_slabs_scanned = -1;
102 + // static uint32_t hash_thp_collapse_alloc = -1;
103 + // static uint32_t hash_thp_collapse_alloc_failed = -1;
104 + // static uint32_t hash_thp_fault_alloc = -1;
105 + // static uint32_t hash_thp_fault_fallback = -1;
106 + // static uint32_t hash_thp_split = -1;
107 + // static uint32_t hash_unevictable_pgs_cleared = -1;
108 + // static uint32_t hash_unevictable_pgs_culled = -1;
109 + // static uint32_t hash_unevictable_pgs_mlocked = -1;
110 + // static uint32_t hash_unevictable_pgs_mlockfreed = -1;
111 + // static uint32_t hash_unevictable_pgs_munlocked = -1;
112 + // static uint32_t hash_unevictable_pgs_rescued = -1;
113 + // static uint32_t hash_unevictable_pgs_scanned = -1;
114 + // static uint32_t hash_unevictable_pgs_stranded = -1;
115 +
116 + if(gen_hashes != 1) {
117 + gen_hashes = 1;
118 + // hash_allocstall = simple_hash("allocstall");
119 + // hash_compact_blocks_moved = simple_hash("compact_blocks_moved");
120 + // hash_compact_fail = simple_hash("compact_fail");
121 + // hash_compact_pagemigrate_failed = simple_hash("compact_pagemigrate_failed");
122 + // hash_compact_pages_moved = simple_hash("compact_pages_moved");
123 + // hash_compact_stall = simple_hash("compact_stall");
124 + // hash_compact_success = simple_hash("compact_success");
125 + // hash_htlb_buddy_alloc_fail = simple_hash("htlb_buddy_alloc_fail");
126 + // hash_htlb_buddy_alloc_success = simple_hash("htlb_buddy_alloc_success");
127 + // hash_kswapd_high_wmark_hit_quickly = simple_hash("kswapd_high_wmark_hit_quickly");
128 + // hash_kswapd_inodesteal = simple_hash("kswapd_inodesteal");
129 + // hash_kswapd_low_wmark_hit_quickly = simple_hash("kswapd_low_wmark_hit_quickly");
130 + // hash_kswapd_skip_congestion_wait = simple_hash("kswapd_skip_congestion_wait");
131 + // hash_nr_active_anon = simple_hash("nr_active_anon");
132 + // hash_nr_active_file = simple_hash("nr_active_file");
133 + // hash_nr_anon_pages = simple_hash("nr_anon_pages");
134 + // hash_nr_anon_transparent_hugepages = simple_hash("nr_anon_transparent_hugepages");
135 + // hash_nr_bounce = simple_hash("nr_bounce");
136 + // hash_nr_dirtied = simple_hash("nr_dirtied");
137 + // hash_nr_dirty = simple_hash("nr_dirty");
138 + // hash_nr_dirty_background_threshold = simple_hash("nr_dirty_background_threshold");
139 + // hash_nr_dirty_threshold = simple_hash("nr_dirty_threshold");
140 + // hash_nr_file_pages = simple_hash("nr_file_pages");
141 + // hash_nr_free_pages = simple_hash("nr_free_pages");
142 + // hash_nr_inactive_anon = simple_hash("nr_inactive_anon");
143 + // hash_nr_inactive_file = simple_hash("nr_inactive_file");
144 + // hash_nr_isolated_anon = simple_hash("nr_isolated_anon");
145 + // hash_nr_isolated_file = simple_hash("nr_isolated_file");
146 + // hash_nr_kernel_stack = simple_hash("nr_kernel_stack");
147 + // hash_nr_mapped = simple_hash("nr_mapped");
148 + // hash_nr_mlock = simple_hash("nr_mlock");
149 + // hash_nr_page_table_pages = simple_hash("nr_page_table_pages");
150 + // hash_nr_shmem = simple_hash("nr_shmem");
151 + // hash_nr_slab_reclaimable = simple_hash("nr_slab_reclaimable");
152 + // hash_nr_slab_unreclaimable = simple_hash("nr_slab_unreclaimable");
153 + // hash_nr_unevictable = simple_hash("nr_unevictable");
154 + // hash_nr_unstable = simple_hash("nr_unstable");
155 + // hash_nr_vmscan_immediate_reclaim = simple_hash("nr_vmscan_immediate_reclaim");
156 + // hash_nr_vmscan_write = simple_hash("nr_vmscan_write");
157 + // hash_nr_writeback = simple_hash("nr_writeback");
158 + // hash_nr_writeback_temp = simple_hash("nr_writeback_temp");
159 + // hash_nr_written = simple_hash("nr_written");
160 + // hash_pageoutrun = simple_hash("pageoutrun");
161 + // hash_pgactivate = simple_hash("pgactivate");
162 + // hash_pgalloc_dma = simple_hash("pgalloc_dma");
163 + // hash_pgalloc_dma32 = simple_hash("pgalloc_dma32");
164 + // hash_pgalloc_movable = simple_hash("pgalloc_movable");
165 + // hash_pgalloc_normal = simple_hash("pgalloc_normal");
166 + // hash_pgdeactivate = simple_hash("pgdeactivate");
167 + hash_pgfault = simple_hash("pgfault");
168 + // hash_pgfree = simple_hash("pgfree");
169 + // hash_pginodesteal = simple_hash("pginodesteal");
170 + hash_pgmajfault = simple_hash("pgmajfault");
171 + hash_pgpgin = simple_hash("pgpgin");
172 + hash_pgpgout = simple_hash("pgpgout");
173 + // hash_pgrefill_dma = simple_hash("pgrefill_dma");
174 + // hash_pgrefill_dma32 = simple_hash("pgrefill_dma32");
175 + // hash_pgrefill_movable = simple_hash("pgrefill_movable");
176 + // hash_pgrefill_normal = simple_hash("pgrefill_normal");
177 + // hash_pgrotated = simple_hash("pgrotated");
178 + // hash_pgscan_direct_dma = simple_hash("pgscan_direct_dma");
179 + // hash_pgscan_direct_dma32 = simple_hash("pgscan_direct_dma32");
180 + // hash_pgscan_direct_movable = simple_hash("pgscan_direct_movable");
181 + // hash_pgscan_direct_normal = simple_hash("pgscan_direct_normal");
182 + // hash_pgscan_kswapd_dma = simple_hash("pgscan_kswapd_dma");
183 + // hash_pgscan_kswapd_dma32 = simple_hash("pgscan_kswapd_dma32");
184 + // hash_pgscan_kswapd_movable = simple_hash("pgscan_kswapd_movable");
185 + // hash_pgscan_kswapd_normal = simple_hash("pgscan_kswapd_normal");
186 + // hash_pgsteal_direct_dma = simple_hash("pgsteal_direct_dma");
187 + // hash_pgsteal_direct_dma32 = simple_hash("pgsteal_direct_dma32");
188 + // hash_pgsteal_direct_movable = simple_hash("pgsteal_direct_movable");
189 + // hash_pgsteal_direct_normal = simple_hash("pgsteal_direct_normal");
190 + // hash_pgsteal_kswapd_dma = simple_hash("pgsteal_kswapd_dma");
191 + // hash_pgsteal_kswapd_dma32 = simple_hash("pgsteal_kswapd_dma32");
192 + // hash_pgsteal_kswapd_movable = simple_hash("pgsteal_kswapd_movable");
193 + // hash_pgsteal_kswapd_normal = simple_hash("pgsteal_kswapd_normal");
194 + hash_pswpin = simple_hash("pswpin");
195 + hash_pswpout = simple_hash("pswpout");
196 + // hash_slabs_scanned = simple_hash("slabs_scanned");
197 + // hash_thp_collapse_alloc = simple_hash("thp_collapse_alloc");
198 + // hash_thp_collapse_alloc_failed = simple_hash("thp_collapse_alloc_failed");
199 + // hash_thp_fault_alloc = simple_hash("thp_fault_alloc");
200 + // hash_thp_fault_fallback = simple_hash("thp_fault_fallback");
201 + // hash_thp_split = simple_hash("thp_split");
202 + // hash_unevictable_pgs_cleared = simple_hash("unevictable_pgs_cleared");
203 + // hash_unevictable_pgs_culled = simple_hash("unevictable_pgs_culled");
204 + // hash_unevictable_pgs_mlocked = simple_hash("unevictable_pgs_mlocked");
205 + // hash_unevictable_pgs_mlockfreed = simple_hash("unevictable_pgs_mlockfreed");
206 + // hash_unevictable_pgs_munlocked = simple_hash("unevictable_pgs_munlocked");
207 + // hash_unevictable_pgs_rescued = simple_hash("unevictable_pgs_rescued");
208 + // hash_unevictable_pgs_scanned = simple_hash("unevictable_pgs_scanned");
209 + // hash_unevictable_pgs_stranded = simple_hash("unevictable_pgs_stranded");
210 + }
211
212 if(do_swapio == -1) do_swapio = config_get_boolean("plugin:proc:/proc/vmstat", "swap i/o", 1);
213 if(do_io == -1) do_io = config_get_boolean("plugin:proc:/proc/vmstat", "disk i/o", 1);
@@ -39,19 +228,98 @@ int do_proc_vmstat(int update_every, unsigned long long dt) {
228 uint32_t lines = procfile_lines(ff), l;
229 uint32_t words;
230
42 - unsigned long long nr_free_pages = 0, nr_inactive_anon = 0, nr_active_anon = 0, nr_inactive_file = 0, nr_active_file = 0, nr_unevictable = 0, nr_mlock = 0,
43 - nr_anon_pages = 0, nr_mapped = 0, nr_file_pages = 0, nr_dirty = 0, nr_writeback = 0, nr_slab_reclaimable = 0, nr_slab_unreclaimable = 0, nr_page_table_pages = 0,
44 - nr_kernel_stack = 0, nr_unstable = 0, nr_bounce = 0, nr_vmscan_write = 0, nr_vmscan_immediate_reclaim = 0, nr_writeback_temp = 0, nr_isolated_anon = 0, nr_isolated_file = 0,
45 - nr_shmem = 0, nr_dirtied = 0, nr_written = 0, nr_anon_transparent_hugepages = 0, nr_dirty_threshold = 0, nr_dirty_background_threshold = 0,
46 - pgpgin = 0, pgpgout = 0, pswpin = 0, pswpout = 0, pgalloc_dma = 0, pgalloc_dma32 = 0, pgalloc_normal = 0, pgalloc_movable = 0, pgfree = 0, pgactivate = 0, pgdeactivate = 0,
47 - pgfault = 0, pgmajfault = 0, pgrefill_dma = 0, pgrefill_dma32 = 0, pgrefill_normal = 0, pgrefill_movable = 0, pgsteal_kswapd_dma = 0, pgsteal_kswapd_dma32 = 0,
48 - pgsteal_kswapd_normal = 0, pgsteal_kswapd_movable = 0, pgsteal_direct_dma = 0, pgsteal_direct_dma32 = 0, pgsteal_direct_normal = 0, pgsteal_direct_movable = 0,
49 - pgscan_kswapd_dma = 0, pgscan_kswapd_dma32 = 0, pgscan_kswapd_normal = 0, pgscan_kswapd_movable = 0, pgscan_direct_dma = 0, pgscan_direct_dma32 = 0, pgscan_direct_normal = 0,
50 - pgscan_direct_movable = 0, pginodesteal = 0, slabs_scanned = 0, kswapd_inodesteal = 0, kswapd_low_wmark_hit_quickly = 0, kswapd_high_wmark_hit_quickly = 0,
51 - kswapd_skip_congestion_wait = 0, pageoutrun = 0, allocstall = 0, pgrotated = 0, compact_blocks_moved = 0, compact_pages_moved = 0, compact_pagemigrate_failed = 0,
52 - compact_stall = 0, compact_fail = 0, compact_success = 0, htlb_buddy_alloc_success = 0, htlb_buddy_alloc_fail = 0, unevictable_pgs_culled = 0, unevictable_pgs_scanned = 0,
53 - unevictable_pgs_rescued = 0, unevictable_pgs_mlocked = 0, unevictable_pgs_munlocked = 0, unevictable_pgs_cleared = 0, unevictable_pgs_stranded = 0, unevictable_pgs_mlockfreed = 0,
54 - thp_fault_alloc = 0, thp_fault_fallback = 0, thp_collapse_alloc = 0, thp_collapse_alloc_failed = 0, thp_split = 0;
231 + // unsigned long long allocstall = 0ULL;
232 + // unsigned long long compact_blocks_moved = 0ULL;
233 + // unsigned long long compact_fail = 0ULL;
234 + // unsigned long long compact_pagemigrate_failed = 0ULL;
235 + // unsigned long long compact_pages_moved = 0ULL;
236 + // unsigned long long compact_stall = 0ULL;
237 + // unsigned long long compact_success = 0ULL;
238 + // unsigned long long htlb_buddy_alloc_fail = 0ULL;
239 + // unsigned long long htlb_buddy_alloc_success = 0ULL;
240 + // unsigned long long kswapd_high_wmark_hit_quickly = 0ULL;
241 + // unsigned long long kswapd_inodesteal = 0ULL;
242 + // unsigned long long kswapd_low_wmark_hit_quickly = 0ULL;
243 + // unsigned long long kswapd_skip_congestion_wait = 0ULL;
244 + // unsigned long long nr_active_anon = 0ULL;
245 + // unsigned long long nr_active_file = 0ULL;
246 + // unsigned long long nr_anon_pages = 0ULL;
247 + // unsigned long long nr_anon_transparent_hugepages = 0ULL;
248 + // unsigned long long nr_bounce = 0ULL;
249 + // unsigned long long nr_dirtied = 0ULL;
250 + // unsigned long long nr_dirty = 0ULL;
251 + // unsigned long long nr_dirty_background_threshold = 0ULL;
252 + // unsigned long long nr_dirty_threshold = 0ULL;
253 + // unsigned long long nr_file_pages = 0ULL;
254 + // unsigned long long nr_free_pages = 0ULL;
255 + // unsigned long long nr_inactive_anon = 0ULL;
256 + // unsigned long long nr_inactive_file = 0ULL;
257 + // unsigned long long nr_isolated_anon = 0ULL;
258 + // unsigned long long nr_isolated_file = 0ULL;
259 + // unsigned long long nr_kernel_stack = 0ULL;
260 + // unsigned long long nr_mapped = 0ULL;
261 + // unsigned long long nr_mlock = 0ULL;
262 + // unsigned long long nr_page_table_pages = 0ULL;
263 + // unsigned long long nr_shmem = 0ULL;
264 + // unsigned long long nr_slab_reclaimable = 0ULL;
265 + // unsigned long long nr_slab_unreclaimable = 0ULL;
266 + // unsigned long long nr_unevictable = 0ULL;
267 + // unsigned long long nr_unstable = 0ULL;
268 + // unsigned long long nr_vmscan_immediate_reclaim = 0ULL;
269 + // unsigned long long nr_vmscan_write = 0ULL;
270 + // unsigned long long nr_writeback = 0ULL;
271 + // unsigned long long nr_writeback_temp = 0ULL;
272 + // unsigned long long nr_written = 0ULL;
273 + // unsigned long long pageoutrun = 0ULL;
274 + // unsigned long long pgactivate = 0ULL;
275 + // unsigned long long pgalloc_dma = 0ULL;
276 + // unsigned long long pgalloc_dma32 = 0ULL;
277 + // unsigned long long pgalloc_movable = 0ULL;
278 + // unsigned long long pgalloc_normal = 0ULL;
279 + // unsigned long long pgdeactivate = 0ULL;
280 + unsigned long long pgfault = 0ULL;
281 + // unsigned long long pgfree = 0ULL;
282 + // unsigned long long pginodesteal = 0ULL;
283 + unsigned long long pgmajfault = 0ULL;
284 + unsigned long long pgpgin = 0ULL;
285 + unsigned long long pgpgout = 0ULL;
286 + // unsigned long long pgrefill_dma = 0ULL;
287 + // unsigned long long pgrefill_dma32 = 0ULL;
288 + // unsigned long long pgrefill_movable = 0ULL;
289 + // unsigned long long pgrefill_normal = 0ULL;
290 + // unsigned long long pgrotated = 0ULL;
291 + // unsigned long long pgscan_direct_dma = 0ULL;
292 + // unsigned long long pgscan_direct_dma32 = 0ULL;
293 + // unsigned long long pgscan_direct_movable = 0ULL;
294 + // unsigned long long pgscan_direct_normal = 0ULL;
295 + // unsigned long long pgscan_kswapd_dma = 0ULL;
296 + // unsigned long long pgscan_kswapd_dma32 = 0ULL;
297 + // unsigned long long pgscan_kswapd_movable = 0ULL;
298 + // unsigned long long pgscan_kswapd_normal = 0ULL;
299 + // unsigned long long pgsteal_direct_dma = 0ULL;
300 + // unsigned long long pgsteal_direct_dma32 = 0ULL;
301 + // unsigned long long pgsteal_direct_movable = 0ULL;
302 + // unsigned long long pgsteal_direct_normal = 0ULL;
303 + // unsigned long long pgsteal_kswapd_dma = 0ULL;
304 + // unsigned long long pgsteal_kswapd_dma32 = 0ULL;
305 + // unsigned long long pgsteal_kswapd_movable = 0ULL;
306 + // unsigned long long pgsteal_kswapd_normal = 0ULL;
307 + unsigned long long pswpin = 0ULL;
308 + unsigned long long pswpout = 0ULL;
309 + // unsigned long long slabs_scanned = 0ULL;
310 + // unsigned long long thp_collapse_alloc = 0ULL;
311 + // unsigned long long thp_collapse_alloc_failed = 0ULL;
312 + // unsigned long long thp_fault_alloc = 0ULL;
313 + // unsigned long long thp_fault_fallback = 0ULL;
314 + // unsigned long long thp_split = 0ULL;
315 + // unsigned long long unevictable_pgs_cleared = 0ULL;
316 + // unsigned long long unevictable_pgs_culled = 0ULL;
317 + // unsigned long long unevictable_pgs_mlocked = 0ULL;
318 + // unsigned long long unevictable_pgs_mlockfreed = 0ULL;
319 + // unsigned long long unevictable_pgs_munlocked = 0ULL;
320 + // unsigned long long unevictable_pgs_rescued = 0ULL;
321 + // unsigned long long unevictable_pgs_scanned = 0ULL;
322 + // unsigned long long unevictable_pgs_stranded = 0ULL;
323
324 for(l = 0; l < lines ;l++) {
325 words = procfile_linewords(ff, l);
@@ -61,154 +329,156 @@ int do_proc_vmstat(int update_every, unsigned long long dt) {
329 }
330
331 char *name = procfile_lineword(ff, l, 0);
64 - unsigned long long value = strtoull(procfile_lineword(ff, l, 1), NULL, 10);
65 -
66 - if(!nr_free_pages && strcmp(name, "nr_free_pages") == 0) nr_free_pages = value;
67 - else if(!nr_inactive_anon && strcmp(name, "nr_inactive_anon") == 0) nr_inactive_anon = value;
68 - else if(!nr_active_anon && strcmp(name, "nr_active_anon") == 0) nr_active_anon = value;
69 - else if(!nr_inactive_file && strcmp(name, "nr_inactive_file") == 0) nr_inactive_file = value;
70 - else if(!nr_active_file && strcmp(name, "nr_active_file") == 0) nr_active_file = value;
71 - else if(!nr_unevictable && strcmp(name, "nr_unevictable") == 0) nr_unevictable = value;
72 - else if(!nr_mlock && strcmp(name, "nr_mlock") == 0) nr_mlock = value;
73 - else if(!nr_anon_pages && strcmp(name, "nr_anon_pages") == 0) nr_anon_pages = value;
74 - else if(!nr_mapped && strcmp(name, "nr_mapped") == 0) nr_mapped = value;
75 - else if(!nr_file_pages && strcmp(name, "nr_file_pages") == 0) nr_file_pages = value;
76 - else if(!nr_dirty && strcmp(name, "nr_dirty") == 0) nr_dirty = value;
77 - else if(!nr_writeback && strcmp(name, "nr_writeback") == 0) nr_writeback = value;
78 - else if(!nr_slab_reclaimable && strcmp(name, "nr_slab_reclaimable") == 0) nr_slab_reclaimable = value;
79 - else if(!nr_slab_unreclaimable && strcmp(name, "nr_slab_unreclaimable") == 0) nr_slab_unreclaimable = value;
80 - else if(!nr_page_table_pages && strcmp(name, "nr_page_table_pages") == 0) nr_page_table_pages = value;
81 - else if(!nr_kernel_stack && strcmp(name, "nr_kernel_stack") == 0) nr_kernel_stack = value;
82 - else if(!nr_unstable && strcmp(name, "nr_unstable") == 0) nr_unstable = value;
83 - else if(!nr_bounce && strcmp(name, "nr_bounce") == 0) nr_bounce = value;
84 - else if(!nr_vmscan_write && strcmp(name, "nr_vmscan_write") == 0) nr_vmscan_write = value;
85 - else if(!nr_vmscan_immediate_reclaim && strcmp(name, "nr_vmscan_immediate_reclaim") == 0) nr_vmscan_immediate_reclaim = value;
86 - else if(!nr_writeback_temp && strcmp(name, "nr_writeback_temp") == 0) nr_writeback_temp = value;
87 - else if(!nr_isolated_anon && strcmp(name, "nr_isolated_anon") == 0) nr_isolated_anon = value;
88 - else if(!nr_isolated_file && strcmp(name, "nr_isolated_file") == 0) nr_isolated_file = value;
89 - else if(!nr_shmem && strcmp(name, "nr_shmem") == 0) nr_shmem = value;
90 - else if(!nr_dirtied && strcmp(name, "nr_dirtied") == 0) nr_dirtied = value;
91 - else if(!nr_written && strcmp(name, "nr_written") == 0) nr_written = value;
92 - else if(!nr_anon_transparent_hugepages && strcmp(name, "nr_anon_transparent_hugepages") == 0) nr_anon_transparent_hugepages = value;
93 - else if(!nr_dirty_threshold && strcmp(name, "nr_dirty_threshold") == 0) nr_dirty_threshold = value;
94 - else if(!nr_dirty_background_threshold && strcmp(name, "nr_dirty_background_threshold") == 0) nr_dirty_background_threshold = value;
95 - else if(!pgpgin && strcmp(name, "pgpgin") == 0) pgpgin = value;
96 - else if(!pgpgout && strcmp(name, "pgpgout") == 0) pgpgout = value;
97 - else if(!pswpin && strcmp(name, "pswpin") == 0) pswpin = value;
98 - else if(!pswpout && strcmp(name, "pswpout") == 0) pswpout = value;
99 - else if(!pgalloc_dma && strcmp(name, "pgalloc_dma") == 0) pgalloc_dma = value;
100 - else if(!pgalloc_dma32 && strcmp(name, "pgalloc_dma32") == 0) pgalloc_dma32 = value;
101 - else if(!pgalloc_normal && strcmp(name, "pgalloc_normal") == 0) pgalloc_normal = value;
102 - else if(!pgalloc_movable && strcmp(name, "pgalloc_movable") == 0) pgalloc_movable = value;
103 - else if(!pgfree && strcmp(name, "pgfree") == 0) pgfree = value;
104 - else if(!pgactivate && strcmp(name, "pgactivate") == 0) pgactivate = value;
105 - else if(!pgdeactivate && strcmp(name, "pgdeactivate") == 0) pgdeactivate = value;
106 - else if(!pgfault && strcmp(name, "pgfault") == 0) pgfault = value;
107 - else if(!pgmajfault && strcmp(name, "pgmajfault") == 0) pgmajfault = value;
108 - else if(!pgrefill_dma && strcmp(name, "pgrefill_dma") == 0) pgrefill_dma = value;
109 - else if(!pgrefill_dma32 && strcmp(name, "pgrefill_dma32") == 0) pgrefill_dma32 = value;
110 - else if(!pgrefill_normal && strcmp(name, "pgrefill_normal") == 0) pgrefill_normal = value;
111 - else if(!pgrefill_movable && strcmp(name, "pgrefill_movable") == 0) pgrefill_movable = value;
112 - else if(!pgsteal_kswapd_dma && strcmp(name, "pgsteal_kswapd_dma") == 0) pgsteal_kswapd_dma = value;
113 - else if(!pgsteal_kswapd_dma32 && strcmp(name, "pgsteal_kswapd_dma32") == 0) pgsteal_kswapd_dma32 = value;
114 - else if(!pgsteal_kswapd_normal && strcmp(name, "pgsteal_kswapd_normal") == 0) pgsteal_kswapd_normal = value;
115 - else if(!pgsteal_kswapd_movable && strcmp(name, "pgsteal_kswapd_movable") == 0) pgsteal_kswapd_movable = value;
116 - else if(!pgsteal_direct_dma && strcmp(name, "pgsteal_direct_dma") == 0) pgsteal_direct_dma = value;
117 - else if(!pgsteal_direct_dma32 && strcmp(name, "pgsteal_direct_dma32") == 0) pgsteal_direct_dma32 = value;
118 - else if(!pgsteal_direct_normal && strcmp(name, "pgsteal_direct_normal") == 0) pgsteal_direct_normal = value;
119 - else if(!pgsteal_direct_movable && strcmp(name, "pgsteal_direct_movable") == 0) pgsteal_direct_movable = value;
120 - else if(!pgscan_kswapd_dma && strcmp(name, "pgscan_kswapd_dma") == 0) pgscan_kswapd_dma = value;
121 - else if(!pgscan_kswapd_dma32 && strcmp(name, "pgscan_kswapd_dma32") == 0) pgscan_kswapd_dma32 = value;
122 - else if(!pgscan_kswapd_normal && strcmp(name, "pgscan_kswapd_normal") == 0) pgscan_kswapd_normal = value;
123 - else if(!pgscan_kswapd_movable && strcmp(name, "pgscan_kswapd_movable") == 0) pgscan_kswapd_movable = value;
124 - else if(!pgscan_direct_dma && strcmp(name, "pgscan_direct_dma") == 0) pgscan_direct_dma = value;
125 - else if(!pgscan_direct_dma32 && strcmp(name, "pgscan_direct_dma32") == 0) pgscan_direct_dma32 = value;
126 - else if(!pgscan_direct_normal && strcmp(name, "pgscan_direct_normal") == 0) pgscan_direct_normal = value;
127 - else if(!pgscan_direct_movable && strcmp(name, "pgscan_direct_movable") == 0) pgscan_direct_movable = value;
128 - else if(!pginodesteal && strcmp(name, "pginodesteal") == 0) pginodesteal = value;
129 - else if(!slabs_scanned && strcmp(name, "slabs_scanned") == 0) slabs_scanned = value;
130 - else if(!kswapd_inodesteal && strcmp(name, "kswapd_inodesteal") == 0) kswapd_inodesteal = value;
131 - else if(!kswapd_low_wmark_hit_quickly && strcmp(name, "kswapd_low_wmark_hit_quickly") == 0) kswapd_low_wmark_hit_quickly = value;
132 - else if(!kswapd_high_wmark_hit_quickly && strcmp(name, "kswapd_high_wmark_hit_quickly") == 0) kswapd_high_wmark_hit_quickly = value;
133 - else if(!kswapd_skip_congestion_wait && strcmp(name, "kswapd_skip_congestion_wait") == 0) kswapd_skip_congestion_wait = value;
134 - else if(!pageoutrun && strcmp(name, "pageoutrun") == 0) pageoutrun = value;
135 - else if(!allocstall && strcmp(name, "allocstall") == 0) allocstall = value;
136 - else if(!pgrotated && strcmp(name, "pgrotated") == 0) pgrotated = value;
137 - else if(!compact_blocks_moved && strcmp(name, "compact_blocks_moved") == 0) compact_blocks_moved = value;
138 - else if(!compact_pages_moved && strcmp(name, "compact_pages_moved") == 0) compact_pages_moved = value;
139 - else if(!compact_pagemigrate_failed && strcmp(name, "compact_pagemigrate_failed") == 0) compact_pagemigrate_failed = value;
140 - else if(!compact_stall && strcmp(name, "compact_stall") == 0) compact_stall = value;
141 - else if(!compact_fail && strcmp(name, "compact_fail") == 0) compact_fail = value;
142 - else if(!compact_success && strcmp(name, "compact_success") == 0) compact_success = value;
143 - else if(!htlb_buddy_alloc_success && strcmp(name, "htlb_buddy_alloc_success") == 0) htlb_buddy_alloc_success = value;
144 - else if(!htlb_buddy_alloc_fail && strcmp(name, "htlb_buddy_alloc_fail") == 0) htlb_buddy_alloc_fail = value;
145 - else if(!unevictable_pgs_culled && strcmp(name, "unevictable_pgs_culled") == 0) unevictable_pgs_culled = value;
146 - else if(!unevictable_pgs_scanned && strcmp(name, "unevictable_pgs_scanned") == 0) unevictable_pgs_scanned = value;
147 - else if(!unevictable_pgs_rescued && strcmp(name, "unevictable_pgs_rescued") == 0) unevictable_pgs_rescued = value;
148 - else if(!unevictable_pgs_mlocked && strcmp(name, "unevictable_pgs_mlocked") == 0) unevictable_pgs_mlocked = value;
149 - else if(!unevictable_pgs_munlocked && strcmp(name, "unevictable_pgs_munlocked") == 0) unevictable_pgs_munlocked = value;
150 - else if(!unevictable_pgs_cleared && strcmp(name, "unevictable_pgs_cleared") == 0) unevictable_pgs_cleared = value;
151 - else if(!unevictable_pgs_stranded && strcmp(name, "unevictable_pgs_stranded") == 0) unevictable_pgs_stranded = value;
152 - else if(!unevictable_pgs_mlockfreed && strcmp(name, "unevictable_pgs_mlockfreed") == 0) unevictable_pgs_mlockfreed = value;
153 - else if(!thp_fault_alloc && strcmp(name, "thp_fault_alloc") == 0) thp_fault_alloc = value;
154 - else if(!thp_fault_fallback && strcmp(name, "thp_fault_fallback") == 0) thp_fault_fallback = value;
155 - else if(!thp_collapse_alloc && strcmp(name, "thp_collapse_alloc") == 0) thp_collapse_alloc = value;
156 - else if(!thp_collapse_alloc_failed && strcmp(name, "thp_collapse_alloc_failed") == 0) thp_collapse_alloc_failed = value;
157 - else if(!thp_split && strcmp(name, "thp_split") == 0) thp_split = value;
158 - }
332 + char * value = procfile_lineword(ff, l, 1);
333 + if(!name || !*name || !value || !*value) continue;
334 +
335 + uint32_t hash = simple_hash(name);
336
160 - RRDSET *st;
337 + if(0) ;
338 + // else if(hash == hash_allocstall && strcmp(name, "allocstall") == 0) allocstall = strtoull(value, NULL, 10);
339 + // else if(hash == hash_compact_blocks_moved && strcmp(name, "compact_blocks_moved") == 0) compact_blocks_moved = strtoull(value, NULL, 10);
340 + // else if(hash == hash_compact_fail && strcmp(name, "compact_fail") == 0) compact_fail = strtoull(value, NULL, 10);
341 + // else if(hash == hash_compact_pagemigrate_failed && strcmp(name, "compact_pagemigrate_failed") == 0) compact_pagemigrate_failed = strtoull(value, NULL, 10);
342 + // else if(hash == hash_compact_pages_moved && strcmp(name, "compact_pages_moved") == 0) compact_pages_moved = strtoull(value, NULL, 10);
343 + // else if(hash == hash_compact_stall && strcmp(name, "compact_stall") == 0) compact_stall = strtoull(value, NULL, 10);
344 + // else if(hash == hash_compact_success && strcmp(name, "compact_success") == 0) compact_success = strtoull(value, NULL, 10);
345 + // else if(hash == hash_htlb_buddy_alloc_fail && strcmp(name, "htlb_buddy_alloc_fail") == 0) htlb_buddy_alloc_fail = strtoull(value, NULL, 10);
346 + // else if(hash == hash_htlb_buddy_alloc_success && strcmp(name, "htlb_buddy_alloc_success") == 0) htlb_buddy_alloc_success = strtoull(value, NULL, 10);
347 + // else if(hash == hash_kswapd_high_wmark_hit_quickly && strcmp(name, "kswapd_high_wmark_hit_quickly") == 0) kswapd_high_wmark_hit_quickly = strtoull(value, NULL, 10);
348 + // else if(hash == hash_kswapd_inodesteal && strcmp(name, "kswapd_inodesteal") == 0) kswapd_inodesteal = strtoull(value, NULL, 10);
349 + // else if(hash == hash_kswapd_low_wmark_hit_quickly && strcmp(name, "kswapd_low_wmark_hit_quickly") == 0) kswapd_low_wmark_hit_quickly = strtoull(value, NULL, 10);
350 + // else if(hash == hash_kswapd_skip_congestion_wait && strcmp(name, "kswapd_skip_congestion_wait") == 0) kswapd_skip_congestion_wait = strtoull(value, NULL, 10);
351 + // else if(hash == hash_nr_active_anon && strcmp(name, "nr_active_anon") == 0) nr_active_anon = strtoull(value, NULL, 10);
352 + // else if(hash == hash_nr_active_file && strcmp(name, "nr_active_file") == 0) nr_active_file = strtoull(value, NULL, 10);
353 + // else if(hash == hash_nr_anon_pages && strcmp(name, "nr_anon_pages") == 0) nr_anon_pages = strtoull(value, NULL, 10);
354 + // else if(hash == hash_nr_anon_transparent_hugepages && strcmp(name, "nr_anon_transparent_hugepages") == 0) nr_anon_transparent_hugepages = strtoull(value, NULL, 10);
355 + // else if(hash == hash_nr_bounce && strcmp(name, "nr_bounce") == 0) nr_bounce = strtoull(value, NULL, 10);
356 + // else if(hash == hash_nr_dirtied && strcmp(name, "nr_dirtied") == 0) nr_dirtied = strtoull(value, NULL, 10);
357 + // else if(hash == hash_nr_dirty && strcmp(name, "nr_dirty") == 0) nr_dirty = strtoull(value, NULL, 10);
358 + // else if(hash == hash_nr_dirty_background_threshold && strcmp(name, "nr_dirty_background_threshold") == 0) nr_dirty_background_threshold = strtoull(value, NULL, 10);
359 + // else if(hash == hash_nr_dirty_threshold && strcmp(name, "nr_dirty_threshold") == 0) nr_dirty_threshold = strtoull(value, NULL, 10);
360 + // else if(hash == hash_nr_file_pages && strcmp(name, "nr_file_pages") == 0) nr_file_pages = strtoull(value, NULL, 10);
361 + // else if(hash == hash_nr_free_pages && strcmp(name, "nr_free_pages") == 0) nr_free_pages = strtoull(value, NULL, 10);
362 + // else if(hash == hash_nr_inactive_anon && strcmp(name, "nr_inactive_anon") == 0) nr_inactive_anon = strtoull(value, NULL, 10);
363 + // else if(hash == hash_nr_inactive_file && strcmp(name, "nr_inactive_file") == 0) nr_inactive_file = strtoull(value, NULL, 10);
364 + // else if(hash == hash_nr_isolated_anon && strcmp(name, "nr_isolated_anon") == 0) nr_isolated_anon = strtoull(value, NULL, 10);
365 + // else if(hash == hash_nr_isolated_file && strcmp(name, "nr_isolated_file") == 0) nr_isolated_file = strtoull(value, NULL, 10);
366 + // else if(hash == hash_nr_kernel_stack && strcmp(name, "nr_kernel_stack") == 0) nr_kernel_stack = strtoull(value, NULL, 10);
367 + // else if(hash == hash_nr_mapped && strcmp(name, "nr_mapped") == 0) nr_mapped = strtoull(value, NULL, 10);
368 + // else if(hash == hash_nr_mlock && strcmp(name, "nr_mlock") == 0) nr_mlock = strtoull(value, NULL, 10);
369 + // else if(hash == hash_nr_page_table_pages && strcmp(name, "nr_page_table_pages") == 0) nr_page_table_pages = strtoull(value, NULL, 10);
370 + // else if(hash == hash_nr_shmem && strcmp(name, "nr_shmem") == 0) nr_shmem = strtoull(value, NULL, 10);
371 + // else if(hash == hash_nr_slab_reclaimable && strcmp(name, "nr_slab_reclaimable") == 0) nr_slab_reclaimable = strtoull(value, NULL, 10);
372 + // else if(hash == hash_nr_slab_unreclaimable && strcmp(name, "nr_slab_unreclaimable") == 0) nr_slab_unreclaimable = strtoull(value, NULL, 10);
373 + // else if(hash == hash_nr_unevictable && strcmp(name, "nr_unevictable") == 0) nr_unevictable = strtoull(value, NULL, 10);
374 + // else if(hash == hash_nr_unstable && strcmp(name, "nr_unstable") == 0) nr_unstable = strtoull(value, NULL, 10);
375 + // else if(hash == hash_nr_vmscan_immediate_reclaim && strcmp(name, "nr_vmscan_immediate_reclaim") == 0) nr_vmscan_immediate_reclaim = strtoull(value, NULL, 10);
376 + // else if(hash == hash_nr_vmscan_write && strcmp(name, "nr_vmscan_write") == 0) nr_vmscan_write = strtoull(value, NULL, 10);
377 + // else if(hash == hash_nr_writeback && strcmp(name, "nr_writeback") == 0) nr_writeback = strtoull(value, NULL, 10);
378 + // else if(hash == hash_nr_writeback_temp && strcmp(name, "nr_writeback_temp") == 0) nr_writeback_temp = strtoull(value, NULL, 10);
379 + // else if(hash == hash_nr_written && strcmp(name, "nr_written") == 0) nr_written = strtoull(value, NULL, 10);
380 + // else if(hash == hash_pageoutrun && strcmp(name, "pageoutrun") == 0) pageoutrun = strtoull(value, NULL, 10);
381 + // else if(hash == hash_pgactivate && strcmp(name, "pgactivate") == 0) pgactivate = strtoull(value, NULL, 10);
382 + // else if(hash == hash_pgalloc_dma && strcmp(name, "pgalloc_dma") == 0) pgalloc_dma = strtoull(value, NULL, 10);
383 + // else if(hash == hash_pgalloc_dma32 && strcmp(name, "pgalloc_dma32") == 0) pgalloc_dma32 = strtoull(value, NULL, 10);
384 + // else if(hash == hash_pgalloc_movable && strcmp(name, "pgalloc_movable") == 0) pgalloc_movable = strtoull(value, NULL, 10);
385 + // else if(hash == hash_pgalloc_normal && strcmp(name, "pgalloc_normal") == 0) pgalloc_normal = strtoull(value, NULL, 10);
386 + // else if(hash == hash_pgdeactivate && strcmp(name, "pgdeactivate") == 0) pgdeactivate = strtoull(value, NULL, 10);
387 + else if(hash == hash_pgfault && strcmp(name, "pgfault") == 0) pgfault = strtoull(value, NULL, 10);
388 + // else if(hash == hash_pgfree && strcmp(name, "pgfree") == 0) pgfree = strtoull(value, NULL, 10);
389 + // else if(hash == hash_pginodesteal && strcmp(name, "pginodesteal") == 0) pginodesteal = strtoull(value, NULL, 10);
390 + else if(hash == hash_pgmajfault && strcmp(name, "pgmajfault") == 0) pgmajfault = strtoull(value, NULL, 10);
391 + else if(hash == hash_pgpgin && strcmp(name, "pgpgin") == 0) pgpgin = strtoull(value, NULL, 10);
392 + else if(hash == hash_pgpgout && strcmp(name, "pgpgout") == 0) pgpgout = strtoull(value, NULL, 10);
393 + // else if(hash == hash_pgrefill_dma && strcmp(name, "pgrefill_dma") == 0) pgrefill_dma = strtoull(value, NULL, 10);
394 + // else if(hash == hash_pgrefill_dma32 && strcmp(name, "pgrefill_dma32") == 0) pgrefill_dma32 = strtoull(value, NULL, 10);
395 + // else if(hash == hash_pgrefill_movable && strcmp(name, "pgrefill_movable") == 0) pgrefill_movable = strtoull(value, NULL, 10);
396 + // else if(hash == hash_pgrefill_normal && strcmp(name, "pgrefill_normal") == 0) pgrefill_normal = strtoull(value, NULL, 10);
397 + // else if(hash == hash_pgrotated && strcmp(name, "pgrotated") == 0) pgrotated = strtoull(value, NULL, 10);
398 + // else if(hash == hash_pgscan_direct_dma && strcmp(name, "pgscan_direct_dma") == 0) pgscan_direct_dma = strtoull(value, NULL, 10);
399 + // else if(hash == hash_pgscan_direct_dma32 && strcmp(name, "pgscan_direct_dma32") == 0) pgscan_direct_dma32 = strtoull(value, NULL, 10);
400 + // else if(hash == hash_pgscan_direct_movable && strcmp(name, "pgscan_direct_movable") == 0) pgscan_direct_movable = strtoull(value, NULL, 10);
401 + // else if(hash == hash_pgscan_direct_normal && strcmp(name, "pgscan_direct_normal") == 0) pgscan_direct_normal = strtoull(value, NULL, 10);
402 + // else if(hash == hash_pgscan_kswapd_dma && strcmp(name, "pgscan_kswapd_dma") == 0) pgscan_kswapd_dma = strtoull(value, NULL, 10);
403 + // else if(hash == hash_pgscan_kswapd_dma32 && strcmp(name, "pgscan_kswapd_dma32") == 0) pgscan_kswapd_dma32 = strtoull(value, NULL, 10);
404 + // else if(hash == hash_pgscan_kswapd_movable && strcmp(name, "pgscan_kswapd_movable") == 0) pgscan_kswapd_movable = strtoull(value, NULL, 10);
405 + // else if(hash == hash_pgscan_kswapd_normal && strcmp(name, "pgscan_kswapd_normal") == 0) pgscan_kswapd_normal = strtoull(value, NULL, 10);
406 + // else if(hash == hash_pgsteal_direct_dma && strcmp(name, "pgsteal_direct_dma") == 0) pgsteal_direct_dma = strtoull(value, NULL, 10);
407 + // else if(hash == hash_pgsteal_direct_dma32 && strcmp(name, "pgsteal_direct_dma32") == 0) pgsteal_direct_dma32 = strtoull(value, NULL, 10);
408 + // else if(hash == hash_pgsteal_direct_movable && strcmp(name, "pgsteal_direct_movable") == 0) pgsteal_direct_movable = strtoull(value, NULL, 10);
409 + // else if(hash == hash_pgsteal_direct_normal && strcmp(name, "pgsteal_direct_normal") == 0) pgsteal_direct_normal = strtoull(value, NULL, 10);
410 + // else if(hash == hash_pgsteal_kswapd_dma && strcmp(name, "pgsteal_kswapd_dma") == 0) pgsteal_kswapd_dma = strtoull(value, NULL, 10);
411 + // else if(hash == hash_pgsteal_kswapd_dma32 && strcmp(name, "pgsteal_kswapd_dma32") == 0) pgsteal_kswapd_dma32 = strtoull(value, NULL, 10);
412 + // else if(hash == hash_pgsteal_kswapd_movable && strcmp(name, "pgsteal_kswapd_movable") == 0) pgsteal_kswapd_movable = strtoull(value, NULL, 10);
413 + // else if(hash == hash_pgsteal_kswapd_normal && strcmp(name, "pgsteal_kswapd_normal") == 0) pgsteal_kswapd_normal = strtoull(value, NULL, 10);
414 + else if(hash == hash_pswpin && strcmp(name, "pswpin") == 0) pswpin = strtoull(value, NULL, 10);
415 + else if(hash == hash_pswpout && strcmp(name, "pswpout") == 0) pswpout = strtoull(value, NULL, 10);
416 + // else if(hash == hash_slabs_scanned && strcmp(name, "slabs_scanned") == 0) slabs_scanned = strtoull(value, NULL, 10);
417 + // else if(hash == hash_thp_collapse_alloc && strcmp(name, "thp_collapse_alloc") == 0) thp_collapse_alloc = strtoull(value, NULL, 10);
418 + // else if(hash == hash_thp_collapse_alloc_failed && strcmp(name, "thp_collapse_alloc_failed") == 0) thp_collapse_alloc_failed = strtoull(value, NULL, 10);
419 + // else if(hash == hash_thp_fault_alloc && strcmp(name, "thp_fault_alloc") == 0) thp_fault_alloc = strtoull(value, NULL, 10);
420 + // else if(hash == hash_thp_fault_fallback && strcmp(name, "thp_fault_fallback") == 0) thp_fault_fallback = strtoull(value, NULL, 10);
421 + // else if(hash == hash_thp_split && strcmp(name, "thp_split") == 0) thp_split = strtoull(value, NULL, 10);
422 + // else if(hash == hash_unevictable_pgs_cleared && strcmp(name, "unevictable_pgs_cleared") == 0) unevictable_pgs_cleared = strtoull(value, NULL, 10);
423 + // else if(hash == hash_unevictable_pgs_culled && strcmp(name, "unevictable_pgs_culled") == 0) unevictable_pgs_culled = strtoull(value, NULL, 10);
424 + // else if(hash == hash_unevictable_pgs_mlocked && strcmp(name, "unevictable_pgs_mlocked") == 0) unevictable_pgs_mlocked = strtoull(value, NULL, 10);
425 + // else if(hash == hash_unevictable_pgs_mlockfreed && strcmp(name, "unevictable_pgs_mlockfreed") == 0) unevictable_pgs_mlockfreed = strtoull(value, NULL, 10);
426 + // else if(hash == hash_unevictable_pgs_munlocked && strcmp(name, "unevictable_pgs_munlocked") == 0) unevictable_pgs_munlocked = strtoull(value, NULL, 10);
427 + // else if(hash == hash_unevictable_pgs_rescued && strcmp(name, "unevictable_pgs_rescued") == 0) unevictable_pgs_rescued = strtoull(value, NULL, 10);
428 + // else if(hash == hash_unevictable_pgs_scanned && strcmp(name, "unevictable_pgs_scanned") == 0) unevictable_pgs_scanned = strtoull(value, NULL, 10);
429 + // else if(hash == hash_unevictable_pgs_stranded && strcmp(name, "unevictable_pgs_stranded") == 0) unevictable_pgs_stranded = strtoull(value, NULL, 10);
430 + }
431
432 // --------------------------------------------------------------------
433
434 if(do_swapio) {
165 - st = rrdset_find("system.swapio");
166 - if(!st) {
167 - st = rrdset_create("system", "swapio", NULL, "swap", NULL, "Swap I/O", "kilobytes/s", 250, update_every, RRDSET_TYPE_AREA);
435 + static RRDSET *st_swapio = NULL;
436 + if(!st_swapio) {
437 + st_swapio = rrdset_create("system", "swapio", NULL, "swap", NULL, "Swap I/O", "kilobytes/s", 250, update_every, RRDSET_TYPE_AREA);
438
169 - rrddim_add(st, "in", NULL, sysconf(_SC_PAGESIZE), 1024, RRDDIM_INCREMENTAL);
170 - rrddim_add(st, "out", NULL, -sysconf(_SC_PAGESIZE), 1024, RRDDIM_INCREMENTAL);
439 + rrddim_add(st_swapio, "in", NULL, sysconf(_SC_PAGESIZE), 1024, RRDDIM_INCREMENTAL);
440 + rrddim_add(st_swapio, "out", NULL, -sysconf(_SC_PAGESIZE), 1024, RRDDIM_INCREMENTAL);
441 }
172 - else rrdset_next(st);
442 + else rrdset_next(st_swapio);
443
174 - rrddim_set(st, "in", pswpin);
175 - rrddim_set(st, "out", pswpout);
176 - rrdset_done(st);
444 + rrddim_set(st_swapio, "in", pswpin);
445 + rrddim_set(st_swapio, "out", pswpout);
446 + rrdset_done(st_swapio);
447 }
448
449 // --------------------------------------------------------------------
450
451 if(do_io) {
182 - st = rrdset_find("system.io");
183 - if(!st) {
184 - st = rrdset_create("system", "io", NULL, "disk", NULL, "Disk I/O", "kilobytes/s", 150, update_every, RRDSET_TYPE_AREA);
452 + static RRDSET *st_io = NULL;
453 + if(!st_io) {
454 + st_io = rrdset_create("system", "io", NULL, "disk", NULL, "Disk I/O", "kilobytes/s", 150, update_every, RRDSET_TYPE_AREA);
455
186 - rrddim_add(st, "in", NULL, 1, 1, RRDDIM_INCREMENTAL);
187 - rrddim_add(st, "out", NULL, -1, 1, RRDDIM_INCREMENTAL);
456 + rrddim_add(st_io, "in", NULL, 1, 1, RRDDIM_INCREMENTAL);
457 + rrddim_add(st_io, "out", NULL, -1, 1, RRDDIM_INCREMENTAL);
458 }
189 - else rrdset_next(st);
459 + else rrdset_next(st_io);
460
191 - rrddim_set(st, "in", pgpgin);
192 - rrddim_set(st, "out", pgpgout);
193 - rrdset_done(st);
461 + rrddim_set(st_io, "in", pgpgin);
462 + rrddim_set(st_io, "out", pgpgout);
463 + rrdset_done(st_io);
464 }
465
466 // --------------------------------------------------------------------
467
468 if(do_pgfaults) {
199 - st = rrdset_find("mem.pgfaults");
200 - if(!st) {
201 - st = rrdset_create("mem", "pgfaults", NULL, "system", NULL, "Memory Page Faults", "page faults/s", 500, update_every, RRDSET_TYPE_LINE);
202 - st->isdetail = 1;
469 + static RRDSET *st_pgfaults = NULL;
470 + if(!st_pgfaults) {
471 + st_pgfaults = rrdset_create("mem", "pgfaults", NULL, "system", NULL, "Memory Page Faults", "page faults/s", 500, update_every, RRDSET_TYPE_LINE);
472 + st_pgfaults->isdetail = 1;
473
204 - rrddim_add(st, "minor", NULL, 1, 1, RRDDIM_INCREMENTAL);
205 - rrddim_add(st, "major", NULL, -1, 1, RRDDIM_INCREMENTAL);
474 + rrddim_add(st_pgfaults, "minor", NULL, 1, 1, RRDDIM_INCREMENTAL);
475 + rrddim_add(st_pgfaults, "major", NULL, -1, 1, RRDDIM_INCREMENTAL);
476 }
207 - else rrdset_next(st);
477 + else rrdset_next(st_pgfaults);
478
209 - rrddim_set(st, "minor", pgfault);
210 - rrddim_set(st, "major", pgmajfault);
211 - rrdset_done(st);
479 + rrddim_set(st_pgfaults, "minor", pgfault);
480 + rrddim_set(st_pgfaults, "major", pgmajfault);
481 + rrdset_done(st_pgfaults);
482 }
483
484 return 0;
web/index.html
+5 -1
@@ -921,6 +921,10 @@ var chartData = {
921 info: 'System processes, read from <code>/proc/stat</code>. <b>Blocked</b> are processes that are willing to execute but they cannot, e.g. because they wait for disk activity.'
922 },
923
924 + 'system.active_processes': {
925 + info: 'All system active processes, read from <code>/proc/loadavg</code>.'
926 + },
927 +
928 'system.ctxt': {
929 info: '<a href="https://en.wikipedia.org/wiki/Context_switch" target="_blank">Context Switches</a>, read from <code>/proc/stat</code>, is the switching of the CPU from one process, task or thread to another. If there are many processes or threads willing to execute and very few CPU cores available to handle them, the system is making more context switching to balance the CPU resources among them. The whole process is computationally intensive. The more the context switches, the slower the system gets.'
930 },
@@ -984,7 +988,7 @@ var chartData = {
988 },
989
990 'disk.backlog': {
987 - colors: '#CCCC00'
991 + colors: '#0099CC'
992 },
993
994 'disk.io': {