@cryptotaxi247 / netdata-1 / commits / 8fbf817ef

modularized all source code (#4391)

* modularized all external plugins * added README.md in plugins * fixed title * fixed typo * relative link to external plugins * external plugins configuration README * added plugins link * remove plugins link * plugin names are links * added links to external plugins * removed unecessary spacing * list to table * added language * fixed typo * list to table on internal plugins * added more documentation to internal plugins * moved python, node, and bash code and configs into the external plugins * added statsd README * fix bug with corrupting config.h every 2nd compilation * moved all config files together with their code * more documentation * diskspace info * fixed broken links in apps.plugin * added backends docs * updated plugins readme * move nc-backend.sh to backends * created daemon directory * moved all code outside src/ * fixed readme identation * renamed plugins.d.plugin to plugins.d * updated readme * removed linux- from linux plugins * updated readme * updated readme * updated readme * updated readme * updated readme * updated readme * fixed README.md links * fixed netdata tree links * updated codacy, codeclimate and lgtm excluded paths * update CMakeLists.txt * updated automake options at top directory * libnetdata slit into directories * updated READMEs * updated READMEs * updated ARL docs * updated ARL docs * moved /plugins to /collectors * moved all external plugins outside plugins.d * updated codacy, codeclimate, lgtm * updated README * updated url * updated readme * updated readme * updated readme * updated readme * moved api and web into webserver * web/api web/gui web/server * modularized webserver * removed web/gui/version.txt

Costa Tsaousis committed Oct 15, 2018 at 23:16 UTC 8fbf817ef83b3524b15f908251909d9d6feb5532
835 files changed +9848 -6412
.codacy.yml
+9 -9
@@ -1,15 +1,15 @@
1 ---
2 exclude_paths:
3 - - python.d/python_modules/pyyaml2/**
4 - - python.d/python_modules/pyyaml3/**
5 - - python.d/python_modules/urllib3/**
6 - - python.d/python_modules/lm_sensors.py
3 + - collectors/python.d.plugin/python_modules/pyyaml2/**
4 + - collectors/python.d.plugin/python_modules/pyyaml3/**
5 + - collectors/python.d.plugin/python_modules/urllib3/**
6 + - collectors/python.d.plugin/python_modules/lm_sensors.py
7 - web/css/**
8 - web/lib/**
9 - web/old/**
10 - - node.d/node_modules/lib/**
11 - - node.d/node_modules/asn1-ber.js
12 - - node.d/node_modules/net-snmp.js
13 - - node.d/node_modules/pixl-xml.js
14 - - node.d/node_modules/extend.js
10 + - collectors/node.d.plugin/node_modules/lib/**
11 + - collectors/node.d.plugin/node_modules/asn1-ber.js
12 + - collectors/node.d.plugin/node_modules/net-snmp.js
13 + - collectors/node.d.plugin/node_modules/pixl-xml.js
14 + - collectors/node.d.plugin/node_modules/extend.js
15 - tests/**
.codeclimate.yml
+8 -9
@@ -81,7 +81,6 @@ plugins:
81 enabled: false
82 exclude_patterns:
83 - ".gitignore"
84 - - "conf.d/"
84 - ".githooks/"
85 - "tests/"
86 - "m4/"
@@ -89,12 +88,12 @@ exclude_patterns:
88 - "web/lib/"
89 - "web/fonts/"
90 - "web/old/"
92 - - "python.d/python_modules/pyyaml2/"
93 - - "python.d/python_modules/pyyaml3/"
94 - - "python.d/python_modules/urllib3/"
95 - - "node.d/node_modules/lib/"
96 - - "node.d/node_modules/asn1-ber.js"
97 - - "node.d/node_modules/extend.js"
98 - - "node.d/node_modules/pixl-xml.js"
99 - - "node.d/node_modules/net-snmp.js"
91 + - "collectors/python.d.plugin/python_modules/pyyaml2/"
92 + - "collectors/python.d.plugin/python_modules/pyyaml3/"
93 + - "collectors/python.d.plugin/python_modules/urllib3/"
94 + - "collectors/node.d.plugin/node_modules/lib/"
95 + - "collectors/node.d.plugin/node_modules/asn1-ber.js"
96 + - "collectors/node.d.plugin/node_modules/extend.js"
97 + - "collectors/node.d.plugin/node_modules/pixl-xml.js"
98 + - "collectors/node.d.plugin/node_modules/net-snmp.js"
99
.gitignore
+21 -17
@@ -1,6 +1,8 @@
1 .deps
2 .libs
3 .dirstamp
4 +.project
5 +.pydevproject
6
7 *.o
8 *.a
@@ -62,15 +64,15 @@ netdata-coverity-analysis.tgz
64 .settings/
65 README
66 TODO.md
65 -conf.d/netdata.conf
66 -src/TODO.txt
67 +netdata.conf
68 +TODO.txt
69
68 -web/chart-info/
69 -web/control.html
70 -web/datasource.css
71 -web/gadget.xml
72 -web/index_new.html
73 -web/version.txt
70 +web/gui/chart-info/
71 +web/gui/control.html
72 +web/gui/datasource.css
73 +web/gui/gadget.xml
74 +web/gui/index_new.html
75 +web/gui/version.txt
76
77 # related to karma/javascript/node
78 /node_modules/
@@ -83,15 +85,15 @@ system/netdata.logrotate
85 system/netdata.service
86 system/netdata.plist
87 system/netdata-freebsd
88 +system/edit-config
89
87 -conf.d/edit-config
88 -plugins.d/alarm-notify.sh
89 -src/plugins/linux-cgroups.plugin/cgroup-name.sh
90 -plugins.d/charts.d.plugin
91 -plugins.d/fping.plugin
92 -plugins.d/node.d.plugin
93 -plugins.d/python.d.plugin
94 -plugins.d/tc-qos-helper.sh
90 +health/alarm-notify.sh
91 +collectors/cgroups.plugin/cgroup-name.sh
92 +collectors/tc.plugin/tc-qos-helper.sh
93 +collectors/charts.d.plugin/charts.d.plugin
94 +collectors/node.d.plugin/node.d.plugin
95 +collectors/python.d.plugin/python.d.plugin
96 +collectors/fping.plugin/fping.plugin
97
98 # installer generated files
99 netdata-uninstaller.sh
@@ -117,7 +119,9 @@ diagrams/*.atxt
119 diagrams/plantuml.jar
120
121 # cppcheck
120 -src/cppcheck-build/
122 +cppcheck-build/
123 +
124 +venv/
125
126 # debugging / profiling
127 makeself/debug/
.lgtm.yml
+9 -9
@@ -8,15 +8,15 @@
8 # https://lgtm.com/help/lgtm/lgtm.yml-configuration-file
9 path_classifiers:
10 library:
11 - - python.d/python_modules/third_party/
12 - - python.d/python_modules/urllib3/
13 - - python.d/python_modules/pyyaml2/
14 - - python.d/python_modules/pyyaml3/
15 - - node.d/node_modules/lib/
16 - - node.d/node_modules/asn1-ber.js
17 - - node.d/node_modules/extend.js
18 - - node.d/node_modules/net-snmp.js
19 - - node.d/node_modules/pixl-xml.js
11 + - collectors/python.d.plugin/python_modules/third_party/
12 + - collectors/python.d.plugin/python_modules/urllib3/
13 + - collectors/python.d.plugin/python_modules/pyyaml2/
14 + - collectors/python.d.plugin/python_modules/pyyaml3/
15 + - collectors/node.d.plugin/node_modules/lib/
16 + - collectors/node.d.plugin/node_modules/asn1-ber.js
17 + - collectors/node.d.plugin/node_modules/extend.js
18 + - collectors/node.d.plugin/node_modules/net-snmp.js
19 + - collectors/node.d.plugin/node_modules/pixl-xml.js
20 - web/lib/
21 - web/css/
22 test:
CMakeLists.txt
+181 -177
@@ -139,250 +139,254 @@ ENDIF(LINUX)
139 # netdata files
140
141 set(LIBNETDATA_FILES
142 - src/libnetdata/adaptive_resortable_list.c
143 - src/libnetdata/adaptive_resortable_list.h
144 - src/libnetdata/appconfig.c
145 - src/libnetdata/appconfig.h
146 - src/libnetdata/avl.c
147 - src/libnetdata/avl.h
148 - src/libnetdata/clocks.c
149 - src/libnetdata/clocks.h
150 - src/libnetdata/common.c
151 - src/libnetdata/dictionary.c
152 - src/libnetdata/dictionary.h
153 - src/libnetdata/eval.c
154 - src/libnetdata/eval.h
155 - src/libnetdata/inlined.h
156 - src/libnetdata/libnetdata.h
157 - src/libnetdata/locks.c
158 - src/libnetdata/locks.h
159 - src/libnetdata/log.c
160 - src/libnetdata/log.h
161 - src/libnetdata/os.c
162 - src/libnetdata/os.h
163 - src/libnetdata/popen.c
164 - src/libnetdata/popen.h
165 - src/libnetdata/procfile.c
166 - src/libnetdata/procfile.h
167 - src/libnetdata/simple_pattern.c
168 - src/libnetdata/simple_pattern.h
169 - src/libnetdata/socket.c
170 - src/libnetdata/socket.h
171 - src/libnetdata/statistical.c
172 - src/libnetdata/statistical.h
173 - src/libnetdata/storage_number.c
174 - src/libnetdata/storage_number.h
175 - src/libnetdata/threads.c
176 - src/libnetdata/threads.h
177 - src/libnetdata/web_buffer.c
178 - src/libnetdata/web_buffer.h
179 - src/libnetdata/url.c
180 - src/libnetdata/url.h
142 + libnetdata/adaptive_resortable_list/adaptive_resortable_list.c
143 + libnetdata/adaptive_resortable_list/adaptive_resortable_list.h
144 + libnetdata/config/appconfig.c
145 + libnetdata/config/appconfig.h
146 + libnetdata/avl/avl.c
147 + libnetdata/avl/avl.h
148 + libnetdata/buffer/buffer.c
149 + libnetdata/buffer/buffer.h
150 + libnetdata/clocks/clocks.c
151 + libnetdata/clocks/clocks.h
152 + libnetdata/dictionary/dictionary.c
153 + libnetdata/dictionary/dictionary.h
154 + libnetdata/eval/eval.c
155 + libnetdata/eval/eval.h
156 + libnetdata/inlined.h
157 + libnetdata/libnetdata.c
158 + libnetdata/libnetdata.h
159 + libnetdata/locks/locks.c
160 + libnetdata/locks/locks.h
161 + libnetdata/log/log.c
162 + libnetdata/log/log.h
163 + libnetdata/os.c
164 + libnetdata/os.h
165 + libnetdata/popen/popen.c
166 + libnetdata/popen/popen.h
167 + libnetdata/procfile/procfile.c
168 + libnetdata/procfile/procfile.h
169 + libnetdata/simple_pattern/simple_pattern.c
170 + libnetdata/simple_pattern/simple_pattern.h
171 + libnetdata/socket/socket.c
172 + libnetdata/socket/socket.h
173 + libnetdata/statistical/statistical.c
174 + libnetdata/statistical/statistical.h
175 + libnetdata/storage_number/storage_number.c
176 + libnetdata/storage_number/storage_number.h
177 + libnetdata/threads/threads.c
178 + libnetdata/threads/threads.h
179 + libnetdata/url/url.c
180 + libnetdata/url/url.h
181 )
182
183 add_library(libnetdata OBJECT ${LIBNETDATA_FILES})
184
185 set(APPS_PLUGIN_FILES
186 - src/plugins/apps.plugin/apps_plugin.c
186 + collectors/apps.plugin/apps_plugin.c
187 )
188
189 set(CHECKS_PLUGIN_FILES
190 - src/plugins/checks.plugin/plugin_checks.c
191 - src/plugins/checks.plugin/plugin_checks.h
190 + collectors/checks.plugin/plugin_checks.c
191 + collectors/checks.plugin/plugin_checks.h
192 )
193
194 set(FREEBSD_PLUGIN_FILES
195 - src/plugins/freebsd.plugin/plugin_freebsd.c
196 - src/plugins/freebsd.plugin/plugin_freebsd.h
197 - src/plugins/freebsd.plugin/freebsd_sysctl.c
198 - src/plugins/freebsd.plugin/freebsd_getmntinfo.c
199 - src/plugins/freebsd.plugin/freebsd_getifaddrs.c
200 - src/plugins/freebsd.plugin/freebsd_devstat.c
201 - src/plugins/freebsd.plugin/freebsd_kstat_zfs.c
202 - src/plugins/freebsd.plugin/freebsd_ipfw.c
203 - src/plugins/linux-proc.plugin/zfs_common.c
204 - src/plugins/linux-proc.plugin/zfs_common.h
195 + collectors/freebsd.plugin/plugin_freebsd.c
196 + collectors/freebsd.plugin/plugin_freebsd.h
197 + collectors/freebsd.plugin/freebsd_sysctl.c
198 + collectors/freebsd.plugin/freebsd_getmntinfo.c
199 + collectors/freebsd.plugin/freebsd_getifaddrs.c
200 + collectors/freebsd.plugin/freebsd_devstat.c
201 + collectors/freebsd.plugin/freebsd_kstat_zfs.c
202 + collectors/freebsd.plugin/freebsd_ipfw.c
203 + collectors/proc.plugin/zfs_common.c
204 + collectors/proc.plugin/zfs_common.h
205 )
206
207 set(HEALTH_PLUGIN_FILES
208 - src/health/health.c
209 - src/health/health.h
210 - src/health/health_config.c
211 - src/health/health_json.c
212 - src/health/health_log.c
208 + health/health.c
209 + health/health.h
210 + health/health_config.c
211 + health/health_json.c
212 + health/health_log.c
213 )
214
215 set(IDLEJITTER_PLUGIN_FILES
216 - src/plugins/idlejitter.plugin/plugin_idlejitter.c
217 - src/plugins/idlejitter.plugin/plugin_idlejitter.h
216 + collectors/idlejitter.plugin/plugin_idlejitter.c
217 + collectors/idlejitter.plugin/plugin_idlejitter.h
218 )
219
220 set(CGROUPS_PLUGIN_FILES
221 - src/plugins/linux-cgroups.plugin/sys_fs_cgroup.c
222 - src/plugins/linux-cgroups.plugin/sys_fs_cgroup.h
221 + collectors/cgroups.plugin/sys_fs_cgroup.c
222 + collectors/cgroups.plugin/sys_fs_cgroup.h
223 )
224
225 set(CGROUP_NETWORK_FILES
226 - src/plugins/linux-cgroups.plugin/cgroup-network.c
226 + collectors/cgroups.plugin/cgroup-network.c
227 )
228
229 set(DISKSPACE_PLUGIN_FILES
230 - src/plugins/linux-diskspace.plugin/plugin_diskspace.h
231 - src/plugins/linux-diskspace.plugin/plugin_diskspace.c
230 + collectors/diskspace.plugin/plugin_diskspace.h
231 + collectors/diskspace.plugin/plugin_diskspace.c
232 )
233
234 set(FREEIPMI_PLUGIN_FILES
235 - src/plugins/linux-freeipmi.plugin/freeipmi_plugin.c
235 + collectors/freeipmi.plugin/freeipmi_plugin.c
236 )
237
238 set(NFACCT_PLUGIN_FILES
239 - src/plugins/linux-nfacct.plugin/plugin_nfacct.c
240 - src/plugins/linux-nfacct.plugin/plugin_nfacct.h
239 + collectors/nfacct.plugin/plugin_nfacct.c
240 + collectors/nfacct.plugin/plugin_nfacct.h
241 )
242
243 set(PROC_PLUGIN_FILES
244 - src/plugins/linux-proc.plugin/ipc.c
245 - src/plugins/linux-proc.plugin/plugin_proc.c
246 - src/plugins/linux-proc.plugin/plugin_proc.h
247 - src/plugins/linux-proc.plugin/proc_diskstats.c
248 - src/plugins/linux-proc.plugin/proc_interrupts.c
249 - src/plugins/linux-proc.plugin/proc_softirqs.c
250 - src/plugins/linux-proc.plugin/proc_loadavg.c
251 - src/plugins/linux-proc.plugin/proc_meminfo.c
252 - src/plugins/linux-proc.plugin/proc_net_dev.c
253 - src/plugins/linux-proc.plugin/proc_net_ip_vs_stats.c
254 - src/plugins/linux-proc.plugin/proc_net_netstat.c
255 - src/plugins/linux-proc.plugin/proc_net_rpc_nfs.c
256 - src/plugins/linux-proc.plugin/proc_net_rpc_nfsd.c
257 - src/plugins/linux-proc.plugin/proc_net_snmp.c
258 - src/plugins/linux-proc.plugin/proc_net_snmp6.c
259 - src/plugins/linux-proc.plugin/proc_net_sctp_snmp.c
260 - src/plugins/linux-proc.plugin/proc_net_sockstat.c
261 - src/plugins/linux-proc.plugin/proc_net_sockstat6.c
262 - src/plugins/linux-proc.plugin/proc_net_softnet_stat.c
263 - src/plugins/linux-proc.plugin/proc_net_stat_conntrack.c
264 - src/plugins/linux-proc.plugin/proc_net_stat_synproxy.c
265 - src/plugins/linux-proc.plugin/proc_self_mountinfo.c
266 - src/plugins/linux-proc.plugin/proc_self_mountinfo.h
267 - src/plugins/linux-proc.plugin/zfs_common.c
268 - src/plugins/linux-proc.plugin/zfs_common.h
269 - src/plugins/linux-proc.plugin/proc_spl_kstat_zfs.c
270 - src/plugins/linux-proc.plugin/proc_stat.c
271 - src/plugins/linux-proc.plugin/proc_sys_kernel_random_entropy_avail.c
272 - src/plugins/linux-proc.plugin/proc_vmstat.c
273 - src/plugins/linux-proc.plugin/proc_uptime.c
274 - src/plugins/linux-proc.plugin/sys_kernel_mm_ksm.c
275 - src/plugins/linux-proc.plugin/sys_devices_system_edac_mc.c
276 - src/plugins/linux-proc.plugin/sys_devices_system_node.c
277 - src/plugins/linux-proc.plugin/sys_fs_btrfs.c
244 + collectors/proc.plugin/ipc.c
245 + collectors/proc.plugin/plugin_proc.c
246 + collectors/proc.plugin/plugin_proc.h
247 + collectors/proc.plugin/proc_diskstats.c
248 + collectors/proc.plugin/proc_interrupts.c
249 + collectors/proc.plugin/proc_softirqs.c
250 + collectors/proc.plugin/proc_loadavg.c
251 + collectors/proc.plugin/proc_meminfo.c
252 + collectors/proc.plugin/proc_net_dev.c
253 + collectors/proc.plugin/proc_net_ip_vs_stats.c
254 + collectors/proc.plugin/proc_net_netstat.c
255 + collectors/proc.plugin/proc_net_rpc_nfs.c
256 + collectors/proc.plugin/proc_net_rpc_nfsd.c
257 + collectors/proc.plugin/proc_net_snmp.c
258 + collectors/proc.plugin/proc_net_snmp6.c
259 + collectors/proc.plugin/proc_net_sctp_snmp.c
260 + collectors/proc.plugin/proc_net_sockstat.c
261 + collectors/proc.plugin/proc_net_sockstat6.c
262 + collectors/proc.plugin/proc_net_softnet_stat.c
263 + collectors/proc.plugin/proc_net_stat_conntrack.c
264 + collectors/proc.plugin/proc_net_stat_synproxy.c
265 + collectors/proc.plugin/proc_self_mountinfo.c
266 + collectors/proc.plugin/proc_self_mountinfo.h
267 + collectors/proc.plugin/zfs_common.c
268 + collectors/proc.plugin/zfs_common.h
269 + collectors/proc.plugin/proc_spl_kstat_zfs.c
270 + collectors/proc.plugin/proc_stat.c
271 + collectors/proc.plugin/proc_sys_kernel_random_entropy_avail.c
272 + collectors/proc.plugin/proc_vmstat.c
273 + collectors/proc.plugin/proc_uptime.c
274 + collectors/proc.plugin/sys_kernel_mm_ksm.c
275 + collectors/proc.plugin/sys_devices_system_edac_mc.c
276 + collectors/proc.plugin/sys_devices_system_node.c
277 + collectors/proc.plugin/sys_fs_btrfs.c
278 )
279
280 set(TC_PLUGIN_FILES
281 - src/plugins/linux-tc.plugin/plugin_tc.c
282 - src/plugins/linux-tc.plugin/plugin_tc.h
281 + collectors/tc.plugin/plugin_tc.c
282 + collectors/tc.plugin/plugin_tc.h
283 )
284
285 set(MACOS_PLUGIN_FILES
286 - src/plugins/macos.plugin/plugin_macos.c
287 - src/plugins/macos.plugin/plugin_macos.h
288 - src/plugins/macos.plugin/macos_sysctl.c
289 - src/plugins/macos.plugin/macos_mach_smi.c
290 - src/plugins/macos.plugin/macos_fw.c
286 + collectors/macos.plugin/plugin_macos.c
287 + collectors/macos.plugin/plugin_macos.h
288 + collectors/macos.plugin/macos_sysctl.c
289 + collectors/macos.plugin/macos_mach_smi.c
290 + collectors/macos.plugin/macos_fw.c
291 )
292
293 set(PLUGINSD_PLUGIN_FILES
294 - src/plugins/plugins.d.plugin/plugins_d.c
295 - src/plugins/plugins.d.plugin/plugins_d.h
294 + collectors/plugins.d/plugins_d.c
295 + collectors/plugins.d/plugins_d.h
296 )
297
298 set(REGISTRY_PLUGIN_FILES
299 - src/registry/registry.c
300 - src/registry/registry.h
301 - src/registry/registry_db.c
302 - src/registry/registry_init.c
303 - src/registry/registry_internals.c
304 - src/registry/registry_internals.h
305 - src/registry/registry_log.c
306 - src/registry/registry_machine.c
307 - src/registry/registry_machine.h
308 - src/registry/registry_person.c
309 - src/registry/registry_person.h
310 - src/registry/registry_url.c
311 - src/registry/registry_url.h
299 + registry/registry.c
300 + registry/registry.h
301 + registry/registry_db.c
302 + registry/registry_init.c
303 + registry/registry_internals.c
304 + registry/registry_internals.h
305 + registry/registry_log.c
306 + registry/registry_machine.c
307 + registry/registry_machine.h
308 + registry/registry_person.c
309 + registry/registry_person.h
310 + registry/registry_url.c
311 + registry/registry_url.h
312 )
313
314 set(STATSD_PLUGIN_FILES
315 - src/plugins/statsd.plugin/statsd.c
316 - src/plugins/statsd.plugin/statsd.h
315 + collectors/statsd.plugin/statsd.c
316 + collectors/statsd.plugin/statsd.h
317 )
318
319 set(RRD_PLUGIN_FILES
320 - src/database/rrdcalc.c
321 - src/database/rrdcalc.h
322 - src/database/rrdcalctemplate.c
323 - src/database/rrdcalctemplate.h
324 - src/database/rrddim.c
325 - src/database/rrddimvar.c
326 - src/database/rrddimvar.h
327 - src/database/rrdfamily.c
328 - src/database/rrdhost.c
329 - src/database/rrd.c
330 - src/database/rrd.h
331 - src/database/rrdset.c
332 - src/database/rrdsetvar.c
333 - src/database/rrdsetvar.h
334 - src/database/rrdvar.c
335 - src/database/rrdvar.h
320 + database/rrdcalc.c
321 + database/rrdcalc.h
322 + database/rrdcalctemplate.c
323 + database/rrdcalctemplate.h
324 + database/rrddim.c
325 + database/rrddimvar.c
326 + database/rrddimvar.h
327 + database/rrdfamily.c
328 + database/rrdhost.c
329 + database/rrd.c
330 + database/rrd.h
331 + database/rrdset.c
332 + database/rrdsetvar.c
333 + database/rrdsetvar.h
334 + database/rrdvar.c
335 + database/rrdvar.h
336 )
337
338 set(WEB_PLUGIN_FILES
339 - src/webserver/web_client.c
340 - src/webserver/web_client.h
341 - src/webserver/web_server.c
342 - src/webserver/web_server.h
343 - )
339 + web/server/web_client.c
340 + web/server/web_client.h
341 + web/server/web_server.c
342 + web/server/web_server.h
343 + web/server/single/single-threaded.c web/server/single/single-threaded.h web/server/multi/multi-threaded.c web/server/multi/multi-threaded.h web/server/static/static-threaded.c web/server/static/static-threaded.h web/server/web_client_cache.c web/server/web_client_cache.h)
344
345 set(API_PLUGIN_FILES
346 - src/api/rrd2json.c
347 - src/api/rrd2json.h
348 - src/api/web_api_v1.c
349 - src/api/web_api_v1.h
350 - src/api/web_buffer_svg.c
351 - src/api/web_buffer_svg.h
346 + web/api/rrd2json.c
347 + web/api/rrd2json.h
348 + web/api/web_api_v1.c
349 + web/api/web_api_v1.h
350 + web/api/web_buffer_svg.c
351 + web/api/web_buffer_svg.h
352 )
353
354 set(STREAMING_PLUGIN_FILES
355 - src/streaming/rrdpush.c
356 - src/streaming/rrdpush.h
355 + streaming/rrdpush.c
356 + streaming/rrdpush.h
357 )
358
359 set(BACKENDS_PLUGIN_FILES
360 - src/backends/backends.c
361 - src/backends/backends.h
362 - src/backends/graphite/graphite.c
363 - src/backends/graphite/graphite.h
364 - src/backends/json/json.c
365 - src/backends/json/json.h
366 - src/backends/opentsdb/opentsdb.c
367 - src/backends/opentsdb/opentsdb.h
368 - src/backends/prometheus/backend_prometheus.c
369 - src/backends/prometheus/backend_prometheus.h
360 + backends/backends.c
361 + backends/backends.h
362 + backends/graphite/graphite.c
363 + backends/graphite/graphite.h
364 + backends/json/json.c
365 + backends/json/json.h
366 + backends/opentsdb/opentsdb.c
367 + backends/opentsdb/opentsdb.h
368 + backends/prometheus/backend_prometheus.c
369 + backends/prometheus/backend_prometheus.h
370 + )
371 +
372 +set(DAEMON_FILES
373 + daemon/common.c
374 + daemon/common.h
375 + daemon/daemon.c
376 + daemon/daemon.h
377 + daemon/global_statistics.c
378 + daemon/global_statistics.h
379 + daemon/main.c
380 + daemon/main.h
381 + daemon/signals.c
382 + daemon/signals.h
383 + daemon/unit_test.c
384 + daemon/unit_test.h
385 )
386
387 set(NETDATA_FILES
373 - src/plugins/all.h
374 - src/common.c
375 - src/common.h
376 - src/daemon.c
377 - src/daemon.h
378 - src/global_statistics.c
379 - src/global_statistics.h
380 - src/main.c
381 - src/main.h
382 - src/signals.c
383 - src/signals.h
384 - src/unit_test.c
385 - src/unit_test.h
388 + collectors/all.h
389 + ${DAEMON_FILES}
390 ${API_PLUGIN_FILES}
391 ${BACKENDS_PLUGIN_FILES}
392 ${CHECKS_PLUGIN_FILES}
Makefile.am
+368 -11
@@ -1,8 +1,6 @@
1 -#
2 -# Copyright (C) 2015 Alon Bar-Lev <alon.barlev@gmail.com>
1 # SPDX-License-Identifier: GPL-3.0-or-later
4 -#
5 -AUTOMAKE_OPTIONS=foreign 1.10
2 +
3 +AUTOMAKE_OPTIONS=foreign subdir-objects 1.10
4 ACLOCAL_AMFLAGS = -I build/m4
5
6 MAINTAINERCLEANFILES= \
@@ -47,16 +45,9 @@ EXTRA_DIST = \
45 $(NULL)
46
47 SUBDIRS = \
50 - charts.d \
51 - conf.d \
48 diagrams \
49 makeself \
54 - node.d \
55 - plugins.d \
56 - python.d \
57 - src \
50 system \
59 - web \
51 contrib \
52 tests \
53 $(NULL)
@@ -79,3 +70,369 @@ dist_noinst_SCRIPTS= \
70 netdata-installer.sh \
71 installer/functions.sh \
72 $(NULL)
73 +
74 +# -----------------------------------------------------------------------------
75 +# Compile netdata binaries
76 +
77 +SUBDIRS += \
78 + backends \
79 + collectors \
80 + database \
81 + health \
82 + libnetdata \
83 + registry \
84 + streaming \
85 + web \
86 + $(NULL)
87 +
88 +
89 +AM_CFLAGS = \
90 + $(OPTIONAL_MATH_CFLAGS) \
91 + $(OPTIONAL_NFACCT_CLFAGS) \
92 + $(OPTIONAL_ZLIB_CFLAGS) \
93 + $(OPTIONAL_UUID_CFLAGS) \
94 + $(OPTIONAL_LIBCAP_LIBS) \
95 + $(OPTIONAL_IPMIMONITORING_CFLAGS) \
96 + $(NULL)
97 +
98 +sbin_PROGRAMS =
99 +dist_cache_DATA = installer/.keep
100 +dist_varlib_DATA = installer/.keep
101 +dist_registry_DATA = installer/.keep
102 +dist_log_DATA = installer/.keep
103 +plugins_PROGRAMS =
104 +
105 +LIBNETDATA_FILES = \
106 + libnetdata/adaptive_resortable_list/adaptive_resortable_list.c \
107 + libnetdata/adaptive_resortable_list/adaptive_resortable_list.h \
108 + libnetdata/config/appconfig.c \
109 + libnetdata/config/appconfig.h \
110 + libnetdata/avl/avl.c \
111 + libnetdata/avl/avl.h \
112 + libnetdata/buffer/buffer.c \
113 + libnetdata/buffer/buffer.h \
114 + libnetdata/clocks/clocks.c \
115 + libnetdata/clocks/clocks.h \
116 + libnetdata/dictionary/dictionary.c \
117 + libnetdata/dictionary/dictionary.h \
118 + libnetdata/eval/eval.c \
119 + libnetdata/eval/eval.h \
120 + libnetdata/inlined.h \
121 + libnetdata/libnetdata.c \
122 + libnetdata/libnetdata.h \
123 + libnetdata/locks/locks.c \
124 + libnetdata/locks/locks.h \
125 + libnetdata/log/log.c \
126 + libnetdata/log/log.h \
127 + libnetdata/popen/popen.c \
128 + libnetdata/popen/popen.h \
129 + libnetdata/procfile/procfile.c \
130 + libnetdata/procfile/procfile.h \
131 + libnetdata/os.c \
132 + libnetdata/os.h \
133 + libnetdata/simple_pattern/simple_pattern.c \
134 + libnetdata/simple_pattern/simple_pattern.h \
135 + libnetdata/socket/socket.c \
136 + libnetdata/socket/socket.h \
137 + libnetdata/statistical/statistical.c \
138 + libnetdata/statistical/statistical.h \
139 + libnetdata/storage_number/storage_number.c \
140 + libnetdata/storage_number/storage_number.h \
141 + libnetdata/threads/threads.c \
142 + libnetdata/threads/threads.h \
143 + libnetdata/url/url.c \
144 + libnetdata/url/url.h \
145 + $(NULL)
146 +
147 +APPS_PLUGIN_FILES = \
148 + collectors/apps.plugin/apps_plugin.c \
149 + $(LIBNETDATA_FILES) \
150 + $(NULL)
151 +
152 +CHECKS_PLUGIN_FILES = \
153 + collectors/checks.plugin/plugin_checks.c \
154 + collectors/checks.plugin/plugin_checks.h \
155 + $(NULL)
156 +
157 +FREEBSD_PLUGIN_FILES = \
158 + collectors/freebsd.plugin/plugin_freebsd.c \
159 + collectors/freebsd.plugin/plugin_freebsd.h \
160 + collectors/freebsd.plugin/freebsd_sysctl.c \
161 + collectors/freebsd.plugin/freebsd_getmntinfo.c \
162 + collectors/freebsd.plugin/freebsd_getifaddrs.c \
163 + collectors/freebsd.plugin/freebsd_devstat.c \
164 + collectors/freebsd.plugin/freebsd_kstat_zfs.c \
165 + collectors/freebsd.plugin/freebsd_ipfw.c \
166 + collectors/proc.plugin/zfs_common.c \
167 + collectors/proc.plugin/zfs_common.h \
168 + $(NULL)
169 +
170 +HEALTH_PLUGIN_FILES = \
171 + health/health.c \
172 + health/health.h \
173 + health/health_config.c \
174 + health/health_json.c \
175 + health/health_log.c \
176 + $(NULL)
177 +
178 +IDLEJITTER_PLUGIN_FILES = \
179 + collectors/idlejitter.plugin/plugin_idlejitter.c \
180 + collectors/idlejitter.plugin/plugin_idlejitter.h \
181 + $(NULL)
182 +
183 +CGROUPS_PLUGIN_FILES = \
184 + collectors/cgroups.plugin/sys_fs_cgroup.c \
185 + collectors/cgroups.plugin/sys_fs_cgroup.h \
186 + $(NULL)
187 +
188 +CGROUP_NETWORK_FILES = \
189 + collectors/cgroups.plugin/cgroup-network.c \
190 + $(LIBNETDATA_FILES) \
191 + $(NULL)
192 +
193 +DISKSPACE_PLUGIN_FILES = \
194 + collectors/diskspace.plugin/plugin_diskspace.h \
195 + collectors/diskspace.plugin/plugin_diskspace.c \
196 + $(NULL)
197 +
198 +FREEIPMI_PLUGIN_FILES = \
199 + collectors/freeipmi.plugin/freeipmi_plugin.c \
200 + $(LIBNETDATA_FILES) \
201 + $(NULL)
202 +
203 +NFACCT_PLUGIN_FILES = \
204 + collectors/nfacct.plugin/plugin_nfacct.c \
205 + collectors/nfacct.plugin/plugin_nfacct.h \
206 + $(NULL)
207 +
208 +PROC_PLUGIN_FILES = \
209 + collectors/proc.plugin/ipc.c \
210 + collectors/proc.plugin/plugin_proc.c \
211 + collectors/proc.plugin/plugin_proc.h \
212 + collectors/proc.plugin/proc_diskstats.c \
213 + collectors/proc.plugin/proc_interrupts.c \
214 + collectors/proc.plugin/proc_softirqs.c \
215 + collectors/proc.plugin/proc_loadavg.c \
216 + collectors/proc.plugin/proc_meminfo.c \
217 + collectors/proc.plugin/proc_net_dev.c \
218 + collectors/proc.plugin/proc_net_ip_vs_stats.c \
219 + collectors/proc.plugin/proc_net_netstat.c \
220 + collectors/proc.plugin/proc_net_rpc_nfs.c \
221 + collectors/proc.plugin/proc_net_rpc_nfsd.c \
222 + collectors/proc.plugin/proc_net_snmp.c \
223 + collectors/proc.plugin/proc_net_snmp6.c \
224 + collectors/proc.plugin/proc_net_sctp_snmp.c \
225 + collectors/proc.plugin/proc_net_sockstat.c \
226 + collectors/proc.plugin/proc_net_sockstat6.c \
227 + collectors/proc.plugin/proc_net_softnet_stat.c \
228 + collectors/proc.plugin/proc_net_stat_conntrack.c \
229 + collectors/proc.plugin/proc_net_stat_synproxy.c \
230 + collectors/proc.plugin/proc_self_mountinfo.c \
231 + collectors/proc.plugin/proc_self_mountinfo.h \
232 + collectors/proc.plugin/zfs_common.c \
233 + collectors/proc.plugin/zfs_common.h \
234 + collectors/proc.plugin/proc_spl_kstat_zfs.c \
235 + collectors/proc.plugin/proc_stat.c \
236 + collectors/proc.plugin/proc_sys_kernel_random_entropy_avail.c \
237 + collectors/proc.plugin/proc_vmstat.c \
238 + collectors/proc.plugin/proc_uptime.c \
239 + collectors/proc.plugin/sys_kernel_mm_ksm.c \
240 + collectors/proc.plugin/sys_devices_system_edac_mc.c \
241 + collectors/proc.plugin/sys_devices_system_node.c \
242 + collectors/proc.plugin/sys_fs_btrfs.c \
243 + $(NULL)
244 +
245 +TC_PLUGIN_FILES = \
246 + collectors/tc.plugin/plugin_tc.c \
247 + collectors/tc.plugin/plugin_tc.h \
248 + $(NULL)
249 +
250 +MACOS_PLUGIN_FILES = \
251 + collectors/macos.plugin/plugin_macos.c \
252 + collectors/macos.plugin/plugin_macos.h \
253 + collectors/macos.plugin/macos_sysctl.c \
254 + collectors/macos.plugin/macos_mach_smi.c \
255 + collectors/macos.plugin/macos_fw.c \
256 + $(NULL)
257 +
258 +PLUGINSD_PLUGIN_FILES = \
259 + collectors/plugins.d/plugins_d.c \
260 + collectors/plugins.d/plugins_d.h \
261 + $(NULL)
262 +
263 +RRD_PLUGIN_FILES = \
264 + database/rrdcalc.c \
265 + database/rrdcalc.h \
266 + database/rrdcalctemplate.c \
267 + database/rrdcalctemplate.h \
268 + database/rrddim.c \
269 + database/rrddimvar.c \
270 + database/rrddimvar.h \
271 + database/rrdfamily.c \
272 + database/rrdhost.c \
273 + database/rrd.c \
274 + database/rrd.h \
275 + database/rrdset.c \
276 + database/rrdsetvar.c \
277 + database/rrdsetvar.h \
278 + database/rrdvar.c \
279 + database/rrdvar.h \
280 + $(NULL)
281 +
282 +API_PLUGIN_FILES = \
283 + web/api/rrd2json.c \
284 + web/api/rrd2json.h \
285 + web/api/web_api_v1.c \
286 + web/api/web_api_v1.h \
287 + web/api/web_buffer_svg.c \
288 + web/api/web_buffer_svg.h \
289 + $(NULL)
290 +
291 +STREAMING_PLUGIN_FILES = \
292 + streaming/rrdpush.c \
293 + streaming/rrdpush.h \
294 + $(NULL)
295 +
296 +REGISTRY_PLUGIN_FILES = \
297 + registry/registry.c \
298 + registry/registry.h \
299 + registry/registry_db.c \
300 + registry/registry_init.c \
301 + registry/registry_internals.c \
302 + registry/registry_internals.h \
303 + registry/registry_log.c \
304 + registry/registry_machine.c \
305 + registry/registry_machine.h \
306 + registry/registry_person.c \
307 + registry/registry_person.h \
308 + registry/registry_url.c \
309 + registry/registry_url.h \
310 + $(NULL)
311 +
312 +STATSD_PLUGIN_FILES = \
313 + collectors/statsd.plugin/statsd.c \
314 + collectors/statsd.plugin/statsd.h \
315 + $(NULL)
316 +
317 +WEB_PLUGIN_FILES = \
318 + web/server/web_client.c \
319 + web/server/web_client.h \
320 + web/server/web_server.c \
321 + web/server/web_server.h \
322 + web/server/web_client_cache.c \
323 + web/server/web_client_cache.h \
324 + web/server/single/single-threaded.c \
325 + web/server/single/single-threaded.h \
326 + web/server/multi/multi-threaded.c \
327 + web/server/multi/multi-threaded.h \
328 + web/server/static/static-threaded.c \
329 + web/server/static/static-threaded.h \
330 + $(NULL)
331 +
332 +BACKENDS_PLUGIN_FILES = \
333 + backends/backends.c \
334 + backends/backends.h \
335 + backends/graphite/graphite.c \
336 + backends/graphite/graphite.h \
337 + backends/json/json.c \
338 + backends/json/json.h \
339 + backends/opentsdb/opentsdb.c \
340 + backends/opentsdb/opentsdb.h \
341 + backends/prometheus/backend_prometheus.c \
342 + backends/prometheus/backend_prometheus.h \
343 + $(NULL)
344 +
345 +DAEMON_FILES = \
346 + daemon/common.c \
347 + daemon/common.h \
348 + daemon/daemon.c \
349 + daemon/daemon.h \
350 + daemon/global_statistics.c \
351 + daemon/global_statistics.h \
352 + daemon/main.c \
353 + daemon/main.h \
354 + daemon/signals.c \
355 + daemon/signals.h \
356 + daemon/unit_test.c \
357 + daemon/unit_test.h \
358 + $(NULL)
359 +
360 +NETDATA_FILES = \
361 + collectors/all.h \
362 + $(DAEMON_FILES) \
363 + $(LIBNETDATA_FILES) \
364 + $(API_PLUGIN_FILES) \
365 + $(BACKENDS_PLUGIN_FILES) \
366 + $(CHECKS_PLUGIN_FILES) \
367 + $(HEALTH_PLUGIN_FILES) \
368 + $(IDLEJITTER_PLUGIN_FILES) \
369 + $(PLUGINSD_PLUGIN_FILES) \
370 + $(REGISTRY_PLUGIN_FILES) \
371 + $(RRD_PLUGIN_FILES) \
372 + $(STREAMING_PLUGIN_FILES) \
373 + $(STATSD_PLUGIN_FILES) \
374 + $(WEB_PLUGIN_FILES) \
375 + $(NULL)
376 +
377 +if FREEBSD
378 + NETDATA_FILES += \
379 + $(FREEBSD_PLUGIN_FILES) \
380 + $(NULL)
381 +endif
382 +
383 +if MACOS
384 + NETDATA_FILES += \
385 + $(MACOS_PLUGIN_FILES) \
386 + $(NULL)
387 +endif
388 +
389 +if LINUX
390 + NETDATA_FILES += \
391 + $(CGROUPS_PLUGIN_FILES) \
392 + $(DISKSPACE_PLUGIN_FILES) \
393 + $(NFACCT_PLUGIN_FILES) \
394 + $(PROC_PLUGIN_FILES) \
395 + $(TC_PLUGIN_FILES) \
396 + $(NULL)
397 +
398 +endif
399 +
400 +NETDATA_COMMON_LIBS = \
401 + $(OPTIONAL_MATH_LIBS) \
402 + $(OPTIONAL_ZLIB_LIBS) \
403 + $(OPTIONAL_UUID_LIBS) \
404 + $(NULL)
405 +
406 +
407 +sbin_PROGRAMS += netdata
408 +netdata_SOURCES = ../config.h $(NETDATA_FILES)
409 +netdata_LDADD = \
410 + $(NETDATA_COMMON_LIBS) \
411 + $(OPTIONAL_NFACCT_LIBS) \
412 + $(NULL)
413 +
414 +if ENABLE_PLUGIN_APPS
415 + plugins_PROGRAMS += apps.plugin
416 + apps_plugin_SOURCES = ../config.h $(APPS_PLUGIN_FILES)
417 + apps_plugin_LDADD = \
418 + $(NETDATA_COMMON_LIBS) \
419 + $(OPTIONAL_LIBCAP_LIBS) \
420 + $(NULL)
421 +endif
422 +
423 +if ENABLE_PLUGIN_CGROUP_NETWORK
424 + plugins_PROGRAMS += cgroup-network
425 + cgroup_network_SOURCES = ../config.h $(CGROUP_NETWORK_FILES)
426 + cgroup_network_LDADD = \
427 + $(NETDATA_COMMON_LIBS) \
428 + $(NULL)
429 +endif
430 +
431 +if ENABLE_PLUGIN_FREEIPMI
432 + plugins_PROGRAMS += freeipmi.plugin
433 + freeipmi_plugin_SOURCES = ../config.h $(FREEIPMI_PLUGIN_FILES)
434 + freeipmi_plugin_LDADD = \
435 + $(NETDATA_COMMON_LIBS) \
436 + $(OPTIONAL_IPMIMONITORING_LIBS) \
437 + $(NULL)
438 +endif
backends/Makefile.am renamed
+9 -1
@@ -1,7 +1,7 @@
1 # SPDX-License-Identifier: GPL-3.0-or-later
2
3 AUTOMAKE_OPTIONS = subdir-objects
4 -MAINTAINERCLEANFILES = Makefile.in
4 +MAINTAINERCLEANFILES = $(srcdir)/Makefile.in
5
6 SUBDIRS = \
7 graphite \
@@ -9,3 +9,11 @@ SUBDIRS = \
9 opentsdb \
10 prometheus \
11 $(NULL)
12 +
13 +dist_noinst_DATA = \
14 + README.md \
15 + $(NULL)
16 +
17 +dist_noinst_SCRIPTS = \
18 + nc-backend.sh \
19 + $(NULL)
backends/README.md new
+137
@@ -0,0 +1,137 @@
1 +
2 +netdata supports backends for archiving the metrics, or providing long term dashboards, using grafana or other tools, like this:
3 +
4 +![image](https://cloud.githubusercontent.com/assets/2662304/20649711/29f182ba-b4ce-11e6-97c8-ab2c0ab59833.png)
5 +
6 +Since netdata collects thousands of metrics per server per second, which would easily congest any backend server when several netdata servers are sending data to it, netdata allows sending metrics at a lower frequency. So, although netdata collects metrics every second, it can send to the backend servers averages or sums every X seconds (though, it can send them per second if you need it to).
7 +
8 +## features
9 +
10 +1. Supported backends
11 +
12 + 1. **graphite** (`plaintext interface`, used by **Graphite**, **InfluxDB**, **KairosDB**, **Blueflood**, **ElasticSearch** via logstash tcp input and the graphite codec, etc)
13 +
14 + metrics are sent to the backend server as `prefix.hostname.chart.dimension`. `prefix` is configured below, `hostname` is the hostname of the machine (can also be configured).
15 +
16 + 2. **opentsdb** (`telnet interface`, used by **OpenTSDB**, **InfluxDB**, **KairosDB**, etc)
17 +
18 + metrics are sent to opentsdb as `prefix.chart.dimension` with tag `host=hostname`.
19 +
20 + 3. **json** document DBs
21 +
22 + metrics are sent to a document db, `JSON` formatted.
23 +
24 + 4. **prometheus** is described at [prometheus page](prometheus/) since it pulls data from netdata.
25 +
26 +2. Only one backend may be active at a time.
27 +
28 +3. All metrics are transferred to the backend - netdata does not implement any metric filtering.
29 +
30 +4. Three modes of operation (for all backends):
31 +
32 + 1. `as collected`: the latest collected value is sent to the backend. This means that if netdata is configured to send data to the backend every 10 seconds, only 1 out of 10 values will appear at the backend server. The values are sent exactly as collected, before any multipliers or dividers applied and before any interpolation. This mode emulates other data collectors, such as `collectd`.
33 +
34 + 2. `average`: the average of the interpolated values shown on the netdata graphs is sent to the backend. So, if netdata is configured to send data to the backend server every 10 seconds, the average of the 10 values shown on the netdata charts will be used. **If you can't decide which mode to use, use `average`.**
35 +
36 + 3. `sum` or `volume`: the sum of the interpolated values shown on the netdata graphs is sent to the backend. So, if netdata is configured to send data to the backend every 10 seconds, the sum of the 10 values shown on the netdata charts will be used.
37 +
38 +5. This code is smart enough, not to slow down netdata, independently of the speed of the backend server.
39 +
40 +## configuration
41 +
42 +In `/etc/netdata/netdata.conf` you should have something like this (if not download the latest version of `netdata.conf` from your netdata):
43 +
44 +```
45 +[backend]
46 + enabled = yes | no
47 + type = graphite | opentsdb | json
48 + host tags = list of TAG=VALUE
49 + destination = space separated list of [PROTOCOL:]HOST[:PORT] - the first working will be used
50 + data source = average | sum | as collected
51 + prefix = netdata
52 + hostname = my-name
53 + update every = 10
54 + buffer on failures = 10
55 + timeout ms = 20000
56 + send charts matching = *
57 + send hosts matching = localhost *
58 + send names instead of ids = yes
59 +```
60 +
61 +- `enabled = yes | no`, enables or disables sending data to a backend
62 +
63 +- `type = graphite | opentsdb | json`, selects the backend type
64 +
65 +- `destination = host1 host2 host3 ...`, accepts **a space separated list** of hostnames, IPs (IPv4 and IPv6) and ports to connect to. Netdata will use the **first available** to send the metrics.
66 +
67 + The format of each item in this list, is: `[PROTOCOL:]IP[:PORT]`.
68 +
69 + `PROTOCOL` can be `udp` or `tcp`. `tcp` is the default and only supported by the current backends.
70 +
71 + `IP` can be `XX.XX.XX.XX` (IPv4), or `[XX:XX...XX:XX]` (IPv6). For IPv6 you can to enclose the IP in `[]` to separate it from the port.
72 +
73 + `PORT` can be a number of a service name. If omitted, the default port for the backend will be used (graphite = 2003, opentsdb = 4242).
74 +
75 + Example IPv4:
76 +
77 +```
78 + destination = 10.11.14.2:4242 10.11.14.3:4242 10.11.14.4:4242
79 +```
80 +
81 + Example IPv6 and IPv4 together:
82 +
83 +```
84 + destination = [ffff:...:0001]:2003 10.11.12.1:2003
85 +```
86 +
87 + When multiple servers are defined, netdata will try the next one when the first one fails. This allows you to load-balance different servers: give your backend servers in different order on each netdata.
88 +
89 + netdata also ships [`nc-backend.sh`](https://github.com/netdata/netdata/blob/master/contrib/nc-backend.sh), a script that can be used as a fallback backend to save the metrics to disk and push them to the time-series database when it becomes available again. It can also be used to monitor / trace / debug the metrics netdata generates.
90 +
91 +- `data source = as collected`, or `data source = average`, or `data source = sum`, selects the kind of data that will be sent to the backend.
92 +
93 +- `hostname = my-name`, is the hostname to be used for sending data to the backend server. By default this is `[global].hostname`.
94 +
95 +- `prefix = netdata`, is the prefix to add to all metrics.
96 +
97 +- `update every = 10`, is the number of seconds between sending data to the backend. netdata will add some randomness to this number, to prevent stressing the backend server when many netdata servers send data to the same backend. This randomness does not affect the quality of the data, only the time they are sent.
98 +
99 +- `buffer on failures = 10`, is the number of iterations (each iteration is `[backend].update every` seconds) to buffer data, when the backend is not available. If the backend fails to receive the data after that many failures, data loss on the backend is expected (netdata will also log it).
100 +
101 +- `timeout ms = 20000`, is the timeout in milliseconds to wait for the backend server to process the data. By default this is `2 * update_every * 1000`.
102 +
103 +- `send hosts matching = localhost *` includes one or more space separated patterns, using ` * ` as wildcard (any number of times within each pattern). The patterns are checked against the hostname (the localhost is always checked as `localhost`), allowing us to filter which hosts will be sent to the backend when this netdata is a central netdata aggregating multiple hosts. A pattern starting with ` ! ` gives a negative match. So to match all hosts named `*db*` except hosts containing `*slave*`, use `!*slave* *db*` (so, the order is important: the first pattern matching the hostname will be used - positive or negative).
104 +
105 +- `send charts matching = *` includes one or more space separated patterns, using ` * ` as wildcard (any number of times within each pattern). The patterns are checked against both chart id and chart name. A pattern starting with ` ! ` gives a negative match. So to match all charts named `apps.*` except charts ending in `*reads`, use `!*reads apps.*` (so, the order is important: the first pattern matching the chart id or the chart name will be used - positive or negative).
106 +
107 +- `send names instead of ids = yes | no` controls the metric names netdata should send to backend. netdata supports names and IDs for charts and dimensions. Usually IDs are unique identifiers as read by the system and names are human friendly labels (also unique). Most charts and metrics have the same ID and name, but in several cases they are different: disks with device-mapper, interrupts, QoS classes, statsd synthetic charts, etc.
108 +
109 +- `host tags = list of TAG=VALUE` defines tags that should be appended on all metrics for the given host. These are currently only sent to opentsdb and prometheus. Please use the appropriate format for each time-series db. For example opentsdb likes them like `TAG1=VALUE1 TAG2=VALUE2`, but prometheus like `tag1="value1",tag2="value2"`. Host tags are mirrored with database replication (streaming of metrics between netdata servers).
110 +
111 +## monitoring operation
112 +
113 +netdata provides 5 charts:
114 +
115 +1. **Buffered metrics**, the number of metrics netdata added to the buffer for dispatching them to the backend server.
116 +2. **Buffered data size**, the amount of data (in KB) netdata added the buffer.
117 +3. ~~**Backend latency**, the time the backend server needed to process the data netdata sent. If there was a re-connection involved, this includes the connection time.~~ (this chart has been removed, because it only measures the time netdata needs to give the data to the O/S - since the backend servers do not ack the reception, netdata does not have any means to measure this properly)
118 +4. **Backend operations**, the number of operations performed by netdata.
119 +5. **Backend thread CPU usage**, the CPU resources consumed by the netdata thread, that is responsible for sending the metrics to the backend server.
120 +
121 +![image](https://cloud.githubusercontent.com/assets/2662304/20463536/eb196084-af3d-11e6-8ee5-ddbd3b4d8449.png)
122 +
123 +## alarms
124 +
125 +The latest version of the alarms configuration for monitoring the backend is here: https://github.com/netdata/netdata/blob/master/conf.d/health.d/backend.conf
126 +
127 +netdata adds 4 alarms:
128 +
129 +1. `backend_last_buffering`, number of seconds since the last successful buffering of backend data
130 +2. `backend_metrics_sent`, percentage of metrics sent to the backend server
131 +3. `backend_metrics_lost`, number of metrics lost due to repeating failures to contact the backend server
132 +4. ~~`backend_slow`, the percentage of time between iterations needed by the backend time to process the data sent by netdata~~ (this was misleading and has been removed).
133 +
134 +![image](https://cloud.githubusercontent.com/assets/2662304/20463779/a46ed1c2-af43-11e6-91a5-07ca4533cac3.png)
135 +
136 +## InfluxDB setup as netdata backend (example)
137 +You can find blog post with example: how to use InfluxDB with netdata [here](https://blog.hda.me/2017/01/09/using-netdata-with-influxdb-backend.html)
backends/backends.c renamed
+1 -1
@@ -1,6 +1,6 @@
1 // SPDX-License-Identifier: GPL-3.0-or-later
2
3 -#include "../common.h"
3 +#include "backends.h"
4
5 // ----------------------------------------------------------------------------
6 // How backends work in netdata:
backends/backends.h renamed
+5 -5
@@ -3,7 +3,7 @@
3 #ifndef NETDATA_BACKENDS_H
4 #define NETDATA_BACKENDS_H 1
5
6 -#include "../common.h"
6 +#include "daemon/common.h"
7
8 typedef enum backend_options {
9 BACKEND_OPTION_NONE = 0,
@@ -42,9 +42,9 @@ extern size_t backend_name_copy(char *d, const char *s, size_t usable);
42 extern int discard_response(BUFFER *b, const char *backend);
43 #endif // BACKENDS_INTERNALS
44
45 -#include "prometheus/backend_prometheus.h"
46 -#include "graphite/graphite.h"
47 -#include "json/json.h"
48 -#include "opentsdb/opentsdb.h"
45 +#include "backends/prometheus/backend_prometheus.h"
46 +#include "backends/graphite/graphite.h"
47 +#include "backends/json/json.h"
48 +#include "backends/opentsdb/opentsdb.h"
49
50 #endif /* NETDATA_BACKENDS_H */
backends/graphite/Makefile.am renamed
+1 -1
@@ -1,4 +1,4 @@
1 # SPDX-License-Identifier: GPL-3.0-or-later
2
3 AUTOMAKE_OPTIONS = subdir-objects
4 -MAINTAINERCLEANFILES = Makefile.in
4 +MAINTAINERCLEANFILES = $(srcdir)/Makefile.in
backends/graphite/graphite.c renamed
backends/graphite/graphite.h renamed
+1 -1
@@ -4,7 +4,7 @@
4 #ifndef NETDATA_BACKEND_GRAPHITE_H
5 #define NETDATA_BACKEND_GRAPHITE_H
6
7 -#include "../backends.h"
7 +#include "backends/backends.h"
8
9 extern int format_dimension_collected_graphite_plaintext(
10 BUFFER *b // the buffer to write data to
backends/json/Makefile.am renamed
+1 -1
@@ -1,4 +1,4 @@
1 # SPDX-License-Identifier: GPL-3.0-or-later
2
3 AUTOMAKE_OPTIONS = subdir-objects
4 -MAINTAINERCLEANFILES = Makefile.in
4 +MAINTAINERCLEANFILES = $(srcdir)/Makefile.in
backends/json/json.c renamed
backends/json/json.h renamed
+1 -1
@@ -3,7 +3,7 @@
3 #ifndef NETDATA_BACKEND_JSON_H
4 #define NETDATA_BACKEND_JSON_H
5
6 -#include "../backends.h"
6 +#include "backends/backends.h"
7
8 extern int format_dimension_collected_json_plaintext(
9 BUFFER *b // the buffer to write data to
backends/nc-backend.sh renamed
+4
@@ -1,6 +1,10 @@
1 #!/usr/bin/env bash
2 +
3 # SPDX-License-Identifier: GPL-3.0-or-later
4
5 +# This is a simple backend database proxy, written in BASH, using the nc command.
6 +# Run the script without any parameters for help.
7 +
8 MODE="${1}"
9 MY_PORT="${2}"
10 BACKEND_HOST="${3}"
backends/opentsdb/Makefile.am renamed
+1 -1
@@ -1,4 +1,4 @@
1 # SPDX-License-Identifier: GPL-3.0-or-later
2
3 AUTOMAKE_OPTIONS = subdir-objects
4 -MAINTAINERCLEANFILES = Makefile.in
4 +MAINTAINERCLEANFILES = $(srcdir)/Makefile.in
backends/opentsdb/opentsdb.c renamed
backends/opentsdb/opentsdb.h renamed
+1 -1
@@ -3,7 +3,7 @@
3 #ifndef NETDATA_BACKEND_OPENTSDB_H
4 #define NETDATA_BACKEND_OPENTSDB_H
5
6 -#include "../backends.h"
6 +#include "backends/backends.h"
7
8 extern int format_dimension_collected_opentsdb_telnet(
9 BUFFER *b // the buffer to write data to
backends/prometheus/Makefile.am new
+8
@@ -0,0 +1,8 @@
1 +# SPDX-License-Identifier: GPL-3.0-or-later
2 +
3 +AUTOMAKE_OPTIONS = subdir-objects
4 +MAINTAINERCLEANFILES = $(srcdir)/Makefile.in
5 +
6 +dist_noinst_DATA = \
7 + README.md \
8 + $(NULL)
backends/prometheus/README.md new
+376
@@ -0,0 +1,376 @@
1 +> IMPORTANT: the format netdata sends metrics to prometheus has changed since netdata v1.7. The new prometheus backend for netdata supports a lot more features and is aligned to the development of the rest of the netdata backends.
2 +
3 +# Using netdata with Prometheus
4 +
5 +Prometheus is a distributed monitoring system which offers a very simple setup along with a robust data model. Recently netdata added support for Prometheus. I'm going to quickly show you how to install both netdata and prometheus on the same server. We can then use grafana pointed at Prometheus to obtain long term metrics netdata offers. I'm assuming we are starting at a fresh ubuntu shell (whether you'd like to follow along in a VM or a cloud instance is up to you).
6 +
7 +## Installing netdata and prometheus
8 +
9 +### Installing netdata
10 +There are number of ways to install netdata according to [Installation](https://github.com/netdata/netdata/wiki/Installation)
11 +The suggested way of installing the latest netdata and keep it upgrade automatically. Using one line installation:
12 +
13 +```
14 +bash <(curl -Ss https://my-netdata.io/kickstart.sh)
15 +```
16 +At this point we should have netdata listening on port 19999. Attempt to take your browser here:
17 +
18 +```
19 +http://your.netdata.ip:19999
20 +```
21 +
22 +*(replace `your.netdata.ip` with the IP or hostname of the server running netdata)*
23 +
24 +### Installing Prometheus
25 +In order to install prometheus we are going to introduce our own systemd startup script along with an example of prometheus.yaml configuration. Prometheus needs to be pointed to your server at a specific target url for it to scrape netdata's api. Prometheus is always a pull model meaning netdata is the passive client within this architecture. Prometheus always initiates the connection with netdata.
26 +
27 +##### Download Prometheus
28 +
29 +```sh
30 +wget -O /tmp/prometheus-2.3.2.linux-amd64.tar.gz https://github.com/prometheus/prometheus/releases/download/v2.3.2/prometheus-2.3.2.linux-amd64.tar.gz
31 +```
32 +
33 +##### Create prometheus system user
34 +
35 +```sh
36 +sudo useradd -r prometheus
37 +```
38 +
39 +#### Create prometheus directory
40 +
41 +```sh
42 +sudo mkdir /opt/prometheus
43 +sudo chown prometheus:prometheus /opt/prometheus
44 +```
45 +
46 +#### Untar prometheus directory
47 +
48 +```sh
49 +sudo tar -xvf /tmp/prometheus-2.3.2.linux-amd64.tar.gz -C /opt/prometheus --strip=1
50 +```
51 +
52 +#### Install prometheus.yml
53 +
54 +We will use the following `prometheus.yml` file. Save it at `/opt/prometheus/prometheus.yml`.
55 +
56 +Make sure to replace `your.netdata.ip` with the IP or hostname of the host running netdata.
57 +
58 +```yaml
59 +# my global config
60 +global:
61 + scrape_interval: 5s # Set the scrape interval to every 5 seconds. Default is every 1 minute.
62 + evaluation_interval: 5s # Evaluate rules every 5 seconds. The default is every 1 minute.
63 + # scrape_timeout is set to the global default (10s).
64 +
65 + # Attach these labels to any time series or alerts when communicating with
66 + # external systems (federation, remote storage, Alertmanager).
67 + external_labels:
68 + monitor: 'codelab-monitor'
69 +
70 +# Load rules once and periodically evaluate them according to the global 'evaluation_interval'.
71 +rule_files:
72 + # - "first.rules"
73 + # - "second.rules"
74 +
75 +# A scrape configuration containing exactly one endpoint to scrape:
76 +# Here it's Prometheus itself.
77 +scrape_configs:
78 + # The job name is added as a label `job=<job_name>` to any timeseries scraped from this config.
79 + - job_name: 'prometheus'
80 +
81 + # metrics_path defaults to '/metrics'
82 + # scheme defaults to 'http'.
83 +
84 + static_configs:
85 + - targets: ['0.0.0.0:9090']
86 +
87 + - job_name: 'netdata-scrape'
88 +
89 + metrics_path: '/api/v1/allmetrics'
90 + params:
91 + # format: prometheus | prometheus_all_hosts
92 + # You can use `prometheus_all_hosts` if you want Prometheus to set the `instance` to your hostname instead of IP
93 + format: [prometheus]
94 + #
95 + # sources: as-collected | raw | average | sum | volume
96 + # default is: average
97 + #source: [as-collected]
98 + #
99 + # server name for this prometheus - the default is the client IP
100 + # for netdata to uniquely identify it
101 + #server: ['prometheus1']
102 + honor_labels: true
103 +
104 + static_configs:
105 + - targets: ['{your.netdata.ip}:19999']
106 +```
107 +#### Install nodes.yml
108 +
109 +The following is completely optional, it will enable Prometheus to generate alerts from some NetData sources. Tweak the values to your own needs. We will use the following `nodes.yml` file below. Save it at `/opt/prometheus/nodes.yml`, and add a *- "nodes.yml"* entry under the *rule_files:* section in the example prometheus.yml file above.
110 +```
111 +groups:
112 +- name: nodes
113 +
114 + rules:
115 + - alert: node_high_cpu_usage_70
116 + expr: avg(rate(netdata_cpu_cpu_percentage_average{dimension="idle"}[1m])) by (job) > 70
117 + for: 1m
118 + annotations:
119 + description: '{{ $labels.job }} on ''{{ $labels.job }}'' CPU usage is at {{ humanize $value }}%.'
120 + summary: CPU alert for container node '{{ $labels.job }}'
121 +
122 + - alert: node_high_memory_usage_70
123 + expr: 100 / sum(netdata_system_ram_MB_average) by (job)
124 + * sum(netdata_system_ram_MB_average{dimension=~"free|cached"}) by (job) < 30
125 + for: 1m
126 + annotations:
127 + description: '{{ $labels.job }} memory usage is {{ humanize $value}}%.'
128 + summary: Memory alert for container node '{{ $labels.job }}'
129 +
130 + - alert: node_low_root_filesystem_space_20
131 + expr: 100 / sum(netdata_disk_space_GB_average{family="/"}) by (job)
132 + * sum(netdata_disk_space_GB_average{family="/",dimension=~"avail|cached"}) by (job) < 20
133 + for: 1m
134 + annotations:
135 + description: '{{ $labels.job }} root filesystem space is {{ humanize $value}}%.'
136 + summary: Root filesystem alert for container node '{{ $labels.job }}'
137 +
138 + - alert: node_root_filesystem_fill_rate_6h
139 + expr: predict_linear(netdata_disk_space_GB_average{family="/",dimension=~"avail|cached"}[1h], 6 * 3600) < 0
140 + for: 1h
141 + labels:
142 + severity: critical
143 + annotations:
144 + description: Container node {{ $labels.job }} root filesystem is going to fill up in 6h.
145 + summary: Disk fill alert for Swarm node '{{ $labels.job }}'
146 +```
147 +
148 +#### Install prometheus.service
149 +
150 +Save this service file as `/etc/systemd/system/prometheus.service`:
151 +
152 +```
153 +[Unit]
154 +Description=Prometheus Server
155 +AssertPathExists=/opt/prometheus
156 +
157 +[Service]
158 +Type=simple
159 +WorkingDirectory=/opt/prometheus
160 +User=prometheus
161 +Group=prometheus
162 +ExecStart=/opt/prometheus/prometheus --config.file=/opt/prometheus/prometheus.yml --log.level=info
163 +ExecReload=/bin/kill -SIGHUP $MAINPID
164 +ExecStop=/bin/kill -SIGINT $MAINPID
165 +
166 +[Install]
167 +WantedBy=multi-user.target
168 +```
169 +
170 +##### Start Prometheus
171 +
172 +```
173 +sudo systemctl start prometheus
174 +sudo systemctl enable prometheus
175 +```
176 +
177 +Prometheus should now start and listen on port 9090. Attempt to head there with your browser.
178 +
179 +If everything is working correctly when you fetch `http://your.prometheus.ip:9090` you will see a 'Status' tab. Click this and click on 'targets' We should see the netdata host as a scraped target.
180 +
181 +---
182 +
183 +## netdata support for prometheus
184 +
185 +> IMPORTANT: the format netdata sends metrics to prometheus has changed since netdata v1.6. The new format allows easier queries for metrics and supports both `as collected` and normalized metrics.
186 +
187 +Before explaining the changes, we have to understand the key differences between netdata and prometheus.
188 +
189 +### understanding netdata metrics
190 +
191 +##### charts
192 +
193 +Each chart in netdata has several properties (common to all its metrics):
194 +
195 +- `chart_id` - uniquely identifies a chart.
196 +
197 +- `chart_name` - a more human friendly name for `chart_id`, also unique.
198 +
199 +- `context` - this is the template of the chart. All disk I/O charts have the same context, all mysql requests charts have the same context, etc. This is used for alarm templates to match all the charts they should be attached to.
200 +
201 +- `family` groups a set of charts together. It is used as the submenu of the dashboard.
202 +
203 +- `units` is the units for all the metrics attached to the chart.
204 +
205 +##### dimensions
206 +
207 +Then each netdata chart contains metrics called `dimensions`. All the dimensions of a chart have the same units of measurement, and are contextually in the same category (ie. the metrics for disk bandwidth are `read` and `write` and they are both in the same chart).
208 +
209 +### netdata data source
210 +
211 +netdata can send metrics to prometheus from 3 data sources:
212 +
213 +- `as collected` or `raw` - this data source sends the metrics to prometheus as they are collected. No conversion is done by netdata. The latest value for each metric is just given to prometheus. This is the most preferred method by prometheus, but it is also the harder to work with. To work with this data source, you will need to understand how to get meaningful values out of them.
214 +
215 + The format of the metrics is: `CONTEXT{chart="CHART",family="FAMILY",dimension="DIMENSION"}`.
216 +
217 + If the metric is a counter (`incremental` in netdata lingo), `_total` is appended the context.
218 +
219 + Unlike prometheus, netdata allows each dimension of a chart to have a different algorithm and conversion constants (`multiplier` and `divisor`). In this case, that the dimensions of a charts are heterogeneous, netdata will use this format: `CONTEXT_DIMENSION{chart="CHART",family="FAMILY"}`
220 +
221 +- `average` - this data source uses the netdata database to send the metrics to prometheus as they are presented on the netdata dashboard. So, all the metrics are sent as gauges, at the units they are presented in the netdata dashboard charts. This is the easiest to work with.
222 +
223 + The format of the metrics is: `CONTEXT_UNITS_average{chart="CHART",family="FAMILY",dimension="DIMENSION"}`.
224 +
225 + When this source is used, netdata keeps track of the last access time for each prometheus server fetching the metrics. This last access time is used at the subsequent queries of the same prometheus server to identify the time-frame the `average` will be calculated. So, no matter how frequently prometheus scrapes netdata, it will get all the database data. To identify each prometheus server, netdata uses by default the IP of the client fetching the metrics. If there are multiple prometheus servers fetching data from the same netdata, using the same IP, each prometheus server can append `server=NAME` to the URL. Netdata will use this `NAME` to uniquely identify the prometheus server.
226 +
227 +- `sum` or `volume`, is like `average` but instead of averaging the values, it sums them.
228 +
229 + The format of the metrics is: `CONTEXT_UNITS_sum{chart="CHART",family="FAMILY",dimension="DIMENSION"}`.
230 + All the other operations are the same with `average`.
231 +
232 +Keep in mind that early versions of netdata were sending the metrics as: `CHART_DIMENSION{}`.
233 +
234 +
235 +### Querying Metrics
236 +
237 +Fetch with your web browser this URL:
238 +
239 +`http://your.netdata.ip:19999/api/v1/allmetrics?format=prometheus&help=yes`
240 +
241 +*(replace `your.netdata.ip` with the ip or hostname of your netdata server)*
242 +
243 +netdata will respond with all the metrics it sends to prometheus.
244 +
245 +If you search that page for `"system.cpu"` you will find all the metrics netdata is exporting to prometheus for this chart. `system.cpu` is the chart name on the netdata dashboard (on the netdata dashboard all charts have a text heading such as : `Total CPU utilization (system.cpu)`. What we are interested here in the chart name: `system.cpu`).
246 +
247 +Searching for `"system.cpu"` reveals:
248 +
249 +```sh
250 +# COMMENT homogeneus chart "system.cpu", context "system.cpu", family "cpu", units "percentage"
251 +# COMMENT netdata_system_cpu_percentage_average: dimension "guest_nice", value is percentage, gauge, dt 1500066653 to 1500066662 inclusive
252 +netdata_system_cpu_percentage_average{chart="system.cpu",family="cpu",dimension="guest_nice"} 0.0000000 1500066662000
253 +# COMMENT netdata_system_cpu_percentage_average: dimension "guest", value is percentage, gauge, dt 1500066653 to 1500066662 inclusive
254 +netdata_system_cpu_percentage_average{chart="system.cpu",family="cpu",dimension="guest"} 1.7837326 1500066662000
255 +# COMMENT netdata_system_cpu_percentage_average: dimension "steal", value is percentage, gauge, dt 1500066653 to 1500066662 inclusive
256 +netdata_system_cpu_percentage_average{chart="system.cpu",family="cpu",dimension="steal"} 0.0000000 1500066662000
257 +# COMMENT netdata_system_cpu_percentage_average: dimension "softirq", value is percentage, gauge, dt 1500066653 to 1500066662 inclusive
258 +netdata_system_cpu_percentage_average{chart="system.cpu",family="cpu",dimension="softirq"} 0.5275442 1500066662000
259 +# COMMENT netdata_system_cpu_percentage_average: dimension "irq", value is percentage, gauge, dt 1500066653 to 1500066662 inclusive
260 +netdata_system_cpu_percentage_average{chart="system.cpu",family="cpu",dimension="irq"} 0.2260836 1500066662000
261 +# COMMENT netdata_system_cpu_percentage_average: dimension "user", value is percentage, gauge, dt 1500066653 to 1500066662 inclusive
262 +netdata_system_cpu_percentage_average{chart="system.cpu",family="cpu",dimension="user"} 2.3362762 1500066662000
263 +# COMMENT netdata_system_cpu_percentage_average: dimension "system", value is percentage, gauge, dt 1500066653 to 1500066662 inclusive
264 +netdata_system_cpu_percentage_average{chart="system.cpu",family="cpu",dimension="system"} 1.7961062 1500066662000
265 +# COMMENT netdata_system_cpu_percentage_average: dimension "nice", value is percentage, gauge, dt 1500066653 to 1500066662 inclusive
266 +netdata_system_cpu_percentage_average{chart="system.cpu",family="cpu",dimension="nice"} 0.0000000 1500066662000
267 +# COMMENT netdata_system_cpu_percentage_average: dimension "iowait", value is percentage, gauge, dt 1500066653 to 1500066662 inclusive
268 +netdata_system_cpu_percentage_average{chart="system.cpu",family="cpu",dimension="iowait"} 0.9671802 1500066662000
269 +# COMMENT netdata_system_cpu_percentage_average: dimension "idle", value is percentage, gauge, dt 1500066653 to 1500066662 inclusive
270 +netdata_system_cpu_percentage_average{chart="system.cpu",family="cpu",dimension="idle"} 92.3630770 1500066662000
271 +```
272 +*(netdata response for `system.cpu` with source=`average`)*
273 +
274 +In `average` or `sum` data sources, all values are normalized and are reported to prometheus as gauges. Now, use the 'expression' text form in prometheus. Begin to type the metrics we are looking for: `netdata_system_cpu`. You should see that the text form begins to auto-fill as prometheus knows about this metric.
275 +
276 +If the data source was `as collected`, the response would be:
277 +
278 +```sh
279 +# COMMENT homogeneus chart "system.cpu", context "system.cpu", family "cpu", units "percentage"
280 +# COMMENT netdata_system_cpu_total: chart "system.cpu", context "system.cpu", family "cpu", dimension "guest_nice", value * 1 / 1 delta gives percentage (counter)
281 +netdata_system_cpu_total{chart="system.cpu",family="cpu",dimension="guest_nice"} 0 1500066716438
282 +# COMMENT netdata_system_cpu_total: chart "system.cpu", context "system.cpu", family "cpu", dimension "guest", value * 1 / 1 delta gives percentage (counter)
283 +netdata_system_cpu_total{chart="system.cpu",family="cpu",dimension="guest"} 63945 1500066716438
284 +# COMMENT netdata_system_cpu_total: chart "system.cpu", context "system.cpu", family "cpu", dimension "steal", value * 1 / 1 delta gives percentage (counter)
285 +netdata_system_cpu_total{chart="system.cpu",family="cpu",dimension="steal"} 0 1500066716438
286 +# COMMENT netdata_system_cpu_total: chart "system.cpu", context "system.cpu", family "cpu", dimension "softirq", value * 1 / 1 delta gives percentage (counter)
287 +netdata_system_cpu_total{chart="system.cpu",family="cpu",dimension="softirq"} 8295 1500066716438
288 +# COMMENT netdata_system_cpu_total: chart "system.cpu", context "system.cpu", family "cpu", dimension "irq", value * 1 / 1 delta gives percentage (counter)
289 +netdata_system_cpu_total{chart="system.cpu",family="cpu",dimension="irq"} 4079 1500066716438
290 +# COMMENT netdata_system_cpu_total: chart "system.cpu", context "system.cpu", family "cpu", dimension "user", value * 1 / 1 delta gives percentage (counter)
291 +netdata_system_cpu_total{chart="system.cpu",family="cpu",dimension="user"} 116488 1500066716438
292 +# COMMENT netdata_system_cpu_total: chart "system.cpu", context "system.cpu", family "cpu", dimension "system", value * 1 / 1 delta gives percentage (counter)
293 +netdata_system_cpu_total{chart="system.cpu",family="cpu",dimension="system"} 35084 1500066716438
294 +# COMMENT netdata_system_cpu_total: chart "system.cpu", context "system.cpu", family "cpu", dimension "nice", value * 1 / 1 delta gives percentage (counter)
295 +netdata_system_cpu_total{chart="system.cpu",family="cpu",dimension="nice"} 505 1500066716438
296 +# COMMENT netdata_system_cpu_total: chart "system.cpu", context "system.cpu", family "cpu", dimension "iowait", value * 1 / 1 delta gives percentage (counter)
297 +netdata_system_cpu_total{chart="system.cpu",family="cpu",dimension="iowait"} 23314 1500066716438
298 +# COMMENT netdata_system_cpu_total: chart "system.cpu", context "system.cpu", family "cpu", dimension "idle", value * 1 / 1 delta gives percentage (counter)
299 +netdata_system_cpu_total{chart="system.cpu",family="cpu",dimension="idle"} 918470 1500066716438
300 +```
301 +*(netdata response for `system.cpu` with source=`as-collected`)*
302 +
303 +For more information check prometheus documentation.
304 +
305 +### Streaming data from upstream hosts
306 +
307 +The `format=prometheus` parameter only exports the host's netdata metrics. If you are using the master/slave functionality of netdata this ignores any upstream hosts - so you should consider using the below in your **prometheus.yml**:
308 +
309 +```
310 + metrics_path: '/api/v1/allmetrics'
311 + params:
312 + format: [prometheus_all_hosts]
313 + honor_labels: true
314 +```
315 +
316 +This will report all upstream host data, and `honor_labels` will make Prometheus take note of the instance names provided.
317 +
318 +### timestamps
319 +
320 +To pass the metrics through prometheus pushgateway, netdata supports the option `&timestamps=no` to send the metrics without timestamps.
321 +
322 +## netdata host variables
323 +
324 +netdata collects various system configuration metrics, like the max number of TCP sockets supported, the max number of files allowed system-wide, various IPC sizes, etc. These metrics are not exposed to prometheus by default.
325 +
326 +To expose them, append `variables=yes` to the netdata URL.
327 +
328 +### TYPE and HELP
329 +
330 +To save bandwidth, and because prometheus does not use them anyway, `# TYPE` and `# HELP` lines are suppressed. If wanted they can be re-enabled via `types=yes` and `help=yes`, e.g. `/api/v1/allmetrics?format=prometheus&types=yes&help=yes`
331 +
332 +### Names and IDs
333 +
334 +netdata supports names and IDs for charts and dimensions. Usually IDs are unique identifiers as read by the system and names are human friendly labels (also unique).
335 +
336 +Most charts and metrics have the same ID and name, but in several cases they are different: disks with device-mapper, interrupts, QoS classes, statsd synthetic charts, etc.
337 +
338 +The default is controlled in `netdata.conf`:
339 +
340 +```
341 +[backend]
342 + send names instead of ids = yes | no
343 +```
344 +
345 +You can overwrite it from prometheus, by appending to the URL:
346 +
347 +* `&names=no` to get IDs (the old behaviour)
348 +* `&names=yes` to get names
349 +
350 +### Filtering metrics sent to prometheus
351 +
352 +netdata can filter the metrics it sends to prometheus with this setting:
353 +
354 +```
355 +[backend]
356 + send charts matching = *
357 +```
358 +
359 +This settings accepts a space separated list of patterns to match the **charts** to be sent to prometheus. Each pattern can use ` * ` as wildcard, any number of times (e.g `*a*b*c*` is valid). Patterns starting with ` ! ` give a negative match (e.g `!*.bad users.* groups.*` will send all the users and groups except `bad` user and `bad` group). The order is important: the first match (positive or negative) left to right, is used.
360 +
361 +### Changing the prefix of netdata metrics
362 +
363 +netdata sends all metrics prefixed with `netdata_`. You can change this in `netdata.conf`, like this:
364 +
365 +```
366 +[backend]
367 + prefix = netdata
368 +```
369 +
370 +It can also be changed from the URL, by appending `&prefix=netdata`.
371 +
372 +### accuracy of `average` and `sum` data sources
373 +
374 +When the data source is set to `average` or `sum`, netdata remembers the last access of each client accessing prometheus metrics and uses this last access time to respond with the `average` or `sum` of all the entries in the database since that. This means that prometheus servers are not losing data when they access netdata with data source = `average` or `sum`.
375 +
376 +To uniquely identify each prometheus server, netdata uses the IP of the client accessing the metrics. If however the IP is not good enough for identifying a single prometheus server (e.g. when prometheus servers are accessing netdata through a web proxy, or when multiple prometheus servers are NATed to a single IP), each prometheus may append `&server=NAME` to the URL. This `NAME` is used by netdata to uniquely identify each prometheus server and keep track of its last access time.
backends/prometheus/backend_prometheus.c renamed
backends/prometheus/backend_prometheus.h renamed
+1 -1
@@ -3,7 +3,7 @@
3 #ifndef NETDATA_BACKEND_PROMETHEUS_H
4 #define NETDATA_BACKEND_PROMETHEUS_H 1
5
6 -#include "../backends.h"
6 +#include "backends/backends.h"
7
8 typedef enum prometheus_output_flags {
9 PROMETHEUS_OUTPUT_NONE = 0,
charts.d/Makefile.am deleted
-32
@@ -1,32 +0,0 @@
1 -#
2 -# Copyright (C) 2015 Alon Bar-Lev <alon.barlev@gmail.com>
3 -# SPDX-License-Identifier: GPL-3.0-or-later
4 -#
5 -MAINTAINERCLEANFILES= $(srcdir)/Makefile.in
6 -
7 -dist_charts_SCRIPTS = \
8 - $(NULL)
9 -
10 -dist_charts_DATA = \
11 - README.md \
12 - ap.chart.sh \
13 - apcupsd.chart.sh \
14 - apache.chart.sh \
15 - cpu_apps.chart.sh \
16 - cpufreq.chart.sh \
17 - example.chart.sh \
18 - exim.chart.sh \
19 - hddtemp.chart.sh \
20 - libreswan.chart.sh \
21 - load_average.chart.sh \
22 - mem_apps.chart.sh \
23 - mysql.chart.sh \
24 - nginx.chart.sh \
25 - nut.chart.sh \
26 - opensips.chart.sh \
27 - phpfpm.chart.sh \
28 - postfix.chart.sh \
29 - sensors.chart.sh \
30 - squid.chart.sh \
31 - tomcat.chart.sh \
32 - $(NULL)
charts.d/README.md deleted
-344
@@ -1,344 +0,0 @@
1 -The following charts.d plugins are supported:
2 -
3 ----
4 -
5 -# hddtemp
6 -
7 -The plugin will collect temperatures from disks
8 -
9 -It will create one chart with all active disks
10 -
11 -1. **temperature in Celsius**
12 -
13 -### configuration
14 -
15 -hddtemp needs to be running in daemonized mode
16 -
17 -```sh
18 -# host with daemonized hddtemp
19 -hddtemp_host="localhost"
20 -
21 -# port on which hddtemp is showing data
22 -hddtemp_port="7634"
23 -
24 -# array of included disks
25 -# the default is to include all
26 -hddtemp_disks=()
27 -```
28 -
29 ----
30 -
31 -# libreswan
32 -
33 -The plugin will collects bytes-in, bytes-out and uptime for all established libreswan IPSEC tunnels.
34 -
35 -The following charts are created, **per tunnel**:
36 -
37 -1. **Uptime**
38 -
39 - * the uptime of the tunnel
40 -
41 -2. **Traffic**
42 -
43 - * bytes in
44 - * bytes out
45 -
46 -### configuration
47 -
48 -Its config file is `/etc/netdata/charts.d/libreswan.conf`.
49 -
50 -The plugin executes 2 commands to collect all the information it needs:
51 -
52 -```sh
53 -ipsec whack --status
54 -ipsec whack --trafficstatus
55 -```
56 -
57 -The first command is used to extract the currently established tunnels, their IDs and their names.
58 -The second command is used to extract the current uptime and traffic.
59 -
60 -Most probably user `netdata` will not be able to query libreswan, so the `ipsec` commands will be denied.
61 -The plugin attempts to run `ipsec` as `sudo ipsec ...`, to get access to libreswan statistics.
62 -
63 -To allow user `netdata` execute `sudo ipsec ...`, create the file `/etc/sudoers.d/netdata` with this content:
64 -
65 -```
66 -netdata ALL = (root) NOPASSWD: /sbin/ipsec whack --status
67 -netdata ALL = (root) NOPASSWD: /sbin/ipsec whack --trafficstatus
68 -```
69 -
70 -Make sure the path `/sbin/ipsec` matches your setup (execute `which ipsec` to find the right path).
71 -
72 ----
73 -
74 -# mysql
75 -
76 -The plugin will monitor one or more mysql servers
77 -
78 -It will produce the following charts:
79 -
80 -1. **Bandwidth** in kbps
81 - * in
82 - * out
83 -
84 -2. **Queries** in queries/sec
85 - * queries
86 - * questions
87 - * slow queries
88 -
89 -3. **Operations** in operations/sec
90 - * opened tables
91 - * flush
92 - * commit
93 - * delete
94 - * prepare
95 - * read first
96 - * read key
97 - * read next
98 - * read prev
99 - * read random
100 - * read random next
101 - * rollback
102 - * save point
103 - * update
104 - * write
105 -
106 -4. **Table Locks** in locks/sec
107 - * immediate
108 - * waited
109 -
110 -5. **Select Issues** in issues/sec
111 - * full join
112 - * full range join
113 - * range
114 - * range check
115 - * scan
116 -
117 -6. **Sort Issues** in issues/sec
118 - * merge passes
119 - * range
120 - * scan
121 -
122 -### configuration
123 -
124 -You can configure many database servers, like this:
125 -
126 -You can provide, per server, the following:
127 -
128 -1. a name, anything you like, but keep it short
129 -2. the mysql command to connect to the server
130 -3. the mysql command line options to be used for connecting to the server
131 -
132 -Here is an example for 2 servers:
133 -
134 -```sh
135 -mysql_opts[server1]="-h server1.example.com"
136 -mysql_opts[server2]="-h server2.example.com --connect_timeout 2"
137 -```
138 -
139 -The above will use the `mysql` command found in the system path.
140 -You can also provide a custom mysql command per server, like this:
141 -
142 -```sh
143 -mysql_cmds[server2]="/opt/mysql/bin/mysql"
144 -```
145 -
146 -The above sets the mysql command only for server2. server1 will use the system default.
147 -
148 -If no configuration is given, the plugin will attempt to connect to mysql server at localhost.
149 -
150 -
151 ----
152 -
153 -# nut
154 -
155 -The plugin will collect UPS data for all UPSes configured in the system.
156 -
157 -The following charts will be created:
158 -
159 -1. **UPS Charge**
160 -
161 - * percentage changed
162 -
163 -2. **UPS Battery Voltage**
164 -
165 - * current voltage
166 - * high voltage
167 - * low voltage
168 - * nominal voltage
169 -
170 -3. **UPS Input Voltage**
171 -
172 - * current voltage
173 - * fault voltage
174 - * nominal voltage
175 -
176 -4. **UPS Input Current**
177 -
178 - * nominal current
179 -
180 -5. **UPS Input Frequency**
181 -
182 - * current frequency
183 - * nominal frequency
184 -
185 -6. **UPS Output Voltage**
186 -
187 - * current voltage
188 -
189 -7. **UPS Load**
190 -
191 - * current load
192 -
193 -8. **UPS Temperature**
194 -
195 - * current temperature
196 -
197 -
198 -### configuration
199 -
200 -This is the internal default for `/etc/netdata/nut.conf`
201 -
202 -```sh
203 -# a space separated list of UPS names
204 -# if empty, the list returned by 'upsc -l' will be used
205 -nut_ups=
206 -
207 -# how frequently to collect UPS data
208 -nut_update_every=2
209 -```
210 -
211 ----
212 -
213 -# postfix
214 -
215 -The plugin will collect the postfix queue size.
216 -
217 -It will create two charts:
218 -
219 -1. **queue size in emails**
220 -2. **queue size in KB**
221 -
222 -### configuration
223 -
224 -This is the internal default for `/etc/netdata/postfix.conf`
225 -
226 -```sh
227 -# the postqueue command
228 -# if empty, it will use the one found in the system path
229 -postfix_postqueue=
230 -
231 -# how frequently to collect queue size
232 -postfix_update_every=15
233 -```
234 -
235 ----
236 -
237 -# sensors
238 -
239 -The plugin will provide charts for all configured system sensors
240 -
241 -> This plugin is reading sensors directly from the kernel.
242 -> The `lm-sensors` package is able to perform calculations on the
243 -> kernel provided values, this plugin will not perform.
244 -> So, the values graphed, are the raw hardware values of the sensors.
245 -
246 -The plugin will create netdata charts for:
247 -
248 -1. **Temperature**
249 -2. **Voltage**
250 -3. **Current**
251 -4. **Power**
252 -5. **Fans Speed**
253 -6. **Energy**
254 -7. **Humidity**
255 -
256 -One chart for every sensor chip found and each of the above will be created.
257 -
258 -### configuration
259 -
260 -This is the internal default for `/etc/netdata/sensors.conf`
261 -
262 -```sh
263 -# the directory the kernel keeps sensor data
264 -sensors_sys_dir="${NETDATA_HOST_PREFIX}/sys/devices"
265 -
266 -# how deep in the tree to check for sensor data
267 -sensors_sys_depth=10
268 -
269 -# if set to 1, the script will overwrite internal
270 -# script functions with code generated ones
271 -# leave to 1, is faster
272 -sensors_source_update=1
273 -
274 -# how frequently to collect sensor data
275 -# the default is to collect it at every iteration of charts.d
276 -sensors_update_every=
277 -
278 -# array of sensors which are excluded
279 -# the default is to include all
280 -sensors_excluded=()
281 -```
282 -
283 ----
284 -
285 -# squid
286 -
287 -The plugin will monitor a squid server.
288 -
289 -It will produce 4 charts:
290 -
291 -1. **Squid Client Bandwidth** in kbps
292 -
293 - * in
294 - * out
295 - * hits
296 -
297 -2. **Squid Client Requests** in requests/sec
298 -
299 - * requests
300 - * hits
301 - * errors
302 -
303 -3. **Squid Server Bandwidth** in kbps
304 -
305 - * in
306 - * out
307 -
308 -4. **Squid Server Requests** in requests/sec
309 -
310 - * requests
311 - * errors
312 -
313 -### autoconfig
314 -
315 -The plugin will by itself detect squid servers running on
316 -localhost, on ports 3128 or 8080.
317 -
318 -It will attempt to download URLs in the form:
319 -
320 -- `cache_object://HOST:PORT/counters`
321 -- `/squid-internal-mgr/counters`
322 -
323 -If any succeeds, it will use this.
324 -
325 -### configuration
326 -
327 -If you need to configure it by hand, create the file
328 -`/etc/netdata/squid.conf` with the following variables:
329 -
330 -- `squid_host=IP` the IP of the squid host
331 -- `squid_port=PORT` the port the squid is listening
332 -- `squid_url="URL"` the URL with the statistics to be fetched from squid
333 -- `squid_timeout=SECONDS` how much time we should wait for squid to respond
334 -- `squid_update_every=SECONDS` the frequency of the data collection
335 -
336 -Example `/etc/netdata/squid.conf`:
337 -
338 -```sh
339 -squid_host=127.0.0.1
340 -squid_port=3128
341 -squid_url="cache_object://127.0.0.1:3128/counters"
342 -squid_timeout=2
343 -squid_update_every=5
344 -```
collectors/Makefile.am new
+28
@@ -0,0 +1,28 @@
1 +# SPDX-License-Identifier: GPL-3.0-or-later
2 +
3 +MAINTAINERCLEANFILES = $(srcdir)/Makefile.in
4 +
5 +SUBDIRS = \
6 + plugins.d \
7 + apps.plugin \
8 + cgroups.plugin \
9 + charts.d.plugin \
10 + checks.plugin \
11 + diskspace.plugin \
12 + fping.plugin \
13 + freebsd.plugin \
14 + freeipmi.plugin \
15 + idlejitter.plugin \
16 + macos.plugin \
17 + nfacct.plugin \
18 + node.d.plugin \
19 + proc.plugin \
20 + python.d.plugin \
21 + statsd.plugin \
22 + tc.plugin \
23 + $(NULL)
24 +
25 +
26 +dist_noinst_DATA = \
27 + README.md \
28 + $(NULL)
collectors/README.md new
+118
@@ -0,0 +1,118 @@
1 +# Data Collection Plugins
2 +
3 +netdata supports **internal** and **external** data collection plugins:
4 +
5 +- **internal** plugins are written in `C` and run as threads inside the netdata daemon.
6 +
7 +- **external** plugins may be written in any computer language and are spawn as independent long-running processes by the netdata daemon.
8 + They communicate with the netdata daemon via `pipes` (`stdout` communication).
9 +
10 +To minimize the number of processes spawn for data collection, netdata also supports **plugin orchestrators**.
11 +
12 +- **plugin orchestrators** are external plugins that do not collect any data by themeselves.
13 + Instead they support data collection **modules** written in the language of the orchestrator.
14 + Usually the orchestrator provides a higher level abstraction, making it ideal for writing new
15 + data collection modules with the minimum of code.
16 +
17 + Currently netdata provides plugin orchestrators
18 + BASH v4+ [charts.d.plugin](charts.d.plugin),
19 + node.js [node.d.plugin](node.d.plugin) and
20 + python v2+ (including v3) [python.d.plugin](python.d.plugin).
21 +
22 +## Netdata Plugins
23 +
24 +plugin|lang|O/S|runs as|modular|description
25 +:---:|:---:|:---:|:---:|:---:|:---
26 +[apps.plugin](apps.plugin/)|`C`|linux, freebsd|external|-|monitors the whole process tree on Linux and FreeBSD and breaks down system resource usage by **process**, **user** and **user group**.
27 +[cgroups.plugin](cgroups.plugin/)|`C`|linux|internal|-|collects resource usage of **Containers**, libvirt **VMs** and **systemd services**, on Linux systems
28 +[charts.d.plugin](charts.d.plugin/)|`BASH` v4+|any|external|yes|a **plugin orchestrator** for data collection modules written in `BASH` v4+.
29 +[checks.plugin](checks.plugin/)|`C`|any|internal|-|a debugging plugin (by default it is disabled)
30 +[diskspace.plugin](diskspace.plugin/)|`C`|linux|internal|-|collects disk space usage metrics on Linux mount points
31 +[fping.plugin](fping.plugin/)|`C`|any|external|-|measures network latency, jitter and packet loss between the monitored node and any number of remote network end points.
32 +[freebsd.plugin](freebsd.plugin/)|`C`|freebsd|internal|yes|collects resource usage and performance data on FreeBSD systems
33 +[freeipmi.plugin](freeipmi.plugin/)|`C`|linux|external|-|collects metrics from enterprise hardware sensors, on Linux servers.
34 +[idlejitter.plugin](idlejitter.plugin/)|`C`|any|internal|-|measures CPU latency and jitter on all operating systems
35 +[macos.plugin](macos.plugin/)|`C`|macos|internal|yes|collects resource usage and performance data on MacOS systems
36 +[nfacct.plugin](nfacct.plugin/)|`C`|linux|internal|-|collects netfilter firewall, connection tracker and accounting metrics using `libmnl` and `libnetfilter_acct`
37 +[node.d.plugin](node.d.plugin/)|`node.js`|any|external|yes|a **plugin orchestrator** for data collection modules written in `node.js`.
38 +[plugins.d](plugins.d/)|`C`|any|internal|-|implements the **external plugins** API and serves external plugins
39 +[proc.plugin](proc.plugin/)|`C`|linux|internal|yes|collects resource usage and performance data on Linux systems
40 +[python.d.plugin](python.d.plugin/)|`python` v2+|any|external|yes|a **plugin orchestrator** for data collection modules written in `python` v2 or v3 (both are supported).
41 +[statsd.plugin](statsd.plugin/)|`C`|any|internal|-|implements a high performance **statsd** server for netdata
42 +[tc.plugin](tc.plugin/)|`C`|linux|internal|-|collects traffic QoS metrics (`tc`) of Linux network interfaces
43 +
44 +## Enabling and Disabling plugins
45 +
46 +Each plugin can be enabled or disabled via `netdata.conf`, section `[plugins]`.
47 +
48 +At this section there a list of all the plugins with a boolean setting to enable them or disable them.
49 +
50 +The exception is `statsd.plugin` that has its own `[statsd]` section.
51 +
52 +Once a plugin is enabled, consult the page of each plugin for additional configuration options.
53 +
54 +All **external plugins** are managed by [plugins.d](plugins.d/), which provides additional management options.
55 +
56 +### Internal Plugins
57 +
58 +Each of the internal plugins runs as a thread inside the netdata daemon.
59 +Once this thread has started, the plugin may spawn additional threads according to its design.
60 +
61 +#### Internal Plugins API
62 +
63 +The internal data collection API consists of the following calls:
64 +
65 +```c
66 +collect_data() {
67 + // collect data here (one iteration)
68 +
69 + collected_number collected_value = collect_a_value();
70 +
71 + // give the metrics to netdata
72 +
73 + static RRDSET *st = NULL; // the chart
74 + static RRDDIM *rd = NULL; // a dimension attached to this chart
75 +
76 + if(unlikely(!st)) {
77 + // we haven't created this chart before
78 + // create it now
79 + st = rrdset_create_localhost(
80 + "type"
81 + , "id"
82 + , "name"
83 + , "family"
84 + , "context"
85 + , "Chart Title"
86 + , "units"
87 + , "plugin-name"
88 + , "module-name"
89 + , priority
90 + , update_every
91 + , chart_type
92 + );
93 +
94 + // attach a metric to it
95 + rd = rrddim_add(st, "id", "name", multiplier, divider, algorithm);
96 + }
97 + else {
98 + // this chart is already created
99 + // let netdata know we start a new iteration on it
100 + rrdset_next(st);
101 + }
102 +
103 + // give the collected value(s) to the chart
104 + rrddim_set_by_pointer(st, rd, collected_value);
105 +
106 + // signal netdata we are done with this iteration
107 + rrdset_done(st);
108 +}
109 +```
110 +
111 +Of course netdata has a lot of libraries to help you also in collecting the metrics.
112 +The best way to find your way through this, is to examine what other similar plugins do.
113 +
114 +
115 +### External Plugins
116 +
117 +**External plugins** use the API and are managed by [plugins.d](plugins.d/).
118 +
collectors/all.h renamed
+8 -7
@@ -3,22 +3,23 @@
3 #ifndef NETDATA_ALL_H
4 #define NETDATA_ALL_H 1
5
6 -#include "../common.h"
6 +#include "../daemon/common.h"
7
8 // netdata internal data collection plugins
9
10 #include "checks.plugin/plugin_checks.h"
11 #include "freebsd.plugin/plugin_freebsd.h"
12 #include "idlejitter.plugin/plugin_idlejitter.h"
13 -#include "linux-cgroups.plugin/sys_fs_cgroup.h"
14 -#include "linux-diskspace.plugin/plugin_diskspace.h"
15 -#include "linux-nfacct.plugin/plugin_nfacct.h"
16 -#include "linux-proc.plugin/plugin_proc.h"
17 -#include "linux-tc.plugin/plugin_tc.h"
13 +#include "cgroups.plugin/sys_fs_cgroup.h"
14 +#include "diskspace.plugin/plugin_diskspace.h"
15 +#include "nfacct.plugin/plugin_nfacct.h"
16 +#include "proc.plugin/plugin_proc.h"
17 +#include "tc.plugin/plugin_tc.h"
18 #include "macos.plugin/plugin_macos.h"
19 -#include "plugins.d.plugin/plugins_d.h"
19 #include "statsd.plugin/statsd.h"
20
21 +#include "plugins.d/plugins_d.h"
22 +
23
24 // ----------------------------------------------------------------------------
25 // netdata chart priorities
collectors/apps.plugin/Makefile.am new
+13
@@ -0,0 +1,13 @@
1 +# SPDX-License-Identifier: GPL-3.0-or-later
2 +
3 +AUTOMAKE_OPTIONS = subdir-objects
4 +
5 +MAINTAINERCLEANFILES = $(srcdir)/Makefile.in
6 +
7 +dist_noinst_DATA = \
8 + README.md \
9 + $(NULL)
10 +
11 +dist_libconfig_DATA = \
12 + apps_groups.conf \
13 + $(NULL)
collectors/apps.plugin/README.md new
+103
@@ -0,0 +1,103 @@
1 +# apps.plugin
2 +
3 +This plugin provides charts for 3 sections of the default dashboard:
4 +
5 +1. Per application charts
6 +2. Per user charts
7 +3. Per user group charts
8 +
9 +## Per application charts
10 +
11 +This plugin walks through the entire `/proc` filesystem and aggregates statistics for applications of interest, defined in `/etc/netdata/apps_groups.conf` (the default is [here](apps_groups.conf)) (to edit it on your system run `/etc/netdata/edit-config apps_groups.conf`).
12 +
13 +The plugin internally builds a process tree (much like `ps fax` does), and groups processes together (evaluating both child and parent processes) so that the result is always a chart with a predefined set of dimensions (of course, only application groups found running are reported).
14 +
15 +Using this information it provides the following charts (per application group defined in `/etc/netdata/apps_groups.conf` - to edit it on your system run `/etc/netdata/edit-config apps_groups.conf`):
16 +
17 +1. Total CPU usage
18 +2. Total User CPU usage
19 +3. Total System CPU usage
20 +4. Total Disk Physical Reads
21 +5. Total Disk Physical Writes
22 +6. Total Disk Logical Reads
23 +7. Total Disk Logical Writes
24 +8. Total Open Files (unique files - if a file is found open multiple times, it is counted just once)
25 +9. Total Dedicated Memory (non shared)
26 +10. Total Minor Page Faults
27 +11. Total Number of Processes
28 +12. Total Number of Threads
29 +13. Total Number of Pipes
30 +14. Total Swap Activity (Major Page Faults)
31 +15. Total Open Sockets
32 +
33 +## Per User Charts
34 +
35 +All the above charts, are also grouped by username, using the effective uid of each process.
36 +
37 +## Per Group Charts
38 +
39 +All the above charts, are also grouped by group name, using the effective gid of each process.
40 +
41 +## CPU Usage
42 +
43 +`apps.plugin` is a complex software piece and has a lot of work to do (actually this plugin requires more CPU resources that the netdata daemon). For each process running, `apps.plugin` reads several `/proc` files to get CPU usage, memory allocated, I/O usage, open file descriptors, etc. Doing this work per-second, especially on hosts with several thousands of processes, may increase the CPU resources consumed by the plugin.
44 +
45 +In such cases, you many need to lower its data collection frequency. To do this, edit `/etc/netdata/netdata.conf` and find this section:
46 +
47 +```
48 +[plugin:apps]
49 + # update every = 1
50 + # command options =
51 +```
52 +
53 +Uncomment the line `update every` and set it to a higher number. If you just set it to ` 2 `, its CPU resources will be cut in half, and data collection will be once every 2 seconds.
54 +
55 +
56 +## Configuration
57 +
58 +The configuration file is `/etc/netdata/apps_groups.conf` (the default is [here](apps_groups.conf)).
59 +To edit it on your system run `/etc/netdata/edit-config apps_groups.conf`.
60 +
61 +The configuration file works accepts multiple lines, each having this format:
62 +
63 +```txt
64 +group: process1 process2 ...
65 +```
66 +
67 +Process names should be given as they appear when running `ps -e`. The program will actually match the process names in the `/proc/PID/status` file. So, to be sure the name is right for a process running with PID ` X `, do this:
68 +
69 +```sh
70 +cat /proc/X/status
71 +```
72 +
73 +The first line on the output is `Name: xxxxx`. This is the process name `apps.plugin` sees.
74 +
75 +The order of the lines in the file is important only if you include the same process name to multiple groups.
76 +
77 +## Apps plugin is missing information
78 +
79 +`apps.plugin` requires additional privileges to collect all the information it needs. The problem is described in issue #157.
80 +
81 +When netdata is installed, `apps.plugin` is given the capabilities `cap_dac_read_search,cap_sys_ptrace+ep`. If that is not possible (i.e. `setcap` fails), `apps.plugin` is setuid to `root`.
82 +
83 +## linux capabilities in containers
84 +
85 +There are a few cases, like `docker` and `virtuozzo` containers, where `setcap` succeeds, but the capabilities are silently ignored (in `lxc` containers `setcap` fails).
86 +
87 +In these cases that `setcap` succeeds by capabilities do not work, you will have to setuid to root `apps.plugin` by running these commands:
88 +
89 +```sh
90 +chown root:netdata /usr/libexec/netdata/plugins.d/apps.plugin
91 +chmod 4750 /usr/libexec/netdata/plugins.d/apps.plugin
92 +```
93 +
94 +You will have to run these, every time you update netdata.
95 +
96 +
97 +### Is is safe to give `apps.plugin` these privileges?
98 +
99 +`apps.plugin` performs a hard-coded function of building the process tree in memory, iterating forever, collecting metrics for each running process and sending them to netdata. This is a one-way communication, from `apps.plugin` to netdata.
100 +
101 +So, since `apps.plugin` cannot be instructed by netdata for the actions it performs, we think it is pretty safe to allow it have these increased privileges.
102 +
103 +Keep in mind that `apps.plugin` will still run without these permissions, but it will not be able to collect all the data for every process.
collectors/apps.plugin/apps_groups.conf renamed
collectors/apps.plugin/apps_plugin.c renamed
collectors/cgroups.plugin/Makefile.am new
+20
@@ -0,0 +1,20 @@
1 +# SPDX-License-Identifier: GPL-3.0-or-later
2 +
3 +AUTOMAKE_OPTIONS = subdir-objects
4 +MAINTAINERCLEANFILES = $(srcdir)/Makefile.in
5 +
6 +CLEANFILES = \
7 + cgroup-name.sh \
8 + $(NULL)
9 +
10 +include $(top_srcdir)/build/subst.inc
11 +SUFFIXES = .in
12 +
13 +dist_plugins_SCRIPTS = \
14 + cgroup-name.sh \
15 + cgroup-network-helper.sh \
16 + $(NULL)
17 +
18 +dist_noinst_DATA = \
19 + cgroup-name.sh.in \
20 + $(NULL)
collectors/cgroups.plugin/cgroup-name.sh.in renamed
collectors/cgroups.plugin/cgroup-network-helper.sh renamed
collectors/cgroups.plugin/cgroup-network.c renamed
+1 -1
@@ -1,6 +1,6 @@
1 // SPDX-License-Identifier: GPL-3.0-or-later
2
3 -#include "../../common.h"
3 +#include "../../daemon/common.h"
4
5 #ifdef HAVE_SETNS
6 #ifndef _GNU_SOURCE
collectors/cgroups.plugin/sys_fs_cgroup.c renamed
collectors/cgroups.plugin/sys_fs_cgroup.h renamed
+2 -2
@@ -3,7 +3,7 @@
3 #ifndef NETDATA_SYS_FS_CGROUP_H
4 #define NETDATA_SYS_FS_CGROUP_H 1
5
6 -#include "../../common.h"
6 +#include "../../daemon/common.h"
7
8 #if (TARGET_OS == OS_LINUX)
9
@@ -20,7 +20,7 @@
20
21 extern void *cgroups_main(void *ptr);
22
23 -#include "../linux-proc.plugin/plugin_proc.h"
23 +#include "../proc.plugin/plugin_proc.h"
24
25 #else // (TARGET_OS == OS_LINUX)
26
collectors/charts.d.plugin/Makefile.am new
+94
@@ -0,0 +1,94 @@
1 +# SPDX-License-Identifier: GPL-3.0-or-later
2 +
3 +MAINTAINERCLEANFILES = $(srcdir)/Makefile.in
4 +
5 +CLEANFILES = \
6 + charts.d.plugin \
7 + $(NULL)
8 +
9 +include $(top_srcdir)/build/subst.inc
10 +SUFFIXES = .in
11 +
12 +dist_libconfig_DATA = \
13 + charts.d.conf \
14 + $(NULL)
15 +
16 +dist_plugins_SCRIPTS = \
17 + charts.d.dryrun-helper.sh \
18 + charts.d.plugin \
19 + loopsleepms.sh.inc \
20 + $(NULL)
21 +
22 +dist_noinst_DATA = \
23 + charts.d.plugin.in \
24 + ap/README.md \
25 + apache/README.md \
26 + apcupsd/README.md \
27 + cpu_apps/README.md \
28 + cpufreq/README.md \
29 + example/README.md \
30 + exim/README.md \
31 + hddtemp/README.md \
32 + libreswan/README.md \
33 + load_average/README.md \
34 + mem_apps/README.md \
35 + mysql/README.md \
36 + nginx/README.md \
37 + nut/README.md \
38 + opensips/README.md \
39 + phpfpm/README.md \
40 + postfix/README.md \
41 + sensors/README.md \
42 + squid/README.md \
43 + tomcat/README.md \
44 + $(NULL)
45 +
46 +dist_charts_SCRIPTS = \
47 + $(NULL)
48 +
49 +dist_charts_DATA = \
50 + ap/ap.chart.sh \
51 + apcupsd/apcupsd.chart.sh \
52 + apache/apache.chart.sh \
53 + cpu_apps/cpu_apps.chart.sh \
54 + cpufreq/cpufreq.chart.sh \
55 + example/example.chart.sh \
56 + exim/exim.chart.sh \
57 + hddtemp/hddtemp.chart.sh \
58 + libreswan/libreswan.chart.sh \
59 + load_average/load_average.chart.sh \
60 + mem_apps/mem_apps.chart.sh \
61 + mysql/mysql.chart.sh \
62 + nginx/nginx.chart.sh \
63 + nut/nut.chart.sh \
64 + opensips/opensips.chart.sh \
65 + phpfpm/phpfpm.chart.sh \
66 + postfix/postfix.chart.sh \
67 + sensors/sensors.chart.sh \
68 + squid/squid.chart.sh \
69 + tomcat/tomcat.chart.sh \
70 + $(NULL)
71 +
72 +chartsconfigdir=$(libconfigdir)/charts.d
73 +dist_chartsconfig_DATA = \
74 + ap/ap.conf \
75 + apache/apache.conf \
76 + apcupsd/apcupsd.conf \
77 + cpu_apps/cpu_apps.conf \
78 + cpufreq/cpufreq.conf \
79 + example/example.conf \
80 + exim/exim.conf \
81 + hddtemp/hddtemp.conf \
82 + libreswan/libreswan.conf \
83 + load_average/load_average.conf \
84 + mem_apps/mem_apps.conf \
85 + mysql/mysql.conf \
86 + nginx/nginx.conf \
87 + nut/nut.conf \
88 + opensips/opensips.conf \
89 + phpfpm/phpfpm.conf \
90 + postfix/postfix.conf \
91 + sensors/sensors.conf \
92 + squid/squid.conf \
93 + tomcat/tomcat.conf \
94 + $(NULL)
collectors/charts.d.plugin/README.md new
+193
@@ -0,0 +1,193 @@
1 +# charts.d.plugin
2 +
3 +`charts.d.plugin` is a netdata external plugin. It is an **orchestrator** for data collection modules written in `BASH` v4+.
4 +
5 +1. It runs as an independent process `ps fax` shows it
6 +2. It is started and stopped automatically by netdata
7 +3. It communicates with netdata via a unidirectional pipe (sending data to the netdata daemon)
8 +4. Supports any number of data collection **modules**
9 +
10 +`charts.d.plugin` has been designed so that the actual script that will do data collection will be permanently in
11 +memory, collecting data with as little overheads as possible
12 +(i.e. initialize once, repeatedly collect values with minimal overhead).
13 +
14 +`charts.d.plugin` looks for scripts in `/usr/lib/netdata/charts.d`.
15 +The scripts should have the filename suffix: `.chart.sh`.
16 +
17 +## Configuration
18 +
19 +`charts.d.plugin` itself can be configured using the configuration file `/etc/netdata/charts.d.conf`
20 +(to edit it on your system run `/etc/netdata/edit-config charts.d.conf`). This file is also a BASH script.
21 +
22 +In this file, you can place statements like this:
23 +
24 +```
25 +enable_all_charts="yes"
26 +X="yes"
27 +Y="no"
28 +```
29 +
30 +where `X` and `Y` are the names of individual charts.d collector scripts.
31 +When set to `yes`, charts.d will evaluate the collector script (see below).
32 +When set to `no`, charts.d will ignore the collector script.
33 +
34 +The variable `enable_all_charts` sets the default enable/disable state for all charts.
35 +
36 +## A charts.d module
37 +
38 +A `charts.d.plugin` module is a BASH script defining a few functions.
39 +
40 +For a module called `X`, the following criteria must be met:
41 +
42 +1. The module script must be called `X.chart.sh` and placed in `/usr/libexec/netdata/charts.d`.
43 +
44 +2. If the module needs a configuration, it should be called `X.conf` and placed in `/etc/netdata/charts.d`.
45 + The configuration file `X.conf` is also a BASH script itself.
46 + To edit the default files supplied by netdata run `/etc/netdata/edit-config charts.d/X.conf`,
47 + where `X` is the name of the module.
48 +
49 +3. All functions and global variables defined in the script and its configuration, must begin with `X_`.
50 +
51 +4. The following functions must be defined:
52 +
53 + - `X_check()` - returns 0 or 1 depending on whether the module is able to run or not
54 + (following the standard Linux command line return codes: 0 = OK, the collector can operate and 1 = FAILED,
55 + the collector cannot be used).
56 +
57 + - `X_create()` - creates the netdata charts, following the standard netdata plugin guides as described in
58 + **[External Plugins](../plugins.d/)** (commands `CHART` and `DIMENSION`).
59 + The return value does matter: 0 = OK, 1 = FAILED.
60 +
61 + - `X_update()` - collects the values for the defined charts, following the standard netdata plugin guides
62 + as described in **[External Plugins](../plugins.d/)** (commands `BEGIN`, `SET`, `END`).
63 + The return value also matters: 0 = OK, 1 = FAILED.
64 +
65 +5. The following global variables are available to be set:
66 + - `X_update_every` - is the data collection frequency for the module script, in seconds.
67 +
68 +The module script may use more functions or variables. But all of them must begin with `X_`.
69 +
70 +The standard netdata plugin variables are also available (check **[External Plugins](../plugins.d/)**).
71 +
72 +### X_check()
73 +
74 +The purpose of the BASH function `X_check()` is to check if the module can collect data (or check its config).
75 +
76 +For example, if the module is about monitoring a local mysql database, the `X_check()` function may attempt to
77 +connect to a local mysql database to find out if it can read the values it needs.
78 +
79 +`X_check()` is run only once for the lifetime of the module.
80 +
81 +### X_create()
82 +
83 +The purpose of the BASH function `X_create()` is to create the charts and dimensions using the standard netdata
84 +plugin guides (**[External Plugins](../plugins.d/)**).
85 +
86 +`X_create()` will be called just once and only after `X_check()` was successful.
87 +You can however call it yourself when there is need for it (for example to add a new dimension to an existing chart).
88 +
89 +A non-zero return value will disable the collector.
90 +
91 +### X_update()
92 +
93 +`X_update()` will be called repeatedly every `X_update_every` seconds, to collect new values and send them to netdata,
94 +following the netdata plugin guides (**[External Plugins](../plugins.d/)**).
95 +
96 +The function will be called with one parameter: microseconds since the last time it was run. This value should be
97 +appended to the `BEGIN` statement of every chart updated by the collector script.
98 +
99 +A non-zero return value will disable the collector.
100 +
101 +### Useful functions charts.d provides
102 +
103 +Module scripts can use the following charts.d functions:
104 +
105 +#### require_cmd command
106 +
107 +`require_cmd()` will check if a command is available in the running system.
108 +
109 +For example, your `X_check()` function may use it like this:
110 +
111 +```sh
112 +mysql_check() {
113 + require_cmd mysql || return 1
114 + return 0
115 +}
116 +```
117 +
118 +Using the above, if the command `mysql` is not available in the system, the `mysql` module will be disabled.
119 +
120 +#### fixid "string"
121 +
122 +`fixid()` will get a string and return a properly formatted id for a chart or dimension.
123 +
124 +This is an expensive function that should not be used in `X_update()`.
125 +You can keep the generated id in a BASH associative array to have the values availables in `X_update()`, like this:
126 +
127 +```sh
128 +declare -A X_ids=()
129 +X_create() {
130 + local name="a very bad name for id"
131 +
132 + X_ids[$name]="$(fixid "$name")"
133 +}
134 +
135 +X_update() {
136 + local microseconds="$1"
137 +
138 + ...
139 + local name="a very bad name for id"
140 + ...
141 +
142 + echo "BEGIN ${X_ids[$name]} $microseconds"
143 + ...
144 +}
145 +```
146 +
147 +### Debugging your collectors
148 +
149 +You can run `charts.d.plugin` by hand with something like this:
150 +
151 +```sh
152 +# become user netdata
153 +sudo su -s /bin/sh netdata
154 +
155 +# run the plugin in debug mode
156 +/usr/libexec/netdata/plugins.d/charts.d.plugin debug 1 X Y Z
157 +```
158 +
159 +Charts.d will run in `debug` mode, with an update frequency of `1`, evaluating only the collector scripts
160 +`X`, `Y` and `Z`. You can define zero or more module scripts. If none is defined, charts.d will evaluate all
161 +module scripts available.
162 +
163 +Keep in mind that if your configs are not in `/etc/netdata`, you should do the following before running
164 +`charts.d.plugin`:
165 +
166 +```sh
167 +export NETDATA_USER_CONFIG_DIR="/path/to/etc/netdata"
168 +```
169 +
170 +Also, remember that netdata runs `chart.d.plugin` as user `netdata` (or any other user netdata is configured to run as).
171 +
172 +
173 +## Running multiple instances of charts.d.plugin
174 +
175 +`charts.d.plugin` will call the `X_update()` function one after another. This means that a delay in collector `X`
176 +will also delay the collection of `Y` and `Z`.
177 +
178 +You can have multiple `charts.d.plugin` running to overcome this problem.
179 +
180 +This is what you need to do:
181 +
182 +1. Decide a new name for the new charts.d instance: example `charts2.d`.
183 +
184 +2. Create/edit the files `/etc/netdata/charts.d.conf` and `/etc/netdata/charts2.d.conf` and enable / disable the
185 + module you want each to run. Remember to set `enable_all_charts="no"` to both of them, and enable the individual
186 + modules for each.
187 +
188 +3. link `/usr/libexec/netdata/plugins.d/charts.d.plugin` to `/usr/libexec/netdata/plugins.d/charts2.d.plugin`.
189 + Netdata will spawn a new charts.d process.
190 +
191 +Execute the above in this order, since netdata will (by default) attempt to start new plugins soon after they are
192 +created in `/usr/libexec/netdata/plugins.d/`.
193 +
collectors/charts.d.plugin/ap/README.md new
+86
@@ -0,0 +1,86 @@
1 +# Access Point Plugin (ap)
2 +
3 +The `ap` collector visualizes data related to access points.
4 +
5 +The source code is [here](https://github.com/netdata/netdata/blob/master/charts.d/ap.chart.sh).
6 +
7 +## Example netdata charts
8 +
9 +![image](https://cloud.githubusercontent.com/assets/2662304/12377654/9f566e88-bd2d-11e5-855a-e0ba96b8fd98.png)
10 +
11 +## How it works
12 +
13 +It does the following:
14 +
15 +1. Runs `iw dev` searching for interfaces that have `type AP`.
16 +
17 + From the same output it collects the SSIDs each AP supports by looking for lines `ssid NAME`.
18 +
19 + Example:
20 +```sh
21 +# iw dev
22 +phy#0
23 + Interface wlan0
24 + ifindex 3
25 + wdev 0x1
26 + addr 7c:dd:90:77:34:2a
27 + ssid TSAOUSIS
28 + type AP
29 + channel 7 (2442 MHz), width: 20 MHz, center1: 2442 MHz
30 +```
31 +
32 +
33 +2. For each interface found, it runs `iw INTERFACE station dump`.
34 +
35 + From the output is collects:
36 +
37 + - rx/tx bytes
38 + - rx/tx packets
39 + - tx retries
40 + - tx failed
41 + - signal strength
42 + - rx/tx bitrate
43 + - expected throughput
44 +
45 + Example:
46 +
47 +```sh
48 +# iw wlan0 station dump
49 +Station 40:b8:37:5a:ed:5e (on wlan0)
50 + inactive time: 910 ms
51 + rx bytes: 15588897
52 + rx packets: 127772
53 + tx bytes: 52257763
54 + tx packets: 95802
55 + tx retries: 2162
56 + tx failed: 28
57 + signal: -43 dBm
58 + signal avg: -43 dBm
59 + tx bitrate: 65.0 MBit/s MCS 7
60 + rx bitrate: 1.0 MBit/s
61 + expected throughput: 32.125Mbps
62 + authorized: yes
63 + authenticated: yes
64 + preamble: long
65 + WMM/WME: yes
66 + MFP: no
67 + TDLS peer: no
68 +```
69 +
70 +3. For each interface found, it creates 6 charts:
71 +
72 + - Number of Connected clients
73 + - Bandwidth for all clients
74 + - Packets for all clients
75 + - Transmit Issues for all clients
76 + - Average Signal among all clients
77 + - Average Bitrate (including average expected throughput) among all clients
78 +
79 +## Configuration
80 +
81 +You can only set `ap_update_every=NUMBER` to `/etc/netdata/charts.d/ap.conf`, to give the data collection frequency.
82 +To edit this file on your system run `/etc/netdata/edit-config charts.d/ap.conf`.
83 +
84 +## Auto-detection
85 +
86 +The plugin is able to auto-detect if you are running access points on your linux box.
collectors/charts.d.plugin/ap/ap.chart.sh renamed
collectors/charts.d.plugin/ap/ap.conf renamed
collectors/charts.d.plugin/apache/README.md new
+2
@@ -0,0 +1,2 @@
1 +> THIS MODULE IS OBSOLETE.
2 +> USE THE PYTHON ONE - IT SUPPORTS MULTIPLE JOBS AND IT IS MORE EFFICIENT
collectors/charts.d.plugin/apache/apache.chart.sh renamed
collectors/charts.d.plugin/apache/apache.conf renamed
collectors/charts.d.plugin/apcupsd/README.md renamed
collectors/charts.d.plugin/apcupsd/apcupsd.chart.sh renamed
collectors/charts.d.plugin/apcupsd/apcupsd.conf renamed
collectors/charts.d.plugin/charts.d.conf renamed
collectors/charts.d.plugin/charts.d.dryrun-helper.sh renamed
collectors/charts.d.plugin/charts.d.plugin.in renamed
collectors/charts.d.plugin/cpu_apps/README.md new
+2
@@ -0,0 +1,2 @@
1 +> THIS MODULE IS OBSOLETE.
2 +> USE APPS.PLUGIN.
collectors/charts.d.plugin/cpu_apps/cpu_apps.chart.sh renamed
collectors/charts.d.plugin/cpu_apps/cpu_apps.conf renamed
collectors/charts.d.plugin/cpufreq/README.md new
+2
@@ -0,0 +1,2 @@
1 +> THIS MODULE IS OBSOLETE.
2 +> USE THE PYTHON ONE - IT SUPPORTS MULTIPLE JOBS AND IT IS MORE EFFICIENT
collectors/charts.d.plugin/cpufreq/cpufreq.chart.sh renamed
collectors/charts.d.plugin/cpufreq/cpufreq.conf renamed
collectors/charts.d.plugin/example/README.md new
+2
@@ -0,0 +1,2 @@
1 +This is just an example charts.d data collector.
2 +
collectors/charts.d.plugin/example/example.chart.sh renamed
collectors/charts.d.plugin/example/example.conf renamed
collectors/charts.d.plugin/exim/README.md new
+2
@@ -0,0 +1,2 @@
1 +> THIS MODULE IS OBSOLETE.
2 +> USE THE PYTHON ONE - IT SUPPORTS MULTIPLE JOBS AND IT IS MORE EFFICIENT
collectors/charts.d.plugin/exim/exim.chart.sh renamed
collectors/charts.d.plugin/exim/exim.conf renamed
collectors/charts.d.plugin/hddtemp/README.md new
+28
@@ -0,0 +1,28 @@
1 +> THIS MODULE IS OBSOLETE.
2 +> USE THE PYTHON ONE - IT SUPPORTS MULTIPLE JOBS AND IT IS MORE EFFICIENT
3 +
4 +# hddtemp
5 +
6 +The plugin will collect temperatures from disks
7 +
8 +It will create one chart with all active disks
9 +
10 +1. **temperature in Celsius**
11 +
12 +### configuration
13 +
14 +hddtemp needs to be running in daemonized mode
15 +
16 +```sh
17 +# host with daemonized hddtemp
18 +hddtemp_host="localhost"
19 +
20 +# port on which hddtemp is showing data
21 +hddtemp_port="7634"
22 +
23 +# array of included disks
24 +# the default is to include all
25 +hddtemp_disks=()
26 +```
27 +
28 +---
collectors/charts.d.plugin/hddtemp/hddtemp.chart.sh renamed
collectors/charts.d.plugin/hddtemp/hddtemp.conf renamed
collectors/charts.d.plugin/libreswan/README.md new
+42
@@ -0,0 +1,42 @@
1 +# libreswan
2 +
3 +The plugin will collects bytes-in, bytes-out and uptime for all established libreswan IPSEC tunnels.
4 +
5 +The following charts are created, **per tunnel**:
6 +
7 +1. **Uptime**
8 +
9 + * the uptime of the tunnel
10 +
11 +2. **Traffic**
12 +
13 + * bytes in
14 + * bytes out
15 +
16 +### configuration
17 +
18 +Its config file is `/etc/netdata/charts.d/libreswan.conf`.
19 +
20 +The plugin executes 2 commands to collect all the information it needs:
21 +
22 +```sh
23 +ipsec whack --status
24 +ipsec whack --trafficstatus
25 +```
26 +
27 +The first command is used to extract the currently established tunnels, their IDs and their names.
28 +The second command is used to extract the current uptime and traffic.
29 +
30 +Most probably user `netdata` will not be able to query libreswan, so the `ipsec` commands will be denied.
31 +The plugin attempts to run `ipsec` as `sudo ipsec ...`, to get access to libreswan statistics.
32 +
33 +To allow user `netdata` execute `sudo ipsec ...`, create the file `/etc/sudoers.d/netdata` with this content:
34 +
35 +```
36 +netdata ALL = (root) NOPASSWD: /sbin/ipsec whack --status
37 +netdata ALL = (root) NOPASSWD: /sbin/ipsec whack --trafficstatus
38 +```
39 +
40 +Make sure the path `/sbin/ipsec` matches your setup (execute `which ipsec` to find the right path).
41 +
42 +---
collectors/charts.d.plugin/libreswan/libreswan.chart.sh renamed
collectors/charts.d.plugin/libreswan/libreswan.conf renamed
collectors/charts.d.plugin/load_average/README.md new
+2
@@ -0,0 +1,2 @@
1 +> THIS MODULE IS OBSOLETE.
2 +> THE NETDATA DAEMON COLLECTS LOAD AVERAGE BY ITSELF
collectors/charts.d.plugin/load_average/load_average.chart.sh renamed
collectors/charts.d.plugin/load_average/load_average.conf renamed
collectors/charts.d.plugin/loopsleepms.sh.inc renamed
collectors/charts.d.plugin/mem_apps/README.md new
+2
@@ -0,0 +1,2 @@
1 +> THIS MODULE IS OBSOLETE.
2 +> USE APPS.PLUGIN.
collectors/charts.d.plugin/mem_apps/mem_apps.chart.sh renamed
collectors/charts.d.plugin/mem_apps/mem_apps.conf renamed
collectors/charts.d.plugin/mysql/README.md new
+81
@@ -0,0 +1,81 @@
1 +> THIS MODULE IS OBSOLETE.
2 +> USE THE PYTHON ONE - IT SUPPORTS MULTIPLE JOBS AND IT IS MORE EFFICIENT
3 +
4 +# mysql
5 +
6 +The plugin will monitor one or more mysql servers
7 +
8 +It will produce the following charts:
9 +
10 +1. **Bandwidth** in kbps
11 + * in
12 + * out
13 +
14 +2. **Queries** in queries/sec
15 + * queries
16 + * questions
17 + * slow queries
18 +
19 +3. **Operations** in operations/sec
20 + * opened tables
21 + * flush
22 + * commit
23 + * delete
24 + * prepare
25 + * read first
26 + * read key
27 + * read next
28 + * read prev
29 + * read random
30 + * read random next
31 + * rollback
32 + * save point
33 + * update
34 + * write
35 +
36 +4. **Table Locks** in locks/sec
37 + * immediate
38 + * waited
39 +
40 +5. **Select Issues** in issues/sec
41 + * full join
42 + * full range join
43 + * range
44 + * range check
45 + * scan
46 +
47 +6. **Sort Issues** in issues/sec
48 + * merge passes
49 + * range
50 + * scan
51 +
52 +### configuration
53 +
54 +You can configure many database servers, like this:
55 +
56 +You can provide, per server, the following:
57 +
58 +1. a name, anything you like, but keep it short
59 +2. the mysql command to connect to the server
60 +3. the mysql command line options to be used for connecting to the server
61 +
62 +Here is an example for 2 servers:
63 +
64 +```sh
65 +mysql_opts[server1]="-h server1.example.com"
66 +mysql_opts[server2]="-h server2.example.com --connect_timeout 2"
67 +```
68 +
69 +The above will use the `mysql` command found in the system path.
70 +You can also provide a custom mysql command per server, like this:
71 +
72 +```sh
73 +mysql_cmds[server2]="/opt/mysql/bin/mysql"
74 +```
75 +
76 +The above sets the mysql command only for server2. server1 will use the system default.
77 +
78 +If no configuration is given, the plugin will attempt to connect to mysql server at localhost.
79 +
80 +
81 +---
collectors/charts.d.plugin/mysql/mysql.chart.sh renamed
collectors/charts.d.plugin/mysql/mysql.conf renamed
collectors/charts.d.plugin/nginx/README.md new
+2
@@ -0,0 +1,2 @@
1 +> THIS MODULE IS OBSOLETE.
2 +> USE THE PYTHON ONE - IT SUPPORTS MULTIPLE JOBS AND IT IS MORE EFFICIENT
collectors/charts.d.plugin/nginx/nginx.chart.sh renamed
collectors/charts.d.plugin/nginx/nginx.conf renamed
collectors/charts.d.plugin/nut/README.md new
+59
@@ -0,0 +1,59 @@
1 +# nut
2 +
3 +The plugin will collect UPS data for all UPSes configured in the system.
4 +
5 +The following charts will be created:
6 +
7 +1. **UPS Charge**
8 +
9 + * percentage changed
10 +
11 +2. **UPS Battery Voltage**
12 +
13 + * current voltage
14 + * high voltage
15 + * low voltage
16 + * nominal voltage
17 +
18 +3. **UPS Input Voltage**
19 +
20 + * current voltage
21 + * fault voltage
22 + * nominal voltage
23 +
24 +4. **UPS Input Current**
25 +
26 + * nominal current
27 +
28 +5. **UPS Input Frequency**
29 +
30 + * current frequency
31 + * nominal frequency
32 +
33 +6. **UPS Output Voltage**
34 +
35 + * current voltage
36 +
37 +7. **UPS Load**
38 +
39 + * current load
40 +
41 +8. **UPS Temperature**
42 +
43 + * current temperature
44 +
45 +
46 +### configuration
47 +
48 +This is the internal default for `/etc/netdata/nut.conf`
49 +
50 +```sh
51 +# a space separated list of UPS names
52 +# if empty, the list returned by 'upsc -l' will be used
53 +nut_ups=
54 +
55 +# how frequently to collect UPS data
56 +nut_update_every=2
57 +```
58 +
59 +---
collectors/charts.d.plugin/nut/nut.chart.sh renamed
collectors/charts.d.plugin/nut/nut.conf renamed
collectors/charts.d.plugin/opensips/README.md renamed
collectors/charts.d.plugin/opensips/opensips.chart.sh renamed
collectors/charts.d.plugin/opensips/opensips.conf renamed
collectors/charts.d.plugin/phpfpm/README.md new
+2
@@ -0,0 +1,2 @@
1 +> THIS MODULE IS OBSOLETE.
2 +> USE THE PYTHON ONE - IT SUPPORTS MULTIPLE JOBS AND IT IS MORE EFFICIENT
collectors/charts.d.plugin/phpfpm/phpfpm.chart.sh renamed
collectors/charts.d.plugin/phpfpm/phpfpm.conf renamed
collectors/charts.d.plugin/postfix/README.md new
+26
@@ -0,0 +1,26 @@
1 +> THIS MODULE IS OBSOLETE.
2 +> USE THE PYTHON ONE - IT SUPPORTS MULTIPLE JOBS AND IT IS MORE EFFICIENT
3 +
4 +# postfix
5 +
6 +The plugin will collect the postfix queue size.
7 +
8 +It will create two charts:
9 +
10 +1. **queue size in emails**
11 +2. **queue size in KB**
12 +
13 +### configuration
14 +
15 +This is the internal default for `/etc/netdata/postfix.conf`
16 +
17 +```sh
18 +# the postqueue command
19 +# if empty, it will use the one found in the system path
20 +postfix_postqueue=
21 +
22 +# how frequently to collect queue size
23 +postfix_update_every=15
24 +```
25 +
26 +---
collectors/charts.d.plugin/postfix/postfix.chart.sh renamed
collectors/charts.d.plugin/postfix/postfix.conf renamed
collectors/charts.d.plugin/sensors/README.md new
+52
@@ -0,0 +1,52 @@
1 +> THIS MODULE IS OBSOLETE.
2 +> USE THE PYTHON ONE - IT SUPPORTS MULTIPLE JOBS AND IT IS MORE EFFICIENT
3 +
4 +> Unlike the python one, this module can collect temperature on RPi.
5 +
6 +# sensors
7 +
8 +The plugin will provide charts for all configured system sensors
9 +
10 +> This plugin is reading sensors directly from the kernel.
11 +> The `lm-sensors` package is able to perform calculations on the
12 +> kernel provided values, this plugin will not perform.
13 +> So, the values graphed, are the raw hardware values of the sensors.
14 +
15 +The plugin will create netdata charts for:
16 +
17 +1. **Temperature**
18 +2. **Voltage**
19 +3. **Current**
20 +4. **Power**
21 +5. **Fans Speed**
22 +6. **Energy**
23 +7. **Humidity**
24 +
25 +One chart for every sensor chip found and each of the above will be created.
26 +
27 +### configuration
28 +
29 +This is the internal default for `/etc/netdata/sensors.conf`
30 +
31 +```sh
32 +# the directory the kernel keeps sensor data
33 +sensors_sys_dir="${NETDATA_HOST_PREFIX}/sys/devices"
34 +
35 +# how deep in the tree to check for sensor data
36 +sensors_sys_depth=10
37 +
38 +# if set to 1, the script will overwrite internal
39 +# script functions with code generated ones
40 +# leave to 1, is faster
41 +sensors_source_update=1
42 +
43 +# how frequently to collect sensor data
44 +# the default is to collect it at every iteration of charts.d
45 +sensors_update_every=
46 +
47 +# array of sensors which are excluded
48 +# the default is to include all
49 +sensors_excluded=()
50 +```
51 +
52 +---
collectors/charts.d.plugin/sensors/sensors.chart.sh renamed
collectors/charts.d.plugin/sensors/sensors.conf renamed
collectors/charts.d.plugin/squid/README.md new
+66
@@ -0,0 +1,66 @@
1 +> THIS MODULE IS OBSOLETE.
2 +> USE THE PYTHON ONE - IT SUPPORTS MULTIPLE JOBS AND IT IS MORE EFFICIENT
3 +
4 +
5 +# squid
6 +
7 +The plugin will monitor a squid server.
8 +
9 +It will produce 4 charts:
10 +
11 +1. **Squid Client Bandwidth** in kbps
12 +
13 + * in
14 + * out
15 + * hits
16 +
17 +2. **Squid Client Requests** in requests/sec
18 +
19 + * requests
20 + * hits
21 + * errors
22 +
23 +3. **Squid Server Bandwidth** in kbps
24 +
25 + * in
26 + * out
27 +
28 +4. **Squid Server Requests** in requests/sec
29 +
30 + * requests
31 + * errors
32 +
33 +### autoconfig
34 +
35 +The plugin will by itself detect squid servers running on
36 +localhost, on ports 3128 or 8080.
37 +
38 +It will attempt to download URLs in the form:
39 +
40 +- `cache_object://HOST:PORT/counters`
41 +- `/squid-internal-mgr/counters`
42 +
43 +If any succeeds, it will use this.
44 +
45 +### configuration
46 +
47 +If you need to configure it by hand, create the file
48 +`/etc/netdata/squid.conf` with the following variables:
49 +
50 +- `squid_host=IP` the IP of the squid host
51 +- `squid_port=PORT` the port the squid is listening
52 +- `squid_url="URL"` the URL with the statistics to be fetched from squid
53 +- `squid_timeout=SECONDS` how much time we should wait for squid to respond
54 +- `squid_update_every=SECONDS` the frequency of the data collection
55 +
56 +Example `/etc/netdata/squid.conf`:
57 +
58 +```sh
59 +squid_host=127.0.0.1
60 +squid_port=3128
61 +squid_url="cache_object://127.0.0.1:3128/counters"
62 +squid_timeout=2
63 +squid_update_every=5
64 +```
65 +
66 +---
collectors/charts.d.plugin/squid/squid.chart.sh renamed
collectors/charts.d.plugin/squid/squid.conf renamed
collectors/charts.d.plugin/tomcat/README.md new
+2
@@ -0,0 +1,2 @@
1 +> THIS MODULE IS OBSOLETE.
2 +> USE THE PYTHON ONE - IT SUPPORTS MULTIPLE JOBS AND IT IS MORE EFFICIENT
collectors/charts.d.plugin/tomcat/tomcat.chart.sh renamed
collectors/charts.d.plugin/tomcat/tomcat.conf renamed
collectors/checks.plugin/Makefile.am renamed
+1 -1
@@ -1,4 +1,4 @@
1 # SPDX-License-Identifier: GPL-3.0-or-later
2
3 AUTOMAKE_OPTIONS = subdir-objects
4 -MAINTAINERCLEANFILES = Makefile.in
4 +MAINTAINERCLEANFILES = $(srcdir)/Makefile.in
collectors/checks.plugin/plugin_checks.c renamed
collectors/checks.plugin/plugin_checks.h renamed
+1 -1
@@ -3,7 +3,7 @@
3 #ifndef NETDATA_PLUGIN_CHECKS_H
4 #define NETDATA_PLUGIN_CHECKS_H 1
5
6 -#include "../../common.h"
6 +#include "../../daemon/common.h"
7
8 #ifdef NETDATA_INTERNAL_CHECKS
9
collectors/diskspace.plugin/Makefile.am new
+8
@@ -0,0 +1,8 @@
1 +# SPDX-License-Identifier: GPL-3.0-or-later
2 +
3 +AUTOMAKE_OPTIONS = subdir-objects
4 +MAINTAINERCLEANFILES = $(srcdir)/Makefile.in
5 +
6 +dist_noinst_DATA = \
7 + README.md \
8 + $(NULL)
collectors/diskspace.plugin/README.md new
+5
@@ -0,0 +1,5 @@
1 +> for disks performance monitoring, see the `proc` plugin, [here](../linux-proc.plugin/#monitoring-disks-performance-with-netdata)
2 +
3 +# diskspace.plugin
4 +
5 +This plugin monitors the disk space usage of mounted disks, under Linux.
collectors/diskspace.plugin/plugin_diskspace.c renamed
collectors/diskspace.plugin/plugin_diskspace.h renamed
+2 -2
@@ -3,7 +3,7 @@
3 #ifndef NETDATA_PLUGIN_PROC_DISKSPACE_H
4 #define NETDATA_PLUGIN_PROC_DISKSPACE_H
5
6 -#include "../../common.h"
6 +#include "../../daemon/common.h"
7
8
9 #if (TARGET_OS == OS_LINUX)
@@ -21,7 +21,7 @@
21
22 extern void *diskspace_main(void *ptr);
23
24 -#include "../linux-proc.plugin/plugin_proc.h"
24 +#include "../proc.plugin/plugin_proc.h"
25
26 #else // (TARGET_OS == OS_LINUX)
27
collectors/fping.plugin/Makefile.am new
+24
@@ -0,0 +1,24 @@
1 +# SPDX-License-Identifier: GPL-3.0-or-later
2 +
3 +AUTOMAKE_OPTIONS = subdir-objects
4 +MAINTAINERCLEANFILES = $(srcdir)/Makefile.in
5 +
6 +CLEANFILES = \
7 + fping.plugin \
8 + $(NULL)
9 +
10 +include $(top_srcdir)/build/subst.inc
11 +SUFFIXES = .in
12 +
13 +dist_plugins_SCRIPTS = \
14 + fping.plugin \
15 + $(NULL)
16 +
17 +dist_noinst_DATA = \
18 + fping.plugin.in \
19 + README.md \
20 + $(NULL)
21 +
22 +dist_libconfig_DATA = \
23 + fping.conf \
24 + $(NULL)
collectors/fping.plugin/README.md new
+103
@@ -0,0 +1,103 @@
1 +# fping.plugin
2 +
3 +The fping plugin supports monitoring latency, packet loss and uptime of any number of hosts, by pinging them with fping.
4 +
5 +A recent version of `fping` is required (one that supports option ` -N `). The supplied plugin can install it. Run:
6 +
7 +```sh
8 +/usr/libexec/netdata/plugins.d/fping.plugin install
9 +```
10 +
11 +The above will download, build and install the right version as `/usr/local/bin/fping`.
12 +
13 +Then you need to edit `/etc/netdata/fping.conf` (to edit it on your system run `/etc/netdata/edit-config fping.conf`) like this:
14 +
15 +```sh
16 +# uncomment the following line - it should already be there
17 +fping="/usr/local/bin/fping"
18 +
19 +# set here all the hosts you need to ping
20 +# I suggest to use hostnames and put their IPs in /etc/hosts
21 +hosts="host1 host2 host3"
22 +
23 +# override the chart update frequency - the default is inherited from netdata
24 +update_every=1
25 +
26 +# time in milliseconds (1 sec = 1000 ms) to ping the hosts
27 +# 200 = 5 pings per second
28 +ping_every=200
29 +
30 +# other fping options - these are the defaults
31 +fping_opts="-R -b 56 -i 1 -r 0 -t 5000"
32 +```
33 +
34 +The latest version of the config: https://github.com/netdata/netdata/blob/master/conf.d/fping.conf
35 +
36 +## alarms
37 +
38 +netdata will automatically attach a few alarms for each host.
39 +Check the latest versions of the fping alarms here: https://github.com/netdata/netdata/blob/master/conf.d/health.d/fping.conf
40 +
41 +## Additional Tips
42 +
43 +### Customizing Amount of Pings Per Second
44 +
45 +For example, to update the chart every 10 seconds and use 2 pings every 10 seconds, use this:
46 +
47 +```sh
48 +# Chart Update Frequency (Time in Seconds)
49 +update_every=10
50 +
51 +# Time in Milliseconds (1 sec = 1000 ms) to Ping the Hosts
52 +# The Following Example Sends 1 Ping Every 5000 ms
53 +# Calculation Formula: ping_every = (update_every * 1000 ) / 2
54 +ping_every=5000
55 +```
56 +
57 +### Multiple fping Plugins With Different Settings
58 +
59 +You may need to run multiple fping plugins with different settings for different hosts. For example, you may need to ping a few hosts 10 times per second, and others once per second.
60 +
61 +netdata allows you to add as many `fping` plugins as you like.
62 +
63 +Follow this procedure:
64 +
65 +**1. Create New fping Configuration File**
66 +
67 +Step Into Configuration Directory
68 +
69 +```sh
70 +cd /etc/netdata
71 +```
72 +
73 +Copy Original fping Configuration File To New Configuration File
74 +
75 +```sh
76 +cp fping.conf fping2.conf
77 +```
78 +
79 +Edit `fping2.conf` and set the settings and the hosts you need
80 +
81 +**2. Soft Link Original fping Plugin to New Plugin File**
82 +
83 +Become root (If The Step Step Is Performed As Non-Root User)
84 +
85 +```sh
86 +sudo su
87 +```
88 +
89 +Step Into The Plugins Directory
90 +
91 +```sh
92 +cd /usr/libexec/netdata/plugins.d
93 +```
94 +
95 +Link fping.plugin to fping2.plugin
96 +
97 +```sh
98 +ln -s fping.plugin fping2.plugin
99 +```
100 +
101 +That's it. netdata will detect the new plugin and start it.
102 +
103 +You can name the new plugin any name you like. Just make sure the plugin and the configuration file have the same name.
collectors/fping.plugin/fping.conf renamed
collectors/fping.plugin/fping.plugin.in renamed
collectors/freebsd.plugin/Makefile.am renamed
+1 -1
@@ -1,5 +1,5 @@
1 # SPDX-License-Identifier: GPL-3.0-or-later
2
3 AUTOMAKE_OPTIONS = subdir-objects
4 -MAINTAINERCLEANFILES = Makefile.in
4
5 +MAINTAINERCLEANFILES = $(srcdir)/Makefile.in
collectors/freebsd.plugin/freebsd_devstat.c renamed
collectors/freebsd.plugin/freebsd_getifaddrs.c renamed
collectors/freebsd.plugin/freebsd_getmntinfo.c renamed
collectors/freebsd.plugin/freebsd_ipfw.c renamed
collectors/freebsd.plugin/freebsd_kstat_zfs.c renamed
collectors/freebsd.plugin/freebsd_sysctl.c renamed
collectors/freebsd.plugin/plugin_freebsd.c renamed
collectors/freebsd.plugin/plugin_freebsd.h renamed
+1 -1
@@ -3,7 +3,7 @@
3 #ifndef NETDATA_PLUGIN_FREEBSD_H
4 #define NETDATA_PLUGIN_FREEBSD_H 1
5
6 -#include "../../common.h"
6 +#include "../../daemon/common.h"
7
8 #if (TARGET_OS == OS_FREEBSD)
9
collectors/freeipmi.plugin/Makefile.am new
+8
@@ -0,0 +1,8 @@
1 +# SPDX-License-Identifier: GPL-3.0-or-later
2 +
3 +AUTOMAKE_OPTIONS = subdir-objects
4 +MAINTAINERCLEANFILES = $(srcdir)/Makefile.in
5 +
6 +dist_noinst_DATA = \
7 + README.md \
8 + $(NULL)
collectors/freeipmi.plugin/README.md new
+180
@@ -0,0 +1,180 @@
1 +netdata has a [freeipmi](https://www.gnu.org/software/freeipmi/) plugin.
2 +
3 +> FreeIPMI provides in-band and out-of-band IPMI software based on the IPMI v1.5/2.0 specification. The IPMI specification defines a set of interfaces for platform management and is implemented by a number vendors for system management. The features of IPMI that most users will be interested in are sensor monitoring, system event monitoring, power control, and serial-over-LAN (SOL).
4 +
5 +## compile `freeipmi.plugin`
6 +
7 +1. install `libipmimonitoring-dev` or `libipmimonitoring-devel` (`freeipmi-devel` on RHEL based OS) using the package manager of your system.
8 +
9 +2. re-install netdata from source. The installer will detect that the required libraries are now available and will also build `freeipmi.plugin`.
10 +
11 +Keep in mind IPMI requires root access, so the plugin is setuid to root.
12 +
13 +If you just installed the required IPMI tools, please run at least once the command `ipmimonitoring` and verify it returns sensors information. This command initialises IPMI configuration, so that the netdata plugin will be able to work.
14 +
15 +## netdata use
16 +
17 +The plugin creates (up to) 8 charts, based on the information collected from IPMI:
18 +
19 +1. number of sensors by state
20 +2. number of events in SEL
21 +3. Temperatures CELCIUS
22 +4. Temperatures FAHRENHEIT
23 +5. Voltages
24 +6. Currents
25 +7. Power
26 +8. Fans
27 +
28 +
29 +It also adds 2 alarms:
30 +
31 +1. Sensors in non-nominal state (i.e. warning and critical)
32 +2. SEL is non empty
33 +
34 +![image](https://cloud.githubusercontent.com/assets/2662304/23674138/88926a20-037d-11e7-89c0-20e74ee10cd1.png)
35 +
36 +The plugin does a speed test when it starts, to find out the duration needed by the IPMI processor to respond. Depending on the speed of your IPMI processor, charts may need several seconds to show up on the dashboard.
37 +
38 +## `freeipmi.plugin` configuration
39 +
40 +The plugin supports a few options. To see them, run:
41 +
42 +```sh
43 +# /usr/libexec/netdata/plugins.d/freeipmi.plugin -h
44 +
45 + netdata freeipmi.plugin 1.8.0-546-g72ce5d6b_rolling
46 + Copyright (C) 2016-2017 Costa Tsaousis <costa@tsaousis.gr>
47 + Released under GNU General Public License v3 or later.
48 + All rights reserved.
49 +
50 + This program is a data collector plugin for netdata.
51 +
52 + Available command line options:
53 +
54 + SECONDS data collection frequency
55 + minimum: 5
56 +
57 + debug enable verbose output
58 + default: disabled
59 +
60 + sel
61 + no-sel enable/disable SEL collection
62 + default: enabled
63 +
64 + hostname HOST
65 + username USER
66 + password PASS connect to remote IPMI host
67 + default: local IPMI processor
68 +
69 + sdr-cache-dir PATH directory for SDR cache files
70 + default: /tmp
71 +
72 + sensor-config-file FILE filename to read sensor configuration
73 + default: system default
74 +
75 + ignore N1,N2,N3,... sensor IDs to ignore
76 + default: none
77 +
78 + -v
79 + -V
80 + version print version and exit
81 +
82 + Linux kernel module for IPMI is CPU hungry.
83 + On Linux run this to lower kipmiN CPU utilization:
84 + # echo 10 > /sys/module/ipmi_si/parameters/kipmid_max_busy_us
85 +
86 + or create: /etc/modprobe.d/ipmi.conf with these contents:
87 + options ipmi_si kipmid_max_busy_us=10
88 +
89 + For more information:
90 + https://github.com/ktsaou/netdata/tree/master/plugins/freeipmi.plugin
91 +
92 +```
93 +
94 +You can set these options in `/etc/netdata/netdata.conf` at this section:
95 +
96 +```
97 +[plugin:freeipmi]
98 + update every = 5
99 + command options =
100 +```
101 +
102 +Append to `command options = ` the settings you need. The minimum `update every` is 5 (enforced internally by the plugin). IPMI is slow and CPU hungry. So, once every 5 seconds is pretty acceptable.
103 +
104 +## ignoring specific sensors
105 +
106 +Specific sensor IDs can be excluded from freeipmi tools by editing `/etc/freeipmi/freeipmi.conf` and setting the IDs to be ignored at `ipmi-sensors-exclude-record-ids`. **However this file is not used by `libipmimonitoring`** (the library used by netdata's `freeipmi.plugin`).
107 +
108 +So, `freeipmi.plugin` supports the option `ignore` that accepts a comma separated list of sensor IDs to ignore. To configure it, edit `/etc/netdata/netdata.conf` and set:
109 +
110 +```
111 +[plugin:freeipmi]
112 + command options = ignore 1,2,3,4,...
113 +```
114 +
115 +To find the IDs to ignore, run the command `ipmimonitoring`. The first column is the wanted ID:
116 +
117 +```
118 +ID | Name | Type | State | Reading | Units | Event
119 +1 | Ambient Temp | Temperature | Nominal | 26.00 | C | 'OK'
120 +2 | Altitude | Other Units Based Sensor | Nominal | 480.00 | ft | 'OK'
121 +3 | Avg Power | Current | Nominal | 100.00 | W | 'OK'
122 +4 | Planar 3.3V | Voltage | Nominal | 3.29 | V | 'OK'
123 +5 | Planar 5V | Voltage | Nominal | 4.90 | V | 'OK'
124 +6 | Planar 12V | Voltage | Nominal | 11.99 | V | 'OK'
125 +7 | Planar VBAT | Voltage | Nominal | 2.95 | V | 'OK'
126 +8 | Fan 1A Tach | Fan | Nominal | 3132.00 | RPM | 'OK'
127 +9 | Fan 1B Tach | Fan | Nominal | 2150.00 | RPM | 'OK'
128 +10 | Fan 2A Tach | Fan | Nominal | 2494.00 | RPM | 'OK'
129 +11 | Fan 2B Tach | Fan | Nominal | 1825.00 | RPM | 'OK'
130 +12 | Fan 3A Tach | Fan | Nominal | 3538.00 | RPM | 'OK'
131 +13 | Fan 3B Tach | Fan | Nominal | 2625.00 | RPM | 'OK'
132 +14 | Fan 1 | Entity Presence | Nominal | N/A | N/A | 'Entity Present'
133 +15 | Fan 2 | Entity Presence | Nominal | N/A | N/A | 'Entity Present'
134 +...
135 +```
136 +
137 +
138 +## debugging
139 +
140 +You can run the plugin by hand:
141 +
142 +```sh
143 +# become user netdata
144 +sudo su -s /bin/sh netdata
145 +
146 +# run the plugin in debug mode
147 +/usr/libexec/netdata/plugins.d/freeipmi.plugin 5 debug
148 +```
149 +
150 +You will get verbose output on what the plugin does.
151 +
152 +## kipmi0 CPU usage
153 +
154 +There have been reports that kipmi is showing increased CPU when the IPMI is queried.
155 +
156 +[IBM has given a few explanations](http://www-01.ibm.com/support/docview.wss?uid=nas7d580df3d15874988862575fa0050f604).
157 +
158 +Check also [this stackexchange post](http://unix.stackexchange.com/questions/74900/kipmi0-eating-up-to-99-8-cpu-on-centos-6-4).
159 +
160 +To lower the CPU consumption of the system you can issue this command:
161 +
162 +```sh
163 +echo 10 > /sys/module/ipmi_si/parameters/kipmid_max_busy_us
164 +```
165 +
166 +You can also permanently set the above setting by creating the file `/etc/modprobe.d/ipmi.conf` with this content:
167 +
168 +```sh
169 +# prevent kipmi from consuming 100% CPU
170 +options ipmi_si kipmid_max_busy_us=10
171 +```
172 +
173 +This instructs the kernel IPMI module to pause for a tick between checking IPMI. Querying IPMI will be a lot slower now (e.g. several seconds for IPMI to respond), but `kipmi` will not use any noticeable CPU. You can also use a higher number (this is the number of microseconds to poll IPMI for a response, before waiting for a tick).
174 +
175 +If you need to disable IPMI for netdata, edit `/etc/netdata/netdata.conf` and set:
176 +
177 +```
178 +[plugins]
179 + freeipmi = no
180 +```
collectors/freeipmi.plugin/freeipmi_plugin.c renamed
+1 -1
@@ -1624,7 +1624,7 @@ int main (int argc, char **argv) {
1624 " options ipmi_si kipmid_max_busy_us=10\n"
1625 "\n"
1626 " For more information:\n"
1627 - " https://github.com/netdata/netdata/wiki/monitoring-IPMI\n"
1627 + " https://github.com/ktsaou/netdata/tree/master/plugins/freeipmi.plugin\n"
1628 "\n"
1629 , VERSION
1630 , netdata_update_every
collectors/idlejitter.plugin/Makefile.am new
+8
@@ -0,0 +1,8 @@
1 +# SPDX-License-Identifier: GPL-3.0-or-later
2 +
3 +AUTOMAKE_OPTIONS = subdir-objects
4 +MAINTAINERCLEANFILES = $(srcdir)/Makefile.in
5 +
6 +dist_noinst_DATA = \
7 + README.md \
8 + $(NULL)
collectors/idlejitter.plugin/README.md new
+13
@@ -0,0 +1,13 @@
1 +## idlejitter.plugin
2 +
3 +It works like this:
4 +
5 +A thread is spawn that requests to sleep for 20000 microseconds (20ms).
6 +When the system wakes it up, it measures how many microseconds have passed.
7 +The difference between the requested and the actual duration of the sleep, is the idle jitter.
8 +This is done at most 50 times per second, to ensure we have a good average.
9 +
10 +This number is useful:
11 +
12 + 1. in real-time environments, when the CPU jitter can affect the quality of the service (like VoIP media gateways).
13 + 2. in cloud infrastructure, at can pause the VM or container for a small duration to perform operations at the host.
collectors/idlejitter.plugin/plugin_idlejitter.c renamed
collectors/idlejitter.plugin/plugin_idlejitter.h renamed
+1 -1
@@ -3,7 +3,7 @@
3 #ifndef NETDATA_PLUGIN_IDLEJITTER_H
4 #define NETDATA_PLUGIN_IDLEJITTER_H 1
5
6 -#include "../../common.h"
6 +#include "../../daemon/common.h"
7
8 #define NETDATA_PLUGIN_HOOK_IDLEJITTER \
9 { \
collectors/macos.plugin/Makefile.am new
+4
@@ -0,0 +1,4 @@
1 +# SPDX-License-Identifier: GPL-3.0-or-later
2 +
3 +AUTOMAKE_OPTIONS = subdir-objects
4 +MAINTAINERCLEANFILES = $(srcdir)/Makefile.in
collectors/macos.plugin/macos_fw.c renamed
collectors/macos.plugin/macos_mach_smi.c renamed
collectors/macos.plugin/macos_sysctl.c renamed
collectors/macos.plugin/plugin_macos.c renamed
collectors/macos.plugin/plugin_macos.h renamed
+1 -1
@@ -4,7 +4,7 @@
4 #ifndef NETDATA_PLUGIN_MACOS_H
5 #define NETDATA_PLUGIN_MACOS_H 1
6
7 -#include "../../common.h"
7 +#include "../../daemon/common.h"
8
9 #if (TARGET_OS == OS_MACOS)
10
collectors/nfacct.plugin/Makefile.am new
+8
@@ -0,0 +1,8 @@
1 +# SPDX-License-Identifier: GPL-3.0-or-later
2 +
3 +AUTOMAKE_OPTIONS = subdir-objects
4 +MAINTAINERCLEANFILES = $(srcdir)/Makefile.in
5 +
6 +dist_noinst_DATA = \
7 + README.md \
8 + $(NULL)
collectors/nfacct.plugin/README.md new
+10
@@ -0,0 +1,10 @@
1 +# nfacct.plugin
2 +
3 +This plugin that collects NFACCT statistics.
4 +
5 +It is currently disabled by default, because it requires root access.
6 +We have to move the code to an external plugin to setuid just the plugin not the whole netdata server.
7 +
8 +You can build netdata with it to test it though.
9 +Just run `./configure` (or `netdata-installer.sh`) with the option `--enable-plugin-nfacct` (and any other options you may need).
10 +Remember, you have to tell netdata you want it to run as `root` for this plugin to work.
collectors/nfacct.plugin/plugin_nfacct.c renamed
collectors/nfacct.plugin/plugin_nfacct.h renamed
+1 -1
@@ -3,7 +3,7 @@
3 #ifndef NETDATA_NFACCT_H
4 #define NETDATA_NFACCT_H 1
5
6 -#include "../../common.h"
6 +#include "../../daemon/common.h"
7
8 #if defined(INTERNAL_PLUGIN_NFACCT)
9
collectors/node.d.plugin/Makefile.am new
+57
@@ -0,0 +1,57 @@
1 +# SPDX-License-Identifier: GPL-3.0-or-later
2 +
3 +MAINTAINERCLEANFILES = $(srcdir)/Makefile.in
4 +CLEANFILES = \
5 + node.d.plugin \
6 + $(NULL)
7 +
8 +include $(top_srcdir)/build/subst.inc
9 +SUFFIXES = .in
10 +
11 +dist_libconfig_DATA = \
12 + node.d.conf \
13 + $(NULL)
14 +
15 +dist_plugins_SCRIPTS = \
16 + node.d.plugin \
17 + $(NULL)
18 +
19 +dist_noinst_DATA = \
20 + node.d.plugin.in \
21 + README.md \
22 + named/README.md \
23 + fronius/README.md \
24 + sma_webbox/README.md \
25 + snmp/README.md \
26 + stiebeleltron/README.md \
27 + $(NULL)
28 +
29 +nodeconfigdir=$(libconfigdir)/node.d
30 +dist_nodeconfig_DATA = \
31 + $(NULL)
32 +
33 +dist_node_DATA = \
34 + named/named.node.js \
35 + fronius/fronius.node.js \
36 + sma_webbox/sma_webbox.node.js \
37 + snmp/snmp.node.js \
38 + stiebeleltron/stiebeleltron.node.js \
39 + $(NULL)
40 +
41 +nodemodulesdir=$(nodedir)/node_modules
42 +dist_nodemodules_DATA = \
43 + node_modules/netdata.js \
44 + node_modules/extend.js \
45 + node_modules/pixl-xml.js \
46 + node_modules/net-snmp.js \
47 + node_modules/asn1-ber.js \
48 + $(NULL)
49 +
50 +nodemoduleslibberdir=$(nodedir)/node_modules/lib/ber
51 +dist_nodemoduleslibber_DATA = \
52 + node_modules/lib/ber/index.js \
53 + node_modules/lib/ber/errors.js \
54 + node_modules/lib/ber/reader.js \
55 + node_modules/lib/ber/types.js \
56 + node_modules/lib/ber/writer.js \
57 + $(NULL)
collectors/node.d.plugin/README.md new
+218
@@ -0,0 +1,218 @@
1 +# node.d.plugin
2 +
3 +`node.d.plugin` is a netdata external plugin. It is an **orchestrator** for data collection modules written in `node.js`.
4 +
5 +1. It runs as an independent process `ps fax` shows it
6 +2. It is started and stopped automatically by netdata
7 +3. It communicates with netdata via a unidirectional pipe (sending data to the netdata daemon)
8 +4. Supports any number of data collection **modules**
9 +5. Allows each **module** to have one or more data collection **jobs**
10 +6. Each **job** is collecting one or more metrics from a single data source
11 +
12 +# Motivation
13 +
14 +Node.js is perfect for asynchronous operations. It is very fast and quite common (actually the whole web is based on it).
15 +Since data collection is not a CPU intensive task, node.js is an ideal solution for it.
16 +
17 +`node.d.plugin` is a netdata plugin that provides an abstraction layer to allow easy and quick development of data
18 +collectors in node.js. It also manages all its data collectors (placed in `/usr/libexec/netdata/node.d`) using a single
19 +instance of node, thus lowering the memory footprint of data collection.
20 +
21 +Of course, there can be independent plugins written in node.js (placed in `/usr/libexec/netdata/plugins`).
22 +These will have to be developed using the guidelines of **[External Plugins](../plugins.d/)**.
23 +
24 +To run `node.js` plugins you need to have `node` installed in your system.
25 +
26 +In some older systems, the package named `node` is not node.js. It is a terminal emulation program called `ax25-node`.
27 +In this case the node.js package may be referred as `nodejs`. Once you install `nodejs`, we suggest to link
28 +`/usr/bin/nodejs` to `/usr/bin/node`, so that typing `node` in your terminal, opens node.js.
29 +For more information check the **[[Installation]]** guide.
30 +
31 +## configuring `node.d.plugin`
32 +
33 +`node.d.plugin` can work even without any configuration. Its default configuration file is
34 +[/etc/netdata/node.d.conf](node.d.conf) (to edit it on your system run `/etc/netdata/edit-config node.d.conf`).
35 +
36 +## configuring `node.d.plugin` modules
37 +
38 +`node.d.plugin` modules accept configuration in `JSON` format.
39 +
40 +Unfortunately, `JSON` files do not accept comments. So, the best way to describe them is to have markdown text files
41 +with instructions.
42 +
43 +`JSON` has a very strict formatting. If you get errors from netdata at `/var/log/netdata/error.log` that a certain
44 +configuration file cannot be loaded, we suggest to verify it at [http://jsonlint.com/](http://jsonlint.com/).
45 +
46 +The files in this directory, provide usable examples for configuring each `node.d.plugin` module.
47 +
48 +
49 +## debugging modules written for node.d.plugin
50 +
51 +To test `node.d.plugin` modules, which are placed in `/usr/libexec/netdata/node.d`, you can run `node.d.plugin` by hand,
52 +like this:
53 +
54 +```sh
55 +# become user netdata
56 +sudo su -s /bin/sh netdata
57 +
58 +# run the plugin in debug mode
59 +/usr/libexec/netdata/plugins.d/node.d.plugin debug 1 X Y Z
60 +```
61 +
62 +`node.d.plugin` will run in `debug` mode (lots of debug info), with an update frequency of `1` second, evaluating only
63 +the collector scripts `X` (i.e. `/usr/libexec/netdata/node.d/X.node.js`), `Y` and `Z`.
64 +You can define zero or more modules. If none is defined, `node.d.plugin` will evaluate all modules available.
65 +
66 +Keep in mind that if your configs are not in `/etc/netdata`, you should do the following before running `node.d.plugin`:
67 +
68 +```sh
69 +export NETDATA_USER_CONFIG_DIR="/path/to/etc/netdata"
70 +```
71 +
72 +---
73 +
74 +## developing `node.d.plugin` modules
75 +
76 +Your data collection module should be split in 3 parts:
77 +
78 + - a function to fetch the data from its source. `node.d.plugin` already can fetch data from web sources,
79 + so you don't need to do anything about it for http.
80 +
81 + - a function to process the fetched/manipulate the data fetched. This function will make a number of calls
82 + to create charts and dimensions and pass the collected values to netdata.
83 + This is the only function you need to write for collecting http JSON data.
84 +
85 + - a `configure` and an `update` function, which take care of your module configuration and data refresh
86 + respectively. You can use the supplied ones.
87 +
88 +Your module will automatically be able to process any number of servers, with different settings (even different
89 +data collection frequencies). You will write just the work needed for one and `node.d.plugin` will do the rest.
90 +For each server you are going to fetch data from, you will have to create a `service` (more later).
91 +
92 +### writing the data collection module
93 +
94 +To provide a module called `mymodule`, you have create the file `/usr/libexec/netdata/node.d/mymodule.node.js`, with this structure:
95 +
96 +```js
97 +
98 +// the processor is needed only
99 +// if you need a custom processor
100 +// other than http
101 +netdata.processors.myprocessor = {
102 + name: 'myprocessor',
103 +
104 + process: function(service, callback) {
105 +
106 + /* do data collection here */
107 +
108 + callback(data);
109 + }
110 +};
111 +
112 +// this is the mymodule definition
113 +var mymodule = {
114 + processResponse: function(service, data) {
115 +
116 + /* send information to the netdata server here */
117 +
118 + },
119 +
120 + configure: function(config) {
121 + var eligible_services = 0;
122 +
123 + if(typeof(config.servers) === 'undefined' || config.servers.length === 0) {
124 +
125 + /*
126 + * create a service using internal defaults;
127 + * this is used for auto-detecting the settings
128 + * if possible
129 + */
130 +
131 + netdata.service({
132 + name: 'a name for this service',
133 + update_every: this.update_every,
134 + module: this,
135 + processor: netdata.processors.myprocessor,
136 + // any other information your processor needs
137 + }).execute(this.processResponse);
138 +
139 + eligible_services++;
140 + }
141 + else {
142 +
143 + /*
144 + * create a service for each server in the
145 + * configuration file
146 + */
147 +
148 + var len = config.servers.length;
149 + while(len--) {
150 + var server = config.servers[len];
151 +
152 + netdata.service({
153 + name: server.name,
154 + update_every: server.update_every,
155 + module: this,
156 + processor: netdata.processors.myprocessor,
157 + // any other information your processor needs
158 + }).execute(this.processResponse);
159 +
160 + eligible_services++;
161 + }
162 + }
163 +
164 + return eligible_services;
165 + },
166 +
167 + update: function(service, callback) {
168 +
169 + /*
170 + * this function is called when each service
171 + * created by the configure function, needs to
172 + * collect updated values.
173 + *
174 + * You normally will not need to change it.
175 + */
176 +
177 + service.execute(function(service, data) {
178 + mymodule.processResponse(service, data);
179 + callback();
180 + });
181 + },
182 +};
183 +
184 +module.exports = mymodule;
185 +```
186 +
187 +#### configure(config)
188 +
189 +`configure(config)` is called just once, when `node.d.plugin` starts.
190 +The config file will contain the contents of `/etc/netdata/node.d/mymodule.conf`.
191 +This file should have the following format:
192 +
193 +```js
194 +{
195 + "enable_autodetect": false,
196 + "update_every": 5,
197 + "servers": [ { /* server 1 */ }, { /* server 2 */ } ]
198 +}
199 +```
200 +
201 +If the config file `/etc/netdata/node.d/mymodule.conf` does not give a `enable_autodetect` or `update_every`, these
202 +will be added by `node.d.plugin`. So you module will always have them.
203 +
204 +The configuration file `/etc/netdata/node.d/mymodule.conf` may contain whatever else is needed for `mymodule`.
205 +
206 +#### processResponse(data)
207 +
208 +`data` may be `null` or whatever the processor specified in the `service` returned.
209 +
210 +The `service` object defines a set of functions to allow you send information to the netdata core about:
211 +
212 +1. Charts and dimension definitions
213 +2. Updated values, from the collected values
214 +
215 +---
216 +
217 +*FIXME: document an operational node.d.plugin data collector - the best example is the
218 +[snmp collector](snmp/snmp.node.js)*
collectors/node.d.plugin/fronius/README.md renamed
+53
@@ -1,3 +1,56 @@
1 +# fronius
2 +
3 +This module collects metrics from the configured solar power installation from Fronius Symo.
4 +
5 +**Requirements**
6 + * Configuration file `fronius.conf` in the node.d netdata config dir (default: `/etc/netdata/node.d/fronius.conf`)
7 + * Fronius Symo with network access (http)
8 +
9 +It produces per server:
10 +
11 +1. **Power**
12 + * Current power input from the grid (positive values), output to the grid (negative values), in W
13 + * Current power input from the solar panels, in W
14 + * Current power stored in the accumulator (if present), in W (in theory, untested)
15 +
16 +2. **Consumption**
17 + * Local consumption in W
18 +
19 +3. **Autonomy**
20 + * Relative autonomy in %. 100 % autonomy means that the solar panels are delivering more power than it is needed by local consumption.
21 + * Relative self consumption in %. The lower the better
22 +
23 +4. **Energy**
24 + * The energy produced during the current day, in kWh
25 + * The energy produced during the current year, in kWh
26 +
27 +5. **Inverter**
28 + * The current power output from the connected inverters, in W, one dimension per inverter. At least one is always present.
29 +
30 +
31 +### configuration
32 +
33 +Sample:
34 +
35 +```json
36 +{
37 + "enable_autodetect": false,
38 + "update_every": 5,
39 + "servers": [
40 + {
41 + "name": "Symo",
42 + "hostname": "symo.ip.or.dns",
43 + "update_every": 5,
44 + "api_path": "/solar_api/v1/GetPowerFlowRealtimeData.fcgi"
45 + }
46 + ]
47 +}
48 +```
49 +
50 +If no configuration is given, the module will be disabled. Each `update_every` is optional, the default is `5`.
51 +
52 +---
53 +
54 [Fronius Symo 8.2](https://www.fronius.com/en/photovoltaics/products/all-products/inverters/fronius-symo/fronius-symo-8-2-3-m)
55
56 The plugin has been tested with a single inverter, namely Fronius Symo 8.2-3-M:
collectors/node.d.plugin/fronius/fronius.node.js renamed
collectors/node.d.plugin/named/README.md renamed
collectors/node.d.plugin/named/named.node.js renamed
collectors/node.d.plugin/node.d.conf renamed
collectors/node.d.plugin/node.d.plugin.in renamed
+1 -1
@@ -40,7 +40,7 @@ var util = require('util');
40 var http = require('http');
41 var path = require('path');
42 var extend = require('extend');
43 -var netdata = require('netdata');
43 +var netdata = require('../../../netdata');
44
45
46 // --------------------------------------------------------------------------------------------------------------------
collectors/node.d.plugin/node_modules/asn1-ber.js renamed
collectors/node.d.plugin/node_modules/extend.js renamed
collectors/node.d.plugin/node_modules/lib/ber/errors.js renamed
collectors/node.d.plugin/node_modules/lib/ber/index.js renamed
collectors/node.d.plugin/node_modules/lib/ber/reader.js renamed
collectors/node.d.plugin/node_modules/lib/ber/types.js renamed
collectors/node.d.plugin/node_modules/lib/ber/writer.js renamed
collectors/node.d.plugin/node_modules/net-snmp.js renamed
collectors/node.d.plugin/node_modules/netdata.js renamed
collectors/node.d.plugin/node_modules/pixl-xml.js renamed
collectors/node.d.plugin/sma_webbox/README.md renamed
collectors/node.d.plugin/sma_webbox/sma_webbox.node.js renamed
collectors/node.d.plugin/snmp/README.md renamed
collectors/node.d.plugin/snmp/snmp.node.js renamed
collectors/node.d.plugin/stiebeleltron/README.md renamed
+54
@@ -1,3 +1,57 @@
1 +# stiebel eltron
2 +
3 +This module collects metrics from the configured heat pump and hot water installation from Stiebel Eltron ISG web.
4 +
5 +**Requirements**
6 + * Configuration file `stiebeleltron.conf` in the node.d netdata config dir (default: `/etc/netdata/node.d/stiebeleltron.conf`)
7 + * Stiebel Eltron ISG web with network access (http), without password login
8 +
9 +The charts are configurable, however, the provided default configuration collects the following:
10 +
11 +1. **General**
12 + * Outside temperature in C
13 + * Condenser temperature in C
14 + * Heating circuit pressure in bar
15 + * Flow rate in l/min
16 + * Output of water and heat pumps in %
17 +
18 +2. **Heating**
19 + * Heat circuit 1 temperature in C (set/actual)
20 + * Heat circuit 2 temperature in C (set/actual)
21 + * Flow temperature in C (set/actual)
22 + * Buffer temperature in C (set/actual)
23 + * Pre-flow temperature in C
24 +
25 +3. **Hot Water**
26 + * Hot water temperature in C (set/actual)
27 +
28 +4. **Room Temperature**
29 + * Heat circuit 1 room temperature in C (set/actual)
30 + * Heat circuit 2 room temperature in C (set/actual)
31 +
32 +5. **Eletric Reheating**
33 + * Dual Mode Reheating temperature in C (hot water/heating)
34 +
35 +6. **Process Data**
36 + * Remaining compressor rest time in s
37 +
38 +7. **Runtime**
39 + * Compressor runtime hours (hot water/heating)
40 + * Reheating runtime hours (reheating 1/reheating 2)
41 +
42 +8. **Energy**
43 + * Compressor today in kWh (hot water/heating)
44 + * Compressor Total in kWh (hot water/heating)
45 +
46 +
47 +### configuration
48 +
49 +The default configuration is provided in [netdata/conf.d/node.d/stiebeleltron.conf.md](https://github.com/netdata/netdata/blob/master/conf.d/node.d/stiebeleltron.conf.md). Just change the `update_every` (if necessary) and hostnames. **You may have to adapt the configuration to suit your needs and setup** (which might be different).
50 +
51 +If no configuration is given, the module will be disabled. Each `update_every` is optional, the default is `10`.
52 +
53 +---
54 +
55 [Stiebel Eltron Heat pump system with ISG](https://www.stiebel-eltron.com/en/home/products-solutions/renewables/controller_energymanagement/internet_servicegateway/isg_web.html)
56
57 Original author: BrainDoctor (github)
collectors/node.d.plugin/stiebeleltron/stiebeleltron.node.js renamed
collectors/plugins.d/Makefile.am new
+11
@@ -0,0 +1,11 @@
1 +# SPDX-License-Identifier: GPL-3.0-or-later
2 +
3 +AUTOMAKE_OPTIONS = subdir-objects
4 +MAINTAINERCLEANFILES = $(srcdir)/Makefile.in
5 +
6 +SUBDIRS = \
7 + $(NULL)
8 +
9 +dist_noinst_DATA = \
10 + README.md \
11 + $(NULL)
collectors/plugins.d/README.md new
+347
@@ -0,0 +1,347 @@
1 +# Netdata External Plugins
2 +
3 +`plugins.d` is the netdata internal plugin that collects metrics
4 +from external processes, thus allowing netdata to use **external plugins**.
5 +
6 +## Provided External Plugins
7 +
8 +plugin|language|O/S|description
9 +:---:|:---:|:---:|:---
10 +[apps.plugin](../apps.plugin/)|`C`|linux, freebsd|monitors the whole process tree on Linux and FreeBSD and breaks down system resource usage by **process**, **user** and **user group**.
11 +[charts.d.plugin](../charts.d.plugin/)|`BASH`|all|a **plugin orchestrator** for data collection modules written in `BASH` v4+.
12 +[fping.plugin](../fping.plugin/)|`C`|all|measures network latency, jitter and packet loss between the monitored node and any number of remote network end points.
13 +[freeipmi.plugin](../freeipmi.plugin/)|`C`|linux|collects metrics from enterprise hardware sensors, on Linux servers.
14 +[node.d.plugin](../node.d.plugin/)|`node.js`|all|a **plugin orchestrator** for data collection modules written in `node.js`.
15 +[python.d.plugin](../python.d.plugin/)|`python`|all|a **plugin orchestrator** for data collection modules written in `python` v2 or v3 (both are supported).
16 +
17 +
18 +## Motivation
19 +
20 +This plugin allows netdata to use **external plugins** for data collection:
21 +
22 +1. external data collection plugins may be written in any computer language.
23 +2. external data collection plugins may use O/S capabilities or `setuid` to
24 + run with escalated privileges (compared to the netdata daemon).
25 + The communication between the external plugin and netdata is unidirectional
26 + (from the plugin to netdata), so that netdata cannot manipulate an external
27 + plugin running with escalated privileges.
28 +
29 +## Operation
30 +
31 +Each of the external plugins is expected to run forever.
32 +Netdata will start it when it starts and stop it when it exits.
33 +
34 +If the external plugin exits or crashes, netdata will log an error.
35 +If the external plugin exits or crashes without pushing metrics to netdata,
36 +netdata will not start it again.
37 +
38 +The `stdout` of external plugins is connected to netdata to receive metrics,
39 +with the API defined below.
40 +
41 +The `stderr` of external plugins is connected to netdata `error.log`.
42 +
43 +## Configuration
44 +
45 +This plugin is configured via `netdata.conf`, section `[plugins]`.
46 +At this section there a list of all the plugins found at the system it runs
47 +with a boolean setting to enable them or not.
48 +
49 +Example:
50 +
51 +```
52 +[plugins]
53 + # enable running new plugins = yes
54 + # check for new plugins every = 60
55 +
56 + # charts.d = yes
57 + # fping = yes
58 + # node.d = yes
59 + # python.d = yes
60 +```
61 +
62 +The setting `enable running new plugins` changes the default behavior for all external plugins.
63 +So if set to `no`, only the plugins that are explicitly set to `yes` will be run.
64 +
65 +The setting `check for new plugins every` controls the time the directory `/usr/libexec/netdata/plugins.d`
66 +will be rescanned for new plugins. So, new plugins can give added anytime.
67 +
68 +For each of the external plugins enabled, another `netdata.conf` section
69 +is created, in the form of `[plugin:NAME]`, where `NAME` is the name of the external plugin.
70 +This section allows controlling the update frequency of the plugin and provide
71 +additional command line arguments to it.
72 +
73 +For example, for `apps.plugin` the following section is available:
74 +
75 +```
76 +[plugin:apps]
77 + # update every = 1
78 + # command options =
79 +```
80 +
81 +- `update every` controls the granularity of the external plugin.
82 +- `command options` allows giving additional command line options to the plugin.
83 +
84 +
85 +## External Plugins API
86 +
87 +Any program that can print a few values to its standard output can become a netdata external plugin.
88 +
89 +There are 7 lines netdata parses. lines starting with:
90 +
91 +- `CHART` - create or update a chart
92 +- `DIMENSION` - add or update a dimension to the chart just created
93 +- `BEGIN` - initialize data collection for a chart
94 +- `SET` - set the value of a dimension for the initialized chart
95 +- `END` - complete data collection for the initialized chart
96 +- `FLUSH` - ignore the last collected values
97 +- `DISABLE` - disable this plugin
98 +
99 +a single program can produce any number of charts with any number of dimensions each.
100 +
101 +Charts can be added any time (not just the beginning).
102 +
103 +### command line parameters
104 +
105 +The plugin **MUST** accept just **one** parameter: **the number of seconds it is
106 +expected to update the values for its charts**. The value passed by netdata
107 +to the plugin is controlled via its configuration file (so there is no need
108 +for the plugin to handle this configuration option).
109 +
110 +The external plugin can overwrite the update frequency. For example, the server may
111 +request per second updates, but the plugin may ignore it and update its charts
112 +every 5 seconds.
113 +
114 +### environment variables
115 +
116 +There are a few environment variables that are set by `netdata` and are
117 +available for the plugin to use.
118 +
119 +variable|description
120 +:------:|:----------
121 +`NETDATA_USER_CONFIG_DIR`|The directory where all netdata related user configuration should be stored. If the plugin requires custom user configuration, this is the place the user has saved it (normally under `/etc/netdata`).
122 +`NETDATA_STOCK_CONFIG_DIR`|The directory where all netdata related stock configuration should be stored. If the plugin is shipped with configuration files, this is the place they can be found (normally under `/usr/lib/netdata/conf.d`).
123 +`NETDATA_PLUGINS_DIR`|The directory where all netdata plugins are stored.
124 +`NETDATA_WEB_DIR`|The directory where the web files of netdata are saved.
125 +`NETDATA_CACHE_DIR`|The directory where the cache files of netdata are stored. Use this directory if the plugin requires a place to store data. A new directory should be created for the plugin for this purpose, inside this directory.
126 +`NETDATA_LOG_DIR`|The directory where the log files are stored. By default the `stderr` output of the plugin will be saved in the `error.log` file of netdata.
127 +`NETDATA_HOST_PREFIX`|This is used in environments where system directories like `/sys` and `/proc` have to be accessed at a different path.
128 +`NETDATA_DEBUG_FLAGS`|This is a number (probably in hex starting with `0x`), that enables certain netdata debugging features. Check **[[Tracing Options]]** for more information.
129 +`NETDATA_UPDATE_EVERY`|The minimum number of seconds between chart refreshes. This is like the **internal clock** of netdata (it is user configurable, defaulting to `1`). There is no meaning for a plugin to update its values more frequently than this number of seconds.
130 +
131 +
132 +### the output of the plugin
133 +
134 +The plugin should output instructions for netdata to its output (`stdout`). Since this uses pipes, please make sure you flush stdout after every iteration.
135 +
136 +#### DISABLE
137 +
138 +`DISABLE` will disable this plugin. This will prevent netdata from restarting the plugin. You can also exit with the value `1` to have the same effect.
139 +
140 +#### CHART
141 +
142 +`CHART` defines a new chart.
143 +
144 +the template is:
145 +
146 +> CHART type.id name title units [family [context [charttype [priority [update_every [options [plugin [module]]]]]]]]
147 +
148 + where:
149 + - `type.id`
150 +
151 + uniquely identifies the chart,
152 + this is what will be needed to add values to the chart
153 +
154 + the `type` part controls the menu the charts will appear in
155 +
156 + - `name`
157 +
158 + is the name that will be presented to the user instead of `id` in `type.id`. This means that only the `id` part of `type.id` is changed. When a name has been given, the chart is index (and can be referred) as both `type.id` and `type.name`. You can set name to `''`, or `null`, or `(null)` to disable it.
159 +
160 + - `title`
161 +
162 + the text above the chart
163 +
164 + - `units`
165 +
166 + the label of the vertical axis of the chart,
167 + all dimensions added to a chart should have the same units
168 + of measurement
169 +
170 + - `family`
171 +
172 + is used to group charts together
173 + (for example all eth0 charts should say: eth0),
174 + if empty or missing, the `id` part of `type.id` will be used
175 +
176 + this controls the sub-menu on the dashboard
177 +
178 + - `context`
179 +
180 + the context is giving the template of the chart. For example, if multiple charts present the same information for a different family, they should have the same `context`
181 +
182 + this is used for looking up rendering information for the chart (colors, sizes, informational texts) and also apply alarms to it
183 +
184 + - `charttype`
185 +
186 + one of `line`, `area` or `stacked`,
187 + if empty or missing, the `line` will be used
188 +
189 + - `priority`
190 +
191 + is the relative priority of the charts as rendered on the web page,
192 + lower numbers make the charts appear before the ones with higher numbers,
193 + if empty or missing, `1000` will be used
194 +
195 + - `update_every`
196 +
197 + overwrite the update frequency set by the server,
198 + if empty or missing, the user configured value will be used
199 +
200 + - `options`
201 +
202 + a space separated list of options, enclosed in quotes. 4 options are currently supported: `obsolete` to mark a chart as obsolete (netdata will hide it and delete it after some time), `detail` to mark a chart as insignificant (this may be used by dashboards to make the charts smaller, or somehow visualize properly a less important chart), `store_first` to make netdata store the first collected value, assuming there was an invisible previous value set to zero (this is used by statsd charts - if the first data collected value of incremental dimensions is not zero based, unrealistic spikes will appear with this option set) and `hidden` to perform all operations on a chart, but do not offer it on dashboards (the chart will be send to backends). `CHART` options have been added in netdata v1.7 and the `hidden` option was added in 1.10.
203 +
204 + - `plugin` and `module`
205 +
206 + both are just names that are used to let the user the plugin and its module that generated the chart. If `plugin` is unset or empty, netdata will automatically set the filename of the plugin that generated the chart. `module` has not default.
207 +
208 +
209 +#### DIMENSION
210 +
211 +`DIMENSION` defines a new dimension for the chart
212 +
213 +the template is:
214 +
215 +> DIMENSION id [name [algorithm [multiplier [divisor [hidden]]]]]
216 +
217 + where:
218 +
219 + - `id`
220 +
221 + the `id` of this dimension (it is a text value, not numeric),
222 + this will be needed later to add values to the dimension
223 +
224 + We suggest to avoid using `.` in dimension ids. Backends expect metrics to be `.` separated and people will get confused if a dimension id contains a dot.
225 +
226 + - `name`
227 +
228 + the name of the dimension as it will appear at the legend of the chart,
229 + if empty or missing the `id` will be used
230 +
231 + - `algorithm`
232 +
233 + one of:
234 +
235 + * `absolute`
236 +
237 + the value is to drawn as-is (interpolated to second boundary),
238 + if `algorithm` is empty, invalid or missing, `absolute` is used
239 +
240 + * `incremental`
241 +
242 + the value increases over time,
243 + the difference from the last value is presented in the chart,
244 + the server interpolates the value and calculates a per second figure
245 +
246 + * `percentage-of-absolute-row`
247 +
248 + the % of this value compared to the total of all dimensions
249 +
250 + * `percentage-of-incremental-row`
251 +
252 + the % of this value compared to the incremental total of
253 + all dimensions
254 +
255 + - `multiplier`
256 +
257 + an integer value to multiply the collected value,
258 + if empty or missing, `1` is used
259 +
260 + - `divisor`
261 +
262 + an integer value to divide the collected value,
263 + if empty or missing, `1` is used
264 +
265 + - `hidden`
266 +
267 + giving the keyword `hidden` will make this dimension hidden,
268 + it will take part in the calculations but will not be presented in the chart
269 +
270 +
271 +#### VARIABLE
272 +
273 +> VARIABLE [SCOPE] name = value
274 +
275 +`VARIABLE` defines a variable that can be used in alarms. This is to used for setting constants (like the max connections a server may accept).
276 +
277 +Variables support 2 scopes:
278 +
279 +- `GLOBAL` or `HOST` to define the variable at the host level.
280 +- `LOCAL` or `CHART` to define the variable at the chart level. Use chart-local variables when the same variable may exist for different charts (i.e. netdata monitors 2 mysql servers, and you need to set the `max_connections` each server accepts). Using chart-local variables is the ideal to build alarm templates.
281 +
282 +The position of the `VARIABLE` line, sets its default scope (in case you do not specify a scope). So, defining a `VARIABLE` before any `CHART`, or between `END` and `BEGIN` (outside any chart), sets `GLOBAL` scope, while defining a `VARIABLE` just after a `CHART` or a `DIMENSION`, or within the `BEGIN` - `END` block of a chart, sets `LOCAL` scope.
283 +
284 +These variables can be set and updated at any point.
285 +
286 +Variable names should use alphanumeric characters, the `.` and the `_`.
287 +
288 +The `value` is floating point (netdata used `long double`).
289 +
290 +Variables are transferred to upstream netdata servers (streaming and database replication).
291 +
292 +## data collection
293 +
294 +data collection is defined as a series of `BEGIN` -> `SET` -> `END` lines
295 +
296 +> BEGIN type.id [microseconds]
297 +
298 + - `type.id`
299 +
300 + is the unique identification of the chart (as given in `CHART`)
301 +
302 + - `microseconds`
303 +
304 + is the number of microseconds since the last update of the chart. It is optional.
305 +
306 + Under heavy system load, the system may have some latency transferring
307 + data from the plugins to netdata via the pipe. This number improves
308 + accuracy significantly, since the plugin is able to calculate the
309 + duration between its iterations better than netdata.
310 +
311 + The first time the plugin is started, no microseconds should be given
312 + to netdata.
313 +
314 +> SET id = value
315 +
316 + - `id`
317 +
318 + is the unique identification of the dimension (of the chart just began)
319 +
320 + - `value`
321 +
322 + is the collected value, only integer values are collected. If you want to push fractional values, multiply this value by 100 or 1000 and set the `DIMENSION` divider to 1000.
323 +
324 +> END
325 +
326 + END does not take any parameters, it commits the collected values for all dimensions to the chart. If a dimensions was not `SET`, its value will be empty for this commit.
327 +
328 +More `SET` lines may appear to update all the dimensions of the chart.
329 +All of them in one `BEGIN` -> `END` block.
330 +
331 +All `SET` lines within a single `BEGIN` -> `END` block have to refer to the
332 +same chart.
333 +
334 +If more charts need to be updated, each chart should have its own
335 +`BEGIN` -> `SET` -> `END` block.
336 +
337 +If, for any reason, a plugin has issued a `BEGIN` but wants to cancel it,
338 +it can issue a `FLUSH`. The `FLUSH` command will instruct netdata to ignore
339 +all the values collected since the last `BEGIN` command.
340 +
341 +If a plugin does not behave properly (outputs invalid lines, or does not
342 +follow these guidelines), will be disabled by netdata.
343 +
344 +### collected values
345 +
346 +netdata will collect any **signed** value in the 64bit range:
347 +`-9.223.372.036.854.775.808` to `+9.223.372.036.854.775.807`
collectors/plugins.d/plugins_d.c renamed
collectors/plugins.d/plugins_d.h renamed
+1 -1
@@ -3,7 +3,7 @@
3 #ifndef NETDATA_PLUGINS_D_H
4 #define NETDATA_PLUGINS_D_H 1
5
6 -#include "../../common.h"
6 +#include "../../daemon/common.h"
7
8 #define NETDATA_PLUGIN_HOOK_PLUGINSD \
9 { \
collectors/proc.plugin/Makefile.am new
+8
@@ -0,0 +1,8 @@
1 +# SPDX-License-Identifier: GPL-3.0-or-later
2 +
3 +AUTOMAKE_OPTIONS = subdir-objects
4 +MAINTAINERCLEANFILES = $(srcdir)/Makefile.in
5 +
6 +dist_noinst_DATA = \
7 + README.md \
8 + $(NULL)
collectors/proc.plugin/README.md new
+200
@@ -0,0 +1,200 @@
1 +
2 +# proc.plugin
3 +
4 + - `/proc/net/dev` (all network interfaces for all their values)
5 + - `/proc/diskstats` (all disks for all their values)
6 + - `/proc/net/snmp` (total IPv4, TCP and UDP usage)
7 + - `/proc/net/snmp6` (total IPv6 usage)
8 + - `/proc/net/netstat` (more IPv4 usage)
9 + - `/proc/net/stat/nf_conntrack` (connection tracking performance)
10 + - `/proc/net/stat/synproxy` (synproxy performance)
11 + - `/proc/net/ip_vs/stats` (IPVS connection statistics)
12 + - `/proc/stat` (CPU utilization)
13 + - `/proc/meminfo` (memory information)
14 + - `/proc/vmstat` (system performance)
15 + - `/proc/net/rpc/nfsd` (NFS server statistics for both v3 and v4 NFS servers)
16 + - `/sys/fs/cgroup` (Control Groups - Linux Containers)
17 + - `/proc/self/mountinfo` (mount points)
18 + - `/proc/interrupts` (total and per core hardware interrupts)
19 + - `/proc/softirqs` (total and per core software interrupts)
20 + - `/proc/loadavg` (system load and total processes running)
21 + - `/proc/sys/kernel/random/entropy_avail` (random numbers pool availability - used in cryptography)
22 + - `ksm` Kernel Same-Page Merging performance (several files under `/sys/kernel/mm/ksm`).
23 + - `netdata` (internal netdata resources utilization)
24 +
25 +
26 +---
27 +
28 +# Monitoring Disks' Performance with netdata
29 +
30 +> Live demo of disk monitoring at: **[http://london.netdata.rocks](http://london.netdata.rocks/#disk)**
31 +
32 +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.
33 +
34 +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**.
35 +
36 +Let's see the list of metrics provided by netdata for each of the above:
37 +
38 +### I/O bandwidth/s (kb/s)
39 +
40 +The amount of data transferred from and to the disk.
41 +
42 +### I/O operations/s
43 +
44 +The number of I/O operations completed.
45 +
46 +### Queued I/O operations
47 +
48 +The number of currently queued I/O operations. For traditional disks that execute commands one after another, one of them is being run by the disk and the rest are just waiting in a queue.
49 +
50 +### Backlog size (time in ms)
51 +
52 +The expected duration of the currently queued I/O operations.
53 +
54 +### Utilization (time percentage)
55 +
56 +The percentage of time the disk was busy with something. This is a very interesting metric, since for most disks, that execute commands sequentially, **this is the key indication of congestion**. A sequential disk that is 100% of the available time busy, has no time to do anything more, so even if the bandwidth or the number of operations executed by the disk is low, its capacity has been reached.
57 +
58 +Of course, for newer disk technologies (like fusion cards) that are capable to execute multiple commands in parallel, this metric is just meaningless.
59 +
60 +### Average I/O operation time (ms)
61 +
62 +The average time for I/O requests issued to the device to be served. This includes the time spent by the requests in queue and the time spent servicing them.
63 +
64 +### Average I/O operation size (kb)
65 +
66 +The average amount of data of the completed I/O operations.
67 +
68 +### Average Service Time (ms)
69 +
70 +The average service time for completed I/O operations. This metric is calculated using the total busy time of the disk and the number of completed operations. If the disk is able to execute multiple parallel operations the reporting average service time will be misleading.
71 +
72 +### Merged I/O operations/s
73 +
74 +The Linux kernel is capable of merging I/O operations. So, if two requests to read data from the disk are adjacent, the Linux kernel may merge them to one before giving them to disk. This metric measures the number of operations that have been merged by the Linux kernel.
75 +
76 +### Total I/O time
77 +
78 +The sum of the duration of all completed I/O operations. This number can exceed the interval if the disk is able to execute multiple I/O operations in parallel.
79 +
80 +### Space usage
81 +
82 +For mounted disks, netdata will provide a chart for their space, with 3 dimensions:
83 +
84 +1. free
85 +2. used
86 +3. reserved for root
87 +
88 +### inode usage
89 +
90 +For mounted disks, netdata will provide a chart for their inodes (number of file and directories), with 3 dimensions:
91 +
92 +1. free
93 +2. used
94 +3. reserved for root
95 +
96 +---
97 +
98 +## disk names
99 +
100 +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).
101 +
102 +---
103 +
104 +## performance metrics
105 +
106 +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).
107 +
108 +netdata categorizes all block devices in 3 categories:
109 +
110 +1. physical disks (i.e. block devices that does not have slaves and are not partitions)
111 +2. virtual disks (i.e. block devices that have slaves - like RAID devices)
112 +3. disk partitions (i.e. block devices that are part of a physical disk)
113 +
114 +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.
115 +
116 +### netdata configuration
117 +
118 +You can get the running netdata configuration using this:
119 +
120 +```sh
121 +cd /etc/netdata
122 +curl "http://localhost:19999/netdata.conf" >netdata.conf.new
123 +mv netdata.conf.new netdata.conf
124 +```
125 +
126 +Then edit `netdata.conf` and find the following section. This is the basic plugin configuration.
127 +
128 +```
129 +[plugin:proc:/proc/diskstats]
130 + # enable new disks detected at runtime = yes
131 + # performance metrics for physical disks = auto
132 + # performance metrics for virtual disks = no
133 + # performance metrics for partitions = no
134 + # performance metrics for mounted filesystems = no
135 + # performance metrics for mounted virtual disks = auto
136 + # space metrics for mounted filesystems = auto
137 + # bandwidth for all disks = auto
138 + # operations for all disks = auto
139 + # merged operations for all disks = auto
140 + # i/o time for all disks = auto
141 + # queued operations for all disks = auto
142 + # utilization percentage for all disks = auto
143 + # backlog for all disks = auto
144 + # space usage for all disks = auto
145 + # inodes usage for all disks = auto
146 + # filename to monitor = /proc/diskstats
147 + # path to get block device infos = /sys/dev/block/%lu:%lu/%s
148 + # path to get h/w sector size = /sys/block/%s/queue/hw_sector_size
149 + # path to get h/w sector size for partitions = /sys/dev/block/%lu:%lu/subsystem/%s/../queue
150 +/hw_sector_size
151 +
152 +```
153 +
154 +For each virtual disk, physical disk and partition you will have a section like this:
155 +
156 +```
157 +[plugin:proc:/proc/diskstats:sda]
158 + # enable = yes
159 + # enable performance metrics = auto
160 + # bandwidth = auto
161 + # operations = auto
162 + # merged operations = auto
163 + # i/o time = auto
164 + # queued operations = auto
165 + # utilization percentage = auto
166 + # backlog = auto
167 +```
168 +
169 +For all configuration options:
170 +- `auto` = enable monitoring if the collected values are not zero
171 +- `yes` = enable monitoring
172 +- `no` = disable monitoring
173 +
174 +Of course, to set options, you will have to uncomment them. The comments show the internal defaults.
175 +
176 +After saving `/etc/netdata/netdata.conf`, restart your netdata to apply them.
177 +
178 +#### Disabling performance metrics for individual device and to multiple devices by device type
179 +You can pretty easy disable performance metrics for individual device, for ex.:
180 +```
181 +[plugin:proc:/proc/diskstats:sda]
182 + enable performance metrics = no
183 +```
184 +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.:
185 +```
186 + 7 0 loop0 1651 0 3452 168 0 0 0 0 0 8 168
187 + 7 1 loop1 4955 0 11924 880 0 0 0 0 0 64 880
188 + 7 2 loop2 36 0 216 4 0 0 0 0 0 4 4
189 + 7 6 loop6 0 0 0 0 0 0 0 0 0 0 0
190 + 7 7 loop7 0 0 0 0 0 0 0 0 0 0 0
191 + 251 2 zram2 27487 0 219896 188 79953 0 639624 1640 0 1828 1828
192 + 251 3 zram3 27348 0 218784 152 79952 0 639616 1960 0 2060 2104
193 +```
194 +All zram devices starts with `251` number and all loop devices starts with `7`.
195 +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.
196 +```
197 +[plugin:proc:/proc/diskstats]
198 + performance metrics for disks with major 7 = no
199 +```
200 +
collectors/proc.plugin/ipc.c renamed
collectors/proc.plugin/plugin_proc.c renamed
collectors/proc.plugin/plugin_proc.h renamed
+1 -1
@@ -3,7 +3,7 @@
3 #ifndef NETDATA_PLUGIN_PROC_H
4 #define NETDATA_PLUGIN_PROC_H 1
5
6 -#include "../../common.h"
6 +#include "../../daemon/common.h"
7
8 #if (TARGET_OS == OS_LINUX)
9
collectors/proc.plugin/proc_diskstats.c renamed
collectors/proc.plugin/proc_interrupts.c renamed
collectors/proc.plugin/proc_loadavg.c renamed
collectors/proc.plugin/proc_meminfo.c renamed
collectors/proc.plugin/proc_net_dev.c renamed
collectors/proc.plugin/proc_net_ip_vs_stats.c renamed
collectors/proc.plugin/proc_net_netstat.c renamed
collectors/proc.plugin/proc_net_rpc_nfs.c renamed
collectors/proc.plugin/proc_net_rpc_nfsd.c renamed
collectors/proc.plugin/proc_net_sctp_snmp.c renamed
collectors/proc.plugin/proc_net_snmp.c renamed
collectors/proc.plugin/proc_net_snmp6.c renamed
collectors/proc.plugin/proc_net_sockstat.c renamed
collectors/proc.plugin/proc_net_sockstat6.c renamed
collectors/proc.plugin/proc_net_softnet_stat.c renamed
collectors/proc.plugin/proc_net_stat_conntrack.c renamed
collectors/proc.plugin/proc_net_stat_synproxy.c renamed
collectors/proc.plugin/proc_self_mountinfo.c renamed
collectors/proc.plugin/proc_self_mountinfo.h renamed
collectors/proc.plugin/proc_softirqs.c renamed
collectors/proc.plugin/proc_spl_kstat_zfs.c renamed
collectors/proc.plugin/proc_stat.c renamed
collectors/proc.plugin/proc_sys_kernel_random_entropy_avail.c renamed
collectors/proc.plugin/proc_uptime.c renamed
collectors/proc.plugin/proc_vmstat.c renamed
collectors/proc.plugin/sys_devices_system_edac_mc.c renamed
collectors/proc.plugin/sys_devices_system_node.c renamed
collectors/proc.plugin/sys_fs_btrfs.c renamed
collectors/proc.plugin/sys_kernel_mm_ksm.c renamed
collectors/proc.plugin/zfs_common.c renamed
collectors/proc.plugin/zfs_common.h renamed
+1 -1
@@ -3,7 +3,7 @@
3 #ifndef NETDATA_ZFS_COMMON_H
4 #define NETDATA_ZFS_COMMON_H 1
5
6 -#include "../../common.h"
6 +#include "../../daemon/common.h"
7
8 #define ZFS_FAMILY_SIZE "size"
9 #define ZFS_FAMILY_EFFICIENCY "efficiency"
collectors/python.d.plugin/Makefile.am renamed
+143 -65
@@ -1,78 +1,156 @@
1 # SPDX-License-Identifier: GPL-3.0-or-later
2 -MAINTAINERCLEANFILES= $(srcdir)/Makefile.in
2 +
3 +MAINTAINERCLEANFILES = $(srcdir)/Makefile.in
4 CLEANFILES = \
4 - $(NULL)
5 + python.d.plugin \
6 + $(NULL)
7
8 include $(top_srcdir)/build/subst.inc
7 -
9 SUFFIXES = .in
10
11 +dist_libconfig_DATA = \
12 + python.d.conf \
13 + $(NULL)
14 +
15 +dist_plugins_SCRIPTS = \
16 + python.d.plugin \
17 + $(NULL)
18 +
19 +dist_noinst_DATA = \
20 + python.d.plugin.in \
21 + README.md \
22 + $(NULL)
23 +
24 +pythonconfigdir=$(libconfigdir)/python.d
25 +dist_pythonconfig_DATA = \
26 + apache/apache.conf \
27 + beanstalk/beanstalk.conf \
28 + bind_rndc/bind_rndc.conf \
29 + boinc/boinc.conf \
30 + ceph/ceph.conf \
31 + chrony/chrony.conf \
32 + couchdb/couchdb.conf \
33 + cpuidle/cpuidle.conf \
34 + cpufreq/cpufreq.conf \
35 + dns_query_time/dns_query_time.conf \
36 + dnsdist/dnsdist.conf \
37 + dockerd/dockerd.conf \
38 + dovecot/dovecot.conf \
39 + elasticsearch/elasticsearch.conf \
40 + example/example.conf \
41 + exim/exim.conf \
42 + fail2ban/fail2ban.conf \
43 + freeradius/freeradius.conf \
44 + go_expvar/go_expvar.conf \
45 + haproxy/haproxy.conf \
46 + hddtemp/hddtemp.conf \
47 + httpcheck/httpcheck.conf \
48 + icecast/icecast.conf \
49 + ipfs/ipfs.conf \
50 + isc_dhcpd/isc_dhcpd.conf \
51 + linux_power_supply/linux_power_supply.conf \
52 + litespeed/litespeed.conf \
53 + logind/logind.conf \
54 + mdstat/mdstat.conf \
55 + megacli/megacli.conf \
56 + memcached/memcached.conf \
57 + mongodb/mongodb.conf \
58 + monit/monit.conf \
59 + mysql/mysql.conf \
60 + nginx/nginx.conf \
61 + nginx_plus/nginx_plus.conf \
62 + nsd/nsd.conf \
63 + ntpd/ntpd.conf \
64 + ovpn_status_log/ovpn_status_log.conf \
65 + phpfpm/phpfpm.conf \
66 + portcheck/portcheck.conf \
67 + postfix/postfix.conf \
68 + postgres/postgres.conf \
69 + powerdns/powerdns.conf \
70 + puppet/puppet.conf \
71 + rabbitmq/rabbitmq.conf \
72 + redis/redis.conf \
73 + rethinkdbs/rethinkdbs.conf \
74 + retroshare/retroshare.conf \
75 + samba/samba.conf \
76 + sensors/sensors.conf \
77 + springboot/springboot.conf \
78 + spigotmc/spigotmc.conf \
79 + squid/squid.conf \
80 + smartd_log/smartd_log.conf \
81 + tomcat/tomcat.conf \
82 + traefik/traefik.conf \
83 + unbound/unbound.conf \
84 + varnish/varnish.conf \
85 + w1sensor/w1sensor.conf \
86 + web_log/web_log.conf \
87 + $(NULL)
88 +
89 dist_python_SCRIPTS = \
90 $(NULL)
91
92 dist_python_DATA = \
14 - README.md \
15 - apache.chart.py \
16 - beanstalk.chart.py \
17 - bind_rndc.chart.py \
18 - boinc.chart.py \
19 - ceph.chart.py \
20 - chrony.chart.py \
21 - couchdb.chart.py \
22 - cpufreq.chart.py \
23 - cpuidle.chart.py \
24 - dns_query_time.chart.py \
25 - dnsdist.chart.py \
26 - dockerd.chart.py \
27 - dovecot.chart.py \
28 - elasticsearch.chart.py \
29 - example.chart.py \
30 - exim.chart.py \
31 - fail2ban.chart.py \
32 - freeradius.chart.py \
33 - go_expvar.chart.py \
34 - haproxy.chart.py \
35 - hddtemp.chart.py \
36 - httpcheck.chart.py \
37 - icecast.chart.py \
38 - ipfs.chart.py \
39 - isc_dhcpd.chart.py \
40 - linux_power_supply.chart.py \
41 - litespeed.chart.py \
42 - logind.chart.py \
43 - mdstat.chart.py \
44 - megacli.chart.py \
45 - memcached.chart.py \
46 - mongodb.chart.py \
47 - monit.chart.py \
48 - mysql.chart.py \
49 - nginx.chart.py \
50 - nginx_plus.chart.py \
51 - nsd.chart.py \
52 - ntpd.chart.py \
53 - ovpn_status_log.chart.py \
54 - phpfpm.chart.py \
55 - portcheck.chart.py \
56 - postfix.chart.py \
57 - postgres.chart.py \
58 - powerdns.chart.py \
59 - puppet.chart.py \
60 - rabbitmq.chart.py \
61 - redis.chart.py \
62 - rethinkdbs.chart.py \
63 - retroshare.chart.py \
64 - samba.chart.py \
65 - sensors.chart.py \
66 - spigotmc.chart.py \
67 - springboot.chart.py \
68 - squid.chart.py \
69 - smartd_log.chart.py \
70 - tomcat.chart.py \
71 - traefik.chart.py \
72 - unbound.chart.py \
73 - varnish.chart.py \
74 - w1sensor.chart.py \
75 - web_log.chart.py \
93 + apache/apache.chart.py \
94 + beanstalk/beanstalk.chart.py \
95 + bind_rndc/bind_rndc.chart.py \
96 + boinc/boinc.chart.py \
97 + ceph/ceph.chart.py \
98 + chrony/chrony.chart.py \
99 + couchdb/couchdb.chart.py \
100 + cpufreq/cpufreq.chart.py \
101 + cpuidle/cpuidle.chart.py \
102 + dns_query_time/dns_query_time.chart.py \
103 + dnsdist/dnsdist.chart.py \
104 + dockerd/dockerd.chart.py \
105 + dovecot/dovecot.chart.py \
106 + elasticsearch/elasticsearch.chart.py \
107 + example/example.chart.py \
108 + exim/exim.chart.py \
109 + fail2ban/fail2ban.chart.py \
110 + freeradius/freeradius.chart.py \
111 + go_expvar/go_expvar.chart.py \
112 + haproxy/haproxy.chart.py \
113 + hddtemp/hddtemp.chart.py \
114 + httpcheck/httpcheck.chart.py \
115 + icecast/icecast.chart.py \
116 + ipfs/ipfs.chart.py \
117 + isc_dhcpd/isc_dhcpd.chart.py \
118 + linux_power_supply/linux_power_supply.chart.py \
119 + litespeed/litespeed.chart.py \
120 + logind/logind.chart.py \
121 + mdstat/mdstat.chart.py \
122 + megacli/megacli.chart.py \
123 + memcached/memcached.chart.py \
124 + mongodb/mongodb.chart.py \
125 + monit/monit.chart.py \
126 + mysql/mysql.chart.py \
127 + nginx/nginx.chart.py \
128 + nginx_plus/nginx_plus.chart.py \
129 + nsd/nsd.chart.py \
130 + ntpd/ntpd.chart.py \
131 + ovpn_status_log/ovpn_status_log.chart.py \
132 + phpfpm/phpfpm.chart.py \
133 + portcheck/portcheck.chart.py \
134 + postfix/postfix.chart.py \
135 + postgres/postgres.chart.py \
136 + powerdns/powerdns.chart.py \
137 + puppet/puppet.chart.py \
138 + rabbitmq/rabbitmq.chart.py \
139 + redis/redis.chart.py \
140 + rethinkdbs/rethinkdbs.chart.py \
141 + retroshare/retroshare.chart.py \
142 + samba/samba.chart.py \
143 + sensors/sensors.chart.py \
144 + spigotmc/spigotmc.chart.py \
145 + springboot/springboot.chart.py \
146 + squid/squid.chart.py \
147 + smartd_log/smartd_log.chart.py \
148 + tomcat/tomcat.chart.py \
149 + traefik/traefik.chart.py \
150 + unbound/unbound.chart.py \
151 + varnish/varnish.chart.py \
152 + w1sensor/w1sensor.chart.py \
153 + web_log/web_log.chart.py \
154 $(NULL)
155
156 pythonmodulesdir=$(pythondir)/python_modules
collectors/python.d.plugin/README.md new
+198
@@ -0,0 +1,198 @@
1 +# python.d.plugin
2 +
3 +`python.d.plugin` is a netdata external plugin. It is an **orchestrator** for data collection modules written in `python`.
4 +
5 +1. It runs as an independent process `ps fax` shows it
6 +2. It is started and stopped automatically by netdata
7 +3. It communicates with netdata via a unidirectional pipe (sending data to the netdata daemon)
8 +4. Supports any number of data collection **modules**
9 +5. Allows each **module** to have one or more data collection **jobs**
10 +6. Each **job** is collecting one or more metrics from a single data source
11 +
12 +
13 +## Disclaimer
14 +
15 +Every module should be compatible with python2 and python3.
16 +All third party libraries should be installed system-wide or in `python_modules` directory.
17 +Module configurations are written in YAML and **pyYAML is required**.
18 +
19 +Every configuration file must have one of two formats:
20 +
21 +- Configuration for only one job:
22 +
23 +```yaml
24 +update_every : 2 # update frequency
25 +retries : 1 # how many failures in update() is tolerated
26 +priority : 20000 # where it is shown on dashboard
27 +
28 +other_var1 : bla # variables passed to module
29 +other_var2 : alb
30 +```
31 +
32 +- Configuration for many jobs (ex. mysql):
33 +
34 +```yaml
35 +# module defaults:
36 +update_every : 2
37 +retries : 1
38 +priority : 20000
39 +
40 +local: # job name
41 + update_every : 5 # job update frequency
42 + other_var1 : some_val # module specific variable
43 +
44 +other_job:
45 + priority : 5 # job position on dashboard
46 + retries : 20 # job retries
47 + other_var2 : val # module specific variable
48 +```
49 +
50 +`update_every`, `retries`, and `priority` are always optional.
51 +
52 +---
53 +
54 +## How to write a new module
55 +
56 +Writing new python module is simple. You just need to remember to include 5 major things:
57 +- **ORDER** global list
58 +- **CHART** global dictionary
59 +- **Service** class
60 +- **_get_data** method
61 +- all code needs to be compatible with Python 2 (**≥ 2.7**) *and* 3 (**≥ 3.1**)
62 +
63 +If you plan to submit the module in a PR, make sure and go through the [PR checklist for new modules](https://github.com/netdata/netdata/wiki/New-Module-PR-Checklist) beforehand to make sure you have updated all the files you need to.
64 +
65 +### Global variables `ORDER` and `CHART`
66 +
67 +`ORDER` list should contain the order of chart ids. Example:
68 +```py
69 +ORDER = ['first_chart', 'second_chart', 'third_chart']
70 +```
71 +
72 +`CHART` dictionary is a little bit trickier. It should contain the chart definition in following format:
73 +```py
74 +CHART = {
75 + id: {
76 + 'options': [name, title, units, family, context, charttype],
77 + 'lines': [
78 + [unique_dimension_name, name, algorithm, multiplier, divisor]
79 + ]}
80 +```
81 +
82 +All names are better explained in the [External Plugins](../) section.
83 +Parameters like `priority` and `update_every` are handled by `python.d.plugin`.
84 +
85 +### `Service` class
86 +
87 +Every module needs to implement its own `Service` class. This class should inherit from one of the framework classes:
88 +
89 +- `SimpleService`
90 +- `UrlService`
91 +- `SocketService`
92 +- `LogService`
93 +- `ExecutableService`
94 +
95 +Also it needs to invoke the parent class constructor in a specific way as well as assign global variables to class variables.
96 +
97 +Simple example:
98 +```py
99 +from base import UrlService
100 +class Service(UrlService):
101 + def __init__(self, configuration=None, name=None):
102 + UrlService.__init__(self, configuration=configuration, name=name)
103 + self.order = ORDER
104 + self.definitions = CHARTS
105 +```
106 +
107 +### `_get_data` collector/parser
108 +
109 +This method should grab raw data from `_get_raw_data`, parse it, and return a dictionary where keys are unique dimension names or `None` if no data is collected.
110 +
111 +Example:
112 +```py
113 +def _get_data(self):
114 + try:
115 + raw = self._get_raw_data().split(" ")
116 + return {'active': int(raw[2])}
117 + except (ValueError, AttributeError):
118 + return None
119 +```
120 +
121 +More about framework classes
122 +============================
123 +
124 +Every framework class has some user-configurable variables which are specific to this particular class. Those variables should have default values initialized in the child class constructor.
125 +
126 +If module needs some additional user-configurable variable, it can be accessed from the `self.configuration` list and assigned in constructor or custom `check` method. Example:
127 +```py
128 +def __init__(self, configuration=None, name=None):
129 + UrlService.__init__(self, configuration=configuration, name=name)
130 + try:
131 + self.baseurl = str(self.configuration['baseurl'])
132 + except (KeyError, TypeError):
133 + self.baseurl = "http://localhost:5001"
134 +```
135 +
136 +Classes implement `_get_raw_data` which should be used to grab raw data. This method usually returns a list of strings.
137 +
138 +### `SimpleService`
139 +
140 +_This is last resort class, if a new module cannot be written by using other framework class this one can be used._
141 +
142 +_Example: `mysql`, `sensors`_
143 +
144 +It is the lowest-level class which implements most of module logic, like:
145 +- threading
146 +- handling run times
147 +- chart formatting
148 +- logging
149 +- chart creation and updating
150 +
151 +### `LogService`
152 +
153 +_Examples: `apache_cache`, `nginx_log`_
154 +
155 +_Variable from config file_: `log_path`.
156 +
157 +Object created from this class reads new lines from file specified in `log_path` variable. It will check if file exists and is readable. Also `_get_raw_data` returns list of strings where each string is one line from file specified in `log_path`.
158 +
159 +### `ExecutableService`
160 +
161 +_Examples: `exim`, `postfix`_
162 +
163 +_Variable from config file_: `command`.
164 +
165 +This allows to execute a shell command in a secure way. It will check for invalid characters in `command` variable and won't proceed if there is one of:
166 +- '&'
167 +- '|'
168 +- ';'
169 +- '>'
170 +- '<'
171 +
172 +For additional security it uses python `subprocess.Popen` (without `shell=True` option) to execute command. Command can be specified with absolute or relative name. When using relative name, it will try to find `command` in `PATH` environment variable as well as in `/sbin` and `/usr/sbin`.
173 +
174 +`_get_raw_data` returns list of decoded lines returned by `command`.
175 +
176 +### UrlService
177 +
178 +_Examples: `apache`, `nginx`, `tomcat`_
179 +
180 +_Variables from config file_: `url`, `user`, `pass`.
181 +
182 +If data is grabbed by accessing service via HTTP protocol, this class can be used. It can handle HTTP Basic Auth when specified with `user` and `pass` credentials.
183 +
184 +`_get_raw_data` returns list of utf-8 decoded strings (lines).
185 +
186 +### SocketService
187 +
188 +_Examples: `dovecot`, `redis`_
189 +
190 +_Variables from config file_: `unix_socket`, `host`, `port`, `request`.
191 +
192 +Object will try execute `request` using either `unix_socket` or TCP/IP socket with combination of `host` and `port`. This can access unix sockets with SOCK_STREAM or SOCK_DGRAM protocols and TCP/IP sockets in version 4 and 6 with SOCK_STREAM setting.
193 +
194 +Sockets are accessed in non-blocking mode with 15 second timeout.
195 +
196 +After every execution of `_get_raw_data` socket is closed, to prevent this module needs to set `_keep_alive` variable to `True` and implement custom `_check_raw_data` method.
197 +
198 +`_check_raw_data` should take raw data and return `True` if all data is received otherwise it should return `False`. Also it should do it in fast and efficient way.
\ No newline at end of file
collectors/python.d.plugin/apache/README.md new
+59
@@ -0,0 +1,59 @@
1 +# apache
2 +
3 +This module will monitor one or more Apache servers depending on configuration.
4 +
5 +**Requirements:**
6 + * apache with enabled `mod_status`
7 +
8 +It produces the following charts:
9 +
10 +1. **Requests** in requests/s
11 + * requests
12 +
13 +2. **Connections**
14 + * connections
15 +
16 +3. **Async Connections**
17 + * keepalive
18 + * closing
19 + * writing
20 +
21 +4. **Bandwidth** in kilobytes/s
22 + * sent
23 +
24 +5. **Workers**
25 + * idle
26 + * busy
27 +
28 +6. **Lifetime Avg. Requests/s** in requests/s
29 + * requests_sec
30 +
31 +7. **Lifetime Avg. Bandwidth/s** in kilobytes/s
32 + * size_sec
33 +
34 +8. **Lifetime Avg. Response Size** in bytes/request
35 + * size_req
36 +
37 +### configuration
38 +
39 +Needs only `url` to server's `server-status?auto`
40 +
41 +Here is an example for 2 servers:
42 +
43 +```yaml
44 +update_every : 10
45 +priority : 90100
46 +
47 +local:
48 + url : 'http://localhost/server-status?auto'
49 + retries : 20
50 +
51 +remote:
52 + url : 'http://www.apache.org/server-status?auto'
53 + update_every : 5
54 + retries : 4
55 +```
56 +
57 +Without configuration, module attempts to connect to `http://localhost/server-status?auto`
58 +
59 +---
collectors/python.d.plugin/apache/apache.chart.py renamed
collectors/python.d.plugin/apache/apache.conf renamed
collectors/python.d.plugin/beanstalk/README.md new
+103
@@ -0,0 +1,103 @@
1 +# beanstalk
2 +
3 +Module provides server and tube-level statistics:
4 +
5 +**Requirements:**
6 + * `python-beanstalkc`
7 +
8 +**Server statistics:**
9 +
10 +1. **Cpu usage** in cpu time
11 + * user
12 + * system
13 +
14 +2. **Jobs rate** in jobs/s
15 + * total
16 + * timeouts
17 +
18 +3. **Connections rate** in connections/s
19 + * connections
20 +
21 +4. **Commands rate** in commands/s
22 + * put
23 + * peek
24 + * peek-ready
25 + * peek-delayed
26 + * peek-buried
27 + * reserve
28 + * use
29 + * watch
30 + * ignore
31 + * delete
32 + * release
33 + * bury
34 + * kick
35 + * stats
36 + * stats-job
37 + * stats-tube
38 + * list-tubes
39 + * list-tube-used
40 + * list-tubes-watched
41 + * pause-tube
42 +
43 +5. **Current tubes** in tubes
44 + * tubes
45 +
46 +6. **Current jobs** in jobs
47 + * urgent
48 + * ready
49 + * reserved
50 + * delayed
51 + * buried
52 +
53 +7. **Current connections** in connections
54 + * written
55 + * producers
56 + * workers
57 + * waiting
58 +
59 +8. **Binlog** in records/s
60 + * written
61 + * migrated
62 +
63 +9. **Uptime** in seconds
64 + * uptime
65 +
66 +**Per tube statistics:**
67 +
68 +1. **Jobs rate** in jobs/s
69 + * jobs
70 +
71 +2. **Jobs** in jobs
72 + * using
73 + * ready
74 + * reserved
75 + * delayed
76 + * buried
77 +
78 +3. **Connections** in connections
79 + * using
80 + * waiting
81 + * watching
82 +
83 +4. **Commands** in commands/s
84 + * deletes
85 + * pauses
86 +
87 +5. **Pause** in seconds
88 + * since
89 + * left
90 +
91 +
92 +### configuration
93 +
94 +Sample:
95 +
96 +```yaml
97 +host : '127.0.0.1'
98 +port : 11300
99 +```
100 +
101 +If no configuration is given, module will attempt to connect to beanstalkd on `127.0.0.1:11300` address
102 +
103 +---
collectors/python.d.plugin/beanstalk/beanstalk.chart.py renamed
collectors/python.d.plugin/beanstalk/beanstalk.conf renamed
collectors/python.d.plugin/bind_rndc/README.md new
+60
@@ -0,0 +1,60 @@
1 +# bind_rndc
2 +
3 +Module parses bind dump file to collect real-time performance metrics
4 +
5 +**Requirements:**
6 + * Version of bind must be 9.6 +
7 + * Netdata must have permissions to run `rndc stats`
8 +
9 +It produces:
10 +
11 +1. **Name server statistics**
12 + * requests
13 + * responses
14 + * success
15 + * auth_answer
16 + * nonauth_answer
17 + * nxrrset
18 + * failure
19 + * nxdomain
20 + * recursion
21 + * duplicate
22 + * rejections
23 +
24 +2. **Incoming queries**
25 + * RESERVED0
26 + * A
27 + * NS
28 + * CNAME
29 + * SOA
30 + * PTR
31 + * MX
32 + * TXT
33 + * X25
34 + * AAAA
35 + * SRV
36 + * NAPTR
37 + * A6
38 + * DS
39 + * RSIG
40 + * DNSKEY
41 + * SPF
42 + * ANY
43 + * DLV
44 +
45 +3. **Outgoing queries**
46 + * Same as Incoming queries
47 +
48 +
49 +### configuration
50 +
51 +Sample:
52 +
53 +```yaml
54 +local:
55 + named_stats_path : '/var/log/bind/named.stats'
56 +```
57 +
58 +If no configuration is given, module will attempt to read named.stats file at `/var/log/bind/named.stats`
59 +
60 +---
collectors/python.d.plugin/bind_rndc/bind_rndc.chart.py renamed
collectors/python.d.plugin/bind_rndc/bind_rndc.conf renamed
collectors/python.d.plugin/boinc/README.md new
+28
@@ -0,0 +1,28 @@
1 +# boinc
2 +
3 +This module monitors task counts for the Berkely Open Infrastructure
4 +Networking Computing (BOINC) distributed computing client using the same
5 +RPC interface that the BOINC monitoring GUI does.
6 +
7 +It provides charts tracking the total number of tasks and active tasks,
8 +as well as ones tracking each of the possible states for tasks.
9 +
10 +### configuration
11 +
12 +BOINC requires use of a password to access it's RPC interface. You can
13 +find this password in the `gui_rpc_auth.cfg` file in your BOINC directory.
14 +
15 +By default, the module will try to auto-detect the password by looking
16 +in `/var/lib/boinc` for this file (this is the location most Linux
17 +distributions use for a system-wide BOINC installation), so things may
18 +just work without needing configuration for the local system.
19 +
20 +You can monitor remote systems as well:
21 +
22 +```yaml
23 +remote:
24 + hostname: some-host
25 + password: some-password
26 +```
27 +
28 +---
collectors/python.d.plugin/boinc/boinc.chart.py renamed
collectors/python.d.plugin/boinc/boinc.conf renamed
collectors/python.d.plugin/ceph/README.md new
+32
@@ -0,0 +1,32 @@
1 +# ceph
2 +
3 +This module monitors the ceph cluster usage and consuption data of a server.
4 +
5 +It produces:
6 +
7 +* Cluster statistics (usage, available, latency, objects, read/write rate)
8 +* OSD usage
9 +* OSD latency
10 +* Pool usage
11 +* Pool read/write operations
12 +* Pool read/write rate
13 +* number of objects per pool
14 +
15 +**Requirements:**
16 +
17 +- `rados` python module
18 +- Granting read permissions to ceph group from keyring file
19 +```shell
20 +# chmod 640 /etc/ceph/ceph.client.admin.keyring
21 +```
22 +
23 +### Configuration
24 +
25 +Sample:
26 +```yaml
27 +local:
28 + config_file: '/etc/ceph/ceph.conf'
29 + keyring_file: '/etc/ceph/ceph.client.admin.keyring'
30 +```
31 +
32 +---
collectors/python.d.plugin/ceph/ceph.chart.py renamed
collectors/python.d.plugin/ceph/ceph.conf renamed
collectors/python.d.plugin/chrony/README.md new
+31
@@ -0,0 +1,31 @@
1 +# chrony
2 +
3 +This module monitors the precision and statistics of a local chronyd server.
4 +
5 +It produces:
6 +
7 +* frequency
8 +* last offset
9 +* RMS offset
10 +* residual freq
11 +* root delay
12 +* root dispersion
13 +* skew
14 +* system time
15 +
16 +**Requirements:**
17 +Verify that user netdata can execute `chronyc tracking`. If necessary, update `/etc/chrony.conf`, `cmdallow`.
18 +
19 +### Configuration
20 +
21 +Sample:
22 +```yaml
23 +# data collection frequency:
24 +update_every: 1
25 +
26 +# chrony query command:
27 +local:
28 + command: 'chronyc -n tracking'
29 +```
30 +
31 +---
collectors/python.d.plugin/chrony/chrony.chart.py renamed
collectors/python.d.plugin/chrony/chrony.conf renamed
collectors/python.d.plugin/couchdb/README.md new
+35
@@ -0,0 +1,35 @@
1 +# couchdb
2 +
3 +This module monitors vital statistics of a local Apache CouchDB 2.x server, including:
4 +
5 +* Overall server reads/writes
6 +* HTTP traffic breakdown
7 + * Request methods (`GET`, `PUT`, `POST`, etc.)
8 + * Response status codes (`200`, `201`, `4xx`, etc.)
9 +* Active server tasks
10 +* Replication status (CouchDB 2.1 and up only)
11 +* Erlang VM stats
12 +* Optional per-database statistics: sizes, # of docs, # of deleted docs
13 +
14 +### Configuration
15 +
16 +Sample for a local server running on port 5984:
17 +```yaml
18 +local:
19 + user: 'admin'
20 + pass: 'password'
21 + node: 'couchdb@127.0.0.1'
22 +```
23 +
24 +Be sure to specify a correct admin-level username and password.
25 +
26 +You may also need to change the `node` name; this should match the value of `-name NODENAME` in your CouchDB's `etc/vm.args` file. Typically this is of the form `couchdb@fully.qualified.domain.name` in a cluster, or `couchdb@127.0.0.1` / `couchdb@localhost` for a single-node server.
27 +
28 +If you want per-database statistics, these need to be added to the configuration, separated by spaces:
29 +```yaml
30 +local:
31 + ...
32 + databases: 'db1 db2 db3 ...'
33 +```
34 +
35 +---
collectors/python.d.plugin/couchdb/couchdb.chart.py renamed
collectors/python.d.plugin/couchdb/couchdb.conf renamed
collectors/python.d.plugin/cpufreq/README.md new
+30
@@ -0,0 +1,30 @@
1 +# cpufreq
2 +
3 +This module shows the current CPU frequency as set by the cpufreq kernel
4 +module.
5 +
6 +**Requirement:**
7 +You need to have `CONFIG_CPU_FREQ` and (optionally) `CONFIG_CPU_FREQ_STAT`
8 +enabled in your kernel.
9 +
10 +This module tries to read from one of two possible locations. On
11 +initialization, it tries to read the `time_in_state` files provided by
12 +cpufreq\_stats. If this file does not exist, or doesn't contain valid data, it
13 +falls back to using the more inaccurate `scaling_cur_freq` file (which only
14 +represents the **current** CPU frequency, and doesn't account for any state
15 +changes which happen between updates).
16 +
17 +It produces one chart with multiple lines (one line per core).
18 +
19 +### configuration
20 +
21 +Sample:
22 +
23 +```yaml
24 +sys_dir: "/sys/devices"
25 +```
26 +
27 +If no configuration is given, module will search for cpufreq files in `/sys/devices` directory.
28 +Directory is also prefixed with `NETDATA_HOST_PREFIX` if specified.
29 +
30 +---
collectors/python.d.plugin/cpufreq/cpufreq.chart.py renamed
collectors/python.d.plugin/cpufreq/cpufreq.conf renamed
collectors/python.d.plugin/cpuidle/README.md new
+11
@@ -0,0 +1,11 @@
1 +# cpuidle
2 +
3 +This module monitors the usage of CPU idle states.
4 +
5 +**Requirement:**
6 +Your kernel needs to have `CONFIG_CPU_IDLE` enabled.
7 +
8 +It produces one stacked chart per CPU, showing the percentage of time spent in
9 +each state.
10 +
11 +---
collectors/python.d.plugin/cpuidle/cpuidle.chart.py renamed
collectors/python.d.plugin/cpuidle/cpuidle.conf renamed
collectors/python.d.plugin/dns_query_time/README.md new
+10
@@ -0,0 +1,10 @@
1 +# dns_query_time
2 +
3 +This module provides DNS query time statistics.
4 +
5 +**Requirement:**
6 +* `python-dnspython` package
7 +
8 +It produces one aggregate chart or one chart per DNS server, showing the query time.
9 +
10 +---
collectors/python.d.plugin/dns_query_time/dns_query_time.chart.py renamed
collectors/python.d.plugin/dns_query_time/dns_query_time.conf renamed
collectors/python.d.plugin/dnsdist/README.md new
+54
@@ -0,0 +1,54 @@
1 +# dnsdist
2 +
3 +Module monitor dnsdist performance and health metrics.
4 +
5 +Following charts are drawn:
6 +
7 +1. **Response latency**
8 + * latency-slow
9 + * latency100-1000
10 + * latency50-100
11 + * latency10-50
12 + * latency1-10
13 + * latency0-1
14 +
15 +2. **Cache performance**
16 + * cache-hits
17 + * cache-misses
18 +
19 +3. **ACL events**
20 + * acl-drops
21 + * rule-drop
22 + * rule-nxdomain
23 + * rule-refused
24 +
25 +4. **Noncompliant data**
26 + * empty-queries
27 + * no-policy
28 + * noncompliant-queries
29 + * noncompliant-responses
30 +
31 +5. **Queries**
32 + * queries
33 + * rdqueries
34 + * rdqueries
35 +
36 +6. **Health**
37 + * downstream-send-errors
38 + * downstream-timeouts
39 + * servfail-responses
40 + * trunc-failures
41 +
42 +### configuration
43 +
44 +```yaml
45 +localhost:
46 + name : 'local'
47 + url : 'http://127.0.0.1:5053/jsonstat?command=stats'
48 + user : 'username'
49 + pass : 'password'
50 + header:
51 + X-API-Key: 'dnsdist-api-key'
52 +```
53 +
54 +---
collectors/python.d.plugin/dnsdist/dnsdist.chart.py renamed
collectors/python.d.plugin/dnsdist/dnsdist.conf renamed
collectors/python.d.plugin/dockerd/README.md new
+26
@@ -0,0 +1,26 @@
1 +# dockerd
2 +
3 +Module monitor docker health metrics.
4 +
5 +**Requirement:**
6 +* `docker` package
7 +
8 +Following charts are drawn:
9 +
10 +1. **running containers**
11 + * count
12 +
13 +2. **healthy containers**
14 + * count
15 +
16 +3. **unhealthy containers**
17 + * count
18 +
19 +### configuration
20 +
21 +```yaml
22 + update_every : 1
23 + priority : 60000
24 + ```
25 +
26 +---
collectors/python.d.plugin/dockerd/dockerd.chart.py renamed
collectors/python.d.plugin/dockerd/dockerd.conf renamed
collectors/python.d.plugin/dovecot/README.md new
+73
@@ -0,0 +1,73 @@
1 +# dovecot
2 +
3 +This module provides statistics information from Dovecot server.
4 +Statistics are taken from dovecot socket by executing `EXPORT global` command.
5 +More information about dovecot stats can be found on [project wiki page.](http://wiki2.dovecot.org/Statistics)
6 +
7 +**Requirement:**
8 +Dovecot UNIX socket with R/W permissions for user netdata or Dovecot with configured TCP/IP socket.
9 +
10 +Module gives information with following charts:
11 +
12 +1. **sessions**
13 + * active sessions
14 +
15 +2. **logins**
16 + * logins
17 +
18 +3. **commands** - number of IMAP commands
19 + * commands
20 +
21 +4. **Faults**
22 + * minor
23 + * major
24 +
25 +5. **Context Switches**
26 + * volountary
27 + * involountary
28 +
29 +6. **disk** in bytes/s
30 + * read
31 + * write
32 +
33 +7. **bytes** in bytes/s
34 + * read
35 + * write
36 +
37 +8. **number of syscalls** in syscalls/s
38 + * read
39 + * write
40 +
41 +9. **lookups** - number of lookups per second
42 + * path
43 + * attr
44 +
45 +10. **hits** - number of cache hits
46 + * hits
47 +
48 +11. **attempts** - authorization attempts
49 + * success
50 + * failure
51 +
52 +12. **cache** - cached authorization hits
53 + * hit
54 + * miss
55 +
56 +### configuration
57 +
58 +Sample:
59 +
60 +```yaml
61 +localtcpip:
62 + name : 'local'
63 + host : '127.0.0.1'
64 + port : 24242
65 +
66 +localsocket:
67 + name : 'local'
68 + socket : '/var/run/dovecot/stats'
69 +```
70 +
71 +If no configuration is given, module will attempt to connect to dovecot using unix socket localized in `/var/run/dovecot/stats`
72 +
73 +---
collectors/python.d.plugin/dovecot/dovecot.chart.py renamed
collectors/python.d.plugin/dovecot/dovecot.conf renamed
collectors/python.d.plugin/elasticsearch/README.md new
+60
@@ -0,0 +1,60 @@
1 +# elasticsearch
2 +
3 +This module monitors Elasticsearch performance and health metrics.
4 +
5 +It produces:
6 +
7 +1. **Search performance** charts:
8 + * Number of queries, fetches
9 + * Time spent on queries, fetches
10 + * Query and fetch latency
11 +
12 +2. **Indexing performance** charts:
13 + * Number of documents indexed, index refreshes, flushes
14 + * Time spent on indexing, refreshing, flushing
15 + * Indexing and flushing latency
16 +
17 +3. **Memory usage and garbace collection** charts:
18 + * JVM heap currently in use, committed
19 + * Count of garbage collections
20 + * Time spent on garbage collections
21 +
22 +4. **Host metrics** charts:
23 + * Available file descriptors in percent
24 + * Opened HTTP connections
25 + * Cluster communication transport metrics
26 +
27 +5. **Queues and rejections** charts:
28 + * Number of queued/rejected threads in thread pool
29 +
30 +6. **Fielddata cache** charts:
31 + * Fielddata cache size
32 + * Fielddata evictions and circuit breaker tripped count
33 +
34 +7. **Cluster health API** charts:
35 + * Cluster status
36 + * Nodes and tasks statistics
37 + * Shards statistics
38 +
39 +8. **Cluster stats API** charts:
40 + * Nodes statistics
41 + * Query cache statistics
42 + * Docs statistics
43 + * Store statistics
44 + * Indices and shards statistics
45 +
46 +### configuration
47 +
48 +Sample:
49 +
50 +```yaml
51 +local:
52 + host : 'ipaddress' # Server ip address or hostname
53 + port : 'password' # Port on which elasticsearch listed
54 + cluster_health : True/False # Calls to cluster health elasticsearch API. Enabled by default.
55 + cluster_stats : True/False # Calls to cluster stats elasticsearch API. Enabled by default.
56 +```
57 +
58 +If no configuration is given, module will fail to run.
59 +
60 +---
collectors/python.d.plugin/elasticsearch/elasticsearch.chart.py renamed
collectors/python.d.plugin/elasticsearch/elasticsearch.conf renamed
collectors/python.d.plugin/example/README.md new
+1
@@ -0,0 +1 @@
1 +An example python data collection module.
\ No newline at end of file
collectors/python.d.plugin/example/example.chart.py renamed
collectors/python.d.plugin/example/example.conf renamed
collectors/python.d.plugin/exim/README.md new
+13
@@ -0,0 +1,13 @@
1 +# exim
2 +
3 +Simple module executing `exim -bpc` to grab exim queue.
4 +This command can take a lot of time to finish its execution thus it is not recommended to run it every second.
5 +
6 +It produces only one chart:
7 +
8 +1. **Exim Queue Emails**
9 + * emails
10 +
11 +Configuration is not needed.
12 +
13 +---
collectors/python.d.plugin/exim/exim.chart.py renamed
collectors/python.d.plugin/exim/exim.conf renamed
collectors/python.d.plugin/fail2ban/README.md new
+23
@@ -0,0 +1,23 @@
1 +# fail2ban
2 +
3 +Module monitor fail2ban log file to show all bans for all active jails
4 +
5 +**Requirements:**
6 + * fail2ban.log file MUST BE readable by netdata (A good idea is to add **create 0640 root netdata** to fail2ban conf at logrotate.d)
7 +
8 +It produces one chart with multiple lines (one line per jail)
9 +
10 +### configuration
11 +
12 +Sample:
13 +
14 +```yaml
15 +local:
16 + log_path: '/var/log/fail2ban.log'
17 + conf_path: '/etc/fail2ban/jail.local'
18 + exclude: 'dropbear apache'
19 +```
20 +If no configuration is given, module will attempt to read log file at `/var/log/fail2ban.log` and conf file at `/etc/fail2ban/jail.local`.
21 +If conf file is not found default jail is `ssh`.
22 +
23 +---
collectors/python.d.plugin/fail2ban/fail2ban.chart.py renamed
collectors/python.d.plugin/fail2ban/fail2ban.conf renamed
collectors/python.d.plugin/freeradius/README.md new
+70
@@ -0,0 +1,70 @@
1 +# freeradius
2 +
3 +Uses the `radclient` command to provide freeradius statistics. It is not recommended to run it every second.
4 +
5 +It produces:
6 +
7 +1. **Authentication counters:**
8 + * access-accepts
9 + * access-rejects
10 + * auth-dropped-requests
11 + * auth-duplicate-requests
12 + * auth-invalid-requests
13 + * auth-malformed-requests
14 + * auth-unknown-types
15 +
16 +2. **Accounting counters:** [optional]
17 + * accounting-requests
18 + * accounting-responses
19 + * acct-dropped-requests
20 + * acct-duplicate-requests
21 + * acct-invalid-requests
22 + * acct-malformed-requests
23 + * acct-unknown-types
24 +
25 +3. **Proxy authentication counters:** [optional]
26 + * proxy-access-accepts
27 + * proxy-access-rejects
28 + * proxy-auth-dropped-requests
29 + * proxy-auth-duplicate-requests
30 + * proxy-auth-invalid-requests
31 + * proxy-auth-malformed-requests
32 + * proxy-auth-unknown-types
33 +
34 +4. **Proxy accounting counters:** [optional]
35 + * proxy-accounting-requests
36 + * proxy-accounting-responses
37 + * proxy-acct-dropped-requests
38 + * proxy-acct-duplicate-requests
39 + * proxy-acct-invalid-requests
40 + * proxy-acct-malformed-requests
41 + * proxy-acct-unknown-typesa
42 +
43 +
44 +### configuration
45 +
46 +Sample:
47 +
48 +```yaml
49 +local:
50 + host : 'localhost'
51 + port : '18121'
52 + secret : 'adminsecret'
53 + acct : False # Freeradius accounting statistics.
54 + proxy_auth : False # Freeradius proxy authentication statistics.
55 + proxy_acct : False # Freeradius proxy accounting statistics.
56 +```
57 +
58 +**Freeradius server configuration:**
59 +
60 +The configuration for the status server is automatically created in the sites-available directory.
61 +By default, server is enabled and can be queried from every client.
62 +FreeRADIUS will only respond to status-server messages, if the status-server virtual server has been enabled.
63 +
64 +To do this, create a link from the sites-enabled directory to the status file in the sites-available directory:
65 + * cd sites-enabled
66 + * ln -s ../sites-available/status status
67 +
68 +and restart/reload your FREERADIUS server.
69 +
70 +---
collectors/python.d.plugin/freeradius/freeradius.chart.py renamed
collectors/python.d.plugin/freeradius/freeradius.conf renamed
collectors/python.d.plugin/go_expvar/README.md new
+244
@@ -0,0 +1,244 @@
1 +# go_expvar
2 +
3 +The `go_expvar` module can monitor any Go application that exposes its metrics with the use of `expvar` package from the Go standard library.
4 +
5 +`go_expvar` produces charts for Go runtime memory statistics and optionally any number of custom charts.
6 +Please see the [wiki page](https://github.com/netdata/netdata/wiki/Monitoring-Go-Applications) for more info.
7 +
8 +For the memory statistics, it produces the following charts:
9 +
10 +1. **Heap allocations** in kB
11 + * alloc: size of objects allocated on the heap
12 + * inuse: size of allocated heap spans
13 +
14 +2. **Stack allocations** in kB
15 + * inuse: size of allocated stack spans
16 +
17 +3. **MSpan allocations** in kB
18 + * inuse: size of allocated mspan structures
19 +
20 +4. **MCache allocations** in kB
21 + * inuse: size of allocated mcache structures
22 +
23 +5. **Virtual memory** in kB
24 + * sys: size of reserved virtual address space
25 +
26 +6. **Live objects**
27 + * live: number of live objects in memory
28 +
29 +7. **GC pauses average** in ns
30 + * avg: average duration of all GC stop-the-world pauses
31 +
32 +
33 +## Monitoring Go Applications
34 +
35 +Netdata can be used to monitor running Go applications that expose their metrics with the use of the [expvar package](https://golang.org/pkg/expvar/) included in Go standard library.
36 +
37 +The `expvar` package exposes these metrics over HTTP and is very easy to use. Consider this minimal sample below:
38 +
39 +```
40 +package main
41 +
42 +import (
43 + _ "expvar"
44 + "net/http"
45 +)
46 +
47 +func main() {
48 + http.ListenAndServe("127.0.0.1:8080", nil)
49 +}
50 +```
51 +
52 +When imported this way, the `expvar` package registers a HTTP handler at `/debug/vars` that exposes Go runtime's memory statistics in JSON format. You can inspect the output by opening the URL in your browser (or by using `wget` or `curl`). Sample output:
53 +
54 +```
55 +{
56 +"cmdline": ["./expvar-demo-binary"],
57 +"memstats": {"Alloc":630856,"TotalAlloc":630856,"Sys":3346432,"Lookups":27, <ommited for brevity>}
58 +}
59 +```
60 +
61 +You can of course expose and monitor your own variables as well. Here is a sample Go application that exposes a few custom variables:
62 +
63 +```
64 +package main
65 +
66 +import (
67 + "expvar"
68 + "net/http"
69 + "runtime"
70 + "time"
71 +)
72 +
73 +func main() {
74 +
75 + tick := time.NewTicker(1 * time.Second)
76 + num_go := expvar.NewInt("runtime.goroutines")
77 + counters := expvar.NewMap("counters")
78 + counters.Set("cnt1", new(expvar.Int))
79 + counters.Set("cnt2", new(expvar.Float))
80 +
81 + go http.ListenAndServe(":8080", nil)
82 +
83 + for {
84 + select {
85 + case <- tick.C:
86 + num_go.Set(int64(runtime.NumGoroutine()))
87 + counters.Add("cnt1", 1)
88 + counters.AddFloat("cnt2", 1.452)
89 + }
90 + }
91 +}
92 +```
93 +
94 +Apart from the runtime memory stats, this application publishes two counters and the number of currently running Goroutines and updates these stats every second.
95 +
96 +In the next section, we will cover how to monitor and chart these exposed stats with the use of `netdata`s ```go_expvar``` module.
97 +
98 +### Using netdata go_expvar module
99 +
100 +The `go_expvar` module is disabled by default. To enable it, edit [`python.d.conf`](https://github.com/netdata/netdata/blob/master/conf.d/python.d.conf) (to edit it on your system run `/etc/netdata/edit-config python.d.conf`), and change the `go_expvar` variable to `yes`:
101 +
102 +```
103 +# Enable / Disable python.d.plugin modules
104 +#default_run: yes
105 +#
106 +# If "default_run" = "yes" the default for all modules is enabled (yes).
107 +# Setting any of these to "no" will disable it.
108 +#
109 +# If "default_run" = "no" the default for all modules is disabled (no).
110 +# Setting any of these to "yes" will enable it.
111 +...
112 +go_expvar: yes
113 +...
114 +```
115 +
116 +Next, we need to edit the module configuration file (found at [`/etc/netdata/python.d/go_expvar.conf`](https://github.com/netdata/netdata/blob/master/conf.d/python.d/go_expvar.conf) by default) (to edit it on your system run `/etc/netdata/edit-config python.d/go_expvar.conf`). The module configuration consists of jobs, where each job can be used to monitor a separate Go application. Let's see a sample job configuration:
117 +
118 +```
119 +# /etc/netdata/python.d/go_expvar.conf
120 +
121 +app1:
122 + name : 'app1'
123 + url : 'http://127.0.0.1:8080/debug/vars'
124 + collect_memstats: true
125 + extra_charts: {}
126 +```
127 +
128 +Let's go over each of the defined options:
129 +
130 + name: 'app1'
131 +
132 +This is the job name that will appear at the netdata dashboard. If not defined, the job_name (top level key) will be used.
133 +
134 + url: 'http://127.0.0.1:8080/debug/vars'
135 +
136 +This is the URL of the expvar endpoint. As the expvar handler can be installed in a custom path, the whole URL has to be specified. This value is mandatory.
137 +
138 + collect_memstats: true
139 +
140 +Whether to enable collecting stats about Go runtime's memory. You can find more information about the exposed values at the [runtime package docs](https://golang.org/pkg/runtime/#MemStats).
141 +
142 + extra_charts: {}
143 +
144 +Enables the user to specify custom expvars to monitor and chart. Will be explained in more detail below.
145 +
146 +**Note: if `collect_memstats` is disabled and no `extra_charts` are defined, the plugin will disable itself, as there will be no data to collect!**
147 +
148 +Apart from these options, each job supports options inherited from netdata's `python.d.plugin` and its base `UrlService` class. These are:
149 +
150 + update_every: 1 # the job's data collection frequency
151 + priority: 60000 # the job's order on the dashboard
152 + retries: 60 # the job's number of restoration attempts
153 + user: admin # use when the expvar endpoint is protected by HTTP Basic Auth
154 + password: sekret # use when the expvar endpoint is protected by HTTP Basic Auth
155 +
156 +### Monitoring custom vars with go_expvar
157 +
158 +Now, memory stats might be useful, but what if you want netdata to monitor some custom values that your Go application exposes? The `go_expvar` module can do that as well with the use of the `extra_charts` configuration variable.
159 +
160 +The `extra_charts` variable is a YaML list of netdata chart definitions. Each chart definition has the following keys:
161 +
162 + id: netdata chart ID
163 + options: a key-value mapping of chart options
164 + lines: a list of line definitions
165 +
166 +**Note: please do not use dots in the chart or line ID field. See [this issue](https://github.com/netdata/netdata/pull/1902#issuecomment-284494195) for explanation.**
167 +
168 +Please see these two links to the official netdata documentation for more information about the values:
169 +
170 +- [External plugins - charts](https://github.com/netdata/netdata/wiki/External-Plugins#chart)
171 +- [Chart variables](https://github.com/netdata/netdata/wiki/How-to-write-new-module#global-variables-order-and-chart)
172 +
173 +**Line definitions**
174 +
175 +Each chart can define multiple lines (dimensions). A line definition is a key-value mapping of line options. Each line can have the following options:
176 +
177 + # mandatory
178 + expvar_key: the name of the expvar as present in the JSON output of /debug/vars endpoint
179 + expvar_type: value type; supported are "float" or "int"
180 + id: the id of this line/dimension in netdata
181 +
182 + # optional - netdata defaults are used if these options are not defined
183 + name: ''
184 + algorithm: absolute
185 + multiplier: 1
186 + divisor: 100 if expvar_type == float, 1 if expvar_type == int
187 + hidden: False
188 +
189 +Please see the following link for more information about the options and their default values:
190 +[External plugins - dimensions](https://github.com/netdata/netdata/wiki/External-Plugins#dimension)
191 +
192 +Apart from top-level expvars, this plugin can also parse expvars stored in a multi-level map; All dicts in the resulting JSON document are then flattened to one level. Expvar names are joined together with '.' when flattening.
193 +
194 +Example:
195 +```
196 +{
197 + "counters": {"cnt1": 1042, "cnt2": 1512.9839999999983},
198 + "runtime.goroutines": 5
199 +}
200 +```
201 +
202 +In the above case, the exported variables will be available under `runtime.goroutines`, `counters.cnt1` and `counters.cnt2` expvar_keys. If the flattening results in a key collision, the first defined key wins and all subsequent keys with the same name are ignored.
203 +
204 +**Configuration example**
205 +
206 +The configuration below matches the second Go application described above. Netdata will monitor and chart memory stats for the application, as well as a custom chart of running goroutines and two dummy counters.
207 +
208 +```
209 +app1:
210 + name : 'app1'
211 + url : 'http://127.0.0.1:8080/debug/vars'
212 + collect_memstats: true
213 + extra_charts:
214 + - id: "runtime_goroutines"
215 + options:
216 + name: num_goroutines
217 + title: "runtime: number of goroutines"
218 + units: goroutines
219 + family: runtime
220 + context: expvar.runtime.goroutines
221 + chart_type: line
222 + lines:
223 + - {expvar_key: 'runtime.goroutines', expvar_type: int, id: runtime_goroutines}
224 + - id: "foo_counters"
225 + options:
226 + name: counters
227 + title: "some random counters"
228 + units: awesomeness
229 + family: counters
230 + context: expvar.foo.counters
231 + chart_type: line
232 + lines:
233 + - {expvar_key: 'counters.cnt1', expvar_type: int, id: counters_cnt1}
234 + - {expvar_key: 'counters.cnt2', expvar_type: float, id: counters_cnt2}
235 +```
236 +
237 +**Netdata charts example**
238 +
239 +The images below show how do the final charts in netdata look.
240 +
241 +![Memory stats charts](https://cloud.githubusercontent.com/assets/15180106/26762052/62b4af58-493b-11e7-9e69-146705acfc2c.png)
242 +
243 +![Custom charts](https://cloud.githubusercontent.com/assets/15180106/26762051/62ae915e-493b-11e7-8518-bd25a3886650.png)
244 +
collectors/python.d.plugin/go_expvar/go_expvar.chart.py renamed
collectors/python.d.plugin/go_expvar/go_expvar.conf renamed
collectors/python.d.plugin/haproxy/README.md new
+49
@@ -0,0 +1,49 @@
1 +# haproxy
2 +
3 +Module monitors frontend and backend metrics such as bytes in, bytes out, sessions current, sessions in queue current.
4 +And health metrics such as backend servers status (server check should be used).
5 +
6 +Plugin can obtain data from url **OR** unix socket.
7 +
8 +**Requirement:**
9 +Socket MUST be readable AND writable by netdata user.
10 +
11 +It produces:
12 +
13 +1. **Frontend** family charts
14 + * Kilobytes in/s
15 + * Kilobytes out/s
16 + * Sessions current
17 + * Sessions in queue current
18 +
19 +2. **Backend** family charts
20 + * Kilobytes in/s
21 + * Kilobytes out/s
22 + * Sessions current
23 + * Sessions in queue current
24 +
25 +3. **Health** chart
26 + * number of failed servers for every backend (in DOWN state)
27 +
28 +
29 +### configuration
30 +
31 +Sample:
32 +
33 +```yaml
34 +via_url:
35 + user : 'username' # ONLY IF stats auth is used
36 + pass : 'password' # # ONLY IF stats auth is used
37 + url : 'http://ip.address:port/url;csv;norefresh'
38 +```
39 +
40 +OR
41 +
42 +```yaml
43 +via_socket:
44 + socket : 'path/to/haproxy/sock'
45 +```
46 +
47 +If no configuration is given, module will fail to run.
48 +
49 +---
collectors/python.d.plugin/haproxy/haproxy.chart.py renamed
collectors/python.d.plugin/haproxy/haproxy.conf renamed
collectors/python.d.plugin/hddtemp/README.md new
+22
@@ -0,0 +1,22 @@
1 +# hddtemp
2 +
3 +Module monitors disk temperatures from one or more hddtemp daemons.
4 +
5 +**Requirement:**
6 +Running `hddtemp` in daemonized mode with access on tcp port
7 +
8 +It produces one chart **Temperature** with dynamic number of dimensions (one per disk)
9 +
10 +### configuration
11 +
12 +Sample:
13 +
14 +```yaml
15 +update_every: 3
16 +host: "127.0.0.1"
17 +port: 7634
18 +```
19 +
20 +If no configuration is given, module will attempt to connect to hddtemp daemon on `127.0.0.1:7634` address
21 +
22 +---
collectors/python.d.plugin/hddtemp/hddtemp.chart.py renamed
collectors/python.d.plugin/hddtemp/hddtemp.conf renamed
collectors/python.d.plugin/httpcheck/README.md new
+41
@@ -0,0 +1,41 @@
1 +# httpcheck
2 +
3 +Module monitors remote http server for availability and response time.
4 +
5 +Following charts are drawn per job:
6 +
7 +1. **Response time** ms
8 + * Time in 0.1 ms resolution in which the server responds.
9 + If the connection failed, the value is missing.
10 +
11 +2. **Status** boolean
12 + * Connection successful
13 + * Unexpected content: No Regex match found in the response
14 + * Unexpected status code: Do we get 500 errors?
15 + * Connection failed: port not listening or blocked
16 + * Connection timed out: host or port unreachable
17 +
18 +### configuration
19 +
20 +Sample configuration and their default values.
21 +
22 +```yaml
23 +server:
24 + url: 'http://host:port/path' # required
25 + status_accepted: # optional
26 + - 200
27 + timeout: 1 # optional, supports decimals (e.g. 0.2)
28 + update_every: 3 # optional
29 + regex: 'REGULAR_EXPRESSION' # optional, see https://docs.python.org/3/howto/regex.html
30 + redirect: yes # optional
31 +```
32 +
33 +### notes
34 +
35 + * The status chart is primarily intended for alarms, badges or for access via API.
36 + * A system/service/firewall might block netdata's access if a portscan or
37 + similar is detected.
38 + * This plugin is meant for simple use cases. Currently, the accuracy of the
39 + response time is low and should be used as reference only.
40 +
41 +---
collectors/python.d.plugin/httpcheck/httpcheck.chart.py renamed
collectors/python.d.plugin/httpcheck/httpcheck.conf renamed
collectors/python.d.plugin/icecast/README.md new
+26
@@ -0,0 +1,26 @@
1 +# icecast
2 +
3 +This module will monitor number of listeners for active sources.
4 +
5 +**Requirements:**
6 + * icecast version >= 2.4.0
7 +
8 +It produces the following charts:
9 +
10 +1. **Listeners** in listeners
11 + * source number
12 +
13 +### configuration
14 +
15 +Needs only `url` to server's `/status-json.xsl`
16 +
17 +Here is an example for remote server:
18 +
19 +```yaml
20 +remote:
21 + url : 'http://1.2.3.4:8443/status-json.xsl'
22 +```
23 +
24 +Without configuration, module attempts to connect to `http://localhost:8443/status-json.xsl`
25 +
26 +---
collectors/python.d.plugin/icecast/icecast.chart.py renamed
collectors/python.d.plugin/icecast/icecast.conf renamed
collectors/python.d.plugin/ipfs/README.md new
+25
@@ -0,0 +1,25 @@
1 +# ipfs
2 +
3 +Module monitors [IPFS](https://ipfs.io) basic information.
4 +
5 +1. **Bandwidth** in kbits/s
6 + * in
7 + * out
8 +
9 +2. **Peers**
10 + * peers
11 +
12 +### configuration
13 +
14 +Only url to IPFS server is needed.
15 +
16 +Sample:
17 +
18 +```yaml
19 +localhost:
20 + name : 'local'
21 + url : 'http://localhost:5001'
22 +```
23 +
24 +---
25 +
collectors/python.d.plugin/ipfs/ipfs.chart.py renamed
collectors/python.d.plugin/ipfs/ipfs.conf renamed
collectors/python.d.plugin/isc_dhcpd/README.md new
+34
@@ -0,0 +1,34 @@
1 +# isc_dhcpd
2 +
3 +Module monitor leases database to show all active leases for given pools.
4 +
5 +**Requirements:**
6 + * dhcpd leases file MUST BE readable by netdata
7 + * pools MUST BE in CIDR format
8 +
9 +It produces:
10 +
11 +1. **Pools utilization** Aggregate chart for all pools.
12 + * utilization in percent
13 +
14 +2. **Total leases**
15 + * leases (overall number of leases for all pools)
16 +
17 +3. **Active leases** for every pools
18 + * leases (number of active leases in pool)
19 +
20 +
21 +### configuration
22 +
23 +Sample:
24 +
25 +```yaml
26 +local:
27 + leases_path : '/var/lib/dhcp/dhcpd.leases'
28 + pools : '192.168.3.0/24 192.168.4.0/24 192.168.5.0/24'
29 +```
30 +
31 +In case of python2 you need to install `py2-ipaddress` to make plugin work.
32 +The module will not work If no configuration is given.
33 +
34 +---
collectors/python.d.plugin/isc_dhcpd/isc_dhcpd.chart.py renamed
collectors/python.d.plugin/isc_dhcpd/isc_dhcpd.conf renamed
collectors/python.d.plugin/linux_power_supply/README.md new
+67
@@ -0,0 +1,67 @@
1 +# linux\_power\_supply
2 +
3 +This module monitors variosu metrics reported by power supply drivers
4 +on Linux. This allows tracking and alerting on things like remaining
5 +battery capacity.
6 +
7 +Depending on the uderlying driver, it may provide the following charts
8 +and metrics:
9 +
10 +1. Capacity: The power supply capacity expressed as a percentage.
11 + * capacity\_now
12 +
13 +2. Charge: The charge for the power supply, expressed as microamphours.
14 + * charge\_full\_design
15 + * charge\_full
16 + * charge\_now
17 + * charge\_empty
18 + * charge\_empty\_design
19 +
20 +3. Energy: The energy for the power supply, expressed as microwatthours.
21 + * energy\_full\_design
22 + * energy\_full
23 + * energy\_now
24 + * energy\_empty
25 + * energy\_empty\_design
26 +
27 +2. Voltage: The voltage for the power supply, expressed as microvolts.
28 + * voltage\_max\_design
29 + * voltage\_max
30 + * voltage\_now
31 + * voltage\_min
32 + * voltage\_min\_design
33 +
34 +### configuration
35 +
36 +Sample:
37 +
38 +```yaml
39 +battery:
40 + supply: 'BAT0'
41 + charts: 'capacity charge energy voltage'
42 +```
43 +
44 +The `supply` key specifies the name of the power supply device to monitor.
45 +You can use `ls /sys/class/power_supply` to get a list of such devices
46 +on your system.
47 +
48 +The `charts` key is a space separated list of which charts to try
49 +to display. It defaults to trying to display everything.
50 +
51 +### notes
52 +
53 +* Most drivers provide at least the first chart. Battery powered ACPI
54 +compliant systems (like most laptops) provide all but the third, but do
55 +not provide all of the metrics for each chart.
56 +
57 +* Current, energy, and voltages are reported with a _very_ high precision
58 +by the power\_supply framework. Usually, this is far higher than the
59 +actual hardware supports reporting, so expect to see changes in these
60 +charts jump instead of scaling smoothly.
61 +
62 +* If `max` or `full` attribute is defined by the driver, but not a
63 +corresponding `min or `empty` attribute, then netdata will still provide
64 +the corresponding `min` or `empty`, which will then always read as zero.
65 +This way, alerts which match on these will still work.
66 +
67 +---
collectors/python.d.plugin/linux_power_supply/linux_power_supply.chart.py renamed
collectors/python.d.plugin/linux_power_supply/linux_power_supply.conf renamed
collectors/python.d.plugin/litespeed/README.md new
+47
@@ -0,0 +1,47 @@
1 +# litespeed
2 +
3 +Module monitor litespeed web server performance metrics.
4 +
5 +It produces:
6 +
7 +1. **Network Throughput HTTP** in kilobits/s
8 + * in
9 + * out
10 +
11 +2. **Network Throughput HTTPS** in kilobits/s
12 + * in
13 + * out
14 +
15 +3. **Connections HTTP** in connections
16 + * free
17 + * used
18 +
19 +4. **Connections HTTPS** in connections
20 + * free
21 + * used
22 +
23 +5. **Requests** in requests/s
24 + * requests
25 +
26 +6. **Requests In Processing** in requests
27 + * processing
28 +
29 +7. **Public Cache Hits** in hits/s
30 + * hits
31 +
32 +8. **Private Cache Hits** in hits/s
33 + * hits
34 +
35 +9. **Static Hits** in hits/s
36 + * hits
37 +
38 +
39 +### configuration
40 +```yaml
41 +local:
42 + path : 'PATH'
43 +```
44 +
45 +If no configuration is given, module will use "/tmp/lshttpd/".
46 +
47 +---
collectors/python.d.plugin/litespeed/litespeed.chart.py renamed
collectors/python.d.plugin/litespeed/litespeed.conf renamed
collectors/python.d.plugin/logind/README.md new
+54
@@ -0,0 +1,54 @@
1 +# logind
2 +
3 +This module monitors active sessions, users, and seats tracked by systemd-logind or elogind.
4 +
5 +It provides the following charts:
6 +
7 +1. **Sessions** Tracks the total number of sessions.
8 + * Graphical: Local graphical sessions (running X11, or Wayland, or something else).
9 + * Console: Local console sessions.
10 + * Remote: Remote sessions.
11 +
12 +2. **Users** Tracks total number of unique user logins of each type.
13 + * Graphical
14 + * Console
15 + * Remote
16 +
17 +3. **Seats** Total number of seats in use.
18 + * Seats
19 +
20 +### configuration
21 +
22 +This module needs no configuration. Just make sure the netdata user
23 +can run the `loginctl` command and get a session list without having to
24 +specify a path.
25 +
26 +This will work with any command that can output data in the _exact_
27 +same format as `loginctl list-sessions --no-legend`. If you have some
28 +other command you want to use that outputs data in this format, you can
29 +specify it using the `command` key like so:
30 +
31 +```yaml
32 +command: '/path/to/other/command'
33 +```
34 +
35 +### notes
36 +
37 +* This module's ability to track logins is dependent on what PAM services
38 +are configured to register sessions with logind. In particular, for
39 +most systems, it will only track TTY logins, local desktop logins,
40 +and logins through remote shell connections.
41 +
42 +* The users chart counts _usernames_ not UID's. This is potentially
43 +important in configurations where multiple users have the same UID.
44 +
45 +* The users chart counts any given user name up to once for _each_ type
46 +of login. So if the same user has a graphical and a console login on a
47 +system, they will show up once in the graphical count, and once in the
48 +console count.
49 +
50 +* Because the data collection process is rather expensive, this plugin
51 +is currently disabled by default, and needs to be explicitly enabled in
52 +`/etc/netdata/python.d.conf` before it will run.
53 +
54 +---
collectors/python.d.plugin/logind/logind.chart.py renamed
collectors/python.d.plugin/logind/logind.conf renamed
collectors/python.d.plugin/mdstat/README.md new
+26
@@ -0,0 +1,26 @@
1 +# mdstat
2 +
3 +Module monitor /proc/mdstat
4 +
5 +It produces:
6 +
7 +1. **Health** Number of failed disks in every array (aggregate chart).
8 +
9 +2. **Disks stats**
10 + * total (number of devices array ideally would have)
11 + * inuse (number of devices currently are in use)
12 +
13 +3. **Current status**
14 + * resync in percent
15 + * recovery in percent
16 + * reshape in percent
17 + * check in percent
18 +
19 +4. **Operation status** (if resync/recovery/reshape/check is active)
20 + * finish in minutes
21 + * speed in megabytes/s
22 +
23 +### configuration
24 +No configuration is needed.
25 +
26 +---
collectors/python.d.plugin/mdstat/mdstat.chart.py renamed
collectors/python.d.plugin/mdstat/mdstat.conf renamed
collectors/python.d.plugin/megacli/README.md new
+28
@@ -0,0 +1,28 @@
1 +# megacli
2 +
3 +Module collects adapter, physical drives and battery stats.
4 +
5 +**Requirements:**
6 + * `netdata` user needs to be able to be able to sudo the `megacli` program without password
7 +
8 +To grab stats it executes:
9 + * `sudo -n megacli -LDPDInfo -aAll`
10 + * `sudo -n megacli -AdpBbuCmd -a0`
11 +
12 +
13 +It produces:
14 +
15 +1. **Adapter State**
16 +
17 +2. **Physical Drives Media Errors**
18 +
19 +3. **Physical Drives Predictive Failures**
20 +
21 +4. **Battery Relative State of Charge**
22 +
23 +5. **Battery Cycle Count**
24 +
25 +### configuration
26 +Battery stats disabled by default in the module configuration file.
27 +
28 +---
collectors/python.d.plugin/megacli/megacli.chart.py renamed
collectors/python.d.plugin/megacli/megacli.conf renamed
collectors/python.d.plugin/memcached/README.md new
+69
@@ -0,0 +1,69 @@
1 +# memcached
2 +
3 +Memcached monitoring module. Data grabbed from [stats interface](https://github.com/memcached/memcached/wiki/Commands#stats).
4 +
5 +1. **Network** in kilobytes/s
6 + * read
7 + * written
8 +
9 +2. **Connections** per second
10 + * current
11 + * rejected
12 + * total
13 +
14 +3. **Items** in cluster
15 + * current
16 + * total
17 +
18 +4. **Evicted and Reclaimed** items
19 + * evicted
20 + * reclaimed
21 +
22 +5. **GET** requests/s
23 + * hits
24 + * misses
25 +
26 +6. **GET rate** rate in requests/s
27 + * rate
28 +
29 +7. **SET rate** rate in requests/s
30 + * rate
31 +
32 +8. **DELETE** requests/s
33 + * hits
34 + * misses
35 +
36 +9. **CAS** requests/s
37 + * hits
38 + * misses
39 + * bad value
40 +
41 +10. **Increment** requests/s
42 + * hits
43 + * misses
44 +
45 +11. **Decrement** requests/s
46 + * hits
47 + * misses
48 +
49 +12. **Touch** requests/s
50 + * hits
51 + * misses
52 +
53 +13. **Touch rate** rate in requests/s
54 + * rate
55 +
56 +### configuration
57 +
58 +Sample:
59 +
60 +```yaml
61 +localtcpip:
62 + name : 'local'
63 + host : '127.0.0.1'
64 + port : 24242
65 +```
66 +
67 +If no configuration is given, module will attempt to connect to memcached instance on `127.0.0.1:11211` address.
68 +
69 +---
collectors/python.d.plugin/memcached/memcached.chart.py renamed
collectors/python.d.plugin/memcached/memcached.conf renamed
collectors/python.d.plugin/mongodb/README.md new
+141
@@ -0,0 +1,141 @@
1 +# mongodb
2 +
3 +Module monitor mongodb performance and health metrics
4 +
5 +**Requirements:**
6 + * `python-pymongo` package.
7 +
8 +You need to install it manually.
9 +
10 +
11 +Number of charts depends on mongodb version, storage engine and other features (replication):
12 +
13 +1. **Read requests**:
14 + * query
15 + * getmore (operation the cursor executes to get additional data from query)
16 +
17 +2. **Write requests**:
18 + * insert
19 + * delete
20 + * update
21 +
22 +3. **Active clients**:
23 + * readers (number of clients with read operations in progress or queued)
24 + * writers (number of clients with write operations in progress or queued)
25 +
26 +4. **Journal transactions**:
27 + * commits (count of transactions that have been written to the journal)
28 +
29 +5. **Data written to the journal**:
30 + * volume (volume of data)
31 +
32 +6. **Background flush** (MMAPv1):
33 + * average ms (average time taken by flushes to execute)
34 + * last ms (time taken by the last flush)
35 +
36 +8. **Read tickets** (WiredTiger):
37 + * in use (number of read tickets in use)
38 + * available (number of available read tickets remaining)
39 +
40 +9. **Write tickets** (WiredTiger):
41 + * in use (number of write tickets in use)
42 + * available (number of available write tickets remaining)
43 +
44 +10. **Cursors**:
45 + * opened (number of cursors currently opened by MongoDB for clients)
46 + * timedOut (number of cursors that have timed)
47 + * noTimeout (number of open cursors with timeout disabled)
48 +
49 +11. **Connections**:
50 + * connected (number of clients currently connected to the database server)
51 + * unused (number of unused connections available for new clients)
52 +
53 +12. **Memory usage metrics**:
54 + * virtual
55 + * resident (amount of memory used by the database process)
56 + * mapped
57 + * non mapped
58 +
59 +13. **Page faults**:
60 + * page faults (number of times MongoDB had to request from disk)
61 +
62 +14. **Cache metrics** (WiredTiger):
63 + * percentage of bytes currently in the cache (amount of space taken by cached data)
64 + * percantage of tracked dirty bytes in the cache (amount of space taken by dirty data)
65 +
66 +15. **Pages evicted from cache** (WiredTiger):
67 + * modified
68 + * unmodified
69 +
70 +16. **Queued requests**:
71 + * readers (number of read request currently queued)
72 + * writers (number of write request currently queued)
73 +
74 +17. **Errors**:
75 + * msg (number of message assertions raised)
76 + * warning (number of warning assertions raised)
77 + * regular (number of regular assertions raised)
78 + * user (number of assertions corresponding to errors generated by users)
79 +
80 +18. **Storage metrics** (one chart for every database)
81 + * dataSize (size of all documents + padding in the database)
82 + * indexSize (size of all indexes in the database)
83 + * storageSize (size of all extents in the database)
84 +
85 +19. **Documents in the database** (one chart for all databases)
86 + * documents (number of objects in the database among all the collections)
87 +
88 +20. **tcmalloc metrics**
89 + * central cache free
90 + * current total thread cache
91 + * pageheap free
92 + * pageheap unmapped
93 + * thread cache free
94 + * transfer cache free
95 + * heap size
96 +
97 +21. **Commands total/failed rate**
98 + * count
99 + * createIndex
100 + * delete
101 + * eval
102 + * findAndModify
103 + * insert
104 +
105 +22. **Locks metrics** (acquireCount metrics - number of times the lock was acquired in the specified mode)
106 + * Global lock
107 + * Database lock
108 + * Collection lock
109 + * Metadata lock
110 + * oplog lock
111 +
112 +23. **Replica set members state**
113 + * state
114 +
115 +24. **Oplog window**
116 + * window (interval of time between the oldest and the latest entries in the oplog)
117 +
118 +25. **Replication lag**
119 + * member (time when last entry from the oplog was applied for every member)
120 +
121 +26. **Replication set member heartbeat latency**
122 + * member (time when last heartbeat was received from replica set member)
123 +
124 +
125 +### configuration
126 +
127 +Sample:
128 +
129 +```yaml
130 +local:
131 + name : 'local'
132 + host : '127.0.0.1'
133 + port : 27017
134 + user : 'netdata'
135 + pass : 'netdata'
136 +
137 +```
138 +
139 +If no configuration is given, module will attempt to connect to mongodb daemon on `127.0.0.1:27017` address
140 +
141 +---
collectors/python.d.plugin/mongodb/mongodb.chart.py renamed
collectors/python.d.plugin/mongodb/mongodb.conf renamed
collectors/python.d.plugin/monit/README.md new
+33
@@ -0,0 +1,33 @@
1 +# monit
2 +
3 +Monit monitoring module. Data is grabbed from stats XML interface (exists for a long time, but not mentioned in official documentation). Mostly this plugin shows statuses of monit targets, i.e. [statuses of specified checks](https://mmonit.com/monit/documentation/monit.html#Service-checks).
4 +
5 +1. **Filesystems**
6 + * Filesystems
7 + * Directories
8 + * Files
9 + * Pipes
10 +
11 +2. **Applications**
12 + * Processes (+threads/childs)
13 + * Programs
14 +
15 +3. **Network**
16 + * Hosts (+latency)
17 + * Network interfaces
18 +
19 +### configuration
20 +
21 +Sample:
22 +
23 +```yaml
24 +local:
25 + name : 'local'
26 + url : 'http://localhost:2812'
27 + user: : admin
28 + pass: : monit
29 +```
30 +
31 +If no configuration is given, module will attempt to connect to monit as `http://localhost:2812`.
32 +
33 +---
collectors/python.d.plugin/monit/monit.chart.py renamed
collectors/python.d.plugin/monit/monit.conf renamed
collectors/python.d.plugin/mysql/README.md new
+90
@@ -0,0 +1,90 @@
1 +# mysql
2 +
3 +Module monitors one or more mysql servers
4 +
5 +**Requirements:**
6 + * python library [MySQLdb](https://github.com/PyMySQL/mysqlclient-python) (faster) or [PyMySQL](https://github.com/PyMySQL/PyMySQL) (slower)
7 +
8 +It will produce following charts (if data is available):
9 +
10 +1. **Bandwidth** in kbps
11 + * in
12 + * out
13 +
14 +2. **Queries** in queries/sec
15 + * queries
16 + * questions
17 + * slow queries
18 +
19 +3. **Operations** in operations/sec
20 + * opened tables
21 + * flush
22 + * commit
23 + * delete
24 + * prepare
25 + * read first
26 + * read key
27 + * read next
28 + * read prev
29 + * read random
30 + * read random next
31 + * rollback
32 + * save point
33 + * update
34 + * write
35 +
36 +4. **Table Locks** in locks/sec
37 + * immediate
38 + * waited
39 +
40 +5. **Select Issues** in issues/sec
41 + * full join
42 + * full range join
43 + * range
44 + * range check
45 + * scan
46 +
47 +6. **Sort Issues** in issues/sec
48 + * merge passes
49 + * range
50 + * scan
51 +
52 +### configuration
53 +
54 +You can provide, per server, the following:
55 +
56 +1. username which have access to database (defaults to 'root')
57 +2. password (defaults to none)
58 +3. mysql my.cnf configuration file
59 +4. mysql socket (optional)
60 +5. mysql host (ip or hostname)
61 +6. mysql port (defaults to 3306)
62 +
63 +Here is an example for 3 servers:
64 +
65 +```yaml
66 +update_every : 10
67 +priority : 90100
68 +retries : 5
69 +
70 +local:
71 + 'my.cnf' : '/etc/mysql/my.cnf'
72 + priority : 90000
73 +
74 +local_2:
75 + user : 'root'
76 + pass : 'blablablabla'
77 + socket : '/var/run/mysqld/mysqld.sock'
78 + update_every : 1
79 +
80 +remote:
81 + user : 'admin'
82 + pass : 'bla'
83 + host : 'example.org'
84 + port : 9000
85 + retries : 20
86 +```
87 +
88 +If no configuration is given, module will attempt to connect to mysql server via unix socket at `/var/run/mysqld/mysqld.sock` without password and with username `root`
89 +
90 +---
collectors/python.d.plugin/mysql/mysql.chart.py renamed
collectors/python.d.plugin/mysql/mysql.conf renamed
collectors/python.d.plugin/nginx/README.md new
+45
@@ -0,0 +1,45 @@
1 +# nginx
2 +
3 +This module will monitor one or more nginx servers depending on configuration. Servers can be either local or remote.
4 +
5 +**Requirements:**
6 + * nginx with configured 'ngx_http_stub_status_module'
7 + * 'location /stub_status'
8 +
9 +Example nginx configuration can be found in 'python.d/nginx.conf'
10 +
11 +It produces following charts:
12 +
13 +1. **Active Connections**
14 + * active
15 +
16 +2. **Requests** in requests/s
17 + * requests
18 +
19 +3. **Active Connections by Status**
20 + * reading
21 + * writing
22 + * waiting
23 +
24 +4. **Connections Rate** in connections/s
25 + * accepts
26 + * handled
27 +
28 +### configuration
29 +
30 +Needs only `url` to server's `stub_status`
31 +
32 +Here is an example for local server:
33 +
34 +```yaml
35 +update_every : 10
36 +priority : 90100
37 +
38 +local:
39 + url : 'http://localhost/stub_status'
40 + retries : 10
41 +```
42 +
43 +Without configuration, module attempts to connect to `http://localhost/stub_status`
44 +
45 +---
collectors/python.d.plugin/nginx/nginx.chart.py renamed
collectors/python.d.plugin/nginx/nginx.conf renamed
collectors/python.d.plugin/nginx_plus/README.md new
+125
@@ -0,0 +1,125 @@
1 +# nginx_plus
2 +
3 +This module will monitor one or more nginx_plus servers depending on configuration.
4 +Servers can be either local or remote.
5 +
6 +Example nginx_plus configuration can be found in 'python.d/nginx_plus.conf'
7 +
8 +It produces following charts:
9 +
10 +1. **Requests total** in requests/s
11 + * total
12 +
13 +2. **Requests current** in requests
14 + * current
15 +
16 +3. **Connection Statistics** in connections/s
17 + * accepted
18 + * dropped
19 +
20 +4. **Workers Statistics** in workers
21 + * idle
22 + * active
23 +
24 +5. **SSL Handshakes** in handshakes/s
25 + * successful
26 + * failed
27 +
28 +6. **SSL Session Reuses** in sessions/s
29 + * reused
30 +
31 +7. **SSL Memory Usage** in percent
32 + * usage
33 +
34 +8. **Processes** in processes
35 + * respawned
36 +
37 +For every server zone:
38 +
39 +1. **Processing** in requests
40 + * processing
41 +
42 +2. **Requests** in requests/s
43 + * requests
44 +
45 +3. **Responses** in requests/s
46 + * 1xx
47 + * 2xx
48 + * 3xx
49 + * 4xx
50 + * 5xx
51 +
52 +4. **Traffic** in kilobits/s
53 + * received
54 + * sent
55 +
56 +For every upstream:
57 +
58 +1. **Peers Requests** in requests/s
59 + * peer name (dimension per peer)
60 +
61 +2. **All Peers Responses** in responses/s
62 + * 1xx
63 + * 2xx
64 + * 3xx
65 + * 4xx
66 + * 5xx
67 +
68 +3. **Peer Responses** in requests/s (for every peer)
69 + * 1xx
70 + * 2xx
71 + * 3xx
72 + * 4xx
73 + * 5xx
74 +
75 +4. **Peers Connections** in active
76 + * peer name (dimension per peer)
77 +
78 +5. **Peers Connections Usage** in percent
79 + * peer name (dimension per peer)
80 +
81 +6. **All Peers Traffic** in KB
82 + * received
83 + * sent
84 +
85 +7. **Peer Traffic** in KB/s (for every peer)
86 + * received
87 + * sent
88 +
89 +8. **Peer Timings** in ms (for every peer)
90 + * header
91 + * response
92 +
93 +9. **Memory Usage** in percent
94 + * usage
95 +
96 +10. **Peers Status** in state
97 + * peer name (dimension per peer)
98 +
99 +11. **Peers Total Downtime** in seconds
100 + * peer name (dimension per peer)
101 +
102 +For every cache:
103 +
104 +1. **Traffic** in KB
105 + * served
106 + * written
107 + * bypass
108 +
109 +2. **Memory Usage** in percent
110 + * usage
111 +
112 +### configuration
113 +
114 +Needs only `url` to server's `status`
115 +
116 +Here is an example for local server:
117 +
118 +```yaml
119 +local:
120 + url : 'http://localhost/status'
121 +```
122 +
123 +Without configuration, module fail to start.
124 +
125 +---
collectors/python.d.plugin/nginx_plus/nginx_plus.chart.py renamed
collectors/python.d.plugin/nginx_plus/nginx_plus.conf renamed
collectors/python.d.plugin/nsd/README.md new
+54
@@ -0,0 +1,54 @@
1 +# nsd
2 +
3 +Module uses the `nsd-control stats_noreset` command to provide `nsd` statistics.
4 +
5 +**Requirements:**
6 + * Version of `nsd` must be 4.0+
7 + * Netdata must have permissions to run `nsd-control stats_noreset`
8 +
9 +It produces:
10 +
11 +1. **Queries**
12 + * queries
13 +
14 +2. **Zones**
15 + * master
16 + * slave
17 +
18 +3. **Protocol**
19 + * udp
20 + * udp6
21 + * tcp
22 + * tcp6
23 +
24 +4. **Query Type**
25 + * A
26 + * NS
27 + * CNAME
28 + * SOA
29 + * PTR
30 + * HINFO
31 + * MX
32 + * NAPTR
33 + * TXT
34 + * AAAA
35 + * SRV
36 + * ANY
37 +
38 +5. **Transfer**
39 + * NOTIFY
40 + * AXFR
41 +
42 +6. **Return Code**
43 + * NOERROR
44 + * FORMERR
45 + * SERVFAIL
46 + * NXDOMAIN
47 + * NOTIMP
48 + * REFUSED
49 + * YXDOMAIN
50 +
51 +
52 +Configuration is not needed.
53 +
54 +---
collectors/python.d.plugin/nsd/nsd.chart.py renamed
collectors/python.d.plugin/nsd/nsd.conf renamed
collectors/python.d.plugin/ntpd/README.md new
+71
@@ -0,0 +1,71 @@
1 +# ntpd
2 +
3 +Module monitors the system variables of the local `ntpd` daemon (optional incl. variables of the polled peers) using the NTP Control Message Protocol via UDP socket, similar to `ntpq`, the [standard NTP query program](http://doc.ntp.org/current-stable/ntpq.html).
4 +
5 +**Requirements:**
6 + * Version: `NTPv4`
7 + * Local interrogation allowed in `/etc/ntp.conf` (default):
8 +
9 +```
10 +# Local users may interrogate the ntp server more closely.
11 +restrict 127.0.0.1
12 +restrict ::1
13 +```
14 +
15 +It produces:
16 +
17 +1. system
18 + * offset
19 + * jitter
20 + * frequency
21 + * delay
22 + * dispersion
23 + * stratum
24 + * tc
25 + * precision
26 +
27 +2. peers
28 + * offset
29 + * delay
30 + * dispersion
31 + * jitter
32 + * rootdelay
33 + * rootdispersion
34 + * stratum
35 + * hmode
36 + * pmode
37 + * hpoll
38 + * ppoll
39 + * precision
40 +
41 +**configuration**
42 +
43 +Sample:
44 +
45 +```yaml
46 +update_every: 10
47 +
48 +host: 'localhost'
49 +port: '123'
50 +show_peers: yes
51 +# hide peers with source address in ranges 127.0.0.0/8 and 192.168.0.0/16
52 +peer_filter: '(127\..*)|(192\.168\..*)'
53 +# check for new/changed peers every 60 updates
54 +peer_rescan: 60
55 +```
56 +
57 +Sample (multiple jobs):
58 +
59 +Note: `ntp.conf` on the host `otherhost` must be configured to allow queries from our local host by including a line like `restrict <IP> nomodify notrap nopeer`.
60 +
61 +```yaml
62 +local:
63 + host: 'localhost'
64 +
65 +otherhost:
66 + host: 'otherhost'
67 +```
68 +
69 +If no configuration is given, module will attempt to connect to `ntpd` on `::1:123` or `127.0.0.1:123` and show charts for the systemvars. Use `show_peers: yes` to also show the charts for configured peers. Local peers in the range `127.0.0.0/8` are hidden by default, use `peer_filter: ''` to show all peers.
70 +
71 +---
collectors/python.d.plugin/ntpd/ntpd.chart.py renamed
collectors/python.d.plugin/ntpd/ntpd.conf renamed
collectors/python.d.plugin/ovpn_status_log/README.md new
+32
@@ -0,0 +1,32 @@
1 +# ovpn_status_log
2 +
3 +Module monitor openvpn-status log file.
4 +
5 +**Requirements:**
6 +
7 + * If you are running multiple OpenVPN instances out of the same directory, MAKE SURE TO EDIT DIRECTIVES which create output files
8 + so that multiple instances do not overwrite each other's output files.
9 +
10 + * Make sure NETDATA USER CAN READ openvpn-status.log
11 +
12 + * Update_every interval MUST MATCH interval on which OpenVPN writes operational status to log file.
13 +
14 +It produces:
15 +
16 +1. **Users** OpenVPN active users
17 + * users
18 +
19 +2. **Traffic** OpenVPN overall bandwidth usage in kilobit/s
20 + * in
21 + * out
22 +
23 +### configuration
24 +
25 +Sample:
26 +
27 +```yaml
28 +default
29 + log_path : '/var/log/openvpn-status.log'
30 +```
31 +
32 +---
collectors/python.d.plugin/ovpn_status_log/ovpn_status_log.chart.py renamed
collectors/python.d.plugin/ovpn_status_log/ovpn_status_log.conf renamed
collectors/python.d.plugin/phpfpm/README.md new
+40
@@ -0,0 +1,40 @@
1 +# phpfpm
2 +
3 +This module will monitor one or more php-fpm instances depending on configuration.
4 +
5 +**Requirements:**
6 + * php-fpm with enabled `status` page
7 + * access to `status` page via web server
8 +
9 +It produces following charts:
10 +
11 +1. **Active Connections**
12 + * active
13 + * maxActive
14 + * idle
15 +
16 +2. **Requests** in requests/s
17 + * requests
18 +
19 +3. **Performance**
20 + * reached
21 + * slow
22 +
23 +### configuration
24 +
25 +Needs only `url` to server's `status`
26 +
27 +Here is an example for local instance:
28 +
29 +```yaml
30 +update_every : 3
31 +priority : 90100
32 +
33 +local:
34 + url : 'http://localhost/status'
35 + retries : 10
36 +```
37 +
38 +Without configuration, module attempts to connect to `http://localhost/status`
39 +
40 +---
collectors/python.d.plugin/phpfpm/phpfpm.chart.py renamed
collectors/python.d.plugin/phpfpm/phpfpm.conf renamed
collectors/python.d.plugin/portcheck/README.md new
+35
@@ -0,0 +1,35 @@
1 +# portcheck
2 +
3 +Module monitors a remote TCP service.
4 +
5 +Following charts are drawn per host:
6 +
7 +1. **Latency** ms
8 + * Time required to connect to a TCP port.
9 + Displays latency in 0.1 ms resolution. If the connection failed, the value is missing.
10 +
11 +2. **Status** boolean
12 + * Connection successful
13 + * Could not create socket: possible DNS problems
14 + * Connection refused: port not listening or blocked
15 + * Connection timed out: host or port unreachable
16 +
17 +
18 +### configuration
19 +
20 +```yaml
21 +server:
22 + host: 'dns or ip' # required
23 + port: 22 # required
24 + timeout: 1 # optional
25 + update_every: 1 # optional
26 +```
27 +
28 +### notes
29 +
30 + * The error chart is intended for alarms, badges or for access via API.
31 + * A system/service/firewall might block netdata's access if a portscan or
32 + similar is detected.
33 + * Currently, the accuracy of the latency is low and should be used as reference only.
34 +
35 +---
collectors/python.d.plugin/portcheck/portcheck.chart.py renamed
collectors/python.d.plugin/portcheck/portcheck.conf renamed
collectors/python.d.plugin/postfix/README.md new
+15
@@ -0,0 +1,15 @@
1 +# postfix
2 +
3 +Simple module executing `postfix -p` to grab postfix queue.
4 +
5 +It produces only two charts:
6 +
7 +1. **Postfix Queue Emails**
8 + * emails
9 +
10 +2. **Postfix Queue Emails Size** in KB
11 + * size
12 +
13 +Configuration is not needed.
14 +
15 +---
collectors/python.d.plugin/postfix/postfix.chart.py renamed
collectors/python.d.plugin/postfix/postfix.conf renamed
collectors/python.d.plugin/postgres/README.md new
+68
@@ -0,0 +1,68 @@
1 +# postgres
2 +
3 +Module monitors one or more postgres servers.
4 +
5 +**Requirements:**
6 +
7 + * `python-psycopg2` package. You have to install it manually.
8 +
9 +Following charts are drawn:
10 +
11 +1. **Database size** MB
12 + * size
13 +
14 +2. **Current Backend Processes** processes
15 + * active
16 +
17 +3. **Write-Ahead Logging Statistics** files/s
18 + * total
19 + * ready
20 + * done
21 +
22 +4. **Checkpoints** writes/s
23 + * scheduled
24 + * requested
25 +
26 +5. **Current connections to db** count
27 + * connections
28 +
29 +6. **Tuples returned from db** tuples/s
30 + * sequential
31 + * bitmap
32 +
33 +7. **Tuple reads from db** reads/s
34 + * disk
35 + * cache
36 +
37 +8. **Transactions on db** transactions/s
38 + * committed
39 + * rolled back
40 +
41 +9. **Tuples written to db** writes/s
42 + * inserted
43 + * updated
44 + * deleted
45 + * conflicts
46 +
47 +10. **Locks on db** count per type
48 + * locks
49 +
50 +### configuration
51 +
52 +```yaml
53 +socket:
54 + name : 'socket'
55 + user : 'postgres'
56 + database : 'postgres'
57 +
58 +tcp:
59 + name : 'tcp'
60 + user : 'postgres'
61 + database : 'postgres'
62 + host : 'localhost'
63 + port : 5432
64 +```
65 +
66 +When no configuration file is found, module tries to connect to TCP/IP socket: `localhost:5432`.
67 +
68 +---
collectors/python.d.plugin/postgres/postgres.chart.py renamed
collectors/python.d.plugin/postgres/postgres.conf renamed
collectors/python.d.plugin/powerdns/README.md new
+77
@@ -0,0 +1,77 @@
1 +# powerdns
2 +
3 +Module monitor powerdns performance and health metrics.
4 +
5 +Powerdns charts:
6 +
7 +1. **Queries and Answers**
8 + * udp-queries
9 + * udp-answers
10 + * tcp-queries
11 + * tcp-answers
12 +
13 +2. **Cache Usage**
14 + * query-cache-hit
15 + * query-cache-miss
16 + * packetcache-hit
17 + * packetcache-miss
18 +
19 +3. **Cache Size**
20 + * query-cache-size
21 + * packetcache-size
22 + * key-cache-size
23 + * meta-cache-size
24 +
25 +4. **Latency**
26 + * latency
27 +
28 + Powerdns Recursor charts:
29 +
30 + 1. **Questions In**
31 + * questions
32 + * ipv6-questions
33 + * tcp-queries
34 +
35 +2. **Questions Out**
36 + * all-outqueries
37 + * ipv6-outqueries
38 + * tcp-outqueries
39 + * throttled-outqueries
40 +
41 +3. **Answer Times**
42 + * answers-slow
43 + * answers0-1
44 + * answers1-10
45 + * answers10-100
46 + * answers100-1000
47 +
48 +4. **Timeouts**
49 + * outgoing-timeouts
50 + * outgoing4-timeouts
51 + * outgoing6-timeouts
52 +
53 +5. **Drops**
54 + * over-capacity-drops
55 +
56 +6. **Cache Usage**
57 + * cache-hits
58 + * cache-misses
59 + * packetcache-hits
60 + * packetcache-misses
61 +
62 +7. **Cache Size**
63 + * cache-entries
64 + * packetcache-entries
65 + * negcache-entries
66 +
67 +### configuration
68 +
69 +```yaml
70 +local:
71 + name : 'local'
72 + url : 'http://127.0.0.1:8081/api/v1/servers/localhost/statistics'
73 + header :
74 + X-API-Key: 'change_me'
75 +```
76 +
77 +---
collectors/python.d.plugin/powerdns/powerdns.chart.py renamed
collectors/python.d.plugin/powerdns/powerdns.conf renamed
collectors/python.d.plugin/puppet/README.md new
+48
@@ -0,0 +1,48 @@
1 +# puppet
2 +
3 +Monitor status of Puppet Server and Puppet DB.
4 +
5 +Following charts are drawn:
6 +
7 +1. **JVM Heap**
8 + * committed (allocated from OS)
9 + * used (actual use)
10 +2. **JVM Non-Heap**
11 + * committed (allocated from OS)
12 + * used (actual use)
13 +3. **CPU Usage**
14 + * execution
15 + * GC (taken by garbage collection)
16 +4. **File Descriptors**
17 + * max
18 + * used
19 +
20 +
21 +### configuration
22 +
23 +```yaml
24 +puppetdb:
25 + url: 'https://fqdn.example.com:8081'
26 + tls_cert_file: /path/to/client.crt
27 + tls_key_file: /path/to/client.key
28 + autodetection_retry: 1
29 + retries: 3600
30 +
31 +puppetserver:
32 + url: 'https://fqdn.example.com:8140'
33 + autodetection_retry: 1
34 + retries: 3600
35 +```
36 +
37 +When no configuration is given then `https://fqdn.example.com:8140` is
38 +tried without any retries.
39 +
40 +### notes
41 +
42 +* Exact Fully Qualified Domain Name of the node should be used.
43 +* Usually Puppet Server/DB startup time is VERY long. So, there should
44 + be quite reasonable retry count.
45 +* Secure PuppetDB config may require client certificate. Not applies
46 + to default PuppetDB configuration though.
47 +
48 +---
collectors/python.d.plugin/puppet/puppet.chart.py renamed
collectors/python.d.plugin/puppet/puppet.conf renamed
collectors/python.d.plugin/python.d.conf renamed
collectors/python.d.plugin/python.d.plugin.in renamed
collectors/python.d.plugin/python_modules/__init__.py renamed
collectors/python.d.plugin/python_modules/bases/FrameworkServices/ExecutableService.py renamed
collectors/python.d.plugin/python_modules/bases/FrameworkServices/LogService.py renamed
collectors/python.d.plugin/python_modules/bases/FrameworkServices/MySQLService.py renamed
collectors/python.d.plugin/python_modules/bases/FrameworkServices/SimpleService.py renamed
collectors/python.d.plugin/python_modules/bases/FrameworkServices/SocketService.py renamed
collectors/python.d.plugin/python_modules/bases/FrameworkServices/UrlService.py renamed
collectors/python.d.plugin/python_modules/bases/FrameworkServices/__init__.py renamed
collectors/python.d.plugin/python_modules/bases/__init__.py renamed
collectors/python.d.plugin/python_modules/bases/charts.py renamed
collectors/python.d.plugin/python_modules/bases/collection.py renamed
collectors/python.d.plugin/python_modules/bases/loaders.py renamed
collectors/python.d.plugin/python_modules/bases/loggers.py renamed
collectors/python.d.plugin/python_modules/pyyaml2/__init__.py renamed
collectors/python.d.plugin/python_modules/pyyaml2/composer.py renamed
collectors/python.d.plugin/python_modules/pyyaml2/constructor.py renamed
collectors/python.d.plugin/python_modules/pyyaml2/cyaml.py renamed
collectors/python.d.plugin/python_modules/pyyaml2/dumper.py renamed
collectors/python.d.plugin/python_modules/pyyaml2/emitter.py renamed
collectors/python.d.plugin/python_modules/pyyaml2/error.py renamed
collectors/python.d.plugin/python_modules/pyyaml2/events.py renamed
collectors/python.d.plugin/python_modules/pyyaml2/loader.py renamed
collectors/python.d.plugin/python_modules/pyyaml2/nodes.py renamed
collectors/python.d.plugin/python_modules/pyyaml2/parser.py renamed
collectors/python.d.plugin/python_modules/pyyaml2/reader.py renamed
collectors/python.d.plugin/python_modules/pyyaml2/representer.py renamed
collectors/python.d.plugin/python_modules/pyyaml2/resolver.py renamed
collectors/python.d.plugin/python_modules/pyyaml2/scanner.py renamed
collectors/python.d.plugin/python_modules/pyyaml2/serializer.py renamed
collectors/python.d.plugin/python_modules/pyyaml2/tokens.py renamed
collectors/python.d.plugin/python_modules/pyyaml3/__init__.py renamed
collectors/python.d.plugin/python_modules/pyyaml3/composer.py renamed
collectors/python.d.plugin/python_modules/pyyaml3/constructor.py renamed
collectors/python.d.plugin/python_modules/pyyaml3/cyaml.py renamed
collectors/python.d.plugin/python_modules/pyyaml3/dumper.py renamed
collectors/python.d.plugin/python_modules/pyyaml3/emitter.py renamed
collectors/python.d.plugin/python_modules/pyyaml3/error.py renamed
collectors/python.d.plugin/python_modules/pyyaml3/events.py renamed
collectors/python.d.plugin/python_modules/pyyaml3/loader.py renamed
collectors/python.d.plugin/python_modules/pyyaml3/nodes.py renamed
collectors/python.d.plugin/python_modules/pyyaml3/parser.py renamed
collectors/python.d.plugin/python_modules/pyyaml3/reader.py renamed
collectors/python.d.plugin/python_modules/pyyaml3/representer.py renamed
collectors/python.d.plugin/python_modules/pyyaml3/resolver.py renamed
collectors/python.d.plugin/python_modules/pyyaml3/scanner.py renamed
collectors/python.d.plugin/python_modules/pyyaml3/serializer.py renamed
collectors/python.d.plugin/python_modules/pyyaml3/tokens.py renamed
collectors/python.d.plugin/python_modules/third_party/__init__.py renamed
collectors/python.d.plugin/python_modules/third_party/boinc_client.py renamed
collectors/python.d.plugin/python_modules/third_party/lm_sensors.py renamed
collectors/python.d.plugin/python_modules/third_party/mcrcon.py renamed
collectors/python.d.plugin/python_modules/third_party/monotonic.py renamed
collectors/python.d.plugin/python_modules/third_party/ordereddict.py renamed
collectors/python.d.plugin/python_modules/urllib3/__init__.py renamed
collectors/python.d.plugin/python_modules/urllib3/_collections.py renamed
collectors/python.d.plugin/python_modules/urllib3/connection.py renamed
collectors/python.d.plugin/python_modules/urllib3/connectionpool.py renamed
collectors/python.d.plugin/python_modules/urllib3/contrib/__init__.py renamed
collectors/python.d.plugin/python_modules/urllib3/contrib/_securetransport/__init__.py renamed
collectors/python.d.plugin/python_modules/urllib3/contrib/_securetransport/bindings.py renamed
collectors/python.d.plugin/python_modules/urllib3/contrib/_securetransport/low_level.py renamed
collectors/python.d.plugin/python_modules/urllib3/contrib/appengine.py renamed
collectors/python.d.plugin/python_modules/urllib3/contrib/ntlmpool.py renamed
collectors/python.d.plugin/python_modules/urllib3/contrib/pyopenssl.py renamed
collectors/python.d.plugin/python_modules/urllib3/contrib/securetransport.py renamed
collectors/python.d.plugin/python_modules/urllib3/contrib/socks.py renamed
collectors/python.d.plugin/python_modules/urllib3/exceptions.py renamed
collectors/python.d.plugin/python_modules/urllib3/fields.py renamed
collectors/python.d.plugin/python_modules/urllib3/filepost.py renamed
collectors/python.d.plugin/python_modules/urllib3/packages/__init__.py renamed
collectors/python.d.plugin/python_modules/urllib3/packages/backports/__init__.py
collectors/python.d.plugin/python_modules/urllib3/packages/backports/makefile.py renamed
collectors/python.d.plugin/python_modules/urllib3/packages/ordered_dict.py renamed
collectors/python.d.plugin/python_modules/urllib3/packages/six.py renamed
collectors/python.d.plugin/python_modules/urllib3/packages/ssl_match_hostname/__init__.py renamed
collectors/python.d.plugin/python_modules/urllib3/packages/ssl_match_hostname/_implementation.py renamed
collectors/python.d.plugin/python_modules/urllib3/poolmanager.py renamed
collectors/python.d.plugin/python_modules/urllib3/request.py renamed
collectors/python.d.plugin/python_modules/urllib3/response.py renamed
collectors/python.d.plugin/python_modules/urllib3/util/__init__.py renamed
collectors/python.d.plugin/python_modules/urllib3/util/connection.py renamed
collectors/python.d.plugin/python_modules/urllib3/util/request.py renamed
collectors/python.d.plugin/python_modules/urllib3/util/response.py renamed
collectors/python.d.plugin/python_modules/urllib3/util/retry.py renamed
collectors/python.d.plugin/python_modules/urllib3/util/selectors.py renamed
collectors/python.d.plugin/python_modules/urllib3/util/ssl_.py renamed
collectors/python.d.plugin/python_modules/urllib3/util/timeout.py renamed
collectors/python.d.plugin/python_modules/urllib3/util/url.py renamed
collectors/python.d.plugin/python_modules/urllib3/util/wait.py renamed
collectors/python.d.plugin/rabbitmq/README.md new
+56
@@ -0,0 +1,56 @@
1 +# rabbitmq
2 +
3 +Module monitor rabbitmq performance and health metrics.
4 +
5 +Following charts are drawn:
6 +
7 +1. **Queued Messages**
8 + * ready
9 + * unacknowledged
10 +
11 +2. **Message Rates**
12 + * ack
13 + * redelivered
14 + * deliver
15 + * publish
16 +
17 +3. **Global Counts**
18 + * channels
19 + * consumers
20 + * connections
21 + * queues
22 + * exchanges
23 +
24 +4. **File Descriptors**
25 + * used descriptors
26 +
27 +5. **Socket Descriptors**
28 + * used descriptors
29 +
30 +6. **Erlang processes**
31 + * used processes
32 +
33 +7. **Erlang run queue**
34 + * Erlang run queue
35 +
36 +8. **Memory**
37 + * free memory in megabytes
38 +
39 +9. **Disk Space**
40 + * free disk space in gigabytes
41 +
42 +### configuration
43 +
44 +```yaml
45 +socket:
46 + name : 'local'
47 + host : '127.0.0.1'
48 + port : 15672
49 + user : 'guest'
50 + pass : 'guest'
51 +
52 +```
53 +
54 +When no configuration file is found, module tries to connect to: `localhost:15672`.
55 +
56 +---
collectors/python.d.plugin/rabbitmq/rabbitmq.chart.py renamed
collectors/python.d.plugin/rabbitmq/rabbitmq.conf renamed
collectors/python.d.plugin/redis/README.md new
+42
@@ -0,0 +1,42 @@
1 +# redis
2 +
3 +Get INFO data from redis instance.
4 +
5 +Following charts are drawn:
6 +
7 +1. **Operations** per second
8 + * operations
9 +
10 +2. **Hit rate** in percent
11 + * rate
12 +
13 +3. **Memory utilization** in kilobytes
14 + * total
15 + * lua
16 +
17 +4. **Database keys**
18 + * lines are creates dynamically based on how many databases are there
19 +
20 +5. **Clients**
21 + * connected
22 + * blocked
23 +
24 +6. **Slaves**
25 + * connected
26 +
27 +### configuration
28 +
29 +```yaml
30 +socket:
31 + name : 'local'
32 + socket : '/var/lib/redis/redis.sock'
33 +
34 +localhost:
35 + name : 'local'
36 + host : 'localhost'
37 + port : 6379
38 +```
39 +
40 +When no configuration file is found, module tries to connect to TCP/IP socket: `localhost:6379`.
41 +
42 +---
collectors/python.d.plugin/redis/redis.chart.py renamed
collectors/python.d.plugin/redis/redis.conf renamed
collectors/python.d.plugin/rethinkdbs/README.md new
+34
@@ -0,0 +1,34 @@
1 +# rethinkdbs
2 +
3 +Module monitor rethinkdb health metrics.
4 +
5 +Following charts are drawn:
6 +
7 +1. **Connected Servers**
8 + * connected
9 + * missing
10 +
11 +2. **Active Clients**
12 + * active
13 +
14 +3. **Queries** per second
15 + * queries
16 +
17 +4. **Documents** per second
18 + * documents
19 +
20 +### configuration
21 +
22 +```yaml
23 +
24 +localhost:
25 + name : 'local'
26 + host : '127.0.0.1'
27 + port : 28015
28 + user : "user"
29 + password : "pass"
30 +```
31 +
32 +When no configuration file is found, module tries to connect to `127.0.0.1:28015`.
33 +
34 +---
collectors/python.d.plugin/rethinkdbs/rethinkdbs.chart.py renamed
collectors/python.d.plugin/rethinkdbs/rethinkdbs.conf renamed
collectors/python.d.plugin/retroshare/README.md new
+1
@@ -0,0 +1 @@
1 +# retroshare
collectors/python.d.plugin/retroshare/retroshare.chart.py renamed
collectors/python.d.plugin/retroshare/retroshare.conf renamed
collectors/python.d.plugin/samba/README.md new
+61
@@ -0,0 +1,61 @@
1 +# samba
2 +
3 +Performance metrics of Samba file sharing.
4 +
5 +It produces the following charts:
6 +
7 +1. **Syscall R/Ws** in kilobytes/s
8 + * sendfile
9 + * recvfle
10 +
11 +2. **Smb2 R/Ws** in kilobytes/s
12 + * readout
13 + * writein
14 + * readin
15 + * writeout
16 +
17 +3. **Smb2 Create/Close** in operations/s
18 + * create
19 + * close
20 +
21 +4. **Smb2 Info** in operations/s
22 + * getinfo
23 + * setinfo
24 +
25 +5. **Smb2 Find** in operations/s
26 + * find
27 +
28 +6. **Smb2 Notify** in operations/s
29 + * notify
30 +
31 +7. **Smb2 Lesser Ops** as counters
32 + * tcon
33 + * negprot
34 + * tdis
35 + * cancel
36 + * logoff
37 + * flush
38 + * lock
39 + * keepalive
40 + * break
41 + * sessetup
42 +
43 +### configuration
44 +
45 +Requires that smbd has been compiled with profiling enabled. Also required
46 +that `smbd` was started either with the `-P 1` option or inside `smb.conf`
47 +using `smbd profiling level`.
48 +
49 +This plugin uses `smbstatus -P` which can only be executed by root. It uses
50 +sudo and assumes that it is configured such that the `netdata` user can
51 +execute smbstatus as root without password.
52 +
53 +For example:
54 +
55 + netdata ALL=(ALL) NOPASSWD: /usr/bin/smbstatus -P
56 +
57 +```yaml
58 +update_every : 5 # update frequency
59 +```
60 +
61 +---
collectors/python.d.plugin/samba/samba.chart.py renamed
collectors/python.d.plugin/samba/samba.conf renamed
collectors/python.d.plugin/sensors/README.md new
+17
@@ -0,0 +1,17 @@
1 +# sensors
2 +
3 +System sensors information.
4 +
5 +Charts are created dynamically.
6 +
7 +### configuration
8 +
9 +For detailed configuration information please read [`sensors.conf`](https://github.com/netdata/netdata/blob/master/conf.d/python.d/sensors.conf) file.
10 +
11 +### possible issues
12 +
13 +There have been reports from users that on certain servers, ACPI ring buffer errors are printed by the kernel (`dmesg`) when ACPI sensors are being accessed.
14 +We are tracking such cases in issue [#827](https://github.com/netdata/netdata/issues/827).
15 +Please join this discussion for help.
16 +
17 +---
collectors/python.d.plugin/sensors/sensors.chart.py renamed
collectors/python.d.plugin/sensors/sensors.conf renamed
collectors/python.d.plugin/smartd_log/README.md new
+38
@@ -0,0 +1,38 @@
1 +# smartd_log
2 +
3 +Module monitor `smartd` log files to collect HDD/SSD S.M.A.R.T attributes.
4 +
5 +It produces following charts (you can add additional attributes in the module configuration file):
6 +
7 +1. **Read Error Rate** attribute 1
8 +
9 +2. **Start/Stop Count** attribute 4
10 +
11 +3. **Reallocated Sectors Count** attribute 5
12 +
13 +4. **Seek Error Rate** attribute 7
14 +
15 +5. **Power-On Hours Count** attribute 9
16 +
17 +6. **Power Cycle Count** attribute 12
18 +
19 +7. **Load/Unload Cycles** attribute 193
20 +
21 +8. **Temperature** attribute 194
22 +
23 +9. **Current Pending Sectors** attribute 197
24 +
25 +10. **Off-Line Uncorrectable** attribute 198
26 +
27 +11. **Write Error Rate** attribute 200
28 +
29 +### configuration
30 +
31 +```yaml
32 +local:
33 + log_path : '/var/log/smartd/'
34 +```
35 +
36 +If no configuration is given, module will attempt to read log files in /var/log/smartd/ directory.
37 +
38 +---
collectors/python.d.plugin/smartd_log/smartd_log.chart.py renamed
collectors/python.d.plugin/smartd_log/smartd_log.conf renamed
collectors/python.d.plugin/spigotmc/README.md new
+22
@@ -0,0 +1,22 @@
1 +# spigotmc
2 +
3 +This module does some really basic monitoring for Spigot Minecraft servers.
4 +
5 +It provides two charts, one tracking server-side ticks-per-second in
6 +1, 5 and 15 minute averages, and one tracking the number of currently
7 +active users.
8 +
9 +This is not compatible with Spigot plugins which change the format of
10 +the data returned by the `tps` or `list` console commands.
11 +
12 +### configuration
13 +
14 +```yaml
15 +host: localhost
16 +port: 25575
17 +password: pass
18 +```
19 +
20 +By default, a connection to port 25575 on the local system is attempted with an empty password.
21 +
22 +---
collectors/python.d.plugin/spigotmc/spigotmc.chart.py renamed
collectors/python.d.plugin/spigotmc/spigotmc.conf renamed
collectors/python.d.plugin/springboot/README.md new
+129
@@ -0,0 +1,129 @@
1 +# springboot
2 +
3 +This module will monitor one or more Java Spring-boot applications depending on configuration.
4 +
5 +It produces following charts:
6 +
7 +1. **Response Codes** in requests/s
8 + * 1xx
9 + * 2xx
10 + * 3xx
11 + * 4xx
12 + * 5xx
13 + * others
14 +
15 +2. **Threads**
16 + * daemon
17 + * total
18 +
19 +3. **GC Time** in milliseconds and **GC Operations** in operations/s
20 + * Copy
21 + * MarkSweep
22 + * ...
23 +
24 +4. **Heap Mmeory Usage** in KB
25 + * used
26 + * committed
27 +
28 +### configuration
29 +
30 +Please see the [Monitoring Java Spring Boot Applications](https://github.com/netdata/netdata/wiki/Monitoring-Java-Spring-Boot-Applications) page for detailed info about module configuration.
31 +
32 +---
33 +
34 +# Monitoring Java Spring Boot Applications
35 +
36 +Netdata can be used to monitor running Java [Spring Boot](https://spring.io/) applications that expose their metrics with the use of the **Spring Boot Actuator** included in Spring Boot library.
37 +
38 +The Spring Boot Actuator exposes these metrics over HTTP and is very easy to use:
39 +* add `org.springframework.boot:spring-boot-starter-actuator` to your application dependencies
40 +* set `endpoints.metrics.sensitive=false` in your `application.properties`
41 +
42 +You can create custom Metrics by add and inject a PublicMetrics in your application.
43 +This is a example to add custom metrics:
44 +```java
45 +package com.example;
46 +
47 +import org.springframework.boot.actuate.endpoint.PublicMetrics;
48 +import org.springframework.boot.actuate.metrics.Metric;
49 +import org.springframework.stereotype.Service;
50 +
51 +import java.lang.management.ManagementFactory;
52 +import java.lang.management.MemoryPoolMXBean;
53 +import java.util.ArrayList;
54 +import java.util.Collection;
55 +
56 +@Service
57 +public class HeapPoolMetrics implements PublicMetrics {
58 +
59 + private static final String PREFIX = "mempool.";
60 + private static final String KEY_EDEN = PREFIX + "eden";
61 + private static final String KEY_SURVIVOR = PREFIX + "survivor";
62 + private static final String KEY_TENURED = PREFIX + "tenured";
63 +
64 + @Override
65 + public Collection<Metric<?>> metrics() {
66 + Collection<Metric<?>> result = new ArrayList<>(4);
67 + for (MemoryPoolMXBean mem : ManagementFactory.getMemoryPoolMXBeans()) {
68 + String poolName = mem.getName();
69 + String name = null;
70 + if (poolName.indexOf("Eden Space") != -1) {
71 + name = KEY_EDEN;
72 + } else if (poolName.indexOf("Survivor Space") != -1) {
73 + name = KEY_SURVIVOR;
74 + } else if (poolName.indexOf("Tenured Gen") != -1 || poolName.indexOf("Old Gen") != -1) {
75 + name = KEY_TENURED;
76 + }
77 +
78 + if (name != null) {
79 + result.add(newMemoryMetric(name, mem.getUsage().getMax()));
80 + result.add(newMemoryMetric(name + ".init", mem.getUsage().getInit()));
81 + result.add(newMemoryMetric(name + ".committed", mem.getUsage().getCommitted()));
82 + result.add(newMemoryMetric(name + ".used", mem.getUsage().getUsed()));
83 + }
84 + }
85 + return result;
86 + }
87 +
88 + private Metric<Long> newMemoryMetric(String name, long bytes) {
89 + return new Metric<>(name, bytes / 1024);
90 + }
91 +}
92 +```
93 +
94 +Please refer [Spring Boot Actuator: Production-ready features](https://docs.spring.io/spring-boot/docs/current/reference/html/production-ready.html) and [81. Actuator - Part IX. ‘How-to’ guides](https://docs.spring.io/spring-boot/docs/current/reference/html/howto-actuator.html) for more information.
95 +
96 +## Using netdata springboot module
97 +
98 +The springboot module is enabled by default. It looks up `http://localhost:8080/metrics` and `http://127.0.0.1:8080/metrics` to detect Spring Boot application by default. You can change it by editing `/etc/netdata/python.d/springboot.conf` (to edit it on your system run `/etc/netdata/edit-config python.d/springboot.conf`).
99 +
100 +This module defines some common charts, and you can add custom charts by change the configurations.
101 +
102 +The configuration format is like:
103 +```yaml
104 +<id>:
105 + name: '<name>'
106 + url: '<metrics endpoint>' # ex. http://localhost:8080/metrics
107 + user: '<username>' # optional
108 + pass: '<password>' # optional
109 + defaults:
110 + [<chart-id>]: true|false
111 + extras:
112 + - id: '<chart-id>'
113 + options:
114 + title: '***'
115 + units: '***'
116 + family: '***'
117 + context: 'springboot.***'
118 + charttype: 'stacked' | 'area' | 'line'
119 + lines:
120 + - { dimension: 'myapp_ok', name: 'ok', algorithm: 'absolute', multiplier: 1, divisor: 1} # it shows "myapp.ok" metrics
121 + - { dimension: 'myapp_ng', name: 'ng', algorithm: 'absolute', multiplier: 1, divisor: 1} # it shows "myapp.ng" metrics
122 +```
123 +
124 +By default, it creates `response_code`, `threads`, `gc_time`, `gc_ope` abd `heap` charts.
125 +You can disable the default charts by set `defaults.<chart-id>: false`.
126 +
127 +The dimension name of extras charts should replace `.` to `_`.
128 +
129 +Please check [springboot.conf](https://github.com/netdata/netdata/blob/master/conf.d/python.d/springboot.conf) for more examples.
\ No newline at end of file
collectors/python.d.plugin/springboot/springboot.chart.py renamed
collectors/python.d.plugin/springboot/springboot.conf renamed
collectors/python.d.plugin/squid/README.md new
+38
@@ -0,0 +1,38 @@
1 +# squid
2 +
3 +This module will monitor one or more squid instances depending on configuration.
4 +
5 +It produces following charts:
6 +
7 +1. **Client Bandwidth** in kilobits/s
8 + * in
9 + * out
10 + * hits
11 +
12 +2. **Client Requests** in requests/s
13 + * requests
14 + * hits
15 + * errors
16 +
17 +3. **Server Bandwidth** in kilobits/s
18 + * in
19 + * out
20 +
21 +4. **Server Requests** in requests/s
22 + * requests
23 + * errors
24 +
25 +### configuration
26 +
27 +```yaml
28 +priority : 50000
29 +
30 +local:
31 + request : 'cache_object://localhost:3128/counters'
32 + host : 'localhost'
33 + port : 3128
34 +```
35 +
36 +Without any configuration module will try to autodetect where squid presents its `counters` data
37 +
38 +---
collectors/python.d.plugin/squid/squid.chart.py renamed
collectors/python.d.plugin/squid/squid.conf renamed
collectors/python.d.plugin/tomcat/README.md new
+33
@@ -0,0 +1,33 @@
1 +# tomcat
2 +
3 +Present tomcat containers memory utilization.
4 +
5 +Charts:
6 +
7 +1. **Requests** per second
8 + * accesses
9 +
10 +2. **Volume** in KB/s
11 + * volume
12 +
13 +3. **Threads**
14 + * current
15 + * busy
16 +
17 +4. **JVM Free Memory** in MB
18 + * jvm
19 +
20 +### configuration
21 +
22 +```yaml
23 +localhost:
24 + name : 'local'
25 + url : 'http://127.0.0.1:8080/manager/status?XML=true'
26 + user : 'tomcat_username'
27 + pass : 'secret_tomcat_password'
28 +```
29 +
30 +Without configuration, module attempts to connect to `http://localhost:8080/manager/status?XML=true`, without any credentials.
31 +So it will probably fail.
32 +
33 +---
collectors/python.d.plugin/tomcat/tomcat.chart.py renamed
collectors/python.d.plugin/tomcat/tomcat.conf renamed
collectors/python.d.plugin/traefik/README.md new
+54
@@ -0,0 +1,54 @@
1 +# traefik
2 +
3 +Module uses the `health` API to provide statistics.
4 +
5 +It produces:
6 +
7 +1. **Responses** by statuses
8 + * success (1xx, 2xx, 304)
9 + * error (5xx)
10 + * redirect (3xx except 304)
11 + * bad (4xx)
12 + * other (all other responses)
13 +
14 +2. **Responses** by codes
15 + * 2xx (successful)
16 + * 5xx (internal server errors)
17 + * 3xx (redirect)
18 + * 4xx (bad)
19 + * 1xx (informational)
20 + * other (non-standart responses)
21 +
22 +3. **Detailed Response Codes** requests/s (number of responses for each response code family individually)
23 +
24 +4. **Requests**/s
25 + * request statistics
26 +
27 +5. **Total response time**
28 + * sum of all response time
29 +
30 +6. **Average response time**
31 +
32 +7. **Average response time per iteration**
33 +
34 +8. **Uptime**
35 + * Traefik server uptime
36 +
37 +### configuration
38 +
39 +Needs only `url` to server's `health`
40 +
41 +Here is an example for local server:
42 +
43 +```yaml
44 +update_every : 1
45 +priority : 60000
46 +
47 +local:
48 + url : 'http://localhost:8080/health'
49 + retries : 10
50 +```
51 +
52 +Without configuration, module attempts to connect to `http://localhost:8080/health`.
53 +
54 +---
collectors/python.d.plugin/traefik/traefik.chart.py renamed
collectors/python.d.plugin/traefik/traefik.conf renamed
collectors/python.d.plugin/unbound/README.md new
+76
@@ -0,0 +1,76 @@
1 +# unbound
2 +
3 +Monitoring uses the remote control interface to fetch statistics.
4 +
5 +Provides the following charts:
6 +
7 +1. **Queries Processed**
8 + * Ratelimited
9 + * Cache Misses
10 + * Cache Hits
11 + * Expired
12 + * Prefetched
13 + * Recursive
14 +
15 +2. **Request List**
16 + * Average Size
17 + * Max Size
18 + * Overwritten Requests
19 + * Overruns
20 + * Current Size
21 + * User Requests
22 +
23 +3. **Recursion Timings**
24 + * Average recursion processing time
25 + * Median recursion processing time
26 +
27 +If extended stats are enabled, also provides:
28 +
29 +4. **Cache Sizes**
30 + * Message Cache
31 + * RRset Cache
32 + * Infra Cache
33 + * DNSSEC Key Cache
34 + * DNSCrypt Shared Secret Cache
35 + * DNSCrypt Nonce Cache
36 +
37 +### configuration
38 +
39 +Unbound must be manually configured to enable the remote-control protocol.
40 +Check the Unbound documentation for info on how to do this. Additionally,
41 +if you want to take advantage of the autodetection this plugin offers,
42 +you will need to make sure your `unbound.conf` file only uses spaces for
43 +indentation (the default config shipped by most distributions uses tabs
44 +instead of spaces).
45 +
46 +Once you have the Unbound control protocol enabled, you need to make sure
47 +that either the certificate and key are readable by Netdata (if you're
48 +using the regular control interface), or that the socket is accessible
49 +to Netdata (if you're using a UNIX socket for the contorl interface).
50 +
51 +By default, for the local system, everything can be auto-detected
52 +assuming Unbound is configured correctly and has been told to listen
53 +on the loopback interface or a UNIX socket. This is done by looking
54 +up info in the Unbound config file specified by the `ubconf` key.
55 +
56 +To enable extended stats for a given job, add `extended: yes` to the
57 +definition.
58 +
59 +You can also enable per-thread charts for a given job by adding
60 +`per_thread: yes` to the definition. Note that the numbe rof threads
61 +is only checked on startup.
62 +
63 +A basic local configuration with extended statistics and per-thread
64 +charts looks like this:
65 +
66 +```yaml
67 +local:
68 + ubconf: /etc/unbound/unbound.conf
69 + extended: yes
70 + per_thread: yes
71 +```
72 +
73 +While it's a bit more complicated to set up correctly, it is recommended
74 +that you use a UNIX socket as it provides far better performance.
75 +
76 +---
collectors/python.d.plugin/unbound/unbound.chart.py renamed
collectors/python.d.plugin/unbound/unbound.conf renamed
collectors/python.d.plugin/varnish/README.md new
+69
@@ -0,0 +1,69 @@
1 +# varnish
2 +
3 +Module uses the `varnishstat` command to provide varnish cache statistics.
4 +
5 +It produces:
6 +
7 +1. **Connections Statistics** in connections/s
8 + * accepted
9 + * dropped
10 +
11 +2. **Client Requests** in requests/s
12 + * received
13 +
14 +3. **All History Hit Rate Ratio** in percent
15 + * hit
16 + * miss
17 + * hitpass
18 +
19 +4. **Current Poll Hit Rate Ratio** in percent
20 + * hit
21 + * miss
22 + * hitpass
23 +
24 +5. **Expired Objects** in expired/s
25 + * objects
26 +
27 +6. **Least Recently Used Nuked Objects** in nuked/s
28 + * objects
29 +
30 +
31 +7. **Number Of Threads In All Pools** in threads
32 + * threads
33 +
34 +8. **Threads Statistics** in threads/s
35 + * created
36 + * failed
37 + * limited
38 +
39 +9. **Current Queue Length** in requests
40 + * in queue
41 +
42 +10. **Backend Connections Statistics** in connections/s
43 + * successful
44 + * unhealthy
45 + * reused
46 + * closed
47 + * resycled
48 + * failed
49 +
50 +10. **Requests To The Backend** in requests/s
51 + * received
52 +
53 +11. **ESI Statistics** in problems/s
54 + * errors
55 + * warnings
56 +
57 +12. **Memory Usage** in MB
58 + * free
59 + * allocated
60 +
61 +13. **Uptime** in seconds
62 + * uptime
63 +
64 +
65 +### configuration
66 +
67 +No configuration is needed.
68 +
69 +---
collectors/python.d.plugin/varnish/varnish.chart.py renamed
collectors/python.d.plugin/varnish/varnish.conf renamed
collectors/python.d.plugin/w1sensor/README.md new
+13
@@ -0,0 +1,13 @@
1 +# w1sensor
2 +
3 +Data from 1-Wire sensors.
4 +On Linux these are supported by the wire, w1_gpio, and w1_therm modules.
5 +Currently temperature sensors are supported and automatically detected.
6 +
7 +Charts are created dynamically based on the number of detected sensors.
8 +
9 +### configuration
10 +
11 +For detailed configuration information please read [`w1sensor.conf`](https://github.com/netdata/netdata/blob/master/conf.d/python.d/w1sensor.conf) file.
12 +
13 +---
collectors/python.d.plugin/w1sensor/w1sensor.chart.py renamed
collectors/python.d.plugin/w1sensor/w1sensor.conf renamed
collectors/python.d.plugin/web_log/README.md new
+64
@@ -0,0 +1,64 @@
1 +# web_log
2 +
3 +Tails the apache/nginx/lighttpd/gunicorn log files to collect real-time web-server statistics.
4 +
5 +It produces following charts:
6 +
7 +1. **Response by type** requests/s
8 + * success (1xx, 2xx, 304)
9 + * error (5xx)
10 + * redirect (3xx except 304)
11 + * bad (4xx)
12 + * other (all other responses)
13 +
14 +2. **Response by code family** requests/s
15 + * 1xx (informational)
16 + * 2xx (successful)
17 + * 3xx (redirect)
18 + * 4xx (bad)
19 + * 5xx (internal server errors)
20 + * other (non-standart responses)
21 + * unmatched (the lines in the log file that are not matched)
22 +
23 +3. **Detailed Response Codes** requests/s (number of responses for each response code family individually)
24 +
25 +4. **Bandwidth** KB/s
26 + * received (bandwidth of requests)
27 + * send (bandwidth of responses)
28 +
29 +5. **Timings** ms (request processing time)
30 + * min (bandwidth of requests)
31 + * max (bandwidth of responses)
32 + * average (bandwidth of responses)
33 +
34 +6. **Request per url** requests/s (configured by user)
35 +
36 +7. **Http Methods** requests/s (requests per http method)
37 +
38 +8. **Http Versions** requests/s (requests per http version)
39 +
40 +9. **IP protocols** requests/s (requests per ip protocol version)
41 +
42 +10. **Current Poll Unique Client IPs** unique ips/s (unique client IPs per data collection iteration)
43 +
44 +11. **All Time Unique Client IPs** unique ips/s (unique client IPs since the last restart of netdata)
45 +
46 +
47 +### configuration
48 +
49 +```yaml
50 +nginx_log:
51 + name : 'nginx_log'
52 + path : '/var/log/nginx/access.log'
53 +
54 +apache_log:
55 + name : 'apache_log'
56 + path : '/var/log/apache/other_vhosts_access.log'
57 + categories:
58 + cacti : 'cacti.*'
59 + observium : 'observium'
60 +```
61 +
62 +Module has preconfigured jobs for nginx, apache and gunicorn on various distros.
63 +
64 +---
collectors/python.d.plugin/web_log/web_log.chart.py renamed
collectors/python.d.plugin/web_log/web_log.conf renamed
collectors/statsd.plugin/Makefile.am new
+13
@@ -0,0 +1,13 @@
1 +# SPDX-License-Identifier: GPL-3.0-or-later
2 +
3 +AUTOMAKE_OPTIONS = subdir-objects
4 +MAINTAINERCLEANFILES = $(srcdir)/Makefile.in
5 +
6 +dist_noinst_DATA = \
7 + README.md \
8 + $(NULL)
9 +
10 +statsdconfigdir=$(libconfigdir)/statsd.d
11 +dist_statsdconfig_DATA = \
12 + example.conf \
13 + $(NULL)
collectors/statsd.plugin/README.md new
+523
@@ -0,0 +1,523 @@
1 +# Netdata Statsd
2 +
3 +statsd is a system to collect data from any application. Applications are sending metrics to it, usually via non-blocking UDP communication, and statsd servers collect these metrics, perform a few simple calculations on them and push them to backend time-series databases.
4 +
5 +There is a [plethora of client libraries](https://github.com/etsy/statsd/wiki#client-implementations) for embedding statsd metrics to any application framework. This makes statsd quite popular for custom application metrics.
6 +
7 +## netdata statsd
8 +
9 +netdata is a fully featured statsd server. It can collect statsd formatted metrics, visualize them on its dashboards, stream them to other netdata servers or archive them to backend time-series databases.
10 +
11 +netdata statsd is inside netdata (an internal plugin, running inside the netdata daemon), it is configured via `netdata.conf` and by-default listens on standard statsd ports (tcp and udp 8125 - yes, netdata statsd server supports both tcp and udp at the same time).
12 +
13 +Since statsd is embedded in netdata, it means you now have a statsd server embedded on all your servers. So, the application can send its metrics to `localhost:8125`. This provides a distributed statsd implementation.
14 +
15 +netdata statsd is fast. It can collect more than **1.200.000 metrics per second** on modern hardware, more than **200Mbps of sustained statsd traffic**, using 1 CPU core (yes, it is single threaded - actually double-threaded, one thread collects metrics, another one updates the charts from the collected data).
16 +
17 +## metrics supported by netdata
18 +
19 +netdata fully supports the statsd protocol. All statsd client libraries can be used with netdata too.
20 +
21 +- **Gauges**
22 +
23 + The application sends `name:value|g`, where `value` is any **decimal/fractional** number, statsd reports the latest value collected and the number of times it was updated (events).
24 +
25 + The application may increment or decrement a previous value, by setting the first character of the value to ` + ` or ` - ` (so, the only way to set a gauge to an absolute negative value, is to first set it to zero).
26 +
27 + Sampling rate is supported (check below).
28 +
29 + When a gauge is not collected and the setting is not to show gaps on the charts (the default), the last value will be shown, until a data collection event changes it.
30 +
31 +- **Counters** and **Meters**
32 +
33 + The application sends `name:value|c`, `name:value|C` or `name:value|m`, where `value` is a positive or negative **integer** number of events occurred, statsd reports the **rate** and the number of times it was updated (events).
34 +
35 + `:value` can be omitted and statsd will assume it is `1`. `|c`, `|C` and `|m` can be omitted an statsd will assume it is `|m`. So, the application may send just `name` and statsd will parse it as `name:1|m`.
36 +
37 + For counters use `|c` (esty/statsd compatible) or `|C` (brubeck compatible), for meters use `|m`.
38 +
39 + Sampling rate is supported (check below).
40 +
41 + When a counter or meter is not collected and the setting is not to show gaps on the charts (the default), zero will be shown, until a data collection event changes it.
42 +
43 +- **Timers** and **Histograms**
44 +
45 + The application sends `name:value|ms` or `name:value|h`, where ` value` is any **decimal/fractional** number, statsd reports **min**, **max**, **average**, **sum**, **95th percentile**, **median** and **standard deviation** and the total number of times it was updated (events).
46 +
47 + For timers use `|ms`, or histograms use `|h`. The only difference between the two, is the `units` of the charts (timers report milliseconds).
48 +
49 + Sampling rate is supported (check below).
50 +
51 + When a timer or histogram is not collected and the setting is not to show gaps on the charts (the default), zero will be shown, until a data collection event changes it.
52 +
53 +- **Sets**
54 +
55 + The application sends `name:value|s`, where `value` is anything (**number or text**, leading and trailing spaces are removed), statsd reports the number of unique values sent and the number of times it was updated (events).
56 +
57 + Sampling rate is **not** supported for Sets. `value` is always considered text.
58 +
59 + When a set is not collected and the setting is not to show gaps on the charts (the default), zero will be shown, until a data collection event changes it.
60 +
61 +#### Sampling Rates
62 +
63 +The application may append `|@sampling_rate`, where `sampling_rate` is a number from `0.0` to `1.0`, to have statsd extrapolate the value, to predict to total for the whole period. So, if the application reports to statsd a value for 1/10th of the time, it can append `|@0.1` to the metrics it sends to statsd.
64 +
65 +#### Overlapping metrics
66 +
67 +netdata statsd maintains different indexes for each of the types supported. This means the same metric `name` may exist under different types concurrently.
68 +
69 +#### Multiple metrics per packet
70 +
71 +netdata accepts multiple metrics per packet if each is terminated with `\n`.
72 +
73 +#### TCP packets
74 +
75 +netdata listens for both TCP and UDP packets. For TCP though, is it important to always append `\n` on each metric. netdata uses this to detect if a metric is split into multiple TCP packets. On disconnect, even the remaining (non terminated with `\n`) buffer, is processed.
76 +
77 +#### UDP packets
78 +
79 +When sending multiple packets over UDP, it is important not to exceed the network MTU (usually 1500 bytes minus a few bytes for the headers). netdata will accept UDP packets up to 9000 bytes, but the underlying network will not exceed MTU.
80 +
81 +## configuration
82 +
83 +This is the statsd configuration at `/etc/netdata/netdata.conf`:
84 +
85 +```
86 +[statsd]
87 + # enabled = yes
88 + # decimal detail = 1000
89 + # update every (flushInterval) = 1
90 + # udp messages to process at once = 10
91 + # create private charts for metrics matching = *
92 + # max private charts allowed = 200
93 + # max private charts hard limit = 1000
94 + # private charts memory mode = save
95 + # private charts history = 3996
96 + # histograms and timers percentile (percentThreshold) = 95.00000
97 + # add dimension for number of events received = yes
98 + # gaps on gauges (deleteGauges) = no
99 + # gaps on counters (deleteCounters) = no
100 + # gaps on meters (deleteMeters) = no
101 + # gaps on sets (deleteSets) = no
102 + # gaps on histograms (deleteHistograms) = no
103 + # gaps on timers (deleteTimers) = no
104 + # listen backlog = 4096
105 + # default port = 8125
106 + # bind to = udp:localhost:8125 tcp:localhost:8125
107 +```
108 +
109 +### statsd main config options
110 +- `enabled = yes|no`
111 +
112 + controls if statsd will be enabled for this netdata. The default is enabled.
113 +
114 +- `default port = 8125`
115 +
116 + controls the port statsd will use. This is the default, since the next line, allows defining ports too.
117 +
118 +- `bind to = udp:localhost tcp:localhost`
119 +
120 + is a space separated list of IPs and ports to listen to. The format is `PROTOCOL:IP:PORT` - if `PORT` is omitted, the `default port` will be used. If `IP` is IPv6, it needs to be enclosed in `[]`. `IP` can also be ` * ` (to listen on all IPs) or even a hostname.
121 +
122 +- `update every (flushInterval) = 1` seconds, controls the frequency statsd will push the collected metrics to netdata charts.
123 +
124 +- `decimal detail = 1000` controls the number of fractional digits in gauges and histograms. netdata collects metrics using signed 64 bit integers and their fractional detail is controlled using multipliers and divisors. This setting is used to multiply all collected values to convert them to integers and is also set as the divisors, so that the final data will be a floating point number with this fractional detail (1000 = X.0 - X.999, 10000 = X.0 - X.9999, etc).
125 +
126 +The rest of the settings are discussed below.
127 +
128 +## statsd charts
129 +
130 +netdata can visualize statsd collected metrics in 2 ways:
131 +
132 +1. Each metric gets its own **private chart**. This is the default and does not require any configuration (although there are a few options to tweak).
133 +
134 +2. **Synthetic charts** can be created, combining multiple metrics, independently of their metric types. For this type of charts, special configuration is required, to define the chart title, type, units, its dimensions, etc.
135 +
136 +### private metric charts
137 +
138 +Private charts are controlled with `create private charts for metrics matching = *`. This setting accepts a space separated list of simple patterns (use `*` as wildcard, prepend a pattern with `!` for a negative match, the order of patterns is important).
139 +
140 +So to render charts for all `myapp.*` metrics, except `myapp.*.badmetric`, use:
141 +
142 +```
143 +create private charts for metrics matching = !myapp.*.badmetric myapp.*
144 +```
145 +
146 +The default is to render private charts for all metrics.
147 +
148 +The `memory mode` of the round robin database and the `history` of private metric charts are controlled with `private charts memory mode` and `private charts history`. The defaults for both settings is to use the global netdata settings. So, you need to edit them only when you want statsd to use different settings compared to the global ones.
149 +
150 +If you have thousands of metrics, each with its own private chart, you may notice that your web browser becomes slow when you view the netdata dashboard (this is a web browser issue we need to address at the netdata UI). So, netdata has a protection to stop creating charts when `max private charts allowed = 200` (soft limit) is reached.
151 +
152 +The metrics above this soft limit are still processed by netdata and will be available to be sent to backend time-series databases, up to `max private charts hard limit = 1000`. So, between 200 and 1000 charts, netdata will still generate charts, but they will automatically be created with `memory mode = none` (netdata will not maintain a database for them). These metrics will be sent to backend time series databases, if the backend configuration is set to `as collected`.
153 +
154 +Metrics above the hard limit are still collected, but they can only be used in synthetic charts (once a metric is added to chart, it will be sent to backend servers too).
155 +
156 +Example private charts (automatically generated without any configuration):
157 +
158 +#### counters
159 +
160 +- Scope: **count the events of something** (e.g. number of file downloads)
161 +- Format: `name:INTEGER|c` or `name:INTEGER|C` or `name|c`
162 +- statsd increments the counter by the `INTEGER` number supplied (positive, or negative).
163 +
164 +![image](https://cloud.githubusercontent.com/assets/2662304/26131553/4a26d19c-3aa3-11e7-94e8-c53b5ed6ebc3.png)
165 +
166 +#### gauges
167 +
168 +- Scope: **report the value of something** (e.g. cache memory used by the application server)
169 +- Format: `name:FLOAT|g`
170 +- statsd remembers the last value supplied, and can increment or decrement the latest value if `FLOAT` begins with ` + ` or ` - `.
171 +
172 +![image](https://cloud.githubusercontent.com/assets/2662304/26131575/5d54e6f0-3aa3-11e7-9099-bc4440cd4592.png)
173 +
174 +#### histograms
175 +
176 +- Scope: **statistics on a size of events** (e.g. statistics on the sizes of files downloaded)
177 +- Format: `name:FLOAT|h`
178 +- statsd maintains a list of all the values supplied and provides statistics on them.
179 +
180 +![image](https://cloud.githubusercontent.com/assets/2662304/26131587/704de72a-3aa3-11e7-9ea9-0d2bb778c150.png)
181 +
182 +The same chart with `sum` unselected, to show the detail of the dimensions supported:
183 +![image](https://cloud.githubusercontent.com/assets/2662304/26131598/8076443a-3aa3-11e7-9ffa-ea535aee9c9f.png)
184 +
185 +#### meters
186 +
187 +This is identical to `counter`.
188 +
189 +- Scope: **count the events of something** (e.g. number of file downloads)
190 +- Format: `name:INTEGER|m` or `name|m` or just `name`
191 +- statsd increments the counter by the `INTEGER` number supplied (positive, or negative).
192 +
193 +![image](https://cloud.githubusercontent.com/assets/2662304/26131605/8fdf5a06-3aa3-11e7-963f-7ecf207d1dbc.png)
194 +
195 +#### sets
196 +
197 +- Scope: **count the unique occurrences of something** (e.g. unique filenames downloaded, or unique users that downloaded files)
198 +- Format: `name:TEXT|s`
199 +- statsd maintains a unique index of all values supplied, and reports the unique entries in it.
200 +
201 +![image](https://cloud.githubusercontent.com/assets/2662304/26131612/9eaa7b1a-3aa3-11e7-903b-d881e9a35be2.png)
202 +
203 +#### timers
204 +
205 +- Scope: **statistics on the duration of events** (e.g. statistics for the duration of file downloads)
206 +- Format: `name:FLOAT|ms`
207 +- statsd maintains a list of all the values supplied and provides statistics on them.
208 +
209 +![image](https://cloud.githubusercontent.com/assets/2662304/26131620/acbea6a4-3aa3-11e7-8bdd-4a8996847767.png)
210 +
211 +The same chart with the `sum` unselected:
212 +![image](https://cloud.githubusercontent.com/assets/2662304/26131629/bc34f2d2-3aa3-11e7-8a07-f2fc94ba4352.png)
213 +
214 +
215 +
216 +### synthetic statsd charts
217 +
218 +Using synthetic charts, you can create dedicated sections on the dashboard to render the charts. You can control everything: the main menu, the submenus, the charts, the dimensions on each chart, etc.
219 +
220 +Synthetic charts are organized in
221 +
222 +- **applications** (i.e. entries at the main menu of the netdata dashboard)
223 +- **charts for each application** (grouped in families - i.e. submenus at the dashboard menu)
224 +- **statsd metrics for each chart** (i.e. dimensions of the charts)
225 +
226 +For each application you need to create a `.conf` file in `/etc/netdata/statsd.d`.
227 +
228 +So, to create the statsd application `myapp`, you can create the file `/etc/netdata/statsd.d/myapp.conf`, with this content:
229 +
230 +```
231 +[app]
232 + name = myapp
233 + metrics = myapp.*
234 + private charts = no
235 + gaps when not collected = no
236 + memory mode = ram
237 + history = 60
238 +
239 +[dictionary]
240 + m1 = metric1
241 + m2 = metric2
242 +
243 +# replace 'mychart' with the chart id
244 +# the chart will be named: myapp.mychart
245 +[mychart]
246 + name = mychart
247 + title = my chart title
248 + family = my family
249 + context = chart.context
250 + units = tests/s
251 + priority = 91000
252 + type = area
253 + dimension = myapp.metric1 m1
254 + dimension = myapp.metric2 m2
255 +```
256 +
257 +Using the above configuration `myapp` should get its own section on the dashboard, having one chart with 2 dimensions.
258 +
259 +`[app]` starts a new application definition. The supported settings in this section are:
260 +
261 +- `name` defines the name of the app.
262 +- `metrics` is a netdata simple pattern (space separated patterns, using `*` for wildcard, possibly starting with `!` for negative match). This pattern should match all the possible statsd metrics that will be participating in the application `myapp`.
263 +- `private charts = yes|no`, enables or disables private charts for the metrics matched.
264 +- `gaps when not collected = yes|no`, enables or disables gaps on the charts of the application, when metrics are not collected.
265 +- `memory mode` sets the memory mode for all charts of the application. The default is the global default for netdata (not the global default for statsd private charts).
266 +- `history` sets the size of the round robin database for this application. The default is the global default for netdata (not the global default for statsd private charts).
267 +
268 +`[dictionary]` defines name-value associations. These are used to renaming metrics, when added to synthetic charts. Metric names are also defined at each `dimension` line. However, using the dictionary dimension names can be declared globally, for each app and is the only way to rename dimensions when using patterns. Of course the dictionary can be empty or missing.
269 +
270 +Then, you can add any number of charts. Each chart should start with `[id]`. The chart will be called `app_name.id`. `family` controls the submenu on the dashboard. `context` controls the alarm templates. `priority` controls the ordering of the charts on the dashboard. The rest of the settings are informational.
271 +
272 +You can add any number of metrics to a chart, using `dimension` lines. These lines accept 5 space separated parameters:
273 +
274 +1. the metric name, as it is collected (it has to be matched by the `metrics = ` pattern of the app)
275 +2. the dimension name, as it should be shown on the chart
276 +3. an optional selector (type) of the value to shown (see below)
277 +4. an optional multiplier
278 +5. an optional divider
279 +6. optional flags, space separated and enclosed in quotes. All the external plugins `DIMENSION` flags can be used. Currently the only usable flag is `hidden`, to add the dimension, but not show it on the dashboard. This is usually needed to have the values available for percentage calculation, or use them in alarms.
280 +
281 +So, the format is this:
282 +```
283 +dimension = [pattern] METRIC NAME TYPE MULTIPLIER DIVIDER OPTIONS
284 +```
285 +
286 +`pattern` is a keyword. When set, `METRIC` is expected to be a netdata simple pattern that will be used to match all the statsd metrics to be added to the chart. So, `pattern` automatically matches any number of statsd metrics, all of which will be added as separate chart dimensions.
287 +
288 +`TYPE`, `MUTLIPLIER`, `DIVIDER` and `OPTIONS` are optional.
289 +
290 +`TYPE` can be:
291 +
292 +- `events` to show the number of events received by statsd for this metric
293 +- `last` to show the last value, as calculated at the flush interval of the metric (the default)
294 +
295 +Then for histograms and timers the following types are also supported:
296 +
297 +- `min`, show the minimum value
298 +- `max`, show the maximum value
299 +- `sum`, show the sum of all values
300 +- `average` (same as `last`)
301 +- `percentile`, show the 95th percentile (or any other percentile, as configured at statsd global config)
302 +- `median`, show the median of all values (i.e. sort all values and get the middle value)
303 +- `stddev`, show the standard deviation of the values
304 +
305 +#### example synthetic charts
306 +
307 +statsd metrics: `foo` and `bar`.
308 +
309 +Contents of file `/etc/netdata/stats.d/foobar.conf`:
310 +
311 +```
312 +[app]
313 + name = foobarapp
314 + metrics = foo bar
315 + private charts = yes
316 +
317 +[foobar_chart1]
318 + title = Hey, foo and bar together
319 + family = foobar_family
320 + context = foobarapp.foobars
321 + units = foobars
322 + type = area
323 + dimension = foo 'foo me' last 1 1
324 + dimension = bar 'bar me' last 1 1
325 +```
326 +
327 +I sent to statsd: `foo:10|g` and `bar:20|g`.
328 +
329 +I got these private charts:
330 +
331 +![screenshot from 2017-08-03 23-28-19](https://user-images.githubusercontent.com/2662304/28942295-7c3a73a8-78a3-11e7-88e5-a9a006bb7465.png)
332 +
333 +and this synthetic chart:
334 +
335 +![screenshot from 2017-08-03 23-29-14](https://user-images.githubusercontent.com/2662304/28942317-958a2c68-78a3-11e7-853f-32850141dd36.png)
336 +
337 +#### dictionary to name dimensions
338 +
339 +The `[dictionary]` section accepts any number of `name = value` pairs.
340 +
341 +netdata uses this dictionary as follows:
342 +
343 +1. When a `dimension` has a non-empty `NAME`, that name is looked up at the dictionary.
344 +
345 +2. If the above lookup gives nothing, or the `dimension` has an empty `NAME`, the original statsd metric name is looked up at the dictionary.
346 +
347 +3. If any of the above succeeds, netdata uses the `value` of the dictionary, to set the name of the dimension. The dimensions will have as ID the original statsd metric name, and as name, the dictionary value.
348 +
349 +So, you can use the dictionary in 2 ways:
350 +
351 +1. set `dimension = myapp.metric1 ''` and have at the dictionary `myapp.metric1 = metric1 name`
352 +2. set `dimension = myapp.metric1 'm1'` and have at the dictionary `m1 = metric1 name`
353 +
354 +In both cases, the dimension will be added with ID `myapp.metric1` and will be named `metric1 name`. So, in alarms you can use either of the 2 as `${myapp.metric1}` or `${metric1 name}`.
355 +
356 +> keep in mind that if you add multiple times the same statsd metric to a chart, netdata will append `TYPE` to the dimension ID, so `myapp.metric1` will be added as `myapp.metric1_last` or `myapp.metric1_events`, etc. If you add multiple times the same metric with the same `TYPE` to a chart, netdata will also append an incremental counter to the dimension ID, i.e. `myapp.metric1_last1`, `myapp.metric1_last2`, etc.
357 +
358 +#### dimension patterns
359 +
360 +netdata allows adding multiple dimensions to a chart, by matching the statsd metrics with a netdata simple pattern.
361 +
362 +Assume we have an API that provides statsd metrics for each response code per method it supports, like these:
363 +
364 +```
365 +myapp.api.get.200
366 +myapp.api.get.400
367 +myapp.api.get.500
368 +myapp.api.del.200
369 +myapp.api.del.400
370 +myapp.api.del.500
371 +myapp.api.post.200
372 +myapp.api.post.400
373 +myapp.api.post.500
374 +myapp.api.all.200
375 +myapp.api.all.400
376 +myapp.api.all.500
377 +```
378 +
379 +To add all response codes of `myapp.api.get` to a chart use this:
380 +
381 +```
382 +[api_get_responses]
383 + ...
384 + dimension = pattern 'myapp.api.get.* '' last 1 1
385 +```
386 +
387 +The above will add dimension named `200`, `400` and `500` (yes, netdata extracts the wildcarded part of the metric name - so the dimensions will be named with whatever the `*` matched). You can rename the dimensions with this:
388 +
389 +```
390 +[dictionary]
391 + get.200 = 200 ok
392 + get.400 = 400 bad request
393 + get.500 = 500 cannot connect to db
394 +
395 +[api_get_responses]
396 + ...
397 + dimension = pattern 'myapp.api.get.* 'get.' last 1 1
398 +```
399 +
400 +Note that we added a `NAME` to the dimension line with `get.`. This is prefixed to the wildcarded part of the metric name, to compose the key for looking up the dictionary. So `500` became `get.500` which was looked up to the dictionary to find value `500 cannot connect to db`. This way we can have different dimension names, for each of the API methods (i.e. `get.500 = 500 cannot connect to db` while `post.500 = 500 cannot write to disk`).
401 +
402 +To add all API methods to a chart, do this:
403 +
404 +```
405 +[ok_by_method]
406 + ...
407 + dimension = pattern 'myapp.api.*.200 '' last 1 1
408 +```
409 +
410 +The above will add `get`, `post`, `del` and `all` to the chart.
411 +
412 +If `all` is not wanted (a `stacked` chart does not need the `all` dimension, since the sum of the dimensions provides the total), the line should be:
413 +
414 +```
415 +[ok_by_method]
416 + ...
417 + dimension = pattern '!myapp.api.all.* myapp.api.*.200 '' last 1 1
418 +```
419 +
420 +With the above, all methods except `all` will be added to the chart.
421 +
422 +To automatically rename the methods, use this:
423 +
424 +```
425 +[dictionary]
426 + method.get = GET
427 + method.post = ADD
428 + method.del = DELETE
429 +
430 +[ok_by_method]
431 + ...
432 + dimension = pattern '!myapp.api.all.* myapp.api.*.200 'method.' last 1 1
433 +```
434 +
435 +Using the above, the dimensions will be added as `GET`, `ADD` and `DELETE`.
436 +
437 +
438 +## interpolation
439 +
440 +~~If you send just one value to statsd, you will notice that the chart is created but no value is shown. The reason is that netdata interpolates all values at second boundaries. For incremental values (`counters` and `meters` in statsd terminology), if you send 10 at 00:00:00.500, 20 at 00:00:01.500 and 30 at 00:00:02.500, netdata will show 15 at 00:00:01 and 25 at 00:00:02.~~
441 +
442 +~~This interpolation is automatic and global in netdata for all charts, for incremental values. This means that for the chart to start showing values you need to send 2 values across 2 flush intervals.~~
443 +
444 +~~(although this is required for incremental values, netdata allows mixing incremental and absolute values on the same charts, so this little limitation [i.e. 2 values to start visualization], is applied on all netdata dimensions).~~
445 +
446 +(statsd metrics do not loose their first data collection due to interpolation anymore - fixed with [PR #2411](https://github.com/netdata/netdata/pull/2411))
447 +
448 +## sending statsd metrics from shell scripts
449 +
450 +You can send/update statsd metrics from shell scripts. You can use this feature, to visualize in netdata automated jobs you run on your servers.
451 +
452 +The command you need to run is:
453 +
454 +```sh
455 +echo "NAME:VALUE|TYPE" | nc -u --send-only localhost 8125
456 +```
457 +
458 +Where:
459 +
460 +- `NAME` is the metric name
461 +- `VALUE` is the value for that metric (**gauges** `|g`, **timers** `|ms` and **histograms** `|h` accept decimal/fractional numbers, **counters** `|c` and **meters** `|m` accept integers, **sets** `|s` accept anything)
462 +- `TYPE` is one of `g`, `ms`, `h`, `c`, `m`, `s` to select the metric type.
463 +
464 +So, to set `metric1` as gauge to value `10`, use:
465 +
466 +```sh
467 +echo "metric1:10|g" | nc -u --send-only localhost 8125
468 +```
469 +
470 +To increment `metric2` by `10`, as a counter, use:
471 +
472 +```sh
473 +echo "metric2:10|c" | nc -u --send-only localhost 8125
474 +```
475 +
476 +You can send multiple metrics like this:
477 +
478 +```sh
479 +# send multiple metrics via UDP
480 +printf "metric1:10|g\nmetric2:10|c\n" | nc -u --send-only localhost 8125
481 +```
482 +
483 +Remember, for UDP communication each packet should not exceed the MTU. So, if you plan to push too many metrics at once, prefer TCP communication:
484 +
485 +```sh
486 +# send multiple metrics via TCP
487 +printf "metric1:10|g\nmetric2:10|c\n" | nc --send-only localhost 8125
488 +```
489 +
490 +You can also use this little function to take care of all the details:
491 +
492 +```sh
493 +#!/usr/bin/env bash
494 +
495 +STATSD_HOST="localhost"
496 +STATSD_PORT="8125"
497 +statsd() {
498 + local udp="-u" all="${*}"
499 +
500 + # if the string length of all parameters given is above 1000, use TCP
501 + [ "${#all}" -gt 1000 ] && udp=
502 +
503 + while [ ! -z "${1}" ]
504 + do
505 + printf "${1}\n"
506 + shift
507 + done | nc ${udp} --send-only ${STATSD_HOST} ${STATSD_PORT} || return 1
508 +
509 + return 0
510 +}
511 +```
512 +
513 +You can use it like this:
514 +
515 +```sh
516 +# first, source it in your script
517 +source statsd.sh
518 +
519 +# then, at any point:
520 +statsd "metric1:10|g" "metric2:10|c" ...
521 +```
522 +
523 +The function is smart enough to call `nc` just once and pass all the metrics to it. It will also automatically switch to TCP if the metrics to send are above 1000 bytes.
collectors/statsd.plugin/example.conf renamed
+2 -3
@@ -1,6 +1,7 @@
1 # statsd synthetic charts configuration
2
3 -# You can add many .conf files, one for each of your apps
3 +# You can add many .conf files in /etc/netdata/statsd.d/,
4 +# one for each of your apps.
5
6 # start a new app - you can add many apps in the same file
7 [app]
@@ -26,8 +27,6 @@
27 # the default is to use the global history
28 #history = 3600
29
29 -
30 -
30 # create a chart
31 # this is its id - the chart will be named myexampleapp.myexamplechart
32 [myexamplechart]
collectors/statsd.plugin/statsd.c renamed
collectors/statsd.plugin/statsd.h renamed
+1 -1
@@ -3,7 +3,7 @@
3 #ifndef NETDATA_STATSD_H
4 #define NETDATA_STATSD_H 1
5
6 -#include "../../common.h"
6 +#include "../../daemon/common.h"
7
8 #define STATSD_LISTEN_PORT 8125
9 #define STATSD_LISTEN_BACKLOG 4096
collectors/tc.plugin/Makefile.am new
+20
@@ -0,0 +1,20 @@
1 +# SPDX-License-Identifier: GPL-3.0-or-later
2 +
3 +AUTOMAKE_OPTIONS = subdir-objects
4 +MAINTAINERCLEANFILES = $(srcdir)/Makefile.in
5 +
6 +CLEANFILES = \
7 + tc-qos-helper.sh \
8 + $(NULL)
9 +
10 +include $(top_srcdir)/build/subst.inc
11 +SUFFIXES = .in
12 +
13 +dist_plugins_SCRIPTS = \
14 + tc-qos-helper.sh \
15 + $(NULL)
16 +
17 +dist_noinst_DATA = \
18 + tc-qos-helper.sh.in \
19 + README.md \
20 + $(NULL)
collectors/tc.plugin/README.md new
+9
@@ -0,0 +1,9 @@
1 +## tc.plugin
2 +
3 +Netdata monitors `tc` QoS classes for all interfaces.
4 +
5 +If you also use [FireQOS](http://firehol.org/tutorial/fireqos-new-user/)) it will collect interface and class names.
6 +
7 +There is a [shell helper](tc-qos-helper.sh.in) for this (all parsing is done by the plugin in `C` code - this shell script is just a configuration for the command to run to get `tc` output).
8 +
9 +The source of the tc plugin is [here](plugin_tc.c). It is somewhat complex, because a state machine was needed to keep track of all the `tc` classes, including the pseudo classes tc dynamically creates.
collectors/tc.plugin/plugin_tc.c renamed
collectors/tc.plugin/plugin_tc.h renamed
+1 -1
@@ -3,7 +3,7 @@
3 #ifndef NETDATA_PLUGIN_TC_H
4 #define NETDATA_PLUGIN_TC_H 1
5
6 -#include "../../common.h"
6 +#include "../../daemon/common.h"
7
8 #if (TARGET_OS == OS_LINUX)
9
collectors/tc.plugin/tc-qos-helper.sh.in renamed
conf.d/Makefile.am deleted
-199
@@ -1,199 +0,0 @@
1 -#
2 -# Copyright (C) 2015 Alon Bar-Lev <alon.barlev@gmail.com>
3 -# SPDX-License-Identifier: GPL-3.0-or-later
4 -#
5 -MAINTAINERCLEANFILES= $(srcdir)/Makefile.in
6 -CLEANFILES = \
7 - edit-config \
8 - $(NULL)
9 -
10 -include $(top_srcdir)/build/subst.inc
11 -
12 -SUFFIXES = .in
13 -
14 -dist_config_SCRIPTS = \
15 - edit-config \
16 - $(NULL)
17 -
18 -dist_noinst_DATA = \
19 - edit-config.in \
20 - $(NULL)
21 -
22 -dist_libconfig_DATA = \
23 - apps_groups.conf \
24 - charts.d.conf \
25 - fping.conf \
26 - node.d.conf \
27 - python.d.conf \
28 - health_alarm_notify.conf \
29 - health_email_recipients.conf \
30 - stream.conf \
31 - $(NULL)
32 -
33 -nodeconfigdir=$(libconfigdir)/node.d
34 -dist_nodeconfig_DATA = \
35 - $(NULL)
36 -
37 -usernodeconfigdir=$(configdir)/node.d
38 -dist_usernodeconfig_DATA = \
39 - node.d/README.md \
40 - node.d/fronius.conf.md \
41 - node.d/named.conf.md \
42 - node.d/sma_webbox.conf.md \
43 - node.d/snmp.conf.md \
44 - node.d/stiebeleltron.conf.md \
45 - $(NULL)
46 -
47 -pythonconfigdir=$(libconfigdir)/python.d
48 -dist_pythonconfig_DATA = \
49 - python.d/apache.conf \
50 - python.d/beanstalk.conf \
51 - python.d/bind_rndc.conf \
52 - python.d/boinc.conf \
53 - python.d/ceph.conf \
54 - python.d/chrony.conf \
55 - python.d/couchdb.conf \
56 - python.d/cpuidle.conf \
57 - python.d/cpufreq.conf \
58 - python.d/dns_query_time.conf \
59 - python.d/dnsdist.conf \
60 - python.d/dockerd.conf \
61 - python.d/dovecot.conf \
62 - python.d/elasticsearch.conf \
63 - python.d/example.conf \
64 - python.d/exim.conf \
65 - python.d/fail2ban.conf \
66 - python.d/freeradius.conf \
67 - python.d/go_expvar.conf \
68 - python.d/haproxy.conf \
69 - python.d/hddtemp.conf \
70 - python.d/httpcheck.conf \
71 - python.d/icecast.conf \
72 - python.d/ipfs.conf \
73 - python.d/isc_dhcpd.conf \
74 - python.d/linux_power_supply.conf \
75 - python.d/litespeed.conf \
76 - python.d/logind.conf \
77 - python.d/mdstat.conf \
78 - python.d/megacli.conf \
79 - python.d/memcached.conf \
80 - python.d/mongodb.conf \
81 - python.d/monit.conf \
82 - python.d/mysql.conf \
83 - python.d/nginx.conf \
84 - python.d/nginx_plus.conf \
85 - python.d/nsd.conf \
86 - python.d/ntpd.conf \
87 - python.d/ovpn_status_log.conf \
88 - python.d/phpfpm.conf \
89 - python.d/portcheck.conf \
90 - python.d/postfix.conf \
91 - python.d/postgres.conf \
92 - python.d/powerdns.conf \
93 - python.d/puppet.conf \
94 - python.d/rabbitmq.conf \
95 - python.d/redis.conf \
96 - python.d/rethinkdbs.conf \
97 - python.d/retroshare.conf \
98 - python.d/samba.conf \
99 - python.d/sensors.conf \
100 - python.d/springboot.conf \
101 - python.d/spigotmc.conf \
102 - python.d/squid.conf \
103 - python.d/smartd_log.conf \
104 - python.d/tomcat.conf \
105 - python.d/traefik.conf \
106 - python.d/unbound.conf \
107 - python.d/varnish.conf \
108 - python.d/w1sensor.conf \
109 - python.d/web_log.conf \
110 - $(NULL)
111 -
112 -healthconfigdir=$(libconfigdir)/health.d
113 -dist_healthconfig_DATA = \
114 - health.d/apache.conf \
115 - health.d/apcupsd.conf \
116 - health.d/backend.conf \
117 - health.d/bcache.conf \
118 - health.d/beanstalkd.conf \
119 - health.d/bind_rndc.conf \
120 - health.d/boinc.conf \
121 - health.d/btrfs.conf \
122 - health.d/ceph.conf \
123 - health.d/cpu.conf \
124 - health.d/couchdb.conf \
125 - health.d/disks.conf \
126 - health.d/dockerd.conf \
127 - health.d/elasticsearch.conf \
128 - health.d/entropy.conf \
129 - health.d/fping.conf \
130 - health.d/fronius.conf \
131 - health.d/haproxy.conf \
132 - health.d/httpcheck.conf \
133 - health.d/ipc.conf \
134 - health.d/ipfs.conf \
135 - health.d/ipmi.conf \
136 - health.d/isc_dhcpd.conf \
137 - health.d/lighttpd.conf \
138 - health.d/linux_power_supply.conf \
139 - health.d/load.conf \
140 - health.d/mdstat.conf \
141 - health.d/megacli.conf \
142 - health.d/memcached.conf \
143 - health.d/memory.conf \
144 - health.d/mongodb.conf \
145 - health.d/mysql.conf \
146 - health.d/named.conf \
147 - health.d/net.conf \
148 - health.d/netfilter.conf \
149 - health.d/nginx.conf \
150 - health.d/nginx_plus.conf \
151 - health.d/portcheck.conf \
152 - health.d/postgres.conf \
153 - health.d/qos.conf \
154 - health.d/ram.conf \
155 - health.d/redis.conf \
156 - health.d/retroshare.conf \
157 - health.d/softnet.conf \
158 - health.d/squid.conf \
159 - health.d/stiebeleltron.conf \
160 - health.d/swap.conf \
161 - health.d/tcp_conn.conf \
162 - health.d/tcp_listen.conf \
163 - health.d/tcp_mem.conf \
164 - health.d/tcp_orphans.conf \
165 - health.d/tcp_resets.conf \
166 - health.d/udp_errors.conf \
167 - health.d/varnish.conf \
168 - health.d/web_log.conf \
169 - health.d/zfs.conf \
170 - $(NULL)
171 -
172 -chartsconfigdir=$(libconfigdir)/charts.d
173 -dist_chartsconfig_DATA = \
174 - charts.d/apache.conf \
175 - charts.d/apcupsd.conf \
176 - charts.d/cpufreq.conf \
177 - charts.d/exim.conf \
178 - charts.d/libreswan.conf \
179 - charts.d/load_average.conf \
180 - charts.d/mysql.conf \
181 - charts.d/nut.conf \
182 - charts.d/phpfpm.conf \
183 - charts.d/sensors.conf \
184 - charts.d/tomcat.conf \
185 - charts.d/ap.conf \
186 - charts.d/cpu_apps.conf \
187 - charts.d/example.conf \
188 - charts.d/hddtemp.conf \
189 - charts.d/mem_apps.conf \
190 - charts.d/nginx.conf \
191 - charts.d/opensips.conf \
192 - charts.d/postfix.conf \
193 - charts.d/squid.conf \
194 - $(NULL)
195 -
196 -statsdconfigdir=$(libconfigdir)/statsd.d
197 -dist_statsdconfig_DATA = \
198 - statsd.d/example.conf \
199 - $(NULL)
conf.d/node.d/README.md deleted
-7
@@ -1,7 +0,0 @@
1 -`node.d.plugin` modules accept configuration in JSON format.
2 -
3 -Unfortunately, JSON files do not accept comments. So, the best way to describe them is to have markdown text files with instructions.
4 -
5 -JSON has a very strict formatting. If you get errors from netdata at `/var/log/netdata/error.log` that a certain configuration file cannot be loaded, we suggest to verify it at [http://jsonlint.com/](http://jsonlint.com/).
6 -
7 -The files in this directory, provide usable examples for configuring each `node.d.plugin` module.
configure.ac
+56 -36
@@ -36,7 +36,7 @@ AC_SUBST([PACKAGE_RPM_RELEASE])
36 AC_CONFIG_AUX_DIR([.])
37 AC_CONFIG_HEADERS([config.h])
38 AC_CONFIG_MACRO_DIR([build/m4])
39 -AC_CONFIG_SRCDIR([src/main.c])
39 +AC_CONFIG_SRCDIR([daemon/main.c])
40 define([AUTOMATE_INIT_OPTIONS], [tar-pax subdir-objects])
41 m4_ifdef([AM_SILENT_RULES], [
42 define([AUTOMATE_INIT_OPTIONS], [tar-pax silent-rules subdir-objects])
@@ -548,45 +548,65 @@ AC_SUBST([OPTIONAL_IPMIMONITORING_LIBS])
548
549 AC_CONFIG_FILES([
550 Makefile
551 - charts.d/Makefile
552 - conf.d/Makefile
551 netdata.spec
554 - python.d/Makefile
555 - node.d/Makefile
556 - plugins.d/Makefile
557 - src/api/Makefile
558 - src/backends/graphite/Makefile
559 - src/backends/json/Makefile
560 - src/backends/Makefile
561 - src/backends/opentsdb/Makefile
562 - src/backends/prometheus/Makefile
563 - src/database/Makefile
564 - src/health/Makefile
565 - src/libnetdata/Makefile
566 - src/Makefile
567 - src/plugins/apps.plugin/Makefile
568 - src/plugins/checks.plugin/Makefile
569 - src/plugins/freebsd.plugin/Makefile
570 - src/plugins/idlejitter.plugin/Makefile
571 - src/plugins/linux-cgroups.plugin/Makefile
572 - src/plugins/linux-diskspace.plugin/Makefile
573 - src/plugins/linux-freeipmi.plugin/Makefile
574 - src/plugins/linux-nfacct.plugin/Makefile
575 - src/plugins/linux-proc.plugin/Makefile
576 - src/plugins/linux-tc.plugin/Makefile
577 - src/plugins/macos.plugin/Makefile
578 - src/plugins/Makefile
579 - src/plugins/plugins.d.plugin/Makefile
580 - src/plugins/statsd.plugin/Makefile
581 - src/registry/Makefile
582 - src/streaming/Makefile
583 - src/webserver/Makefile
584 - system/Makefile
585 - web/Makefile
552 + backends/graphite/Makefile
553 + backends/json/Makefile
554 + backends/Makefile
555 + backends/opentsdb/Makefile
556 + backends/prometheus/Makefile
557 + collectors/Makefile
558 + collectors/apps.plugin/Makefile
559 + collectors/cgroups.plugin/Makefile
560 + collectors/charts.d.plugin/Makefile
561 + collectors/checks.plugin/Makefile
562 + collectors/diskspace.plugin/Makefile
563 + collectors/fping.plugin/Makefile
564 + collectors/freebsd.plugin/Makefile
565 + collectors/freeipmi.plugin/Makefile
566 + collectors/idlejitter.plugin/Makefile
567 + collectors/macos.plugin/Makefile
568 + collectors/nfacct.plugin/Makefile
569 + collectors/node.d.plugin/Makefile
570 + collectors/plugins.d/Makefile
571 + collectors/proc.plugin/Makefile
572 + collectors/python.d.plugin/Makefile
573 + collectors/statsd.plugin/Makefile
574 + collectors/tc.plugin/Makefile
575 + contrib/Makefile
576 + daemon/Makefile
577 + database/Makefile
578 diagrams/Makefile
579 + health/Makefile
580 + libnetdata/Makefile
581 + libnetdata/adaptive_resortable_list/Makefile
582 + libnetdata/avl/Makefile
583 + libnetdata/buffer/Makefile
584 + libnetdata/clocks/Makefile
585 + libnetdata/config/Makefile
586 + libnetdata/dictionary/Makefile
587 + libnetdata/eval/Makefile
588 + libnetdata/locks/Makefile
589 + libnetdata/log/Makefile
590 + libnetdata/popen/Makefile
591 + libnetdata/procfile/Makefile
592 + libnetdata/simple_pattern/Makefile
593 + libnetdata/socket/Makefile
594 + libnetdata/statistical/Makefile
595 + libnetdata/storage_number/Makefile
596 + libnetdata/threads/Makefile
597 + libnetdata/url/Makefile
598 makeself/Makefile
588 - contrib/Makefile
599 + registry/Makefile
600 + streaming/Makefile
601 + system/Makefile
602 tests/Makefile
603 + web/Makefile
604 + web/api/Makefile
605 + web/gui/Makefile
606 + web/server/Makefile
607 + web/server/single/Makefile
608 + web/server/multi/Makefile
609 + web/server/static/Makefile
610 ])
611 AC_OUTPUT
612
contrib/Makefile.am
+2 -2
@@ -1,5 +1,6 @@
1 # SPDX-License-Identifier: GPL-3.0-or-later
2 -MAINTAINERCLEANFILES= $(srcdir)/Makefile.in
2 +
3 +MAINTAINERCLEANFILES = $(srcdir)/Makefile.in
4
5 dist_noinst_DATA = \
6 README.md \
@@ -23,7 +24,6 @@ dist_noinst_DATA = \
24
25 dist_noinst_SCRIPTS = \
26 debian/netdata.init \
26 - nc-backend.sh \
27 $(NULL)
28
29 debian/changelog:
daemon/Makefile.am new
+8
@@ -0,0 +1,8 @@
1 +# SPDX-License-Identifier: GPL-3.0-or-later
2 +
3 +AUTOMAKE_OPTIONS = subdir-objects
4 +MAINTAINERCLEANFILES= $(srcdir)/Makefile.in
5 +
6 +dist_noinst_DATA = \
7 + README.md \
8 + $(NULL)
daemon/README.md
daemon/common.c renamed
daemon/common.h renamed
+5 -5
@@ -3,7 +3,7 @@
3 #ifndef NETDATA_COMMON_H
4 #define NETDATA_COMMON_H 1
5
6 -#include "libnetdata/libnetdata.h"
6 +#include "../libnetdata/libnetdata.h"
7
8 // ----------------------------------------------------------------------------
9 // netdata include files
@@ -14,7 +14,7 @@
14 #include "database/rrd.h"
15
16 // the netdata webserver(s)
17 -#include "webserver/web_server.h"
17 +#include "web/server/web_server.h"
18
19 // streaming metrics between netdata servers
20 #include "streaming/rrdpush.h"
@@ -27,13 +27,13 @@
27 #include "registry/registry.h"
28
29 // backends for archiving the metrics
30 -#include "src/backends/backends.h"
30 +#include "backends/backends.h"
31
32 // the netdata API
33 -#include "api/web_api_v1.h"
33 +#include "web/api/web_api_v1.h"
34
35 // all data collection plugins
36 -#include "plugins/all.h"
36 +#include "collectors/all.h"
37
38 // netdata unit tests
39 #include "unit_test.h"
daemon/daemon.c renamed
daemon/daemon.h renamed
daemon/global_statistics.c renamed
daemon/global_statistics.h renamed
daemon/main.c renamed
daemon/main.h renamed
daemon/signals.c renamed
daemon/signals.h renamed
daemon/unit_test.c renamed
daemon/unit_test.h renamed
database/Makefile.am new
+8
@@ -0,0 +1,8 @@
1 +# SPDX-License-Identifier: GPL-3.0-or-later
2 +
3 +AUTOMAKE_OPTIONS = subdir-objects
4 +MAINTAINERCLEANFILES = $(srcdir)/Makefile.in
5 +
6 +dist_noinst_DATA = \
7 + README.md \
8 + $(NULL)
database/README.md
database/rrd.c renamed
database/rrd.h renamed
+1 -1
@@ -14,7 +14,7 @@ typedef struct rrdcalc RRDCALC;
14 typedef struct rrdcalctemplate RRDCALCTEMPLATE;
15 typedef struct alarm_entry ALARM_ENTRY;
16
17 -#include "../common.h"
17 +#include "../daemon/common.h"
18
19 #include "rrdvar.h"
20 #include "rrdsetvar.h"
database/rrdcalc.c renamed
database/rrdcalc.h renamed
database/rrdcalctemplate.c renamed
database/rrdcalctemplate.h renamed
database/rrddim.c renamed
database/rrddimvar.c renamed
database/rrddimvar.h renamed
database/rrdfamily.c renamed
database/rrdhost.c renamed
database/rrdset.c renamed
database/rrdsetvar.c renamed
database/rrdsetvar.h renamed
database/rrdvar.c renamed
database/rrdvar.h renamed
health/Makefile.am new
+87
@@ -0,0 +1,87 @@
1 +# SPDX-License-Identifier: GPL-3.0-or-later
2 +
3 +AUTOMAKE_OPTIONS = subdir-objects
4 +MAINTAINERCLEANFILES = $(srcdir)/Makefile.in
5 +
6 +CLEANFILES = \
7 + alarm-notify.sh \
8 + $(NULL)
9 +
10 +include $(top_srcdir)/build/subst.inc
11 +SUFFIXES = .in
12 +
13 +dist_libconfig_DATA = \
14 + health_alarm_notify.conf \
15 + health_email_recipients.conf \
16 + $(NULL)
17 +
18 +dist_plugins_SCRIPTS = \
19 + alarm-notify.sh \
20 + alarm-email.sh \
21 + alarm-test.sh \
22 + $(NULL)
23 +
24 +dist_noinst_DATA = \
25 + alarm-notify.sh.in \
26 + README.md \
27 + $(NULL)
28 +
29 +healthconfigdir=$(libconfigdir)/health.d
30 +dist_healthconfig_DATA = \
31 + health.d/apache.conf \
32 + health.d/apcupsd.conf \
33 + health.d/backend.conf \
34 + health.d/bcache.conf \
35 + health.d/beanstalkd.conf \
36 + health.d/bind_rndc.conf \
37 + health.d/boinc.conf \
38 + health.d/btrfs.conf \
39 + health.d/ceph.conf \
40 + health.d/cpu.conf \
41 + health.d/couchdb.conf \
42 + health.d/disks.conf \
43 + health.d/dockerd.conf \
44 + health.d/elasticsearch.conf \
45 + health.d/entropy.conf \
46 + health.d/fping.conf \
47 + health.d/fronius.conf \
48 + health.d/haproxy.conf \
49 + health.d/httpcheck.conf \
50 + health.d/ipc.conf \
51 + health.d/ipfs.conf \
52 + health.d/ipmi.conf \
53 + health.d/isc_dhcpd.conf \
54 + health.d/lighttpd.conf \
55 + health.d/linux_power_supply.conf \
56 + health.d/load.conf \
57 + health.d/mdstat.conf \
58 + health.d/megacli.conf \
59 + health.d/memcached.conf \
60 + health.d/memory.conf \
61 + health.d/mongodb.conf \
62 + health.d/mysql.conf \
63 + health.d/named.conf \
64 + health.d/net.conf \
65 + health.d/netfilter.conf \
66 + health.d/nginx.conf \
67 + health.d/nginx_plus.conf \
68 + health.d/portcheck.conf \
69 + health.d/postgres.conf \
70 + health.d/qos.conf \
71 + health.d/ram.conf \
72 + health.d/redis.conf \
73 + health.d/retroshare.conf \
74 + health.d/softnet.conf \
75 + health.d/squid.conf \
76 + health.d/stiebeleltron.conf \
77 + health.d/swap.conf \
78 + health.d/tcp_conn.conf \
79 + health.d/tcp_listen.conf \
80 + health.d/tcp_mem.conf \
81 + health.d/tcp_orphans.conf \
82 + health.d/tcp_resets.conf \
83 + health.d/udp_errors.conf \
84 + health.d/varnish.conf \
85 + health.d/web_log.conf \
86 + health.d/zfs.conf \
87 + $(NULL)
health/README.md
health/alarm-email.sh renamed
health/alarm-notify.sh.in renamed
health/alarm-test.sh renamed
health/health.c renamed
health/health.d/apache.conf renamed
health/health.d/apcupsd.conf renamed
health/health.d/backend.conf renamed
health/health.d/bcache.conf renamed
health/health.d/beanstalkd.conf renamed
health/health.d/bind_rndc.conf renamed
health/health.d/boinc.conf renamed
health/health.d/btrfs.conf renamed
health/health.d/ceph.conf renamed
health/health.d/couchdb.conf renamed
health/health.d/cpu.conf renamed
health/health.d/disks.conf renamed
health/health.d/dockerd.conf renamed
health/health.d/elasticsearch.conf renamed
health/health.d/entropy.conf renamed
health/health.d/fping.conf renamed
health/health.d/fronius.conf renamed
health/health.d/haproxy.conf renamed
health/health.d/httpcheck.conf renamed
health/health.d/ipc.conf renamed
health/health.d/ipfs.conf renamed
health/health.d/ipmi.conf renamed
health/health.d/isc_dhcpd.conf renamed
health/health.d/lighttpd.conf renamed
health/health.d/linux_power_supply.conf renamed
health/health.d/load.conf renamed
health/health.d/mdstat.conf renamed
health/health.d/megacli.conf renamed
health/health.d/memcached.conf renamed
health/health.d/memory.conf renamed
health/health.d/mongodb.conf renamed
health/health.d/mysql.conf renamed
health/health.d/named.conf renamed
health/health.d/net.conf renamed
health/health.d/netfilter.conf renamed
health/health.d/nginx.conf renamed
health/health.d/nginx_plus.conf renamed
health/health.d/portcheck.conf renamed
health/health.d/postgres.conf renamed
health/health.d/qos.conf renamed
health/health.d/ram.conf renamed
health/health.d/redis.conf renamed
health/health.d/retroshare.conf renamed
health/health.d/softnet.conf renamed
health/health.d/squid.conf renamed
health/health.d/stiebeleltron.conf renamed
health/health.d/swap.conf renamed
health/health.d/tcp_conn.conf renamed
health/health.d/tcp_listen.conf renamed
health/health.d/tcp_mem.conf renamed
health/health.d/tcp_orphans.conf renamed
health/health.d/tcp_resets.conf renamed
health/health.d/udp_errors.conf renamed
health/health.d/varnish.conf renamed
health/health.d/web_log.conf renamed
health/health.d/zfs.conf renamed
health/health.h renamed
+1 -1
@@ -3,7 +3,7 @@
3 #ifndef NETDATA_HEALTH_H
4 #define NETDATA_HEALTH_H 1
5
6 -#include "src/common.h"
6 +#include "../daemon/common.h"
7
8 #define NETDATA_PLUGIN_HOOK_HEALTH \
9 { \
health/health_alarm_notify.conf renamed
health/health_config.c renamed
health/health_email_recipients.conf renamed
health/health_json.c renamed
health/health_log.c renamed
installer/.keep
libnetdata/Makefile.am new
+28
@@ -0,0 +1,28 @@
1 +# SPDX-License-Identifier: GPL-3.0-or-later
2 +
3 +AUTOMAKE_OPTIONS = subdir-objects
4 +MAINTAINERCLEANFILES = $(srcdir)/Makefile.in
5 +
6 +SUBDIRS = \
7 + adaptive_resortable_list \
8 + avl \
9 + buffer \
10 + clocks \
11 + config \
12 + dictionary \
13 + eval \
14 + locks \
15 + log \
16 + popen \
17 + procfile \
18 + simple_pattern \
19 + socket \
20 + statistical \
21 + storage_number \
22 + threads \
23 + url \
24 + $(NULL)
25 +
26 +dist_noinst_DATA = \
27 + README.md \
28 + $(NULL)
libnetdata/README.md new
+6
@@ -0,0 +1,6 @@
1 +# libnetdata
2 +
3 +`libnetdata` is a collection of library code that is used by all netdata `C` programs.
4 +
5 +
6 +
libnetdata/adaptive_resortable_list/Makefile.am new
+9
@@ -0,0 +1,9 @@
1 +# SPDX-License-Identifier: GPL-3.0-or-later
2 +
3 +AUTOMAKE_OPTIONS = subdir-objects
4 +MAINTAINERCLEANFILES = $(srcdir)/Makefile.in
5 +
6 +
7 +dist_noinst_DATA = \
8 + README.md \
9 + $(NULL)
libnetdata/adaptive_resortable_list/README.md new
+89
@@ -0,0 +1,89 @@
1 +
2 +# Adaptive Re-sortable List (ARL)
3 +
4 +This library allows netdata to read a series of `name - value` pairs
5 +in the **fastest possible way**.
6 +
7 +ARLs are used all over netdata, as they are the most
8 +CPU utilization efficient way to process `/proc` files. They are used to
9 +process both vertical (csv like) and horizontal (one pair per line) `name - value` pairs.
10 +
11 +## How ARL works
12 +
13 +It maintains a linked list of all `NAME` (keywords), sorted in the
14 +order found in the data source. The linked list is kept
15 +sorted at all times - the data source may change at any time, the
16 +linked list will adapt at the next iteration.
17 +
18 +### Initialization
19 +
20 +During initialization (just once), the caller:
21 +
22 +- calls `arl_create()` to create the ARL
23 +
24 +- calls `arl_expect()` multiple times to register the expected keywords
25 +
26 +The library will call the `processor()` function (given to
27 +`arl_create()`), for each expected keyword found.
28 +The default `processor()` expects `dst` to be an `unsigned long long *`.
29 +
30 +Each `name` keyword may have a different `processor()` (by calling
31 +`arl_expect_custom()` instead of `arl_expect()`).
32 +
33 +### Data collection iterations
34 +
35 +For each iteration through the data source, the caller:
36 +
37 +- calls `arl_begin()` to initiate a data collection iteration.
38 + This is to be called just ONCE every time the source is re-evaluated.
39 +
40 +- calls `arl_check()` for each entry read from the file.
41 +
42 +### Cleanup
43 +
44 +When the caller exits:
45 +
46 +- calls `arl_free()` to destroy this and free all memory.
47 +
48 +### Performance
49 +
50 +ARL maintains a list of `name` keywords found in the data source (even the ones
51 +that are not useful for data collection).
52 +
53 +If the data source maintains the same order on the `name-value` pairs, for each
54 +each call to `arl_check()` only an `strcmp()` is executed to verify the
55 +expected order has not changed, a counter is incremented and a pointer is changed.
56 +So, if the data source has 100 `name-value` pairs, and their order remains constant
57 +over time, 100 successful `strcmp()` are executed.
58 +
59 +In the unlikely event that an iteration sees the data source with a different order,
60 +for each out-of-order keyword, a full search of the remaining keywords is made. But
61 +this search uses 32bit hashes, not string comparisons, so it should also be fast.
62 +
63 +When all expectations are satisfied (even in the middle of an iteration),
64 +the call to `arl_check()` will return 1, to signal the caller to stop the loop,
65 +saving valuable CPU resources for the rest of the data source.
66 +
67 +In the following test we used alternative methods to process, **1M times**,
68 +a data source like `/proc/meminfo`, already tokenized, in memory,
69 +to extract the same number of expected metrics:
70 +
71 +test|code|string comparison|number parsing|duration
72 +:---:|:---:|:---:|:---:|:---:|
73 +1|if-else-if-else-if|`strcmp()`|`strtoull()`|4698657 usecs
74 +2|if-else-if-else-if|inline `simple_hash()` and `strcmp()`|`strtoull()`| 872005 usecs
75 +3|if-else-if-else-if|statement expression `simple_hash()` and `strcmp()`|`strtoull()`|861626 usecs
76 +4|if-continue|inline `simple_hash()` and `strcmp()`|`strtoull()`|871887 usecs
77 +5|if-else-if-else-if|inline `simple_hash()` and `strcmp()`|`str2ull()`|606541 usecs
78 +6|ARL|ARL|`strtoull()`|424149 usecs
79 +7|ARL|ARL|`str2ull()`|199324 usecs
80 +
81 +So, compared to unoptimized code (test No 1: 4.7sec), before ARL netdata was using test
82 +No **5** with hashing and a custom `str2ull()` to achieve 607ms.
83 +The current ARL implementation is test No **7** that needs only 199ms
84 +(23 times faster vs unoptimized code, 3 times faster vs optimized code).
85 +
86 +## Limitations
87 +
88 +Do not use ARL if the a name/keyword may appear more than once in the
89 +source data.
libnetdata/adaptive_resortable_list/adaptive_resortable_list.c renamed
+1 -1
@@ -1,6 +1,6 @@
1 // SPDX-License-Identifier: GPL-3.0-or-later
2
3 -#include "libnetdata.h"
3 +#include "../libnetdata.h"
4
5 // the default processor() of the ARL
6 // can be overwritten at arl_create()
libnetdata/adaptive_resortable_list/adaptive_resortable_list.h renamed
+1 -37
@@ -1,46 +1,10 @@
1 // SPDX-License-Identifier: GPL-3.0-or-later
2
3 -#include "libnetdata.h"
3 +#include "../libnetdata.h"
4
5 #ifndef NETDATA_ADAPTIVE_RESORTABLE_LIST_H
6 #define NETDATA_ADAPTIVE_RESORTABLE_LIST_H 1
7
8 -/*
9 - * ADAPTIVE RE-SORTABLE LIST
10 - * This structure allows netdata to read a file of NAME VALUE lines
11 - * in the fastest possible way.
12 - *
13 - * It maintains a linked list of all NAME (keywords), sorted in the
14 - * same order as found in the source data file.
15 - * The linked list is kept sorted at all times - the source file
16 - * may change at any time, the list will adapt.
17 - *
18 - * The caller:
19 - *
20 - * 1. calls arl_create() to create a list
21 - *
22 - * 2. calls arl_expect() to register the expected keyword
23 - *
24 - * Then:
25 - *
26 - * 3. calls arl_begin() to initiate a data collection iteration.
27 - * This is to be called just ONCE every time the source is re-scanned.
28 - *
29 - * 4. calls arl_check() for each line read from the file.
30 - *
31 - * Finally:
32 - *
33 - * 5. calls arl_free() to destroy this and free all memory.
34 - *
35 - * The program will call the processor() function, given to
36 - * arl_create(), for each expected keyword found.
37 - * The default processor() expects dst to be an unsigned long long *.
38 - *
39 - * LIMITATIONS
40 - * DO NOT USE THIS IF THE A NAME/KEYWORD MAY APPEAR MORE THAN
41 - * ONCE IN THE SOURCE DATA SET.
42 - */
43 -
8 #define ARL_ENTRY_FLAG_FOUND 0x01 // the entry has been found in the source data
9 #define ARL_ENTRY_FLAG_EXPECTED 0x02 // the entry is expected by the program
10 #define ARL_ENTRY_FLAG_DYNAMIC 0x04 // the entry was dynamically allocated, from source data
libnetdata/avl/Makefile.am new
+9
@@ -0,0 +1,9 @@
1 +# SPDX-License-Identifier: GPL-3.0-or-later
2 +
3 +AUTOMAKE_OPTIONS = subdir-objects
4 +MAINTAINERCLEANFILES = $(srcdir)/Makefile.in
5 +
6 +
7 +dist_noinst_DATA = \
8 + README.md \
9 + $(NULL)
libnetdata/avl/README.md new
+11
@@ -0,0 +1,11 @@
1 +# AVL
2 +
3 +AVL is a library indexing objects in B-Trees.
4 +
5 +`avl_insert()`, `avl_remove()` and `avl_search()` are adaptations
6 +of the AVL algorithm found in `libavl` v2.0.3, so that they do not
7 +use any memory allocations and their memory footprint is optimized
8 +(by eliminating non-necessary data members).
9 +
10 +In addition to the above, this version of AVL, provides versions using locks
11 +and traversal functions.
\ No newline at end of file
libnetdata/avl/avl.c renamed
+1 -1
@@ -1,6 +1,6 @@
1 // SPDX-License-Identifier: LGPL-3.0-or-later
2
3 -#include "libnetdata.h"
3 +#include "../libnetdata.h"
4
5 /* ------------------------------------------------------------------------- */
6 /*
libnetdata/avl/avl.h renamed
+1 -2
@@ -3,8 +3,7 @@
3 #ifndef _AVL_H
4 #define _AVL_H 1
5
6 -#include "libnetdata.h"
7 -
6 +#include "../libnetdata.h"
7
8 /* Maximum AVL tree height. */
9 #ifndef AVL_MAX_HEIGHT
libnetdata/buffer/Makefile.am new
+9
@@ -0,0 +1,9 @@
1 +# SPDX-License-Identifier: GPL-3.0-or-later
2 +
3 +AUTOMAKE_OPTIONS = subdir-objects
4 +MAINTAINERCLEANFILES = $(srcdir)/Makefile.in
5 +
6 +
7 +dist_noinst_DATA = \
8 + README.md \
9 + $(NULL)
libnetdata/buffer/README.md new
+11
@@ -0,0 +1,11 @@
1 +# BUFFER
2 +
3 +`BUFFER` is a convenience library for working with strings in `C`.
4 +Mainly, `BUFFER`s eliminate the need for tracking the string length, thus providing
5 +a safe alternative for string operations.
6 +
7 +Also, they are super fast in printing and appending data to the string and its `buffer_strlen()`
8 +is just a lookup (it does not traverse the string).
9 +
10 +Netdata uses `BUFFER`s for preparing web responses and buffering data to be sent upstream or
11 +to backend databases.
\ No newline at end of file
libnetdata/buffer/buffer.c renamed
+1 -1
@@ -1,6 +1,6 @@
1 // SPDX-License-Identifier: GPL-3.0-or-later
2
3 -#include "libnetdata.h"
3 +#include "../libnetdata.h"
4
5 #define BUFFER_OVERFLOW_EOF "EOF"
6
libnetdata/buffer/buffer.h renamed
+1 -1
@@ -3,7 +3,7 @@
3 #ifndef NETDATA_WEB_BUFFER_H
4 #define NETDATA_WEB_BUFFER_H 1
5
6 -#include "libnetdata.h"
6 +#include "../libnetdata.h"
7
8 #define WEB_DATA_LENGTH_INCREASE_STEP 1024
9
libnetdata/clocks/Makefile.am new
+9
@@ -0,0 +1,9 @@
1 +# SPDX-License-Identifier: GPL-3.0-or-later
2 +
3 +AUTOMAKE_OPTIONS = subdir-objects
4 +MAINTAINERCLEANFILES = $(srcdir)/Makefile.in
5 +
6 +
7 +dist_noinst_DATA = \
8 + README.md \
9 + $(NULL)
libnetdata/clocks/README.md
libnetdata/clocks/clocks.c renamed
+1 -1
@@ -1,6 +1,6 @@
1 // SPDX-License-Identifier: GPL-3.0-or-later
2
3 -#include "libnetdata.h"
3 +#include "../libnetdata.h"
4
5 #ifndef HAVE_CLOCK_GETTIME
6 inline int clock_gettime(clockid_t clk_id, struct timespec *ts) {
libnetdata/clocks/clocks.h renamed
+1 -1
@@ -3,7 +3,7 @@
3 #ifndef NETDATA_CLOCKS_H
4 #define NETDATA_CLOCKS_H 1
5
6 -#include "libnetdata.h"
6 +#include "../libnetdata.h"
7
8 #ifndef HAVE_STRUCT_TIMESPEC
9 struct timespec {
libnetdata/config/Makefile.am new
+9
@@ -0,0 +1,9 @@
1 +# SPDX-License-Identifier: GPL-3.0-or-later
2 +
3 +AUTOMAKE_OPTIONS = subdir-objects
4 +MAINTAINERCLEANFILES = $(srcdir)/Makefile.in
5 +
6 +
7 +dist_noinst_DATA = \
8 + README.md \
9 + $(NULL)
libnetdata/config/README.md new
+46
@@ -0,0 +1,46 @@
1 +# netdata ini config files
2 +
3 +Configuration files `netdata.conf` and `stream.conf` are netdata ini files.
4 +
5 +## Motivation
6 +
7 +The whole idea came up when we were evaluating the documentation involved
8 +in maintaining a complex configuration system. Our intention was to give
9 +configuration options for everything imaginable. But then, documenting all
10 +these options would require a tremendous amount of time, users would have
11 +to search through endless pages for the option they need, etc.
12 +
13 +We concluded then that **configuring software like that is a waste of time
14 +and effort**. Of course there must be plenty of configuration options, but
15 +the implementation itself should require a lot less effort for both the
16 +developers and the users.
17 +
18 +So, we did this:
19 +
20 +1. No configuration is required to run netdata
21 +2. There are plenty of options to tweak
22 +3. There is minimal documentation (or no at all)
23 +
24 +## Why this works?
25 +
26 +The configuration file is a `name = value` dictionary with `[sections]`.
27 +Write whatever you like there as long as it follows this simple format.
28 +
29 +Netdata loads this dictionary and then when the code needs a value from
30 +it, it just looks up the `name` in the dictionary at the proper `section`.
31 +In all places, in the code, there are both the `names` and their
32 +`default values`, so if something is not found in the configuration
33 +file, the default is used. The lookup is made using B-Trees and hashes
34 +(no string comparisons), so they are super fast. Also the `names` of the
35 +settings can be `my super duper setting that once set to yes, will turn the world upside down = no`
36 +- so goodbye to most of the documentation involved.
37 +
38 +Next, netdata can generate a valid configuration for the user to edit.
39 +No need to remember anything or copy and paste settings. Just get the
40 +configuration from the server (`/netdata.conf` on your netdata server),
41 +edit it and save it.
42 +
43 +Last, what about options you believe you have set, but you misspelled?
44 +When you get the configuration file from the server, there will be a
45 +comment above all `name = value` pairs the server does not use.
46 +So you know that whatever you wrote there, is not used.
libnetdata/config/appconfig.c renamed
+1 -1
@@ -1,6 +1,6 @@
1 // SPDX-License-Identifier: GPL-3.0-or-later
2
3 -#include "libnetdata.h"
3 +#include "../libnetdata.h"
4
5 #define CONFIG_FILE_LINE_MAX ((CONFIG_MAX_NAME + CONFIG_MAX_VALUE + 1024) * 2)
6
libnetdata/config/appconfig.h renamed
+1 -1
@@ -78,7 +78,7 @@
78 #ifndef NETDATA_CONFIG_H
79 #define NETDATA_CONFIG_H 1
80
81 -#include "libnetdata.h"
81 +#include "../libnetdata.h"
82
83 #define CONFIG_FILENAME "netdata.conf"
84
libnetdata/dictionary/Makefile.am new
+9
@@ -0,0 +1,9 @@
1 +# SPDX-License-Identifier: GPL-3.0-or-later
2 +
3 +AUTOMAKE_OPTIONS = subdir-objects
4 +MAINTAINERCLEANFILES = $(srcdir)/Makefile.in
5 +
6 +
7 +dist_noinst_DATA = \
8 + README.md \
9 + $(NULL)
libnetdata/dictionary/README.md
libnetdata/dictionary/dictionary.c renamed
+1 -1
@@ -1,6 +1,6 @@
1 // SPDX-License-Identifier: GPL-3.0-or-later
2
3 -#include "libnetdata.h"
3 +#include "../libnetdata.h"
4
5 // ----------------------------------------------------------------------------
6 // dictionary statistics
libnetdata/dictionary/dictionary.h renamed
+1 -1
@@ -3,7 +3,7 @@
3 #ifndef NETDATA_DICTIONARY_H
4 #define NETDATA_DICTIONARY_H 1
5
6 -#include "libnetdata.h"
6 +#include "../libnetdata.h"
7
8 struct dictionary_stats {
9 unsigned long long inserts;
libnetdata/eval/Makefile.am new
+9
@@ -0,0 +1,9 @@
1 +# SPDX-License-Identifier: GPL-3.0-or-later
2 +
3 +AUTOMAKE_OPTIONS = subdir-objects
4 +MAINTAINERCLEANFILES = $(srcdir)/Makefile.in
5 +
6 +
7 +dist_noinst_DATA = \
8 + README.md \
9 + $(NULL)
libnetdata/eval/README.md
libnetdata/eval/eval.c renamed
+1 -1
@@ -1,6 +1,6 @@
1 // SPDX-License-Identifier: GPL-3.0-or-later
2
3 -#include "libnetdata.h"
3 +#include "../libnetdata.h"
4
5 // ----------------------------------------------------------------------------
6 // data structures for storing the parsed expression in memory
libnetdata/eval/eval.h renamed
+1 -1
@@ -3,7 +3,7 @@
3 #ifndef NETDATA_EVAL_H
4 #define NETDATA_EVAL_H 1
5
6 -#include "libnetdata.h"
6 +#include "../libnetdata.h"
7
8 #define EVAL_MAX_VARIABLE_NAME_LENGTH 300
9
libnetdata/inlined.h renamed
libnetdata/libnetdata.c renamed
libnetdata/libnetdata.h renamed
+17 -17
@@ -205,24 +205,24 @@
205 #define GUID_LEN 36
206
207 #include "os.h"
208 -#include "storage_number.h"
209 -#include "web_buffer.h"
210 -#include "locks.h"
211 -#include "avl.h"
208 +#include "storage_number/storage_number.h"
209 +#include "buffer/buffer.h"
210 +#include "locks/locks.h"
211 +#include "avl/avl.h"
212 #include "inlined.h"
213 -#include "clocks.h"
214 -#include "threads.h"
215 -#include "popen.h"
216 -#include "simple_pattern.h"
217 -#include "socket.h"
218 -#include "appconfig.h"
219 -#include "log.h"
220 -#include "procfile.h"
221 -#include "dictionary.h"
222 -#include "eval.h"
223 -#include "statistical.h"
224 -#include "adaptive_resortable_list.h"
225 -#include "url.h"
213 +#include "clocks/clocks.h"
214 +#include "threads/threads.h"
215 +#include "popen/popen.h"
216 +#include "simple_pattern/simple_pattern.h"
217 +#include "socket/socket.h"
218 +#include "config/appconfig.h"
219 +#include "log/log.h"
220 +#include "procfile/procfile.h"
221 +#include "dictionary/dictionary.h"
222 +#include "eval/eval.h"
223 +#include "statistical/statistical.h"
224 +#include "adaptive_resortable_list/adaptive_resortable_list.h"
225 +#include "url/url.h"
226
227 extern void netdata_fix_chart_id(char *s);
228 extern void netdata_fix_chart_name(char *s);
libnetdata/locks/Makefile.am new
+9
@@ -0,0 +1,9 @@
1 +# SPDX-License-Identifier: GPL-3.0-or-later
2 +
3 +AUTOMAKE_OPTIONS = subdir-objects
4 +MAINTAINERCLEANFILES = $(srcdir)/Makefile.in
5 +
6 +
7 +dist_noinst_DATA = \
8 + README.md \
9 + $(NULL)
libnetdata/locks/README.md
libnetdata/locks/locks.c renamed
+1 -1
@@ -1,6 +1,6 @@
1 // SPDX-License-Identifier: GPL-3.0-or-later
2
3 -#include "libnetdata.h"
3 +#include "../libnetdata.h"
4
5 // ----------------------------------------------------------------------------
6 // automatic thread cancelability management, based on locks
libnetdata/locks/locks.h renamed
+1 -1
@@ -3,7 +3,7 @@
3 #ifndef NETDATA_LOCKS_H
4 #define NETDATA_LOCKS_H 1
5
6 -#include "libnetdata.h"
6 +#include "../libnetdata.h"
7
8 typedef pthread_mutex_t netdata_mutex_t;
9 #define NETDATA_MUTEX_INITIALIZER PTHREAD_MUTEX_INITIALIZER
libnetdata/log/Makefile.am new
+9
@@ -0,0 +1,9 @@
1 +# SPDX-License-Identifier: GPL-3.0-or-later
2 +
3 +AUTOMAKE_OPTIONS = subdir-objects
4 +MAINTAINERCLEANFILES = $(srcdir)/Makefile.in
5 +
6 +
7 +dist_noinst_DATA = \
8 + README.md \
9 + $(NULL)
libnetdata/log/README.md
libnetdata/log/log.c renamed
+1 -1
@@ -1,6 +1,6 @@
1 // SPDX-License-Identifier: GPL-3.0-or-later
2
3 -#include "libnetdata.h"
3 +#include "../libnetdata.h"
4
5 int web_server_is_multithreaded = 1;
6
libnetdata/log/log.h renamed
+1 -1
@@ -3,7 +3,7 @@
3 #ifndef NETDATA_LOG_H
4 #define NETDATA_LOG_H 1
5
6 -#include "libnetdata.h"
6 +#include "../libnetdata.h"
7
8 #define D_WEB_BUFFER 0x0000000000000001
9 #define D_WEB_CLIENT 0x0000000000000002
libnetdata/os.c renamed
libnetdata/os.h renamed
libnetdata/popen/Makefile.am new
+9
@@ -0,0 +1,9 @@
1 +# SPDX-License-Identifier: GPL-3.0-or-later
2 +
3 +AUTOMAKE_OPTIONS = subdir-objects
4 +MAINTAINERCLEANFILES = $(srcdir)/Makefile.in
5 +
6 +
7 +dist_noinst_DATA = \
8 + README.md \
9 + $(NULL)
libnetdata/popen/README.md
libnetdata/popen/popen.c renamed
+1 -1
@@ -1,6 +1,6 @@
1 // SPDX-License-Identifier: GPL-3.0-or-later
2
3 -#include "libnetdata.h"
3 +#include "../libnetdata.h"
4
5 /*
6 struct mypopen {
libnetdata/popen/popen.h renamed
+1 -1
@@ -3,7 +3,7 @@
3 #ifndef NETDATA_POPEN_H
4 #define NETDATA_POPEN_H 1
5
6 -#include "libnetdata.h"
6 +#include "../libnetdata.h"
7
8 #define PIPE_READ 0
9 #define PIPE_WRITE 1
libnetdata/procfile/Makefile.am new
+9
@@ -0,0 +1,9 @@
1 +# SPDX-License-Identifier: GPL-3.0-or-later
2 +
3 +AUTOMAKE_OPTIONS = subdir-objects
4 +MAINTAINERCLEANFILES = $(srcdir)/Makefile.in
5 +
6 +
7 +dist_noinst_DATA = \
8 + README.md \
9 + $(NULL)
libnetdata/procfile/README.md new
+61
@@ -0,0 +1,61 @@
1 +
2 +# PROCFILE
3 +
4 +procfile is a library for reading text data files (i.e `/proc` files) in the fastest possible way.
5 +
6 +## How it works
7 +
8 +The library automatically adapts (through the iterations) its memory so that each file
9 +is read with single `read()` call.
10 +
11 +Then the library splits the file into words, using the supplied separators.
12 +The library also supported quoted words (i.e. strings within of which the separators are ignored).
13 +
14 +### Initialization
15 +
16 +Initially the caller:
17 +
18 +- calls `procfile_open()` to open the file and allocate the structures needed.
19 +
20 +### Iterations
21 +
22 +For each iteration, the caller:
23 +
24 +- calls `procfile_readall()` to read updated contents.
25 + This call also rewinds (`lseek()` to 0) before reading it.
26 +
27 + For every file, a [BUFFER](../buffer/) is used that is automatically adjusted to fit
28 + the entire file contents of the file. So the file is read with a single `read()` call
29 + (providing atomicity / consistency when the data are read from the kernel).
30 +
31 + Once the data are read, 2 arrays of pointers are updated:
32 +
33 + - a `words` array, pointing to each word in the data read
34 + - a `lines` array, pointing to the first word for each line
35 +
36 + This is highly optimized. Both arrays are automatically adjusted to
37 + fit all contents and are updated in a single pass on the data.
38 +
39 + The library provides a number of macros:
40 +
41 + - `procfile_lines()` returns the # of lines read
42 + - `procfile_linewords()` returns the # of words in the given line
43 + - `procfile_word()` returns a pointer the given word #
44 + - `procfile_line()` returns a pointer to the first word of the given line #
45 + - `procfile_lineword()` returns a pointer to the given word # of the given line #
46 +
47 +### Cleanup
48 +
49 +When the caller exits:
50 +
51 +- calls `procfile_free()` to close the file and free all memory used.
52 +
53 +### Performance
54 +
55 +- a **raspberry Pi 1** (the oldest single core one) can process 5.000+ `/proc` files per second.
56 +- a **J1900 Celeron** processor can process 23.000+ `/proc` files per second per core.
57 +
58 +To achieve this kind of performance, the library tries to work in batches so that the code
59 +and the data are inside the processor's caches.
60 +
61 +This library is extensively used in netdata and its plugins.
libnetdata/procfile/procfile.c renamed
+1 -1
@@ -1,6 +1,6 @@
1 // SPDX-License-Identifier: GPL-3.0-or-later
2
3 -#include "libnetdata.h"
3 +#include "../libnetdata.h"
4
5 #define PF_PREFIX "PROCFILE"
6
libnetdata/procfile/procfile.h renamed
+1 -25
@@ -1,33 +1,9 @@
1 // SPDX-License-Identifier: GPL-3.0-or-later
2
3 -/*
4 - * procfile is a library for reading kernel files from /proc
5 - *
6 - * The idea is this:
7 - *
8 - * - every file is opened once with procfile_open().
9 - *
10 - * - to read updated contents, we rewind it (lseek() to 0) and read again
11 - * with procfile_readall().
12 - *
13 - * - for every file, we use a buffer that is adjusted to fit its entire
14 - * contents in memory, allowing us to read it with a single read() call.
15 - * (this provides atomicity / consistency on the data read from the kernel)
16 - *
17 - * - once the data are read, we update two arrays of pointers:
18 - * - a words array, pointing to each word in the data read
19 - * - a lines array, pointing to the first word for each line
20 - *
21 - * This is highly optimized. Both arrays are automatically adjusted to
22 - * fit all contents and are updated in a single pass on the data:
23 - * - a raspberry Pi can process 5.000+ files / sec.
24 - * - a J1900 celeron processor can process 23.000+ files / sec.
25 -*/
26 -
3 #ifndef NETDATA_PROCFILE_H
4 #define NETDATA_PROCFILE_H 1
5
30 -#include "libnetdata.h"
6 +#include "../libnetdata.h"
7
8 // ----------------------------------------------------------------------------
9 // An array of words
libnetdata/simple_pattern/Makefile.am new
+9
@@ -0,0 +1,9 @@
1 +# SPDX-License-Identifier: GPL-3.0-or-later
2 +
3 +AUTOMAKE_OPTIONS = subdir-objects
4 +MAINTAINERCLEANFILES = $(srcdir)/Makefile.in
5 +
6 +
7 +dist_noinst_DATA = \
8 + README.md \
9 + $(NULL)
libnetdata/simple_pattern/README.md new
+36
@@ -0,0 +1,36 @@
1 +## netdata simple patterns
2 +
3 +Unix prefers regular expressions. But they are just too hard, too cryptic
4 +to use, write and understand.
5 +
6 +So, netdata supports **simple patterns**.
7 +
8 +Simple patterns are a space separated list of words, that can have `*`
9 +as a wildcard. Each world may use any number of `*`. Simple patterns
10 +allow **negative** matches by prefixing a word with `!`.
11 +
12 +So, `pattern = !*bad* *` will match anything, except all those that
13 +contain the word `bad`.
14 +
15 +Simple patterns are quite powerful: `pattern = *foobar* !foo* !*bar *`
16 +matches everything containing `foobar`, except strings that start
17 +with `foo` or end with `bar`.
18 +
19 +You can use the netdata command line to check simple patterns,
20 +like this:
21 +
22 +```sh
23 +# netdata -W simple-pattern '*foobar* !foo* !*bar *' 'hello world'
24 +RESULT: MATCHED - pattern '*foobar* !foo* !*bar *' matches 'hello world'
25 +
26 +# netdata -W simple-pattern '*foobar* !foo* !*bar *' 'hello world bar'
27 +RESULT: NOT MATCHED - pattern '*foobar* !foo* !*bar *' does not match 'hello world bar'
28 +
29 +# netdata -W simple-pattern '*foobar* !foo* !*bar *' 'hello world foobar'
30 +RESULT: MATCHED - pattern '*foobar* !foo* !*bar *' matches 'hello world foobar'
31 +```
32 +
33 +netdata stops processing to the first positive or negative match
34 +(left to right). If it is not matched by either positive or negative
35 +patterns, it is denied at the end.
36 +
libnetdata/simple_pattern/simple_pattern.c renamed
+1 -1
@@ -1,6 +1,6 @@
1 // SPDX-License-Identifier: GPL-3.0-or-later
2
3 -#include "libnetdata.h"
3 +#include "../libnetdata.h"
4
5 struct simple_pattern {
6 const char *match;
libnetdata/simple_pattern/simple_pattern.h renamed
+1 -1
@@ -3,7 +3,7 @@
3 #ifndef NETDATA_SIMPLE_PATTERN_H
4 #define NETDATA_SIMPLE_PATTERN_H
5
6 -#include "libnetdata.h"
6 +#include "../libnetdata.h"
7
8
9 typedef enum {
libnetdata/socket/Makefile.am new
+9
@@ -0,0 +1,9 @@
1 +# SPDX-License-Identifier: GPL-3.0-or-later
2 +
3 +AUTOMAKE_OPTIONS = subdir-objects
4 +MAINTAINERCLEANFILES = $(srcdir)/Makefile.in
5 +
6 +
7 +dist_noinst_DATA = \
8 + README.md \
9 + $(NULL)
libnetdata/socket/README.md
libnetdata/socket/socket.c renamed
+1 -1
@@ -1,6 +1,6 @@
1 // SPDX-License-Identifier: GPL-3.0-or-later
2
3 -#include "libnetdata.h"
3 +#include "../libnetdata.h"
4
5 // --------------------------------------------------------------------------------------------------------------------
6 // various library calls
libnetdata/socket/socket.h renamed
+1 -1
@@ -3,7 +3,7 @@
3 #ifndef NETDATA_SOCKET_H
4 #define NETDATA_SOCKET_H
5
6 -#include "libnetdata.h"
6 +#include "../libnetdata.h"
7
8 #ifndef MAX_LISTEN_FDS
9 #define MAX_LISTEN_FDS 50
libnetdata/statistical/Makefile.am new
+9
@@ -0,0 +1,9 @@
1 +# SPDX-License-Identifier: GPL-3.0-or-later
2 +
3 +AUTOMAKE_OPTIONS = subdir-objects
4 +MAINTAINERCLEANFILES = $(srcdir)/Makefile.in
5 +
6 +
7 +dist_noinst_DATA = \
8 + README.md \
9 + $(NULL)
libnetdata/statistical/README.md
libnetdata/statistical/statistical.c renamed
+1 -1
@@ -1,6 +1,6 @@
1 // SPDX-License-Identifier: GPL-3.0-or-later
2
3 -#include "libnetdata.h"
3 +#include "../libnetdata.h"
4
5 // --------------------------------------------------------------------------------------------------------------------
6
libnetdata/statistical/statistical.h renamed
+1 -1
@@ -3,7 +3,7 @@
3 #ifndef NETDATA_STATISTICAL_H
4 #define NETDATA_STATISTICAL_H 1
5
6 -#include "libnetdata.h"
6 +#include "../libnetdata.h"
7
8 extern LONG_DOUBLE average(const LONG_DOUBLE *series, size_t entries);
9 extern LONG_DOUBLE moving_average(const LONG_DOUBLE *series, size_t entries, size_t period);
libnetdata/storage_number/Makefile.am new
+9
@@ -0,0 +1,9 @@
1 +# SPDX-License-Identifier: GPL-3.0-or-later
2 +
3 +AUTOMAKE_OPTIONS = subdir-objects
4 +MAINTAINERCLEANFILES = $(srcdir)/Makefile.in
5 +
6 +
7 +dist_noinst_DATA = \
8 + README.md \
9 + $(NULL)
libnetdata/storage_number/README.md
libnetdata/storage_number/storage_number.c renamed
+1 -1
@@ -1,6 +1,6 @@
1 // SPDX-License-Identifier: GPL-3.0-or-later
2
3 -#include "libnetdata.h"
3 +#include "../libnetdata.h"
4
5 storage_number pack_storage_number(calculated_number value, uint32_t flags)
6 {
libnetdata/storage_number/storage_number.h renamed
+1 -1
@@ -3,7 +3,7 @@
3 #ifndef NETDATA_STORAGE_NUMBER_H
4 #define NETDATA_STORAGE_NUMBER_H 1
5
6 -#include "libnetdata.h"
6 +#include "../libnetdata.h"
7
8 #ifdef NETDATA_WITHOUT_LONG_DOUBLE
9
libnetdata/threads/Makefile.am new
+9
@@ -0,0 +1,9 @@
1 +# SPDX-License-Identifier: GPL-3.0-or-later
2 +
3 +AUTOMAKE_OPTIONS = subdir-objects
4 +MAINTAINERCLEANFILES = $(srcdir)/Makefile.in
5 +
6 +
7 +dist_noinst_DATA = \
8 + README.md \
9 + $(NULL)
libnetdata/threads/README.md
libnetdata/threads/threads.c renamed
+1 -1
@@ -1,6 +1,6 @@
1 // SPDX-License-Identifier: GPL-3.0-or-later
2
3 -#include "libnetdata.h"
3 +#include "../libnetdata.h"
4
5 static size_t default_stacksize = 0, wanted_stacksize = 0;
6 static pthread_attr_t *attr = NULL;
libnetdata/threads/threads.h renamed
+1 -1
@@ -3,7 +3,7 @@
3 #ifndef NETDATA_THREADS_H
4 #define NETDATA_THREADS_H 1
5
6 -#include "libnetdata.h"
6 +#include "../libnetdata.h"
7
8 extern pid_t gettid(void);
9
libnetdata/url/Makefile.am new
+9
@@ -0,0 +1,9 @@
1 +# SPDX-License-Identifier: GPL-3.0-or-later
2 +
3 +AUTOMAKE_OPTIONS = subdir-objects
4 +MAINTAINERCLEANFILES = $(srcdir)/Makefile.in
5 +
6 +
7 +dist_noinst_DATA = \
8 + README.md \
9 + $(NULL)
libnetdata/url/README.md
libnetdata/url/url.c renamed
+1 -1
@@ -1,6 +1,6 @@
1 // SPDX-License-Identifier: GPL-3.0-or-later
2
3 -#include "libnetdata.h"
3 +#include "../libnetdata.h"
4
5 // ----------------------------------------------------------------------------
6 // URL encode / decode
libnetdata/url/url.h renamed
+1 -1
@@ -3,7 +3,7 @@
3 #ifndef NETDATA_URL_H
4 #define NETDATA_URL_H 1
5
6 -#include "libnetdata.h"
6 +#include "../libnetdata.h"
7
8 // ----------------------------------------------------------------------------
9 // URL encode / decode
netdata-installer.sh
+5 -48
@@ -173,49 +173,6 @@ For the plugins, you will at least need:
173 USAGE
174 }
175
176 -# shellcheck disable=SC2230
177 -md5sum="$(which md5sum 2>/dev/null || command -v md5sum 2>/dev/null || command -v md5 2>/dev/null)"
178 -get_git_config_signatures() {
179 - local x s file md5
180 -
181 - [ ! -d "conf.d" ] && echo >&2 "Wrong directory." && return 1
182 - [ -z "${md5sum}" -o ! -x "${md5sum}" ] && echo >&2 "No md5sum command." && return 1
183 -
184 - echo >configs.signatures.tmp
185 -
186 - for x in $(find conf.d -name \*.conf)
187 - do
188 - x="${x/conf.d\//}"
189 - echo "${x}"
190 - for c in $(git log --follow "conf.d/${x}" | grep ^commit | cut -d ' ' -f 2)
191 - do
192 - git checkout ${c} "conf.d/${x}" || continue
193 - s="$(cat "conf.d/${x}" | ${md5sum} | cut -d ' ' -f 1)"
194 - echo >>configs.signatures.tmp "${s}:${x}"
195 - echo " ${s}"
196 - done
197 - git checkout HEAD "conf.d/${x}" || break
198 - done
199 -
200 - cat configs.signatures.tmp |\
201 - grep -v "^$" |\
202 - sort -u |\
203 - {
204 - echo "declare -A configs_signatures=("
205 - IFS=":"
206 - while read md5 file
207 - do
208 - echo " ['${md5}']='${file}'"
209 - done
210 - echo ")"
211 - } >configs.signatures
212 -
213 - rm configs.signatures.tmp
214 -
215 - return 0
216 -}
217 -
218 -
176 while [ ! -z "${1}" ]
177 do
178 if [ "$1" = "--install" ]
@@ -270,10 +227,6 @@ do
227 then
228 usage
229 exit 1
273 - elif [ "$1" = "get_git_config_signatures" ]
274 - then
275 - get_git_config_signatures && exit 0
276 - exit 1
230 else
231 echo >&2
232 echo >&2 "ERROR:"
@@ -546,6 +499,10 @@ if [ -d "${NETDATA_PREFIX}/etc/netdata" ]
499 fi
500
501 # -----------------------------------------------------------------------------
502 +
503 +# shellcheck disable=SC2230
504 +md5sum="$(which md5sum 2>/dev/null || command -v md5sum 2>/dev/null || command -v md5 2>/dev/null)"
505 +
506 deleted_stock_configs=0
507 if [ ! -f "${NETDATA_PREFIX}/etc/netdata/.installer-cleanup-of-stock-configs-done" ]
508 then
@@ -962,7 +919,7 @@ fi
919 # -----------------------------------------------------------------------------
920 progress "Check version.txt"
921
965 -if [ ! -s web/version.txt ]
922 +if [ ! -s webserver/gui/version.txt ]
923 then
924 cat <<VERMSG
925
node.d/Makefile.am deleted
-29
@@ -1,29 +0,0 @@
1 -# SPDX-License-Identifier: GPL-3.0-or-later
2 -MAINTAINERCLEANFILES= $(srcdir)/Makefile.in
3 -
4 -dist_node_DATA = \
5 - README.md \
6 - named.node.js \
7 - fronius.node.js \
8 - sma_webbox.node.js \
9 - snmp.node.js \
10 - stiebeleltron.node.js \
11 - $(NULL)
12 -
13 -nodemodulesdir=$(nodedir)/node_modules
14 -dist_nodemodules_DATA = \
15 - node_modules/netdata.js \
16 - node_modules/extend.js \
17 - node_modules/pixl-xml.js \
18 - node_modules/net-snmp.js \
19 - node_modules/asn1-ber.js \
20 - $(NULL)
21 -
22 -nodemoduleslibberdir=$(nodedir)/node_modules/lib/ber
23 -dist_nodemoduleslibber_DATA = \
24 - node_modules/lib/ber/index.js \
25 - node_modules/lib/ber/errors.js \
26 - node_modules/lib/ber/reader.js \
27 - node_modules/lib/ber/types.js \
28 - node_modules/lib/ber/writer.js \
29 - $(NULL)
node.d/README.md deleted
-118
@@ -1,118 +0,0 @@
1 -# Disclaimer
2 -
3 -Module configurations are written in JSON and **node.js is required**.
4 -
5 -to be edited.
6 -
7 ----
8 -
9 -The following node.d modules are supported:
10 -
11 -# fronius
12 -
13 -This module collects metrics from the configured solar power installation from Fronius Symo.
14 -See `netdata/conf.d/node.d/fronius.conf.md` for more details.
15 -
16 -**Requirements**
17 - * Configuration file `fronius.conf` in the node.d netdata config dir (default: `/etc/netdata/node.d/fronius.conf`)
18 - * Fronius Symo with network access (http)
19 -
20 -It produces per server:
21 -
22 -1. **Power**
23 - * Current power input from the grid (positive values), output to the grid (negative values), in W
24 - * Current power input from the solar panels, in W
25 - * Current power stored in the accumulator (if present), in W (in theory, untested)
26 -
27 -2. **Consumption**
28 - * Local consumption in W
29 -
30 -3. **Autonomy**
31 - * Relative autonomy in %. 100 % autonomy means that the solar panels are delivering more power than it is needed by local consumption.
32 - * Relative self consumption in %. The lower the better
33 -
34 -4. **Energy**
35 - * The energy produced during the current day, in kWh
36 - * The energy produced during the current year, in kWh
37 -
38 -5. **Inverter**
39 - * The current power output from the connected inverters, in W, one dimension per inverter. At least one is always present.
40 -
41 -
42 -### configuration
43 -
44 -Sample:
45 -
46 -```json
47 -{
48 - "enable_autodetect": false,
49 - "update_every": 5,
50 - "servers": [
51 - {
52 - "name": "Symo",
53 - "hostname": "symo.ip.or.dns",
54 - "update_every": 5,
55 - "api_path": "/solar_api/v1/GetPowerFlowRealtimeData.fcgi"
56 - }
57 - ]
58 -}
59 -```
60 -
61 -If no configuration is given, the module will be disabled. Each `update_every` is optional, the default is `5`.
62 -
63 ----
64 -
65 -# stiebel eltron
66 -
67 -This module collects metrics from the configured heat pump and hot water installation from Stiebel Eltron ISG web.
68 -See `netdata/conf.d/node.d/stiebeleltron.conf.md` for more details.
69 -
70 -**Requirements**
71 - * Configuration file `stiebeleltron.conf` in the node.d netdata config dir (default: `/etc/netdata/node.d/stiebeleltron.conf`)
72 - * Stiebel Eltron ISG web with network access (http), without password login
73 -
74 -The charts are configurable, however, the provided default configuration collects the following:
75 -
76 -1. **General**
77 - * Outside temperature in C
78 - * Condenser temperature in C
79 - * Heating circuit pressure in bar
80 - * Flow rate in l/min
81 - * Output of water and heat pumps in %
82 -
83 -2. **Heating**
84 - * Heat circuit 1 temperature in C (set/actual)
85 - * Heat circuit 2 temperature in C (set/actual)
86 - * Flow temperature in C (set/actual)
87 - * Buffer temperature in C (set/actual)
88 - * Pre-flow temperature in C
89 -
90 -3. **Hot Water**
91 - * Hot water temperature in C (set/actual)
92 -
93 -4. **Room Temperature**
94 - * Heat circuit 1 room temperature in C (set/actual)
95 - * Heat circuit 2 room temperature in C (set/actual)
96 -
97 -5. **Eletric Reheating**
98 - * Dual Mode Reheating temperature in C (hot water/heating)
99 -
100 -6. **Process Data**
101 - * Remaining compressor rest time in s
102 -
103 -7. **Runtime**
104 - * Compressor runtime hours (hot water/heating)
105 - * Reheating runtime hours (reheating 1/reheating 2)
106 -
107 -8. **Energy**
108 - * Compressor today in kWh (hot water/heating)
109 - * Compressor Total in kWh (hot water/heating)
110 -
111 -
112 -### configuration
113 -
114 -The default configuration is provided in [netdata/conf.d/node.d/stiebeleltron.conf.md](https://github.com/netdata/netdata/blob/master/conf.d/node.d/stiebeleltron.conf.md). Just change the `update_every` (if necessary) and hostnames. **You may have to adapt the configuration to suit your needs and setup** (which might be different).
115 -
116 -If no configuration is given, the module will be disabled. Each `update_every` is optional, the default is `10`.
117 -
118 ----
plugins.d/Makefile.am deleted
-43
@@ -1,43 +0,0 @@
1 -#
2 -# Copyright (C) 2015 Alon Bar-Lev <alon.barlev@gmail.com>
3 -# SPDX-License-Identifier: GPL-3.0-or-later
4 -#
5 -MAINTAINERCLEANFILES= $(srcdir)/Makefile.in
6 -CLEANFILES = \
7 - alarm-notify.sh \
8 - charts.d.plugin \
9 - fping.plugin \
10 - node.d.plugin \
11 - python.d.plugin \
12 - tc-qos-helper.sh \
13 - $(NULL)
14 -
15 -include $(top_srcdir)/build/subst.inc
16 -
17 -SUFFIXES = .in
18 -
19 -dist_plugins_DATA = \
20 - README.md \
21 - $(NULL)
22 -
23 -dist_plugins_SCRIPTS = \
24 - alarm-email.sh \
25 - alarm-notify.sh \
26 - alarm-test.sh \
27 - charts.d.dryrun-helper.sh \
28 - charts.d.plugin \
29 - fping.plugin \
30 - node.d.plugin \
31 - python.d.plugin \
32 - tc-qos-helper.sh \
33 - loopsleepms.sh.inc \
34 - $(NULL)
35 -
36 -dist_noinst_DATA = \
37 - alarm-notify.sh.in \
38 - charts.d.plugin.in \
39 - fping.plugin.in \
40 - node.d.plugin.in \
41 - python.d.plugin.in \
42 - tc-qos-helper.sh.in \
43 - $(NULL)
plugins.d/README.md deleted
-236
@@ -1,236 +0,0 @@
1 -netdata plugins
2 -===============
3 -
4 -Any program that can print a few values to its standard output can become
5 -a netdata plugin.
6 -
7 -There are 5 lines netdata parses. lines starting with:
8 -
9 -- `CHART` - create a new chart
10 -- `DIMENSION` - add a dimension to the chart just created
11 -- `BEGIN` - initialize data collection for a chart
12 -- `SET` - set the value of a dimension for the initialized chart
13 -- `END` - complete data collection for the initialized chart
14 -
15 -a single program can produce any number of charts with any number of dimensions
16 -each.
17 -
18 -charts can also be added any time (not just the beginning).
19 -
20 -### command line parameters
21 -
22 -The plugin should accept just **one** parameter: **the number of seconds it is
23 -expected to update the values for its charts**. The value passed by netdata
24 -to the plugin is controlled via its configuration file (so there is not need
25 -for the plugin to handle this configuration option).
26 -
27 -The script can overwrite the update frequency. For example, the server may
28 -request per second updates, but the script may overwrite this to one update
29 -every 5 seconds.
30 -
31 -### environment variables
32 -
33 -There are a few environment variables that are set by `netdata` and are
34 -available for the plugin to use.
35 -
36 -variable|description
37 -:------:|:----------
38 -`NETDATA_CONFIG_DIR`|The directory where all netdata related configuration should be stored. If the plugin requires custom configuration, this is the place to save it.
39 -`NETDATA_PLUGINS_DIR`|The directory where all netdata plugins are stored.
40 -`NETDATA_WEB_DIR`|The directory where the web files of netdata are saved.
41 -`NETDATA_CACHE_DIR`|The directory where the cache files of netdata are stored. Use this directory if the plugin requires a place to store data. A new directory should be created for the plugin for this purpose, inside this directory.
42 -`NETDATA_LOG_DIR`|The directory where the log files are stored. By default the `stderr` output of the plugin will be saved in the `error.log` file of netdata.
43 -`NETDATA_HOST_PREFIX`|This is used in environments where system directories like `/sys` and `/proc` have to be accessed at a different path.
44 -`NETDATA_DEBUG_FLAGS`|This is number (probably in hex starting with `0x`), that enables certain netdata debugging features.
45 -`NETDATA_UPDATE_EVERY`|The minimum number of seconds between chart refreshes. This is like the **internal clock** of netdata (it is user configurable, defaulting to `1`). There is no meaning for a plugin to update its values more frequently than this number of seconds.
46 -
47 -
48 -# the output of the plugin
49 -
50 -The plugin should output instructions for netdata to its output (`stdout`).
51 -
52 -## CHART
53 -
54 -`CHART` defines a new chart.
55 -
56 -the template is:
57 -
58 -> CHART type.id name title units [family [category [charttype [priority [update_every]]]]]
59 -
60 - where:
61 - - `type.id`
62 -
63 - uniquely identifies the chart,
64 - this is what will be needed to add values to the chart
65 -
66 - - `name`
67 -
68 - is the name that will be presented to the used for this chart
69 -
70 - - `title`
71 -
72 - the text above the chart
73 -
74 - - `units`
75 -
76 - the label of the vertical axis of the chart,
77 - all dimensions added to a chart should have the same units
78 - of measurement
79 -
80 - - `family`
81 -
82 - is used to group charts together
83 - (for example all eth0 charts should say: eth0),
84 - if empty or missing, the `id` part of `type.id` will be used
85 -
86 - - `category`
87 -
88 - the section under which the chart will appear
89 - (for example mem.ram should appear in the 'system' section),
90 - the special word 'none' means: do not show this chart on the home page,
91 - if empty or missing, the `type` part of `type.id` will be used
92 -
93 - - `charttype`
94 -
95 - one of `line`, `area` or `stacked`,
96 - if empty or missing, the `line` will be used
97 -
98 - - `priority`
99 -
100 - is the relative priority of the charts as rendered on the web page,
101 - lower numbers make the charts appear before the ones with higher numbers,
102 - if empty or missing, `1000` will be used
103 -
104 - - `update_every`
105 -
106 - overwrite the update frequency set by the server,
107 - if empty or missing, the user configured value will be used
108 -
109 -
110 -## DIMENSION
111 -
112 -`DIMENSION` defines a new dimension for the chart
113 -
114 -the template is:
115 -
116 -> DIMENSION id [name [algorithm [multiplier [divisor [hidden]]]]]
117 -
118 - where:
119 -
120 - - `id`
121 -
122 - the `id` of this dimension (it is a text value, not numeric),
123 - this will be needed later to add values to the dimension
124 -
125 - - `name`
126 -
127 - the name of the dimension as it will appear at the legend of the chart,
128 - if empty or missing the `id` will be used
129 -
130 - - `algorithm`
131 -
132 - one of:
133 -
134 - * `absolute`
135 -
136 - the value is to drawn as-is (interpolated to second boundary),
137 - if `algorithm` is empty, invalid or missing, `absolute` is used
138 -
139 - * `incremental`
140 -
141 - the value increases over time,
142 - the difference from the last value is presented in the chart,
143 - the server interpolates the value and calculates a per second figure
144 -
145 - * `percentage-of-absolute-row`
146 -
147 - the % of this value compared to the total of all dimensions
148 -
149 - * `percentage-of-incremental-row`
150 -
151 - the % of this value compared to the incremental total of
152 - all dimensions
153 -
154 - - `multiplier`
155 -
156 - an integer value to multiply the collected value,
157 - if empty or missing, `1` is used
158 -
159 - - `divisor`
160 -
161 - an integer value to divide the collected value,
162 - if empty or missing, `1` is used
163 -
164 - - `hidden`
165 -
166 - giving the keyword `hidden` will make this dimension hidden,
167 - it will take part in the calculations but will not be presented in the chart
168 -
169 -
170 -## data collection
171 -
172 -data collection is defined as a series of `BEGIN` -> `SET` -> `END` lines
173 -
174 -> BEGIN type.id [microseconds]
175 -
176 - - `type.id`
177 -
178 - is the unique identification of the chart (as given in `CHART`)
179 -
180 - - `microseconds`
181 -
182 - is the number of microseconds since the last update of the chart,
183 - it is optional.
184 -
185 - Under heavy system load, the system may have some latency transferring
186 - data from the plugins to netdata via the pipe. This number improves
187 - accuracy significantly, since the plugin is able to calculate the
188 - duration between its iterations better than netdata.
189 -
190 - The first time the plugin is started, no microseconds should be given
191 - to netdata.
192 -
193 -> SET id = value
194 -
195 - - `id`
196 -
197 - is the unique identification of the dimension (of the chart just began)
198 -
199 - - `value`
200 -
201 - is the collected value
202 -
203 -> END
204 -
205 - END does not take any parameters, it commits the collected values to the chart.
206 -
207 -More `SET` lines may appear to update all the dimensions of the chart.
208 -All of them in one `BEGIN` -> `END` block.
209 -
210 -All `SET` lines within a single `BEGIN` -> `END` block have to refer to the
211 -same chart.
212 -
213 -If more charts need to be updated, each chart should have its own
214 -`BEGIN` -> `SET` -> `END` block.
215 -
216 -If, for any reason, a plugin has issued a `BEGIN` but wants to cancel it,
217 -it can issue a `FLUSH`. The `FLUSH` command will instruct netdata to ignore
218 -the last `BEGIN` command.
219 -
220 -If a plugin does not behave properly (outputs invalid lines, or does not
221 -follow these guidelines), will be disabled by netdata.
222 -
223 -
224 -### collected values
225 -
226 -netdata will collect any **signed** value in the 64bit range:
227 -`-9.223.372.036.854.775.808` to `+9.223.372.036.854.775.807`
228 -
229 -Internally, all calculations are made using 128 bit double precision and are
230 -stored in 30 bits as floating point.
231 -
232 -If a value is not collected, leave it empty, like this:
233 -
234 -`SET id = `
235 -
236 -or do not output the line at all.
python.d/README.md deleted
-2889
@@ -1,2889 +0,0 @@
1 -# Disclaimer
2 -
3 -Every module should be compatible with python2 and python3.
4 -All third party libraries should be installed system-wide or in `python_modules` directory.
5 -Module configurations are written in YAML and **pyYAML is required**.
6 -
7 -Every configuration file must have one of two formats:
8 -
9 -- Configuration for only one job:
10 -
11 -```yaml
12 -update_every : 2 # update frequency
13 -retries : 1 # how many failures in update() is tolerated
14 -priority : 20000 # where it is shown on dashboard
15 -
16 -other_var1 : bla # variables passed to module
17 -other_var2 : alb
18 -```
19 -
20 -- Configuration for many jobs (ex. mysql):
21 -
22 -```yaml
23 -# module defaults:
24 -update_every : 2
25 -retries : 1
26 -priority : 20000
27 -
28 -local: # job name
29 - update_every : 5 # job update frequency
30 - other_var1 : some_val # module specific variable
31 -
32 -other_job:
33 - priority : 5 # job position on dashboard
34 - retries : 20 # job retries
35 - other_var2 : val # module specific variable
36 -```
37 -
38 -`update_every`, `retries`, and `priority` are always optional.
39 -
40 ----
41 -
42 -The following python.d modules are supported:
43 -
44 -# apache
45 -
46 -This module will monitor one or more Apache servers depending on configuration.
47 -
48 -**Requirements:**
49 - * apache with enabled `mod_status`
50 -
51 -It produces the following charts:
52 -
53 -1. **Requests** in requests/s
54 - * requests
55 -
56 -2. **Connections**
57 - * connections
58 -
59 -3. **Async Connections**
60 - * keepalive
61 - * closing
62 - * writing
63 -
64 -4. **Bandwidth** in kilobytes/s
65 - * sent
66 -
67 -5. **Workers**
68 - * idle
69 - * busy
70 -
71 -6. **Lifetime Avg. Requests/s** in requests/s
72 - * requests_sec
73 -
74 -7. **Lifetime Avg. Bandwidth/s** in kilobytes/s
75 - * size_sec
76 -
77 -8. **Lifetime Avg. Response Size** in bytes/request
78 - * size_req
79 -
80 -### configuration
81 -
82 -Needs only `url` to server's `server-status?auto`
83 -
84 -Here is an example for 2 servers:
85 -
86 -```yaml
87 -update_every : 10
88 -priority : 90100
89 -
90 -local:
91 - url : 'http://localhost/server-status?auto'
92 - retries : 20
93 -
94 -remote:
95 - url : 'http://www.apache.org/server-status?auto'
96 - update_every : 5
97 - retries : 4
98 -```
99 -
100 -Without configuration, module attempts to connect to `http://localhost/server-status?auto`
101 -
102 ----
103 -
104 -# apache_cache
105 -
106 -Module monitors apache mod_cache log and produces only one chart:
107 -
108 -**cached responses** in percent cached
109 - * hit
110 - * miss
111 - * other
112 -
113 -### configuration
114 -
115 -Sample:
116 -
117 -```yaml
118 -update_every : 10
119 -priority : 120000
120 -retries : 5
121 -log_path : '/var/log/apache2/cache.log'
122 -```
123 -
124 -If no configuration is given, module will attempt to read log file at `/var/log/apache2/cache.log`
125 -
126 ----
127 -
128 -# beanstalk
129 -
130 -Module provides server and tube-level statistics:
131 -
132 -**Requirements:**
133 - * `python-beanstalkc`
134 -
135 -**Server statistics:**
136 -
137 -1. **Cpu usage** in cpu time
138 - * user
139 - * system
140 -
141 -2. **Jobs rate** in jobs/s
142 - * total
143 - * timeouts
144 -
145 -3. **Connections rate** in connections/s
146 - * connections
147 -
148 -4. **Commands rate** in commands/s
149 - * put
150 - * peek
151 - * peek-ready
152 - * peek-delayed
153 - * peek-buried
154 - * reserve
155 - * use
156 - * watch
157 - * ignore
158 - * delete
159 - * release
160 - * bury
161 - * kick
162 - * stats
163 - * stats-job
164 - * stats-tube
165 - * list-tubes
166 - * list-tube-used
167 - * list-tubes-watched
168 - * pause-tube
169 -
170 -5. **Current tubes** in tubes
171 - * tubes
172 -
173 -6. **Current jobs** in jobs
174 - * urgent
175 - * ready
176 - * reserved
177 - * delayed
178 - * buried
179 -
180 -7. **Current connections** in connections
181 - * written
182 - * producers
183 - * workers
184 - * waiting
185 -
186 -8. **Binlog** in records/s
187 - * written
188 - * migrated
189 -
190 -9. **Uptime** in seconds
191 - * uptime
192 -
193 -**Per tube statistics:**
194 -
195 -1. **Jobs rate** in jobs/s
196 - * jobs
197 -
198 -2. **Jobs** in jobs
199 - * using
200 - * ready
201 - * reserved
202 - * delayed
203 - * buried
204 -
205 -3. **Connections** in connections
206 - * using
207 - * waiting
208 - * watching
209 -
210 -4. **Commands** in commands/s
211 - * deletes
212 - * pauses
213 -
214 -5. **Pause** in seconds
215 - * since
216 - * left
217 -
218 -
219 -### configuration
220 -
221 -Sample:
222 -
223 -```yaml
224 -host : '127.0.0.1'
225 -port : 11300
226 -```
227 -
228 -If no configuration is given, module will attempt to connect to beanstalkd on `127.0.0.1:11300` address
229 -
230 ----
231 -
232 -# bind_rndc
233 -
234 -Module parses bind dump file to collect real-time performance metrics
235 -
236 -**Requirements:**
237 - * Version of bind must be 9.6 +
238 - * Netdata must have permissions to run `rndc stats`
239 -
240 -It produces:
241 -
242 -1. **Name server statistics**
243 - * requests
244 - * responses
245 - * success
246 - * auth_answer
247 - * nonauth_answer
248 - * nxrrset
249 - * failure
250 - * nxdomain
251 - * recursion
252 - * duplicate
253 - * rejections
254 -
255 -2. **Incoming queries**
256 - * RESERVED0
257 - * A
258 - * NS
259 - * CNAME
260 - * SOA
261 - * PTR
262 - * MX
263 - * TXT
264 - * X25
265 - * AAAA
266 - * SRV
267 - * NAPTR
268 - * A6
269 - * DS
270 - * RSIG
271 - * DNSKEY
272 - * SPF
273 - * ANY
274 - * DLV
275 -
276 -3. **Outgoing queries**
277 - * Same as Incoming queries
278 -
279 -
280 -### configuration
281 -
282 -Sample:
283 -
284 -```yaml
285 -local:
286 - named_stats_path : '/var/log/bind/named.stats'
287 -```
288 -
289 -If no configuration is given, module will attempt to read named.stats file at `/var/log/bind/named.stats`
290 -
291 ----
292 -
293 -# boinc
294 -
295 -This module monitors task counts for the Berkely Open Infrastructure
296 -Networking Computing (BOINC) distributed computing client using the same
297 -RPC interface that the BOINC monitoring GUI does.
298 -
299 -It provides charts tracking the total number of tasks and active tasks,
300 -as well as ones tracking each of the possible states for tasks.
301 -
302 -### configuration
303 -
304 -BOINC requires use of a password to access it's RPC interface. You can
305 -find this password in the `gui_rpc_auth.cfg` file in your BOINC directory.
306 -
307 -By default, the module will try to auto-detect the password by looking
308 -in `/var/lib/boinc` for this file (this is the location most Linux
309 -distributions use for a system-wide BOINC installation), so things may
310 -just work without needing configuration for the local system.
311 -
312 -You can monitor remote systems as well:
313 -
314 -```yaml
315 -remote:
316 - hostname: some-host
317 - password: some-password
318 -```
319 -
320 ----
321 -
322 -# chrony
323 -
324 -This module monitors the precision and statistics of a local chronyd server.
325 -
326 -It produces:
327 -
328 -* frequency
329 -* last offset
330 -* RMS offset
331 -* residual freq
332 -* root delay
333 -* root dispersion
334 -* skew
335 -* system time
336 -
337 -**Requirements:**
338 -Verify that user netdata can execute `chronyc tracking`. If necessary, update `/etc/chrony.conf`, `cmdallow`.
339 -
340 -### Configuration
341 -
342 -Sample:
343 -```yaml
344 -# data collection frequency:
345 -update_every: 1
346 -
347 -# chrony query command:
348 -local:
349 - command: 'chronyc -n tracking'
350 -```
351 -
352 ----
353 -
354 -# ceph
355 -
356 -This module monitors the ceph cluster usage and consuption data of a server.
357 -
358 -It produces:
359 -
360 -* Cluster statistics (usage, available, latency, objects, read/write rate)
361 -* OSD usage
362 -* OSD latency
363 -* Pool usage
364 -* Pool read/write operations
365 -* Pool read/write rate
366 -* number of objects per pool
367 -
368 -**Requirements:**
369 -
370 -- `rados` python module
371 -- Granting read permissions to ceph group from keyring file
372 -```shell
373 -# chmod 640 /etc/ceph/ceph.client.admin.keyring
374 -```
375 -
376 -### Configuration
377 -
378 -Sample:
379 -```yaml
380 -local:
381 - config_file: '/etc/ceph/ceph.conf'
382 - keyring_file: '/etc/ceph/ceph.client.admin.keyring'
383 -```
384 -
385 ----
386 -
387 -# couchdb
388 -
389 -This module monitors vital statistics of a local Apache CouchDB 2.x server, including:
390 -
391 -* Overall server reads/writes
392 -* HTTP traffic breakdown
393 - * Request methods (`GET`, `PUT`, `POST`, etc.)
394 - * Response status codes (`200`, `201`, `4xx`, etc.)
395 -* Active server tasks
396 -* Replication status (CouchDB 2.1 and up only)
397 -* Erlang VM stats
398 -* Optional per-database statistics: sizes, # of docs, # of deleted docs
399 -
400 -### Configuration
401 -
402 -Sample for a local server running on port 5984:
403 -```yaml
404 -local:
405 - user: 'admin'
406 - pass: 'password'
407 - node: 'couchdb@127.0.0.1'
408 -```
409 -
410 -Be sure to specify a correct admin-level username and password.
411 -
412 -You may also need to change the `node` name; this should match the value of `-name NODENAME` in your CouchDB's `etc/vm.args` file. Typically this is of the form `couchdb@fully.qualified.domain.name` in a cluster, or `couchdb@127.0.0.1` / `couchdb@localhost` for a single-node server.
413 -
414 -If you want per-database statistics, these need to be added to the configuration, separated by spaces:
415 -```yaml
416 -local:
417 - ...
418 - databases: 'db1 db2 db3 ...'
419 -```
420 -
421 ----
422 -
423 -# cpufreq
424 -
425 -This module shows the current CPU frequency as set by the cpufreq kernel
426 -module.
427 -
428 -**Requirement:**
429 -You need to have `CONFIG_CPU_FREQ` and (optionally) `CONFIG_CPU_FREQ_STAT`
430 -enabled in your kernel.
431 -
432 -This module tries to read from one of two possible locations. On
433 -initialization, it tries to read the `time_in_state` files provided by
434 -cpufreq\_stats. If this file does not exist, or doesn't contain valid data, it
435 -falls back to using the more inaccurate `scaling_cur_freq` file (which only
436 -represents the **current** CPU frequency, and doesn't account for any state
437 -changes which happen between updates).
438 -
439 -It produces one chart with multiple lines (one line per core).
440 -
441 -### configuration
442 -
443 -Sample:
444 -
445 -```yaml
446 -sys_dir: "/sys/devices"
447 -```
448 -
449 -If no configuration is given, module will search for cpufreq files in `/sys/devices` directory.
450 -Directory is also prefixed with `NETDATA_HOST_PREFIX` if specified.
451 -
452 ----
453 -
454 -# cpuidle
455 -
456 -This module monitors the usage of CPU idle states.
457 -
458 -**Requirement:**
459 -Your kernel needs to have `CONFIG_CPU_IDLE` enabled.
460 -
461 -It produces one stacked chart per CPU, showing the percentage of time spent in
462 -each state.
463 -
464 ----
465 -# dns_query_time
466 -
467 -This module provides DNS query time statistics.
468 -
469 -**Requirement:**
470 -* `python-dnspython` package
471 -
472 -It produces one aggregate chart or one chart per DNS server, showing the query time.
473 -
474 ----
475 -
476 -# dnsdist
477 -
478 -Module monitor dnsdist performance and health metrics.
479 -
480 -Following charts are drawn:
481 -
482 -1. **Response latency**
483 - * latency-slow
484 - * latency100-1000
485 - * latency50-100
486 - * latency10-50
487 - * latency1-10
488 - * latency0-1
489 -
490 -2. **Cache performance**
491 - * cache-hits
492 - * cache-misses
493 -
494 -3. **ACL events**
495 - * acl-drops
496 - * rule-drop
497 - * rule-nxdomain
498 - * rule-refused
499 -
500 -4. **Noncompliant data**
501 - * empty-queries
502 - * no-policy
503 - * noncompliant-queries
504 - * noncompliant-responses
505 -
506 -5. **Queries**
507 - * queries
508 - * rdqueries
509 - * rdqueries
510 -
511 -6. **Health**
512 - * downstream-send-errors
513 - * downstream-timeouts
514 - * servfail-responses
515 - * trunc-failures
516 -
517 -### configuration
518 -
519 -```yaml
520 -localhost:
521 - name : 'local'
522 - url : 'http://127.0.0.1:5053/jsonstat?command=stats'
523 - user : 'username'
524 - pass : 'password'
525 - header:
526 - X-API-Key: 'dnsdist-api-key'
527 -```
528 -
529 ----
530 -
531 -# docker
532 -
533 -Module monitor docker health metrics.
534 -
535 -**Requirement:**
536 -* `docker` package
537 -
538 -Following charts are drawn:
539 -
540 -1. **running containers**
541 - * count
542 -
543 -2. **healthy containers**
544 - * count
545 -
546 -3. **unhealthy containers**
547 - * count
548 -
549 -### configuration
550 -
551 -```yaml
552 - update_every : 1
553 - priority : 60000
554 - ```
555 -
556 ----
557 -
558 -# dovecot
559 -
560 -This module provides statistics information from Dovecot server.
561 -Statistics are taken from dovecot socket by executing `EXPORT global` command.
562 -More information about dovecot stats can be found on [project wiki page.](http://wiki2.dovecot.org/Statistics)
563 -
564 -**Requirement:**
565 -Dovecot UNIX socket with R/W permissions for user netdata or Dovecot with configured TCP/IP socket.
566 -
567 -Module gives information with following charts:
568 -
569 -1. **sessions**
570 - * active sessions
571 -
572 -2. **logins**
573 - * logins
574 -
575 -3. **commands** - number of IMAP commands
576 - * commands
577 -
578 -4. **Faults**
579 - * minor
580 - * major
581 -
582 -5. **Context Switches**
583 - * volountary
584 - * involountary
585 -
586 -6. **disk** in bytes/s
587 - * read
588 - * write
589 -
590 -7. **bytes** in bytes/s
591 - * read
592 - * write
593 -
594 -8. **number of syscalls** in syscalls/s
595 - * read
596 - * write
597 -
598 -9. **lookups** - number of lookups per second
599 - * path
600 - * attr
601 -
602 -10. **hits** - number of cache hits
603 - * hits
604 -
605 -11. **attempts** - authorization attempts
606 - * success
607 - * failure
608 -
609 -12. **cache** - cached authorization hits
610 - * hit
611 - * miss
612 -
613 -### configuration
614 -
615 -Sample:
616 -
617 -```yaml
618 -localtcpip:
619 - name : 'local'
620 - host : '127.0.0.1'
621 - port : 24242
622 -
623 -localsocket:
624 - name : 'local'
625 - socket : '/var/run/dovecot/stats'
626 -```
627 -
628 -If no configuration is given, module will attempt to connect to dovecot using unix socket localized in `/var/run/dovecot/stats`
629 -
630 ----
631 -
632 -# elasticsearch
633 -
634 -This module monitors Elasticsearch performance and health metrics.
635 -
636 -It produces:
637 -
638 -1. **Search performance** charts:
639 - * Number of queries, fetches
640 - * Time spent on queries, fetches
641 - * Query and fetch latency
642 -
643 -2. **Indexing performance** charts:
644 - * Number of documents indexed, index refreshes, flushes
645 - * Time spent on indexing, refreshing, flushing
646 - * Indexing and flushing latency
647 -
648 -3. **Memory usage and garbace collection** charts:
649 - * JVM heap currently in use, committed
650 - * Count of garbage collections
651 - * Time spent on garbage collections
652 -
653 -4. **Host metrics** charts:
654 - * Available file descriptors in percent
655 - * Opened HTTP connections
656 - * Cluster communication transport metrics
657 -
658 -5. **Queues and rejections** charts:
659 - * Number of queued/rejected threads in thread pool
660 -
661 -6. **Fielddata cache** charts:
662 - * Fielddata cache size
663 - * Fielddata evictions and circuit breaker tripped count
664 -
665 -7. **Cluster health API** charts:
666 - * Cluster status
667 - * Nodes and tasks statistics
668 - * Shards statistics
669 -
670 -8. **Cluster stats API** charts:
671 - * Nodes statistics
672 - * Query cache statistics
673 - * Docs statistics
674 - * Store statistics
675 - * Indices and shards statistics
676 -
677 -### configuration
678 -
679 -Sample:
680 -
681 -```yaml
682 -local:
683 - host : 'ipaddress' # Server ip address or hostname
684 - port : 'password' # Port on which elasticsearch listed
685 - cluster_health : True/False # Calls to cluster health elasticsearch API. Enabled by default.
686 - cluster_stats : True/False # Calls to cluster stats elasticsearch API. Enabled by default.
687 -```
688 -
689 -If no configuration is given, module will fail to run.
690 -
691 ----
692 -
693 -# exim
694 -
695 -Simple module executing `exim -bpc` to grab exim queue.
696 -This command can take a lot of time to finish its execution thus it is not recommended to run it every second.
697 -
698 -It produces only one chart:
699 -
700 -1. **Exim Queue Emails**
701 - * emails
702 -
703 -Configuration is not needed.
704 -
705 ----
706 -
707 -# fail2ban
708 -
709 -Module monitor fail2ban log file to show all bans for all active jails
710 -
711 -**Requirements:**
712 - * fail2ban.log file MUST BE readable by netdata (A good idea is to add **create 0640 root netdata** to fail2ban conf at logrotate.d)
713 -
714 -It produces one chart with multiple lines (one line per jail)
715 -
716 -### configuration
717 -
718 -Sample:
719 -
720 -```yaml
721 -local:
722 - log_path: '/var/log/fail2ban.log'
723 - conf_path: '/etc/fail2ban/jail.local'
724 - exclude: 'dropbear apache'
725 -```
726 -If no configuration is given, module will attempt to read log file at `/var/log/fail2ban.log` and conf file at `/etc/fail2ban/jail.local`.
727 -If conf file is not found default jail is `ssh`.
728 -
729 ----
730 -
731 -# freeradius
732 -
733 -Uses the `radclient` command to provide freeradius statistics. It is not recommended to run it every second.
734 -
735 -It produces:
736 -
737 -1. **Authentication counters:**
738 - * access-accepts
739 - * access-rejects
740 - * auth-dropped-requests
741 - * auth-duplicate-requests
742 - * auth-invalid-requests
743 - * auth-malformed-requests
744 - * auth-unknown-types
745 -
746 -2. **Accounting counters:** [optional]
747 - * accounting-requests
748 - * accounting-responses
749 - * acct-dropped-requests
750 - * acct-duplicate-requests
751 - * acct-invalid-requests
752 - * acct-malformed-requests
753 - * acct-unknown-types
754 -
755 -3. **Proxy authentication counters:** [optional]
756 - * proxy-access-accepts
757 - * proxy-access-rejects
758 - * proxy-auth-dropped-requests
759 - * proxy-auth-duplicate-requests
760 - * proxy-auth-invalid-requests
761 - * proxy-auth-malformed-requests
762 - * proxy-auth-unknown-types
763 -
764 -4. **Proxy accounting counters:** [optional]
765 - * proxy-accounting-requests
766 - * proxy-accounting-responses
767 - * proxy-acct-dropped-requests
768 - * proxy-acct-duplicate-requests
769 - * proxy-acct-invalid-requests
770 - * proxy-acct-malformed-requests
771 - * proxy-acct-unknown-typesa
772 -
773 -
774 -### configuration
775 -
776 -Sample:
777 -
778 -```yaml
779 -local:
780 - host : 'localhost'
781 - port : '18121'
782 - secret : 'adminsecret'
783 - acct : False # Freeradius accounting statistics.
784 - proxy_auth : False # Freeradius proxy authentication statistics.
785 - proxy_acct : False # Freeradius proxy accounting statistics.
786 -```
787 -
788 -**Freeradius server configuration:**
789 -
790 -The configuration for the status server is automatically created in the sites-available directory.
791 -By default, server is enabled and can be queried from every client.
792 -FreeRADIUS will only respond to status-server messages, if the status-server virtual server has been enabled.
793 -
794 -To do this, create a link from the sites-enabled directory to the status file in the sites-available directory:
795 - * cd sites-enabled
796 - * ln -s ../sites-available/status status
797 -
798 -and restart/reload your FREERADIUS server.
799 -
800 ----
801 -
802 -# go_expvar
803 -
804 ----
805 -
806 -The `go_expvar` module can monitor any Go application that exposes its metrics with the use of `expvar` package from the Go standard library.
807 -
808 -`go_expvar` produces charts for Go runtime memory statistics and optionally any number of custom charts. Please see the [wiki page](https://github.com/netdata/netdata/wiki/Monitoring-Go-Applications) for more info.
809 -
810 -For the memory statistics, it produces the following charts:
811 -
812 -1. **Heap allocations** in kB
813 - * alloc: size of objects allocated on the heap
814 - * inuse: size of allocated heap spans
815 -
816 -2. **Stack allocations** in kB
817 - * inuse: size of allocated stack spans
818 -
819 -3. **MSpan allocations** in kB
820 - * inuse: size of allocated mspan structures
821 -
822 -4. **MCache allocations** in kB
823 - * inuse: size of allocated mcache structures
824 -
825 -5. **Virtual memory** in kB
826 - * sys: size of reserved virtual address space
827 -
828 -6. **Live objects**
829 - * live: number of live objects in memory
830 -
831 -7. **GC pauses average** in ns
832 - * avg: average duration of all GC stop-the-world pauses
833 -
834 -### configuration
835 -
836 -Please see the [wiki page](https://github.com/netdata/netdata/wiki/Monitoring-Go-Applications#using-netdata-go_expvar-module) for detailed info about module configuration.
837 -
838 ----
839 -
840 -# haproxy
841 -
842 -Module monitors frontend and backend metrics such as bytes in, bytes out, sessions current, sessions in queue current.
843 -And health metrics such as backend servers status (server check should be used).
844 -
845 -Plugin can obtain data from url **OR** unix socket.
846 -
847 -**Requirement:**
848 -Socket MUST be readable AND writable by netdata user.
849 -
850 -It produces:
851 -
852 -1. **Frontend** family charts
853 - * Kilobytes in/s
854 - * Kilobytes out/s
855 - * Sessions current
856 - * Sessions in queue current
857 -
858 -2. **Backend** family charts
859 - * Kilobytes in/s
860 - * Kilobytes out/s
861 - * Sessions current
862 - * Sessions in queue current
863 -
864 -3. **Health** chart
865 - * number of failed servers for every backend (in DOWN state)
866 -
867 -
868 -### configuration
869 -
870 -Sample:
871 -
872 -```yaml
873 -via_url:
874 - user : 'username' # ONLY IF stats auth is used
875 - pass : 'password' # # ONLY IF stats auth is used
876 - url : 'http://ip.address:port/url;csv;norefresh'
877 -```
878 -
879 -OR
880 -
881 -```yaml
882 -via_socket:
883 - socket : 'path/to/haproxy/sock'
884 -```
885 -
886 -If no configuration is given, module will fail to run.
887 -
888 ----
889 -
890 -# hddtemp
891 -
892 -Module monitors disk temperatures from one or more hddtemp daemons.
893 -
894 -**Requirement:**
895 -Running `hddtemp` in daemonized mode with access on tcp port
896 -
897 -It produces one chart **Temperature** with dynamic number of dimensions (one per disk)
898 -
899 -### configuration
900 -
901 -Sample:
902 -
903 -```yaml
904 -update_every: 3
905 -host: "127.0.0.1"
906 -port: 7634
907 -```
908 -
909 -If no configuration is given, module will attempt to connect to hddtemp daemon on `127.0.0.1:7634` address
910 -
911 ----
912 -
913 -# httpcheck
914 -
915 -Module monitors remote http server for availability and response time.
916 -
917 -Following charts are drawn per job:
918 -
919 -1. **Response time** ms
920 - * Time in 0.1 ms resolution in which the server responds.
921 - If the connection failed, the value is missing.
922 -
923 -2. **Status** boolean
924 - * Connection successful
925 - * Unexpected content: No Regex match found in the response
926 - * Unexpected status code: Do we get 500 errors?
927 - * Connection failed: port not listening or blocked
928 - * Connection timed out: host or port unreachable
929 -
930 -### configuration
931 -
932 -Sample configuration and their default values.
933 -
934 -```yaml
935 -server:
936 - url: 'http://host:port/path' # required
937 - status_accepted: # optional
938 - - 200
939 - timeout: 1 # optional, supports decimals (e.g. 0.2)
940 - update_every: 3 # optional
941 - regex: 'REGULAR_EXPRESSION' # optional, see https://docs.python.org/3/howto/regex.html
942 - redirect: yes # optional
943 -```
944 -
945 -### notes
946 -
947 - * The status chart is primarily intended for alarms, badges or for access via API.
948 - * A system/service/firewall might block netdata's access if a portscan or
949 - similar is detected.
950 - * This plugin is meant for simple use cases. Currently, the accuracy of the
951 - response time is low and should be used as reference only.
952 -
953 ----
954 -
955 -# icecast
956 -
957 -This module will monitor number of listeners for active sources.
958 -
959 -**Requirements:**
960 - * icecast version >= 2.4.0
961 -
962 -It produces the following charts:
963 -
964 -1. **Listeners** in listeners
965 - * source number
966 -
967 -### configuration
968 -
969 -Needs only `url` to server's `/status-json.xsl`
970 -
971 -Here is an example for remote server:
972 -
973 -```yaml
974 -remote:
975 - url : 'http://1.2.3.4:8443/status-json.xsl'
976 -```
977 -
978 -Without configuration, module attempts to connect to `http://localhost:8443/status-json.xsl`
979 -
980 ----
981 -
982 -# IPFS
983 -
984 -Module monitors [IPFS](https://ipfs.io) basic information.
985 -
986 -1. **Bandwidth** in kbits/s
987 - * in
988 - * out
989 -
990 -2. **Peers**
991 - * peers
992 -
993 -### configuration
994 -
995 -Only url to IPFS server is needed.
996 -
997 -Sample:
998 -
999 -```yaml
1000 -localhost:
1001 - name : 'local'
1002 - url : 'http://localhost:5001'
1003 -```
1004 -
1005 ----
1006 -
1007 -# isc_dhcpd
1008 -
1009 -Module monitor leases database to show all active leases for given pools.
1010 -
1011 -**Requirements:**
1012 - * dhcpd leases file MUST BE readable by netdata
1013 - * pools MUST BE in CIDR format
1014 -
1015 -It produces:
1016 -
1017 -1. **Pools utilization** Aggregate chart for all pools.
1018 - * utilization in percent
1019 -
1020 -2. **Total leases**
1021 - * leases (overall number of leases for all pools)
1022 -
1023 -3. **Active leases** for every pools
1024 - * leases (number of active leases in pool)
1025 -
1026 -
1027 -### configuration
1028 -
1029 -Sample:
1030 -
1031 -```yaml
1032 -local:
1033 - leases_path : '/var/lib/dhcp/dhcpd.leases'
1034 - pools : '192.168.3.0/24 192.168.4.0/24 192.168.5.0/24'
1035 -```
1036 -
1037 -In case of python2 you need to install `py2-ipaddress` to make plugin work.
1038 -The module will not work If no configuration is given.
1039 -
1040 ----
1041 -
1042 -# linux\_power\_supply
1043 -
1044 -This module monitors variosu metrics reported by power supply drivers
1045 -on Linux. This allows tracking and alerting on things like remaining
1046 -battery capacity.
1047 -
1048 -Depending on the uderlying driver, it may provide the following charts
1049 -and metrics:
1050 -
1051 -1. Capacity: The power supply capacity expressed as a percentage.
1052 - * capacity\_now
1053 -
1054 -2. Charge: The charge for the power supply, expressed as microamphours.
1055 - * charge\_full\_design
1056 - * charge\_full
1057 - * charge\_now
1058 - * charge\_empty
1059 - * charge\_empty\_design
1060 -
1061 -3. Energy: The energy for the power supply, expressed as microwatthours.
1062 - * energy\_full\_design
1063 - * energy\_full
1064 - * energy\_now
1065 - * energy\_empty
1066 - * energy\_empty\_design
1067 -
1068 -2. Voltage: The voltage for the power supply, expressed as microvolts.
1069 - * voltage\_max\_design
1070 - * voltage\_max
1071 - * voltage\_now
1072 - * voltage\_min
1073 - * voltage\_min\_design
1074 -
1075 -### configuration
1076 -
1077 -Sample:
1078 -
1079 -```yaml
1080 -battery:
1081 - supply: 'BAT0'
1082 - charts: 'capacity charge energy voltage'
1083 -```
1084 -
1085 -The `supply` key specifies the name of the power supply device to monitor.
1086 -You can use `ls /sys/class/power_supply` to get a list of such devices
1087 -on your system.
1088 -
1089 -The `charts` key is a space separated list of which charts to try
1090 -to display. It defaults to trying to display everything.
1091 -
1092 -### notes
1093 -
1094 -* Most drivers provide at least the first chart. Battery powered ACPI
1095 -compliant systems (like most laptops) provide all but the third, but do
1096 -not provide all of the metrics for each chart.
1097 -
1098 -* Current, energy, and voltages are reported with a _very_ high precision
1099 -by the power\_supply framework. Usually, this is far higher than the
1100 -actual hardware supports reporting, so expect to see changes in these
1101 -charts jump instead of scaling smoothly.
1102 -
1103 -* If `max` or `full` attribute is defined by the driver, but not a
1104 -corresponding `min or `empty` attribute, then netdata will still provide
1105 -the corresponding `min` or `empty`, which will then always read as zero.
1106 -This way, alerts which match on these will still work.
1107 -
1108 ----
1109 -
1110 -# litespeed
1111 -
1112 -Module monitor litespeed web server performance metrics.
1113 -
1114 -It produces:
1115 -
1116 -1. **Network Throughput HTTP** in kilobits/s
1117 - * in
1118 - * out
1119 -
1120 -2. **Network Throughput HTTPS** in kilobits/s
1121 - * in
1122 - * out
1123 -
1124 -3. **Connections HTTP** in connections
1125 - * free
1126 - * used
1127 -
1128 -4. **Connections HTTPS** in connections
1129 - * free
1130 - * used
1131 -
1132 -5. **Requests** in requests/s
1133 - * requests
1134 -
1135 -6. **Requests In Processing** in requests
1136 - * processing
1137 -
1138 -7. **Public Cache Hits** in hits/s
1139 - * hits
1140 -
1141 -8. **Private Cache Hits** in hits/s
1142 - * hits
1143 -
1144 -9. **Static Hits** in hits/s
1145 - * hits
1146 -
1147 -
1148 -### configuration
1149 -```yaml
1150 -local:
1151 - path : 'PATH'
1152 -```
1153 -
1154 -If no configuration is given, module will use "/tmp/lshttpd/".
1155 -
1156 ----
1157 -
1158 -# logind
1159 -
1160 -This module monitors active sessions, users, and seats tracked by systemd-logind or elogind.
1161 -
1162 -It provides the following charts:
1163 -
1164 -1. **Sessions** Tracks the total number of sessions.
1165 - * Graphical: Local graphical sessions (running X11, or Wayland, or something else).
1166 - * Console: Local console sessions.
1167 - * Remote: Remote sessions.
1168 -
1169 -2. **Users** Tracks total number of unique user logins of each type.
1170 - * Graphical
1171 - * Console
1172 - * Remote
1173 -
1174 -3. **Seats** Total number of seats in use.
1175 - * Seats
1176 -
1177 -### configuration
1178 -
1179 -This module needs no configuration. Just make sure the netdata user
1180 -can run the `loginctl` command and get a session list without having to
1181 -specify a path.
1182 -
1183 -This will work with any command that can output data in the _exact_
1184 -same format as `loginctl list-sessions --no-legend`. If you have some
1185 -other command you want to use that outputs data in this format, you can
1186 -specify it using the `command` key like so:
1187 -
1188 -```yaml
1189 -command: '/path/to/other/command'
1190 -```
1191 -
1192 -### notes
1193 -
1194 -* This module's ability to track logins is dependent on what PAM services
1195 -are configured to register sessions with logind. In particular, for
1196 -most systems, it will only track TTY logins, local desktop logins,
1197 -and logins through remote shell connections.
1198 -
1199 -* The users chart counts _usernames_ not UID's. This is potentially
1200 -important in configurations where multiple users have the same UID.
1201 -
1202 -* The users chart counts any given user name up to once for _each_ type
1203 -of login. So if the same user has a graphical and a console login on a
1204 -system, they will show up once in the graphical count, and once in the
1205 -console count.
1206 -
1207 -* Because the data collection process is rather expensive, this plugin
1208 -is currently disabled by default, and needs to be explicitly enabled in
1209 -`/etc/netdata/python.d.conf` before it will run.
1210 -
1211 ----
1212 -
1213 -# mdstat
1214 -
1215 -Module monitor /proc/mdstat
1216 -
1217 -It produces:
1218 -
1219 -1. **Health** Number of failed disks in every array (aggregate chart).
1220 -
1221 -2. **Disks stats**
1222 - * total (number of devices array ideally would have)
1223 - * inuse (number of devices currently are in use)
1224 -
1225 -3. **Current status**
1226 - * resync in percent
1227 - * recovery in percent
1228 - * reshape in percent
1229 - * check in percent
1230 -
1231 -4. **Operation status** (if resync/recovery/reshape/check is active)
1232 - * finish in minutes
1233 - * speed in megabytes/s
1234 -
1235 -### configuration
1236 -No configuration is needed.
1237 -
1238 ----
1239 -
1240 -# megacli
1241 -
1242 -Module collects adapter, physical drives and battery stats.
1243 -
1244 -**Requirements:**
1245 - * `netdata` user needs to be able to be able to sudo the `megacli` program without password
1246 -
1247 -To grab stats it executes:
1248 - * `sudo -n megacli -LDPDInfo -aAll`
1249 - * `sudo -n megacli -AdpBbuCmd -a0`
1250 -
1251 -
1252 -It produces:
1253 -
1254 -1. **Adapter State**
1255 -
1256 -2. **Physical Drives Media Errors**
1257 -
1258 -3. **Physical Drives Predictive Failures**
1259 -
1260 -4. **Battery Relative State of Charge**
1261 -
1262 -5. **Battery Cycle Count**
1263 -
1264 -### configuration
1265 -Battery stats disabled by default in the module configuration file.
1266 -
1267 ----
1268 -
1269 -# memcached
1270 -
1271 -Memcached monitoring module. Data grabbed from [stats interface](https://github.com/memcached/memcached/wiki/Commands#stats).
1272 -
1273 -1. **Network** in kilobytes/s
1274 - * read
1275 - * written
1276 -
1277 -2. **Connections** per second
1278 - * current
1279 - * rejected
1280 - * total
1281 -
1282 -3. **Items** in cluster
1283 - * current
1284 - * total
1285 -
1286 -4. **Evicted and Reclaimed** items
1287 - * evicted
1288 - * reclaimed
1289 -
1290 -5. **GET** requests/s
1291 - * hits
1292 - * misses
1293 -
1294 -6. **GET rate** rate in requests/s
1295 - * rate
1296 -
1297 -7. **SET rate** rate in requests/s
1298 - * rate
1299 -
1300 -8. **DELETE** requests/s
1301 - * hits
1302 - * misses
1303 -
1304 -9. **CAS** requests/s
1305 - * hits
1306 - * misses
1307 - * bad value
1308 -
1309 -10. **Increment** requests/s
1310 - * hits
1311 - * misses
1312 -
1313 -11. **Decrement** requests/s
1314 - * hits
1315 - * misses
1316 -
1317 -12. **Touch** requests/s
1318 - * hits
1319 - * misses
1320 -
1321 -13. **Touch rate** rate in requests/s
1322 - * rate
1323 -
1324 -### configuration
1325 -
1326 -Sample:
1327 -
1328 -```yaml
1329 -localtcpip:
1330 - name : 'local'
1331 - host : '127.0.0.1'
1332 - port : 24242
1333 -```
1334 -
1335 -If no configuration is given, module will attempt to connect to memcached instance on `127.0.0.1:11211` address.
1336 -
1337 ----
1338 -
1339 -# mongodb
1340 -
1341 -Module monitor mongodb performance and health metrics
1342 -
1343 -**Requirements:**
1344 - * `python-pymongo` package.
1345 -
1346 -You need to install it manually.
1347 -
1348 -
1349 -Number of charts depends on mongodb version, storage engine and other features (replication):
1350 -
1351 -1. **Read requests**:
1352 - * query
1353 - * getmore (operation the cursor executes to get additional data from query)
1354 -
1355 -2. **Write requests**:
1356 - * insert
1357 - * delete
1358 - * update
1359 -
1360 -3. **Active clients**:
1361 - * readers (number of clients with read operations in progress or queued)
1362 - * writers (number of clients with write operations in progress or queued)
1363 -
1364 -4. **Journal transactions**:
1365 - * commits (count of transactions that have been written to the journal)
1366 -
1367 -5. **Data written to the journal**:
1368 - * volume (volume of data)
1369 -
1370 -6. **Background flush** (MMAPv1):
1371 - * average ms (average time taken by flushes to execute)
1372 - * last ms (time taken by the last flush)
1373 -
1374 -8. **Read tickets** (WiredTiger):
1375 - * in use (number of read tickets in use)
1376 - * available (number of available read tickets remaining)
1377 -
1378 -9. **Write tickets** (WiredTiger):
1379 - * in use (number of write tickets in use)
1380 - * available (number of available write tickets remaining)
1381 -
1382 -10. **Cursors**:
1383 - * opened (number of cursors currently opened by MongoDB for clients)
1384 - * timedOut (number of cursors that have timed)
1385 - * noTimeout (number of open cursors with timeout disabled)
1386 -
1387 -11. **Connections**:
1388 - * connected (number of clients currently connected to the database server)
1389 - * unused (number of unused connections available for new clients)
1390 -
1391 -12. **Memory usage metrics**:
1392 - * virtual
1393 - * resident (amount of memory used by the database process)
1394 - * mapped
1395 - * non mapped
1396 -
1397 -13. **Page faults**:
1398 - * page faults (number of times MongoDB had to request from disk)
1399 -
1400 -14. **Cache metrics** (WiredTiger):
1401 - * percentage of bytes currently in the cache (amount of space taken by cached data)
1402 - * percantage of tracked dirty bytes in the cache (amount of space taken by dirty data)
1403 -
1404 -15. **Pages evicted from cache** (WiredTiger):
1405 - * modified
1406 - * unmodified
1407 -
1408 -16. **Queued requests**:
1409 - * readers (number of read request currently queued)
1410 - * writers (number of write request currently queued)
1411 -
1412 -17. **Errors**:
1413 - * msg (number of message assertions raised)
1414 - * warning (number of warning assertions raised)
1415 - * regular (number of regular assertions raised)
1416 - * user (number of assertions corresponding to errors generated by users)
1417 -
1418 -18. **Storage metrics** (one chart for every database)
1419 - * dataSize (size of all documents + padding in the database)
1420 - * indexSize (size of all indexes in the database)
1421 - * storageSize (size of all extents in the database)
1422 -
1423 -19. **Documents in the database** (one chart for all databases)
1424 - * documents (number of objects in the database among all the collections)
1425 -
1426 -20. **tcmalloc metrics**
1427 - * central cache free
1428 - * current total thread cache
1429 - * pageheap free
1430 - * pageheap unmapped
1431 - * thread cache free
1432 - * transfer cache free
1433 - * heap size
1434 -
1435 -21. **Commands total/failed rate**
1436 - * count
1437 - * createIndex
1438 - * delete
1439 - * eval
1440 - * findAndModify
1441 - * insert
1442 -
1443 -22. **Locks metrics** (acquireCount metrics - number of times the lock was acquired in the specified mode)
1444 - * Global lock
1445 - * Database lock
1446 - * Collection lock
1447 - * Metadata lock
1448 - * oplog lock
1449 -
1450 -23. **Replica set members state**
1451 - * state
1452 -
1453 -24. **Oplog window**
1454 - * window (interval of time between the oldest and the latest entries in the oplog)
1455 -
1456 -25. **Replication lag**
1457 - * member (time when last entry from the oplog was applied for every member)
1458 -
1459 -26. **Replication set member heartbeat latency**
1460 - * member (time when last heartbeat was received from replica set member)
1461 -
1462 -
1463 -### configuration
1464 -
1465 -Sample:
1466 -
1467 -```yaml
1468 -local:
1469 - name : 'local'
1470 - host : '127.0.0.1'
1471 - port : 27017
1472 - user : 'netdata'
1473 - pass : 'netdata'
1474 -
1475 -```
1476 -
1477 -If no configuration is given, module will attempt to connect to mongodb daemon on `127.0.0.1:27017` address
1478 -
1479 ----
1480 -
1481 -# monit
1482 -
1483 -Monit monitoring module. Data is grabbed from stats XML interface (exists for a long time, but not mentioned in official documentation). Mostly this plugin shows statuses of monit targets, i.e. [statuses of specified checks](https://mmonit.com/monit/documentation/monit.html#Service-checks).
1484 -
1485 -1. **Filesystems**
1486 - * Filesystems
1487 - * Directories
1488 - * Files
1489 - * Pipes
1490 -
1491 -2. **Applications**
1492 - * Processes (+threads/childs)
1493 - * Programs
1494 -
1495 -3. **Network**
1496 - * Hosts (+latency)
1497 - * Network interfaces
1498 -
1499 -### configuration
1500 -
1501 -Sample:
1502 -
1503 -```yaml
1504 -local:
1505 - name : 'local'
1506 - url : 'http://localhost:2812'
1507 - user: : admin
1508 - pass: : monit
1509 -```
1510 -
1511 -If no configuration is given, module will attempt to connect to monit as `http://localhost:2812`.
1512 -
1513 ----
1514 -
1515 -# mysql
1516 -
1517 -Module monitors one or more mysql servers
1518 -
1519 -**Requirements:**
1520 - * python library [MySQLdb](https://github.com/PyMySQL/mysqlclient-python) (faster) or [PyMySQL](https://github.com/PyMySQL/PyMySQL) (slower)
1521 -
1522 -It will produce following charts (if data is available):
1523 -
1524 -1. **Bandwidth** in kbps
1525 - * in
1526 - * out
1527 -
1528 -2. **Queries** in queries/sec
1529 - * queries
1530 - * questions
1531 - * slow queries
1532 -
1533 -3. **Operations** in operations/sec
1534 - * opened tables
1535 - * flush
1536 - * commit
1537 - * delete
1538 - * prepare
1539 - * read first
1540 - * read key
1541 - * read next
1542 - * read prev
1543 - * read random
1544 - * read random next
1545 - * rollback
1546 - * save point
1547 - * update
1548 - * write
1549 -
1550 -4. **Table Locks** in locks/sec
1551 - * immediate
1552 - * waited
1553 -
1554 -5. **Select Issues** in issues/sec
1555 - * full join
1556 - * full range join
1557 - * range
1558 - * range check
1559 - * scan
1560 -
1561 -6. **Sort Issues** in issues/sec
1562 - * merge passes
1563 - * range
1564 - * scan
1565 -
1566 -### configuration
1567 -
1568 -You can provide, per server, the following:
1569 -
1570 -1. username which have access to database (defaults to 'root')
1571 -2. password (defaults to none)
1572 -3. mysql my.cnf configuration file
1573 -4. mysql socket (optional)
1574 -5. mysql host (ip or hostname)
1575 -6. mysql port (defaults to 3306)
1576 -
1577 -Here is an example for 3 servers:
1578 -
1579 -```yaml
1580 -update_every : 10
1581 -priority : 90100
1582 -retries : 5
1583 -
1584 -local:
1585 - 'my.cnf' : '/etc/mysql/my.cnf'
1586 - priority : 90000
1587 -
1588 -local_2:
1589 - user : 'root'
1590 - pass : 'blablablabla'
1591 - socket : '/var/run/mysqld/mysqld.sock'
1592 - update_every : 1
1593 -
1594 -remote:
1595 - user : 'admin'
1596 - pass : 'bla'
1597 - host : 'example.org'
1598 - port : 9000
1599 - retries : 20
1600 -```
1601 -
1602 -If no configuration is given, module will attempt to connect to mysql server via unix socket at `/var/run/mysqld/mysqld.sock` without password and with username `root`
1603 -
1604 ----
1605 -
1606 -# nginx
1607 -
1608 -This module will monitor one or more nginx servers depending on configuration. Servers can be either local or remote.
1609 -
1610 -**Requirements:**
1611 - * nginx with configured 'ngx_http_stub_status_module'
1612 - * 'location /stub_status'
1613 -
1614 -Example nginx configuration can be found in 'python.d/nginx.conf'
1615 -
1616 -It produces following charts:
1617 -
1618 -1. **Active Connections**
1619 - * active
1620 -
1621 -2. **Requests** in requests/s
1622 - * requests
1623 -
1624 -3. **Active Connections by Status**
1625 - * reading
1626 - * writing
1627 - * waiting
1628 -
1629 -4. **Connections Rate** in connections/s
1630 - * accepts
1631 - * handled
1632 -
1633 -### configuration
1634 -
1635 -Needs only `url` to server's `stub_status`
1636 -
1637 -Here is an example for local server:
1638 -
1639 -```yaml
1640 -update_every : 10
1641 -priority : 90100
1642 -
1643 -local:
1644 - url : 'http://localhost/stub_status'
1645 - retries : 10
1646 -```
1647 -
1648 -Without configuration, module attempts to connect to `http://localhost/stub_status`
1649 -
1650 ----
1651 -
1652 -# nginx_plus
1653 -
1654 -This module will monitor one or more nginx_plus servers depending on configuration.
1655 -Servers can be either local or remote.
1656 -
1657 -Example nginx_plus configuration can be found in 'python.d/nginx_plus.conf'
1658 -
1659 -It produces following charts:
1660 -
1661 -1. **Requests total** in requests/s
1662 - * total
1663 -
1664 -2. **Requests current** in requests
1665 - * current
1666 -
1667 -3. **Connection Statistics** in connections/s
1668 - * accepted
1669 - * dropped
1670 -
1671 -4. **Workers Statistics** in workers
1672 - * idle
1673 - * active
1674 -
1675 -5. **SSL Handshakes** in handshakes/s
1676 - * successful
1677 - * failed
1678 -
1679 -6. **SSL Session Reuses** in sessions/s
1680 - * reused
1681 -
1682 -7. **SSL Memory Usage** in percent
1683 - * usage
1684 -
1685 -8. **Processes** in processes
1686 - * respawned
1687 -
1688 -For every server zone:
1689 -
1690 -1. **Processing** in requests
1691 - * processing
1692 -
1693 -2. **Requests** in requests/s
1694 - * requests
1695 -
1696 -3. **Responses** in requests/s
1697 - * 1xx
1698 - * 2xx
1699 - * 3xx
1700 - * 4xx
1701 - * 5xx
1702 -
1703 -4. **Traffic** in kilobits/s
1704 - * received
1705 - * sent
1706 -
1707 -For every upstream:
1708 -
1709 -1. **Peers Requests** in requests/s
1710 - * peer name (dimension per peer)
1711 -
1712 -2. **All Peers Responses** in responses/s
1713 - * 1xx
1714 - * 2xx
1715 - * 3xx
1716 - * 4xx
1717 - * 5xx
1718 -
1719 -3. **Peer Responses** in requests/s (for every peer)
1720 - * 1xx
1721 - * 2xx
1722 - * 3xx
1723 - * 4xx
1724 - * 5xx
1725 -
1726 -4. **Peers Connections** in active
1727 - * peer name (dimension per peer)
1728 -
1729 -5. **Peers Connections Usage** in percent
1730 - * peer name (dimension per peer)
1731 -
1732 -6. **All Peers Traffic** in KB
1733 - * received
1734 - * sent
1735 -
1736 -7. **Peer Traffic** in KB/s (for every peer)
1737 - * received
1738 - * sent
1739 -
1740 -8. **Peer Timings** in ms (for every peer)
1741 - * header
1742 - * response
1743 -
1744 -9. **Memory Usage** in percent
1745 - * usage
1746 -
1747 -10. **Peers Status** in state
1748 - * peer name (dimension per peer)
1749 -
1750 -11. **Peers Total Downtime** in seconds
1751 - * peer name (dimension per peer)
1752 -
1753 -For every cache:
1754 -
1755 -1. **Traffic** in KB
1756 - * served
1757 - * written
1758 - * bypass
1759 -
1760 -2. **Memory Usage** in percent
1761 - * usage
1762 -
1763 -### configuration
1764 -
1765 -Needs only `url` to server's `status`
1766 -
1767 -Here is an example for local server:
1768 -
1769 -```yaml
1770 -local:
1771 - url : 'http://localhost/status'
1772 -```
1773 -
1774 -Without configuration, module fail to start.
1775 -
1776 ----
1777 -
1778 -# nsd
1779 -
1780 -Module uses the `nsd-control stats_noreset` command to provide `nsd` statistics.
1781 -
1782 -**Requirements:**
1783 - * Version of `nsd` must be 4.0+
1784 - * Netdata must have permissions to run `nsd-control stats_noreset`
1785 -
1786 -It produces:
1787 -
1788 -1. **Queries**
1789 - * queries
1790 -
1791 -2. **Zones**
1792 - * master
1793 - * slave
1794 -
1795 -3. **Protocol**
1796 - * udp
1797 - * udp6
1798 - * tcp
1799 - * tcp6
1800 -
1801 -4. **Query Type**
1802 - * A
1803 - * NS
1804 - * CNAME
1805 - * SOA
1806 - * PTR
1807 - * HINFO
1808 - * MX
1809 - * NAPTR
1810 - * TXT
1811 - * AAAA
1812 - * SRV
1813 - * ANY
1814 -
1815 -5. **Transfer**
1816 - * NOTIFY
1817 - * AXFR
1818 -
1819 -6. **Return Code**
1820 - * NOERROR
1821 - * FORMERR
1822 - * SERVFAIL
1823 - * NXDOMAIN
1824 - * NOTIMP
1825 - * REFUSED
1826 - * YXDOMAIN
1827 -
1828 -
1829 -Configuration is not needed.
1830 -
1831 ----
1832 -
1833 -# ntpd
1834 -
1835 -Module monitors the system variables of the local `ntpd` daemon (optional incl. variables of the polled peers) using the NTP Control Message Protocol via UDP socket, similar to `ntpq`, the [standard NTP query program](http://doc.ntp.org/current-stable/ntpq.html).
1836 -
1837 -**Requirements:**
1838 - * Version: `NTPv4`
1839 - * Local interrogation allowed in `/etc/ntp.conf` (default):
1840 -
1841 -```
1842 -# Local users may interrogate the ntp server more closely.
1843 -restrict 127.0.0.1
1844 -restrict ::1
1845 -```
1846 -
1847 -It produces:
1848 -
1849 -1. system
1850 - * offset
1851 - * jitter
1852 - * frequency
1853 - * delay
1854 - * dispersion
1855 - * stratum
1856 - * tc
1857 - * precision
1858 -
1859 -2. peers
1860 - * offset
1861 - * delay
1862 - * dispersion
1863 - * jitter
1864 - * rootdelay
1865 - * rootdispersion
1866 - * stratum
1867 - * hmode
1868 - * pmode
1869 - * hpoll
1870 - * ppoll
1871 - * precision
1872 -
1873 -**configuration**
1874 -
1875 -Sample:
1876 -
1877 -```yaml
1878 -update_every: 10
1879 -
1880 -host: 'localhost'
1881 -port: '123'
1882 -show_peers: yes
1883 -# hide peers with source address in ranges 127.0.0.0/8 and 192.168.0.0/16
1884 -peer_filter: '(127\..*)|(192\.168\..*)'
1885 -# check for new/changed peers every 60 updates
1886 -peer_rescan: 60
1887 -```
1888 -
1889 -Sample (multiple jobs):
1890 -
1891 -Note: `ntp.conf` on the host `otherhost` must be configured to allow queries from our local host by including a line like `restrict <IP> nomodify notrap nopeer`.
1892 -
1893 -```yaml
1894 -local:
1895 - host: 'localhost'
1896 -
1897 -otherhost:
1898 - host: 'otherhost'
1899 -```
1900 -
1901 -If no configuration is given, module will attempt to connect to `ntpd` on `::1:123` or `127.0.0.1:123` and show charts for the systemvars. Use `show_peers: yes` to also show the charts for configured peers. Local peers in the range `127.0.0.0/8` are hidden by default, use `peer_filter: ''` to show all peers.
1902 -
1903 ----
1904 -
1905 -# ovpn_status_log
1906 -
1907 -Module monitor openvpn-status log file.
1908 -
1909 -**Requirements:**
1910 -
1911 - * If you are running multiple OpenVPN instances out of the same directory, MAKE SURE TO EDIT DIRECTIVES which create output files
1912 - so that multiple instances do not overwrite each other's output files.
1913 -
1914 - * Make sure NETDATA USER CAN READ openvpn-status.log
1915 -
1916 - * Update_every interval MUST MATCH interval on which OpenVPN writes operational status to log file.
1917 -
1918 -It produces:
1919 -
1920 -1. **Users** OpenVPN active users
1921 - * users
1922 -
1923 -2. **Traffic** OpenVPN overall bandwidth usage in kilobit/s
1924 - * in
1925 - * out
1926 -
1927 -### configuration
1928 -
1929 -Sample:
1930 -
1931 -```yaml
1932 -default
1933 - log_path : '/var/log/openvpn-status.log'
1934 -```
1935 -
1936 ----
1937 -
1938 -# phpfpm
1939 -
1940 -This module will monitor one or more php-fpm instances depending on configuration.
1941 -
1942 -**Requirements:**
1943 - * php-fpm with enabled `status` page
1944 - * access to `status` page via web server
1945 -
1946 -It produces following charts:
1947 -
1948 -1. **Active Connections**
1949 - * active
1950 - * maxActive
1951 - * idle
1952 -
1953 -2. **Requests** in requests/s
1954 - * requests
1955 -
1956 -3. **Performance**
1957 - * reached
1958 - * slow
1959 -
1960 -### configuration
1961 -
1962 -Needs only `url` to server's `status`
1963 -
1964 -Here is an example for local instance:
1965 -
1966 -```yaml
1967 -update_every : 3
1968 -priority : 90100
1969 -
1970 -local:
1971 - url : 'http://localhost/status'
1972 - retries : 10
1973 -```
1974 -
1975 -Without configuration, module attempts to connect to `http://localhost/status`
1976 -
1977 ----
1978 -
1979 -# portcheck
1980 -
1981 -Module monitors a remote TCP service.
1982 -
1983 -Following charts are drawn per host:
1984 -
1985 -1. **Latency** ms
1986 - * Time required to connect to a TCP port.
1987 - Displays latency in 0.1 ms resolution. If the connection failed, the value is missing.
1988 -
1989 -2. **Status** boolean
1990 - * Connection successful
1991 - * Could not create socket: possible DNS problems
1992 - * Connection refused: port not listening or blocked
1993 - * Connection timed out: host or port unreachable
1994 -
1995 -
1996 -### configuration
1997 -
1998 -```yaml
1999 -server:
2000 - host: 'dns or ip' # required
2001 - port: 22 # required
2002 - timeout: 1 # optional
2003 - update_every: 1 # optional
2004 -```
2005 -
2006 -### notes
2007 -
2008 - * The error chart is intended for alarms, badges or for access via API.
2009 - * A system/service/firewall might block netdata's access if a portscan or
2010 - similar is detected.
2011 - * Currently, the accuracy of the latency is low and should be used as reference only.
2012 -
2013 ----
2014 -
2015 -# postfix
2016 -
2017 -Simple module executing `postfix -p` to grab postfix queue.
2018 -
2019 -It produces only two charts:
2020 -
2021 -1. **Postfix Queue Emails**
2022 - * emails
2023 -
2024 -2. **Postfix Queue Emails Size** in KB
2025 - * size
2026 -
2027 -Configuration is not needed.
2028 -
2029 ----
2030 -
2031 -# postgres
2032 -
2033 -Module monitors one or more postgres servers.
2034 -
2035 -**Requirements:**
2036 -
2037 - * `python-psycopg2` package. You have to install it manually.
2038 -
2039 -Following charts are drawn:
2040 -
2041 -1. **Database size** MB
2042 - * size
2043 -
2044 -2. **Current Backend Processes** processes
2045 - * active
2046 -
2047 -3. **Write-Ahead Logging Statistics** files/s
2048 - * total
2049 - * ready
2050 - * done
2051 -
2052 -4. **Checkpoints** writes/s
2053 - * scheduled
2054 - * requested
2055 -
2056 -5. **Current connections to db** count
2057 - * connections
2058 -
2059 -6. **Tuples returned from db** tuples/s
2060 - * sequential
2061 - * bitmap
2062 -
2063 -7. **Tuple reads from db** reads/s
2064 - * disk
2065 - * cache
2066 -
2067 -8. **Transactions on db** transactions/s
2068 - * committed
2069 - * rolled back
2070 -
2071 -9. **Tuples written to db** writes/s
2072 - * inserted
2073 - * updated
2074 - * deleted
2075 - * conflicts
2076 -
2077 -10. **Locks on db** count per type
2078 - * locks
2079 -
2080 -### configuration
2081 -
2082 -```yaml
2083 -socket:
2084 - name : 'socket'
2085 - user : 'postgres'
2086 - database : 'postgres'
2087 -
2088 -tcp:
2089 - name : 'tcp'
2090 - user : 'postgres'
2091 - database : 'postgres'
2092 - host : 'localhost'
2093 - port : 5432
2094 -```
2095 -
2096 -When no configuration file is found, module tries to connect to TCP/IP socket: `localhost:5432`.
2097 -
2098 ----
2099 -
2100 -# powerdns
2101 -
2102 -Module monitor powerdns performance and health metrics.
2103 -
2104 -Powerdns charts:
2105 -
2106 -1. **Queries and Answers**
2107 - * udp-queries
2108 - * udp-answers
2109 - * tcp-queries
2110 - * tcp-answers
2111 -
2112 -2. **Cache Usage**
2113 - * query-cache-hit
2114 - * query-cache-miss
2115 - * packetcache-hit
2116 - * packetcache-miss
2117 -
2118 -3. **Cache Size**
2119 - * query-cache-size
2120 - * packetcache-size
2121 - * key-cache-size
2122 - * meta-cache-size
2123 -
2124 -4. **Latency**
2125 - * latency
2126 -
2127 - Powerdns Recursor charts:
2128 -
2129 - 1. **Questions In**
2130 - * questions
2131 - * ipv6-questions
2132 - * tcp-queries
2133 -
2134 -2. **Questions Out**
2135 - * all-outqueries
2136 - * ipv6-outqueries
2137 - * tcp-outqueries
2138 - * throttled-outqueries
2139 -
2140 -3. **Answer Times**
2141 - * answers-slow
2142 - * answers0-1
2143 - * answers1-10
2144 - * answers10-100
2145 - * answers100-1000
2146 -
2147 -4. **Timeouts**
2148 - * outgoing-timeouts
2149 - * outgoing4-timeouts
2150 - * outgoing6-timeouts
2151 -
2152 -5. **Drops**
2153 - * over-capacity-drops
2154 -
2155 -6. **Cache Usage**
2156 - * cache-hits
2157 - * cache-misses
2158 - * packetcache-hits
2159 - * packetcache-misses
2160 -
2161 -7. **Cache Size**
2162 - * cache-entries
2163 - * packetcache-entries
2164 - * negcache-entries
2165 -
2166 -### configuration
2167 -
2168 -```yaml
2169 -local:
2170 - name : 'local'
2171 - url : 'http://127.0.0.1:8081/api/v1/servers/localhost/statistics'
2172 - header :
2173 - X-API-Key: 'change_me'
2174 -```
2175 -
2176 ----
2177 -
2178 -# puppet
2179 -
2180 -Monitor status of Puppet Server and Puppet DB.
2181 -
2182 -Following charts are drawn:
2183 -
2184 -1. **JVM Heap**
2185 - * committed (allocated from OS)
2186 - * used (actual use)
2187 -2. **JVM Non-Heap**
2188 - * committed (allocated from OS)
2189 - * used (actual use)
2190 -3. **CPU Usage**
2191 - * execution
2192 - * GC (taken by garbage collection)
2193 -4. **File Descriptors**
2194 - * max
2195 - * used
2196 -
2197 -
2198 -### configuration
2199 -
2200 -```yaml
2201 -puppetdb:
2202 - url: 'https://fqdn.example.com:8081'
2203 - tls_cert_file: /path/to/client.crt
2204 - tls_key_file: /path/to/client.key
2205 - autodetection_retry: 1
2206 - retries: 3600
2207 -
2208 -puppetserver:
2209 - url: 'https://fqdn.example.com:8140'
2210 - autodetection_retry: 1
2211 - retries: 3600
2212 -```
2213 -
2214 -When no configuration is given then `https://fqdn.example.com:8140` is
2215 -tried without any retries.
2216 -
2217 -### notes
2218 -
2219 -* Exact Fully Qualified Domain Name of the node should be used.
2220 -* Usually Puppet Server/DB startup time is VERY long. So, there should
2221 - be quite reasonable retry count.
2222 -* Secure PuppetDB config may require client certificate. Not applies
2223 - to default PuppetDB configuration though.
2224 -
2225 ----
2226 -
2227 -# rabbitmq
2228 -
2229 -Module monitor rabbitmq performance and health metrics.
2230 -
2231 -Following charts are drawn:
2232 -
2233 -1. **Queued Messages**
2234 - * ready
2235 - * unacknowledged
2236 -
2237 -2. **Message Rates**
2238 - * ack
2239 - * redelivered
2240 - * deliver
2241 - * publish
2242 -
2243 -3. **Global Counts**
2244 - * channels
2245 - * consumers
2246 - * connections
2247 - * queues
2248 - * exchanges
2249 -
2250 -4. **File Descriptors**
2251 - * used descriptors
2252 -
2253 -5. **Socket Descriptors**
2254 - * used descriptors
2255 -
2256 -6. **Erlang processes**
2257 - * used processes
2258 -
2259 -7. **Erlang run queue**
2260 - * Erlang run queue
2261 -
2262 -8. **Memory**
2263 - * free memory in megabytes
2264 -
2265 -9. **Disk Space**
2266 - * free disk space in gigabytes
2267 -
2268 -### configuration
2269 -
2270 -```yaml
2271 -socket:
2272 - name : 'local'
2273 - host : '127.0.0.1'
2274 - port : 15672
2275 - user : 'guest'
2276 - pass : 'guest'
2277 -
2278 -```
2279 -
2280 -When no configuration file is found, module tries to connect to: `localhost:15672`.
2281 -
2282 ----
2283 -
2284 -# redis
2285 -
2286 -Get INFO data from redis instance.
2287 -
2288 -Following charts are drawn:
2289 -
2290 -1. **Operations** per second
2291 - * operations
2292 -
2293 -2. **Hit rate** in percent
2294 - * rate
2295 -
2296 -3. **Memory utilization** in kilobytes
2297 - * total
2298 - * lua
2299 -
2300 -4. **Database keys**
2301 - * lines are creates dynamically based on how many databases are there
2302 -
2303 -5. **Clients**
2304 - * connected
2305 - * blocked
2306 -
2307 -6. **Slaves**
2308 - * connected
2309 -
2310 -### configuration
2311 -
2312 -```yaml
2313 -socket:
2314 - name : 'local'
2315 - socket : '/var/lib/redis/redis.sock'
2316 -
2317 -localhost:
2318 - name : 'local'
2319 - host : 'localhost'
2320 - port : 6379
2321 -```
2322 -
2323 -When no configuration file is found, module tries to connect to TCP/IP socket: `localhost:6379`.
2324 -
2325 ----
2326 -
2327 -# rethinkdb
2328 -
2329 -Module monitor rethinkdb health metrics.
2330 -
2331 -Following charts are drawn:
2332 -
2333 -1. **Connected Servers**
2334 - * connected
2335 - * missing
2336 -
2337 -2. **Active Clients**
2338 - * active
2339 -
2340 -3. **Queries** per second
2341 - * queries
2342 -
2343 -4. **Documents** per second
2344 - * documents
2345 -
2346 -### configuration
2347 -
2348 -```yaml
2349 -
2350 -localhost:
2351 - name : 'local'
2352 - host : '127.0.0.1'
2353 - port : 28015
2354 - user : "user"
2355 - password : "pass"
2356 -```
2357 -
2358 -When no configuration file is found, module tries to connect to `127.0.0.1:28015`.
2359 -
2360 ----
2361 -
2362 -# samba
2363 -
2364 -Performance metrics of Samba file sharing.
2365 -
2366 -It produces the following charts:
2367 -
2368 -1. **Syscall R/Ws** in kilobytes/s
2369 - * sendfile
2370 - * recvfle
2371 -
2372 -2. **Smb2 R/Ws** in kilobytes/s
2373 - * readout
2374 - * writein
2375 - * readin
2376 - * writeout
2377 -
2378 -3. **Smb2 Create/Close** in operations/s
2379 - * create
2380 - * close
2381 -
2382 -4. **Smb2 Info** in operations/s
2383 - * getinfo
2384 - * setinfo
2385 -
2386 -5. **Smb2 Find** in operations/s
2387 - * find
2388 -
2389 -6. **Smb2 Notify** in operations/s
2390 - * notify
2391 -
2392 -7. **Smb2 Lesser Ops** as counters
2393 - * tcon
2394 - * negprot
2395 - * tdis
2396 - * cancel
2397 - * logoff
2398 - * flush
2399 - * lock
2400 - * keepalive
2401 - * break
2402 - * sessetup
2403 -
2404 -### configuration
2405 -
2406 -Requires that smbd has been compiled with profiling enabled. Also required
2407 -that `smbd` was started either with the `-P 1` option or inside `smb.conf`
2408 -using `smbd profiling level`.
2409 -
2410 -This plugin uses `smbstatus -P` which can only be executed by root. It uses
2411 -sudo and assumes that it is configured such that the `netdata` user can
2412 -execute smbstatus as root without password.
2413 -
2414 -For example:
2415 -
2416 - netdata ALL=(ALL) NOPASSWD: /usr/bin/smbstatus -P
2417 -
2418 -```yaml
2419 -update_every : 5 # update frequency
2420 -```
2421 -
2422 ----
2423 -
2424 -# sensors
2425 -
2426 -System sensors information.
2427 -
2428 -Charts are created dynamically.
2429 -
2430 -### configuration
2431 -
2432 -For detailed configuration information please read [`sensors.conf`](https://github.com/netdata/netdata/blob/master/conf.d/python.d/sensors.conf) file.
2433 -
2434 -### possible issues
2435 -
2436 -There have been reports from users that on certain servers, ACPI ring buffer errors are printed by the kernel (`dmesg`) when ACPI sensors are being accessed.
2437 -We are tracking such cases in issue [#827](https://github.com/netdata/netdata/issues/827).
2438 -Please join this discussion for help.
2439 -
2440 ----
2441 -
2442 -# spigotmc
2443 -
2444 -This module does some really basic monitoring for Spigot Minecraft servers.
2445 -
2446 -It provides two charts, one tracking server-side ticks-per-second in
2447 -1, 5 and 15 minute averages, and one tracking the number of currently
2448 -active users.
2449 -
2450 -This is not compatible with Spigot plugins which change the format of
2451 -the data returned by the `tps` or `list` console commands.
2452 -
2453 -### configuration
2454 -
2455 -```yaml
2456 -host: localhost
2457 -port: 25575
2458 -password: pass
2459 -```
2460 -
2461 -By default, a connection to port 25575 on the local system is attempted with an empty password.
2462 -
2463 ----
2464 -
2465 -# springboot
2466 -
2467 -This module will monitor one or more Java Spring-boot applications depending on configuration.
2468 -
2469 -It produces following charts:
2470 -
2471 -1. **Response Codes** in requests/s
2472 - * 1xx
2473 - * 2xx
2474 - * 3xx
2475 - * 4xx
2476 - * 5xx
2477 - * others
2478 -
2479 -2. **Threads**
2480 - * daemon
2481 - * total
2482 -
2483 -3. **GC Time** in milliseconds and **GC Operations** in operations/s
2484 - * Copy
2485 - * MarkSweep
2486 - * ...
2487 -
2488 -4. **Heap Mmeory Usage** in KB
2489 - * used
2490 - * committed
2491 -
2492 -### configuration
2493 -
2494 -Please see the [Monitoring Java Spring Boot Applications](https://github.com/netdata/netdata/wiki/Monitoring-Java-Spring-Boot-Applications) page for detailed info about module configuration.
2495 -
2496 ----
2497 -
2498 -# squid
2499 -
2500 -This module will monitor one or more squid instances depending on configuration.
2501 -
2502 -It produces following charts:
2503 -
2504 -1. **Client Bandwidth** in kilobits/s
2505 - * in
2506 - * out
2507 - * hits
2508 -
2509 -2. **Client Requests** in requests/s
2510 - * requests
2511 - * hits
2512 - * errors
2513 -
2514 -3. **Server Bandwidth** in kilobits/s
2515 - * in
2516 - * out
2517 -
2518 -4. **Server Requests** in requests/s
2519 - * requests
2520 - * errors
2521 -
2522 -### configuration
2523 -
2524 -```yaml
2525 -priority : 50000
2526 -
2527 -local:
2528 - request : 'cache_object://localhost:3128/counters'
2529 - host : 'localhost'
2530 - port : 3128
2531 -```
2532 -
2533 -Without any configuration module will try to autodetect where squid presents its `counters` data
2534 -
2535 ----
2536 -
2537 -# smartd_log
2538 -
2539 -Module monitor `smartd` log files to collect HDD/SSD S.M.A.R.T attributes.
2540 -
2541 -It produces following charts (you can add additional attributes in the module configuration file):
2542 -
2543 -1. **Read Error Rate** attribute 1
2544 -
2545 -2. **Start/Stop Count** attribute 4
2546 -
2547 -3. **Reallocated Sectors Count** attribute 5
2548 -
2549 -4. **Seek Error Rate** attribute 7
2550 -
2551 -5. **Power-On Hours Count** attribute 9
2552 -
2553 -6. **Power Cycle Count** attribute 12
2554 -
2555 -7. **Load/Unload Cycles** attribute 193
2556 -
2557 -8. **Temperature** attribute 194
2558 -
2559 -9. **Current Pending Sectors** attribute 197
2560 -
2561 -10. **Off-Line Uncorrectable** attribute 198
2562 -
2563 -11. **Write Error Rate** attribute 200
2564 -
2565 -### configuration
2566 -
2567 -```yaml
2568 -local:
2569 - log_path : '/var/log/smartd/'
2570 -```
2571 -
2572 -If no configuration is given, module will attempt to read log files in /var/log/smartd/ directory.
2573 -
2574 ----
2575 -
2576 -# tomcat
2577 -
2578 -Present tomcat containers memory utilization.
2579 -
2580 -Charts:
2581 -
2582 -1. **Requests** per second
2583 - * accesses
2584 -
2585 -2. **Volume** in KB/s
2586 - * volume
2587 -
2588 -3. **Threads**
2589 - * current
2590 - * busy
2591 -
2592 -4. **JVM Free Memory** in MB
2593 - * jvm
2594 -
2595 -### configuration
2596 -
2597 -```yaml
2598 -localhost:
2599 - name : 'local'
2600 - url : 'http://127.0.0.1:8080/manager/status?XML=true'
2601 - user : 'tomcat_username'
2602 - pass : 'secret_tomcat_password'
2603 -```
2604 -
2605 -Without configuration, module attempts to connect to `http://localhost:8080/manager/status?XML=true`, without any credentials.
2606 -So it will probably fail.
2607 -
2608 ----
2609 -
2610 -# Traefik
2611 -
2612 -Module uses the `health` API to provide statistics.
2613 -
2614 -It produces:
2615 -
2616 -1. **Responses** by statuses
2617 - * success (1xx, 2xx, 304)
2618 - * error (5xx)
2619 - * redirect (3xx except 304)
2620 - * bad (4xx)
2621 - * other (all other responses)
2622 -
2623 -2. **Responses** by codes
2624 - * 2xx (successful)
2625 - * 5xx (internal server errors)
2626 - * 3xx (redirect)
2627 - * 4xx (bad)
2628 - * 1xx (informational)
2629 - * other (non-standart responses)
2630 -
2631 -3. **Detailed Response Codes** requests/s (number of responses for each response code family individually)
2632 -
2633 -4. **Requests**/s
2634 - * request statistics
2635 -
2636 -5. **Total response time**
2637 - * sum of all response time
2638 -
2639 -6. **Average response time**
2640 -
2641 -7. **Average response time per iteration**
2642 -
2643 -8. **Uptime**
2644 - * Traefik server uptime
2645 -
2646 -### configuration
2647 -
2648 -Needs only `url` to server's `health`
2649 -
2650 -Here is an example for local server:
2651 -
2652 -```yaml
2653 -update_every : 1
2654 -priority : 60000
2655 -
2656 -local:
2657 - url : 'http://localhost:8080/health'
2658 - retries : 10
2659 -```
2660 -
2661 -Without configuration, module attempts to connect to `http://localhost:8080/health`.
2662 -
2663 ----
2664 -
2665 -# Unbound
2666 -
2667 -Monitoring uses the remote control interface to fetch statistics.
2668 -
2669 -Provides the following charts:
2670 -
2671 -1. **Queries Processed**
2672 - * Ratelimited
2673 - * Cache Misses
2674 - * Cache Hits
2675 - * Expired
2676 - * Prefetched
2677 - * Recursive
2678 -
2679 -2. **Request List**
2680 - * Average Size
2681 - * Max Size
2682 - * Overwritten Requests
2683 - * Overruns
2684 - * Current Size
2685 - * User Requests
2686 -
2687 -3. **Recursion Timings**
2688 - * Average recursion processing time
2689 - * Median recursion processing time
2690 -
2691 -If extended stats are enabled, also provides:
2692 -
2693 -4. **Cache Sizes**
2694 - * Message Cache
2695 - * RRset Cache
2696 - * Infra Cache
2697 - * DNSSEC Key Cache
2698 - * DNSCrypt Shared Secret Cache
2699 - * DNSCrypt Nonce Cache
2700 -
2701 -### configuration
2702 -
2703 -Unbound must be manually configured to enable the remote-control protocol.
2704 -Check the Unbound documentation for info on how to do this. Additionally,
2705 -if you want to take advantage of the autodetection this plugin offers,
2706 -you will need to make sure your `unbound.conf` file only uses spaces for
2707 -indentation (the default config shipped by most distributions uses tabs
2708 -instead of spaces).
2709 -
2710 -Once you have the Unbound control protocol enabled, you need to make sure
2711 -that either the certificate and key are readable by Netdata (if you're
2712 -using the regular control interface), or that the socket is accessible
2713 -to Netdata (if you're using a UNIX socket for the contorl interface).
2714 -
2715 -By default, for the local system, everything can be auto-detected
2716 -assuming Unbound is configured correctly and has been told to listen
2717 -on the loopback interface or a UNIX socket. This is done by looking
2718 -up info in the Unbound config file specified by the `ubconf` key.
2719 -
2720 -To enable extended stats for a given job, add `extended: yes` to the
2721 -definition.
2722 -
2723 -You can also enable per-thread charts for a given job by adding
2724 -`per_thread: yes` to the definition. Note that the numbe rof threads
2725 -is only checked on startup.
2726 -
2727 -A basic local configuration with extended statistics and per-thread
2728 -charts looks like this:
2729 -
2730 -```yaml
2731 -local:
2732 - ubconf: /etc/unbound/unbound.conf
2733 - extended: yes
2734 - per_thread: yes
2735 -```
2736 -
2737 -While it's a bit more complicated to set up correctly, it is recommended
2738 -that you use a UNIX socket as it provides far better performance.
2739 -
2740 ----
2741 -
2742 -# varnish cache
2743 -
2744 -Module uses the `varnishstat` command to provide varnish cache statistics.
2745 -
2746 -It produces:
2747 -
2748 -1. **Connections Statistics** in connections/s
2749 - * accepted
2750 - * dropped
2751 -
2752 -2. **Client Requests** in requests/s
2753 - * received
2754 -
2755 -3. **All History Hit Rate Ratio** in percent
2756 - * hit
2757 - * miss
2758 - * hitpass
2759 -
2760 -4. **Current Poll Hit Rate Ratio** in percent
2761 - * hit
2762 - * miss
2763 - * hitpass
2764 -
2765 -5. **Expired Objects** in expired/s
2766 - * objects
2767 -
2768 -6. **Least Recently Used Nuked Objects** in nuked/s
2769 - * objects
2770 -
2771 -
2772 -7. **Number Of Threads In All Pools** in threads
2773 - * threads
2774 -
2775 -8. **Threads Statistics** in threads/s
2776 - * created
2777 - * failed
2778 - * limited
2779 -
2780 -9. **Current Queue Length** in requests
2781 - * in queue
2782 -
2783 -10. **Backend Connections Statistics** in connections/s
2784 - * successful
2785 - * unhealthy
2786 - * reused
2787 - * closed
2788 - * resycled
2789 - * failed
2790 -
2791 -10. **Requests To The Backend** in requests/s
2792 - * received
2793 -
2794 -11. **ESI Statistics** in problems/s
2795 - * errors
2796 - * warnings
2797 -
2798 -12. **Memory Usage** in MB
2799 - * free
2800 - * allocated
2801 -
2802 -13. **Uptime** in seconds
2803 - * uptime
2804 -
2805 -
2806 -### configuration
2807 -
2808 -No configuration is needed.
2809 -
2810 ----
2811 -
2812 -# w1sensor
2813 -
2814 -Data from 1-Wire sensors.
2815 -On Linux these are supported by the wire, w1_gpio, and w1_therm modules.
2816 -Currently temperature sensors are supported and automatically detected.
2817 -
2818 -Charts are created dynamically based on the number of detected sensors.
2819 -
2820 -### configuration
2821 -
2822 -For detailed configuration information please read [`w1sensor.conf`](https://github.com/netdata/netdata/blob/master/conf.d/python.d/w1sensor.conf) file.
2823 -
2824 ----
2825 -
2826 -# web_log
2827 -
2828 -Tails the apache/nginx/lighttpd/gunicorn log files to collect real-time web-server statistics.
2829 -
2830 -It produces following charts:
2831 -
2832 -1. **Response by type** requests/s
2833 - * success (1xx, 2xx, 304)
2834 - * error (5xx)
2835 - * redirect (3xx except 304)
2836 - * bad (4xx)
2837 - * other (all other responses)
2838 -
2839 -2. **Response by code family** requests/s
2840 - * 1xx (informational)
2841 - * 2xx (successful)
2842 - * 3xx (redirect)
2843 - * 4xx (bad)
2844 - * 5xx (internal server errors)
2845 - * other (non-standart responses)
2846 - * unmatched (the lines in the log file that are not matched)
2847 -
2848 -3. **Detailed Response Codes** requests/s (number of responses for each response code family individually)
2849 -
2850 -4. **Bandwidth** KB/s
2851 - * received (bandwidth of requests)
2852 - * send (bandwidth of responses)
2853 -
2854 -5. **Timings** ms (request processing time)
2855 - * min (bandwidth of requests)
2856 - * max (bandwidth of responses)
2857 - * average (bandwidth of responses)
2858 -
2859 -6. **Request per url** requests/s (configured by user)
2860 -
2861 -7. **Http Methods** requests/s (requests per http method)
2862 -
2863 -8. **Http Versions** requests/s (requests per http version)
2864 -
2865 -9. **IP protocols** requests/s (requests per ip protocol version)
2866 -
2867 -10. **Current Poll Unique Client IPs** unique ips/s (unique client IPs per data collection iteration)
2868 -
2869 -11. **All Time Unique Client IPs** unique ips/s (unique client IPs since the last restart of netdata)
2870 -
2871 -
2872 -### configuration
2873 -
2874 -```yaml
2875 -nginx_log:
2876 - name : 'nginx_log'
2877 - path : '/var/log/nginx/access.log'
2878 -
2879 -apache_log:
2880 - name : 'apache_log'
2881 - path : '/var/log/apache/other_vhosts_access.log'
2882 - categories:
2883 - cacti : 'cacti.*'
2884 - observium : 'observium'
2885 -```
2886 -
2887 -Module has preconfigured jobs for nginx, apache and gunicorn on various distros.
2888 -
2889 ----
registry/Makefile.am new
+9
@@ -0,0 +1,9 @@
1 +# SPDX-License-Identifier: GPL-3.0-or-later
2 +
3 +AUTOMAKE_OPTIONS = subdir-objects
4 +MAINTAINERCLEANFILES = $(srcdir)/Makefile.in
5 +
6 +
7 +dist_noinst_DATA = \
8 + README.md \
9 + $(NULL)
registry/README.md
registry/registry.c renamed
+1 -1
@@ -1,6 +1,6 @@
1 // SPDX-License-Identifier: GPL-3.0-or-later
2
3 -#include "../common.h"
3 +#include "../daemon/common.h"
4 #include "registry_internals.h"
5
6 #define REGISTRY_STATUS_OK "ok"
registry/registry.h renamed
+1 -1
@@ -49,7 +49,7 @@
49 #ifndef NETDATA_REGISTRY_H
50 #define NETDATA_REGISTRY_H 1
51
52 -#include "../common.h"
52 +#include "../daemon/common.h"
53
54 #define NETDATA_REGISTRY_COOKIE_NAME "netdata_registry_id"
55
registry/registry_db.c renamed
+1 -1
@@ -1,6 +1,6 @@
1 // SPDX-License-Identifier: GPL-3.0-or-later
2
3 -#include "../common.h"
3 +#include "../daemon/common.h"
4 #include "registry_internals.h"
5
6 int registry_db_should_be_saved(void) {
registry/registry_init.c renamed
+1 -1
@@ -1,6 +1,6 @@
1 // SPDX-License-Identifier: GPL-3.0-or-later
2
3 -#include "../common.h"
3 +#include "../daemon/common.h"
4 #include "registry_internals.h"
5
6 int registry_init(void) {
registry/registry_internals.c renamed
+1 -1
@@ -1,6 +1,6 @@
1 // SPDX-License-Identifier: GPL-3.0-or-later
2
3 -#include "../common.h"
3 +#include "../daemon/common.h"
4 #include "registry_internals.h"
5
6 struct registry registry;
registry/registry_internals.h renamed
registry/registry_log.c renamed
+1 -1
@@ -1,6 +1,6 @@
1 // SPDX-License-Identifier: GPL-3.0-or-later
2
3 -#include "../common.h"
3 +#include "../daemon/common.h"
4 #include "registry_internals.h"
5
6 void registry_log(char action, REGISTRY_PERSON *p, REGISTRY_MACHINE *m, REGISTRY_URL *u, char *name) {
registry/registry_machine.c renamed
+1 -1
@@ -1,6 +1,6 @@
1 // SPDX-License-Identifier: GPL-3.0-or-later
2
3 -#include "../common.h"
3 +#include "../daemon/common.h"
4 #include "registry_internals.h"
5
6 // ----------------------------------------------------------------------------
registry/registry_machine.h renamed
registry/registry_person.c renamed
+1 -1
@@ -1,6 +1,6 @@
1 // SPDX-License-Identifier: GPL-3.0-or-later
2
3 -#include "../common.h"
3 +#include "../daemon/common.h"
4 #include "registry_internals.h"
5
6 // ----------------------------------------------------------------------------
registry/registry_person.h renamed
registry/registry_url.c renamed
+1 -1
@@ -1,6 +1,6 @@
1 // SPDX-License-Identifier: GPL-3.0-or-later
2
3 -#include "../common.h"
3 +#include "../daemon/common.h"
4 #include "registry_internals.h"
5
6 // ----------------------------------------------------------------------------
registry/registry_url.h renamed
src/Makefile.am deleted
-363
@@ -1,363 +0,0 @@
1 -# SPDX-License-Identifier: GPL-3.0-or-later
2 -
3 -AUTOMAKE_OPTIONS = subdir-objects
4 -MAINTAINERCLEANFILES= $(srcdir)/Makefile.in
5 -
6 -SUBDIRS = \
7 - api \
8 - backends \
9 - database \
10 - health \
11 - libnetdata \
12 - plugins \
13 - registry \
14 - streaming \
15 - webserver \
16 - $(NULL)
17 -
18 -AM_CFLAGS = \
19 - $(OPTIONAL_MATH_CFLAGS) \
20 - $(OPTIONAL_NFACCT_CLFAGS) \
21 - $(OPTIONAL_ZLIB_CFLAGS) \
22 - $(OPTIONAL_UUID_CFLAGS) \
23 - $(OPTIONAL_LIBCAP_LIBS) \
24 - $(OPTIONAL_IPMIMONITORING_CFLAGS) \
25 - $(NULL)
26 -
27 -sbin_PROGRAMS =
28 -dist_cache_DATA = .keep
29 -dist_varlib_DATA = .keep
30 -dist_registry_DATA = .keep
31 -dist_log_DATA = .keep
32 -plugins_PROGRAMS =
33 -
34 -LIBNETDATA_FILES = \
35 - libnetdata/adaptive_resortable_list.c \
36 - libnetdata/adaptive_resortable_list.h \
37 - libnetdata/appconfig.c \
38 - libnetdata/appconfig.h \
39 - libnetdata/avl.c \
40 - libnetdata/avl.h \
41 - libnetdata/clocks.c \
42 - libnetdata/clocks.h \
43 - libnetdata/common.c \
44 - libnetdata/dictionary.c \
45 - libnetdata/dictionary.h \
46 - libnetdata/eval.c \
47 - libnetdata/eval.h \
48 - libnetdata/inlined.h \
49 - libnetdata/libnetdata.h \
50 - libnetdata/locks.c \
51 - libnetdata/locks.h \
52 - libnetdata/log.c \
53 - libnetdata/log.h \
54 - libnetdata/popen.c \
55 - libnetdata/popen.h \
56 - libnetdata/procfile.c \
57 - libnetdata/procfile.h \
58 - libnetdata/os.c \
59 - libnetdata/os.h \
60 - libnetdata/simple_pattern.c \
61 - libnetdata/simple_pattern.h \
62 - libnetdata/socket.c \
63 - libnetdata/socket.h \
64 - libnetdata/statistical.c \
65 - libnetdata/statistical.h \
66 - libnetdata/storage_number.c \
67 - libnetdata/storage_number.h \
68 - libnetdata/threads.c \
69 - libnetdata/threads.h \
70 - libnetdata/web_buffer.c \
71 - libnetdata/web_buffer.h \
72 - libnetdata/url.c \
73 - libnetdata/url.h \
74 - $(NULL)
75 -
76 -APPS_PLUGIN_FILES = \
77 - plugins/apps.plugin/apps_plugin.c \
78 - $(LIBNETDATA_FILES) \
79 - $(NULL)
80 -
81 -CHECKS_PLUGIN_FILES = \
82 - plugins/checks.plugin/plugin_checks.c \
83 - plugins/checks.plugin/plugin_checks.h \
84 - $(NULL)
85 -
86 -FREEBSD_PLUGIN_FILES = \
87 - plugins/freebsd.plugin/plugin_freebsd.c \
88 - plugins/freebsd.plugin/plugin_freebsd.h \
89 - plugins/freebsd.plugin/freebsd_sysctl.c \
90 - plugins/freebsd.plugin/freebsd_getmntinfo.c \
91 - plugins/freebsd.plugin/freebsd_getifaddrs.c \
92 - plugins/freebsd.plugin/freebsd_devstat.c \
93 - plugins/freebsd.plugin/freebsd_kstat_zfs.c \
94 - plugins/freebsd.plugin/freebsd_ipfw.c \
95 - plugins/linux-proc.plugin/zfs_common.c \
96 - plugins/linux-proc.plugin/zfs_common.h \
97 - $(NULL)
98 -
99 -HEALTH_PLUGIN_FILES = \
100 - health/health.c \
101 - health/health.h \
102 - health/health_config.c \
103 - health/health_json.c \
104 - health/health_log.c \
105 - $(NULL)
106 -
107 -IDLEJITTER_PLUGIN_FILES = \
108 - plugins/idlejitter.plugin/plugin_idlejitter.c \
109 - plugins/idlejitter.plugin/plugin_idlejitter.h \
110 - $(NULL)
111 -
112 -CGROUPS_PLUGIN_FILES = \
113 - plugins/linux-cgroups.plugin/sys_fs_cgroup.c \
114 - plugins/linux-cgroups.plugin/sys_fs_cgroup.h \
115 - $(NULL)
116 -
117 -CGROUP_NETWORK_FILES = \
118 - plugins/linux-cgroups.plugin/cgroup-network.c \
119 - $(LIBNETDATA_FILES) \
120 - $(NULL)
121 -
122 -DISKSPACE_PLUGIN_FILES = \
123 - plugins/linux-diskspace.plugin/plugin_diskspace.h \
124 - plugins/linux-diskspace.plugin/plugin_diskspace.c \
125 - $(NULL)
126 -
127 -FREEIPMI_PLUGIN_FILES = \
128 - plugins/linux-freeipmi.plugin/freeipmi_plugin.c \
129 - $(LIBNETDATA_FILES) \
130 - $(NULL)
131 -
132 -NFACCT_PLUGIN_FILES = \
133 - plugins/linux-nfacct.plugin/plugin_nfacct.c \
134 - plugins/linux-nfacct.plugin/plugin_nfacct.h \
135 - $(NULL)
136 -
137 -PROC_PLUGIN_FILES = \
138 - plugins/linux-proc.plugin/ipc.c \
139 - plugins/linux-proc.plugin/plugin_proc.c \
140 - plugins/linux-proc.plugin/plugin_proc.h \
141 - plugins/linux-proc.plugin/proc_diskstats.c \
142 - plugins/linux-proc.plugin/proc_interrupts.c \
143 - plugins/linux-proc.plugin/proc_softirqs.c \
144 - plugins/linux-proc.plugin/proc_loadavg.c \
145 - plugins/linux-proc.plugin/proc_meminfo.c \
146 - plugins/linux-proc.plugin/proc_net_dev.c \
147 - plugins/linux-proc.plugin/proc_net_ip_vs_stats.c \
148 - plugins/linux-proc.plugin/proc_net_netstat.c \
149 - plugins/linux-proc.plugin/proc_net_rpc_nfs.c \
150 - plugins/linux-proc.plugin/proc_net_rpc_nfsd.c \
151 - plugins/linux-proc.plugin/proc_net_snmp.c \
152 - plugins/linux-proc.plugin/proc_net_snmp6.c \
153 - plugins/linux-proc.plugin/proc_net_sctp_snmp.c \
154 - plugins/linux-proc.plugin/proc_net_sockstat.c \
155 - plugins/linux-proc.plugin/proc_net_sockstat6.c \
156 - plugins/linux-proc.plugin/proc_net_softnet_stat.c \
157 - plugins/linux-proc.plugin/proc_net_stat_conntrack.c \
158 - plugins/linux-proc.plugin/proc_net_stat_synproxy.c \
159 - plugins/linux-proc.plugin/proc_self_mountinfo.c \
160 - plugins/linux-proc.plugin/proc_self_mountinfo.h \
161 - plugins/linux-proc.plugin/zfs_common.c \
162 - plugins/linux-proc.plugin/zfs_common.h \
163 - plugins/linux-proc.plugin/proc_spl_kstat_zfs.c \
164 - plugins/linux-proc.plugin/proc_stat.c \
165 - plugins/linux-proc.plugin/proc_sys_kernel_random_entropy_avail.c \
166 - plugins/linux-proc.plugin/proc_vmstat.c \
167 - plugins/linux-proc.plugin/proc_uptime.c \
168 - plugins/linux-proc.plugin/sys_kernel_mm_ksm.c \
169 - plugins/linux-proc.plugin/sys_devices_system_edac_mc.c \
170 - plugins/linux-proc.plugin/sys_devices_system_node.c \
171 - plugins/linux-proc.plugin/sys_fs_btrfs.c \
172 - $(NULL)
173 -
174 -TC_PLUGIN_FILES = \
175 - plugins/linux-tc.plugin/plugin_tc.c \
176 - plugins/linux-tc.plugin/plugin_tc.h \
177 - $(NULL)
178 -
179 -MACOS_PLUGIN_FILES = \
180 - plugins/macos.plugin/plugin_macos.c \
181 - plugins/macos.plugin/plugin_macos.h \
182 - plugins/macos.plugin/macos_sysctl.c \
183 - plugins/macos.plugin/macos_mach_smi.c \
184 - plugins/macos.plugin/macos_fw.c \
185 - $(NULL)
186 -
187 -PLUGINSD_PLUGIN_FILES = \
188 - plugins/plugins.d.plugin/plugins_d.c \
189 - plugins/plugins.d.plugin/plugins_d.h \
190 - $(NULL)
191 -
192 -RRD_PLUGIN_FILES = \
193 - database/rrdcalc.c \
194 - database/rrdcalc.h \
195 - database/rrdcalctemplate.c \
196 - database/rrdcalctemplate.h \
197 - database/rrddim.c \
198 - database/rrddimvar.c \
199 - database/rrddimvar.h \
200 - database/rrdfamily.c \
201 - database/rrdhost.c \
202 - database/rrd.c \
203 - database/rrd.h \
204 - database/rrdset.c \
205 - database/rrdsetvar.c \
206 - database/rrdsetvar.h \
207 - database/rrdvar.c \
208 - database/rrdvar.h \
209 - $(NULL)
210 -
211 -API_PLUGIN_FILES = \
212 - api/rrd2json.c \
213 - api/rrd2json.h \
214 - api/web_api_v1.c \
215 - api/web_api_v1.h \
216 - api/web_buffer_svg.c \
217 - api/web_buffer_svg.h \
218 - $(NULL)
219 -
220 -STREAMING_PLUGIN_FILES = \
221 - streaming/rrdpush.c \
222 - streaming/rrdpush.h \
223 - $(NULL)
224 -
225 -REGISTRY_PLUGIN_FILES = \
226 - registry/registry.c \
227 - registry/registry.h \
228 - registry/registry_db.c \
229 - registry/registry_init.c \
230 - registry/registry_internals.c \
231 - registry/registry_internals.h \
232 - registry/registry_log.c \
233 - registry/registry_machine.c \
234 - registry/registry_machine.h \
235 - registry/registry_person.c \
236 - registry/registry_person.h \
237 - registry/registry_url.c \
238 - registry/registry_url.h \
239 - $(NULL)
240 -
241 -STATSD_PLUGIN_FILES = \
242 - plugins/statsd.plugin/statsd.c \
243 - plugins/statsd.plugin/statsd.h \
244 - $(NULL)
245 -
246 -WEB_PLGUGIN_FILES = \
247 - webserver/web_client.c \
248 - webserver/web_client.h \
249 - webserver/web_server.c \
250 - webserver/web_server.h \
251 - $(NULL)
252 -
253 -BACKENDS_PLUGIN_FILES = \
254 - backends/backends.c \
255 - backends/backends.h \
256 - backends/graphite/graphite.c \
257 - backends/graphite/graphite.h \
258 - backends/json/json.c \
259 - backends/json/json.h \
260 - backends/opentsdb/opentsdb.c \
261 - backends/opentsdb/opentsdb.h \
262 - backends/prometheus/backend_prometheus.c \
263 - backends/prometheus/backend_prometheus.h \
264 - $(NULL)
265 -
266 -WEB_PLUGIN_FILES = \
267 - webserver/web_client.c \
268 - webserver/web_client.h \
269 - webserver/web_server.c \
270 - webserver/web_server.h \
271 - $(NULL)
272 -
273 -NETDATA_FILES = \
274 - plugins/all.h \
275 - common.c \
276 - common.h \
277 - daemon.c \
278 - daemon.h \
279 - global_statistics.c \
280 - global_statistics.h \
281 - main.c \
282 - main.h \
283 - signals.c \
284 - signals.h \
285 - unit_test.c \
286 - unit_test.h \
287 - $(LIBNETDATA_FILES) \
288 - $(API_PLUGIN_FILES) \
289 - $(BACKENDS_PLUGIN_FILES) \
290 - $(CHECKS_PLUGIN_FILES) \
291 - $(HEALTH_PLUGIN_FILES) \
292 - $(IDLEJITTER_PLUGIN_FILES) \
293 - $(PLUGINSD_PLUGIN_FILES) \
294 - $(REGISTRY_PLUGIN_FILES) \
295 - $(RRD_PLUGIN_FILES) \
296 - $(STREAMING_PLUGIN_FILES) \
297 - $(STATSD_PLUGIN_FILES) \
298 - $(WEB_PLUGIN_FILES) \
299 - $(NULL)
300 -
301 -if FREEBSD
302 - NETDATA_FILES += \
303 - $(FREEBSD_PLUGIN_FILES) \
304 - $(NULL)
305 -endif
306 -
307 -if MACOS
308 - NETDATA_FILES += \
309 - $(MACOS_PLUGIN_FILES) \
310 - $(NULL)
311 -endif
312 -
313 -if LINUX
314 - NETDATA_FILES += \
315 - $(CGROUPS_PLUGIN_FILES) \
316 - $(DISKSPACE_PLUGIN_FILES) \
317 - $(NFACCT_PLUGIN_FILES) \
318 - $(PROC_PLUGIN_FILES) \
319 - $(TC_PLUGIN_FILES) \
320 - $(NULL)
321 -
322 -endif
323 -
324 -NETDATA_COMMON_LIBS = \
325 - $(OPTIONAL_MATH_LIBS) \
326 - $(OPTIONAL_ZLIB_LIBS) \
327 - $(OPTIONAL_UUID_LIBS) \
328 - $(NULL)
329 -
330 -
331 -sbin_PROGRAMS += netdata
332 -netdata_SOURCES = ../config.h $(NETDATA_FILES)
333 -netdata_LDADD = \
334 - $(NETDATA_COMMON_LIBS) \
335 - $(OPTIONAL_NFACCT_LIBS) \
336 - $(NULL)
337 -
338 -if ENABLE_PLUGIN_APPS
339 - plugins_PROGRAMS += apps.plugin
340 - apps_plugin_SOURCES = ../config.h $(APPS_PLUGIN_FILES)
341 - apps_plugin_LDADD = \
342 - $(NETDATA_COMMON_LIBS) \
343 - $(OPTIONAL_LIBCAP_LIBS) \
344 - $(NULL)
345 -endif
346 -
347 -if ENABLE_PLUGIN_CGROUP_NETWORK
348 - plugins_PROGRAMS += cgroup-network
349 - cgroup_network_SOURCES = ../config.h $(CGROUP_NETWORK_FILES)
350 - cgroup_network_LDADD = \
351 - $(NETDATA_COMMON_LIBS) \
352 - $(NULL)
353 -endif
354 -
355 -if ENABLE_PLUGIN_FREEIPMI
356 - plugins_PROGRAMS += freeipmi.plugin
357 - freeipmi_plugin_SOURCES = ../config.h $(FREEIPMI_PLUGIN_FILES)
358 - freeipmi_plugin_LDADD = \
359 - $(NETDATA_COMMON_LIBS) \
360 - $(OPTIONAL_IPMIMONITORING_LIBS) \
361 - $(NULL)
362 -endif
363 -
src/backends/prometheus/Makefile.am deleted
-4
@@ -1,4 +0,0 @@
1 -# SPDX-License-Identifier: GPL-3.0-or-later
2 -
3 -AUTOMAKE_OPTIONS = subdir-objects
4 -MAINTAINERCLEANFILES = Makefile.in
src/database/Makefile.am deleted
-4
@@ -1,4 +0,0 @@
1 -# SPDX-License-Identifier: GPL-3.0-or-later
2 -
3 -AUTOMAKE_OPTIONS = subdir-objects
4 -MAINTAINERCLEANFILES = Makefile.in
src/health/Makefile.am deleted
-4
@@ -1,4 +0,0 @@
1 -# SPDX-License-Identifier: GPL-3.0-or-later
2 -
3 -AUTOMAKE_OPTIONS = subdir-objects
4 -MAINTAINERCLEANFILES = Makefile.in
src/libnetdata/Makefile.am deleted
-5
@@ -1,5 +0,0 @@
1 -# SPDX-License-Identifier: GPL-3.0-or-later
2 -
3 -MAINTAINERCLEANFILES = Makefile.in
4 -
5 -
src/plugins/Makefile.am deleted
-38
@@ -1,38 +0,0 @@
1 -# SPDX-License-Identifier: GPL-3.0-or-later
2 -
3 -MAINTAINERCLEANFILES = Makefile.in
4 -
5 -SUBDIRS = \
6 - apps.plugin \
7 - checks.plugin \
8 - idlejitter.plugin \
9 - plugins.d.plugin \
10 - statsd.plugin \
11 - $(NULL)
12 -
13 -if FREEBSD
14 -
15 -SUBDIRS += \
16 - freebsd.plugin \
17 - $(NULL)
18 -
19 -else
20 -if MACOS
21 -
22 -SUBDIRS += \
23 - macos.plugin \
24 - $(NULL)
25 -
26 -else
27 -
28 -SUBDIRS += \
29 - linux-cgroups.plugin \
30 - linux-diskspace.plugin \
31 - linux-freeipmi.plugin \
32 - linux-nfacct.plugin \
33 - linux-proc.plugin \
34 - linux-tc.plugin \
35 - $(NULL)
36 -
37 -endif
38 -endif
src/plugins/checks.plugin/Makefile.am deleted
-4
@@ -1,4 +0,0 @@
1 -# SPDX-License-Identifier: GPL-3.0-or-later
2 -
3 -AUTOMAKE_OPTIONS = subdir-objects
4 -MAINTAINERCLEANFILES = Makefile.in
src/plugins/freebsd.plugin/Makefile.am deleted
-4
@@ -1,4 +0,0 @@
1 -# SPDX-License-Identifier: GPL-3.0-or-later
2 -
3 -AUTOMAKE_OPTIONS = subdir-objects
4 -MAINTAINERCLEANFILES = Makefile.in
src/plugins/idlejitter.plugin/Makefile.am deleted
-4
@@ -1,4 +0,0 @@
1 -# SPDX-License-Identifier: GPL-3.0-or-later
2 -
3 -AUTOMAKE_OPTIONS = subdir-objects
4 -MAINTAINERCLEANFILES = Makefile.in
src/plugins/linux-cgroups.plugin/Makefile.am deleted
-28
@@ -1,28 +0,0 @@
1 -# SPDX-License-Identifier: GPL-3.0-or-later
2 -
3 -AUTOMAKE_OPTIONS = subdir-objects
4 -MAINTAINERCLEANFILES = Makefile.in
5 -
6 -CLEANFILES = \
7 - cgroup-name.sh \
8 - $(NULL)
9 -
10 -cgroup-name.sh: cgroup-name.sh.in
11 - if sed \
12 - -e 's#[@]configdir_POST@#$(configdir)#g' \
13 - -e 's#[@]libconfigdir_POST@#$(libconfigdir)#g' \
14 - $< > $@.tmp; then \
15 - mv "$@.tmp" "$@"; \
16 - else \
17 - rm -f "$@.tmp"; \
18 - false; \
19 - fi
20 -
21 -dist_plugins_SCRIPTS = \
22 - cgroup-name.sh \
23 - cgroup-network-helper.sh \
24 - $(NULL)
25 -
26 -dist_noinst_DATA = \
27 - cgroup-name.sh.in \
28 - $(NULL)
src/plugins/linux-diskspace.plugin/Makefile.am deleted
-4
@@ -1,4 +0,0 @@
1 -# SPDX-License-Identifier: GPL-3.0-or-later
2 -
3 -AUTOMAKE_OPTIONS = subdir-objects
4 -MAINTAINERCLEANFILES = Makefile.in
src/plugins/linux-freeipmi.plugin/Makefile.am deleted
-5
@@ -1,5 +0,0 @@
1 -# SPDX-License-Identifier: GPL-3.0-or-later
2 -
3 -AUTOMAKE_OPTIONS = subdir-objects
4 -MAINTAINERCLEANFILES = Makefile.in
5 -
src/plugins/linux-nfacct.plugin/Makefile.am deleted
-4
@@ -1,4 +0,0 @@
1 -# SPDX-License-Identifier: GPL-3.0-or-later
2 -
3 -AUTOMAKE_OPTIONS = subdir-objects
4 -MAINTAINERCLEANFILES = Makefile.in
src/plugins/linux-proc.plugin/Makefile.am deleted
-5
@@ -1,5 +0,0 @@
1 -# SPDX-License-Identifier: GPL-3.0-or-later
2 -
3 -AUTOMAKE_OPTIONS = subdir-objects
4 -MAINTAINERCLEANFILES = Makefile.in
5 -
src/plugins/linux-tc.plugin/Makefile.am deleted
-5
@@ -1,5 +0,0 @@
1 -# SPDX-License-Identifier: GPL-3.0-or-later
2 -
3 -AUTOMAKE_OPTIONS = subdir-objects
4 -MAINTAINERCLEANFILES = Makefile.in
5 -
src/plugins/macos.plugin/Makefile.am deleted
-4
@@ -1,4 +0,0 @@
1 -# SPDX-License-Identifier: GPL-3.0-or-later
2 -
3 -AUTOMAKE_OPTIONS = subdir-objects
4 -MAINTAINERCLEANFILES = Makefile.in
src/plugins/plugins.d.plugin/Makefile.am deleted
-5
@@ -1,5 +0,0 @@
1 -# SPDX-License-Identifier: GPL-3.0-or-later
2 -
3 -AUTOMAKE_OPTIONS = subdir-objects
4 -MAINTAINERCLEANFILES = Makefile.in
5 -
src/plugins/statsd.plugin/Makefile.am deleted
-5
@@ -1,5 +0,0 @@
1 -# SPDX-License-Identifier: GPL-3.0-or-later
2 -
3 -AUTOMAKE_OPTIONS = subdir-objects
4 -MAINTAINERCLEANFILES = Makefile.in
5 -
src/registry/Makefile.am deleted
-4
@@ -1,4 +0,0 @@
1 -# SPDX-License-Identifier: GPL-3.0-or-later
2 -
3 -AUTOMAKE_OPTIONS = subdir-objects
4 -MAINTAINERCLEANFILES = Makefile.in
src/streaming/Makefile.am deleted
-4
@@ -1,4 +0,0 @@
1 -# SPDX-License-Identifier: GPL-3.0-or-later
2 -
3 -AUTOMAKE_OPTIONS = subdir-objects
4 -MAINTAINERCLEANFILES = Makefile.in
src/webserver/Makefile.am deleted
-4
@@ -1,4 +0,0 @@
1 -# SPDX-License-Identifier: GPL-3.0-or-later
2 -
3 -AUTOMAKE_OPTIONS = subdir-objects
4 -MAINTAINERCLEANFILES = Makefile.in
src/webserver/web_server.c deleted
-1298
@@ -1,1298 +0,0 @@
1 -// SPDX-License-Identifier: GPL-3.0-or-later
2 -
3 -#include "web_server.h"
4 -
5 -// this file includes 3 web servers:
6 -//
7 -// 1. single-threaded, based on select()
8 -// 2. multi-threaded, based on poll() that spawns threads to handle the requests, based on select()
9 -// 3. static-threaded, based on poll() using a fixed number of threads (configured at netdata.conf)
10 -
11 -WEB_SERVER_MODE web_server_mode = WEB_SERVER_MODE_STATIC_THREADED;
12 -
13 -// --------------------------------------------------------------------------------------
14 -
15 -WEB_SERVER_MODE web_server_mode_id(const char *mode) {
16 - if(!strcmp(mode, "none"))
17 - return WEB_SERVER_MODE_NONE;
18 - else if(!strcmp(mode, "single") || !strcmp(mode, "single-threaded"))
19 - return WEB_SERVER_MODE_SINGLE_THREADED;
20 - else if(!strcmp(mode, "static") || !strcmp(mode, "static-threaded"))
21 - return WEB_SERVER_MODE_STATIC_THREADED;
22 - else // if(!strcmp(mode, "multi") || !strcmp(mode, "multi-threaded"))
23 - return WEB_SERVER_MODE_MULTI_THREADED;
24 -}
25 -
26 -const char *web_server_mode_name(WEB_SERVER_MODE id) {
27 - switch(id) {
28 - case WEB_SERVER_MODE_NONE:
29 - return "none";
30 -
31 - case WEB_SERVER_MODE_SINGLE_THREADED:
32 - return "single-threaded";
33 -
34 - case WEB_SERVER_MODE_STATIC_THREADED:
35 - return "static-threaded";
36 -
37 - default:
38 - case WEB_SERVER_MODE_MULTI_THREADED:
39 - return "multi-threaded";
40 - }
41 -}
42 -
43 -// --------------------------------------------------------------------------------------
44 -// API sockets
45 -
46 -static LISTEN_SOCKETS api_sockets = {
47 - .config_section = CONFIG_SECTION_WEB,
48 - .default_bind_to = "*",
49 - .default_port = API_LISTEN_PORT,
50 - .backlog = API_LISTEN_BACKLOG
51 -};
52 -
53 -int api_listen_sockets_setup(void) {
54 - int socks = listen_sockets_setup(&api_sockets);
55 -
56 - if(!socks)
57 - fatal("LISTENER: Cannot listen on any API socket. Exiting...");
58 -
59 - return socks;
60 -}
61 -
62 -
63 -// --------------------------------------------------------------------------------------
64 -// access lists
65 -
66 -SIMPLE_PATTERN *web_allow_connections_from = NULL;
67 -SIMPLE_PATTERN *web_allow_streaming_from = NULL;
68 -SIMPLE_PATTERN *web_allow_netdataconf_from = NULL;
69 -
70 -// WEB_CLIENT_ACL
71 -SIMPLE_PATTERN *web_allow_dashboard_from = NULL;
72 -SIMPLE_PATTERN *web_allow_registry_from = NULL;
73 -SIMPLE_PATTERN *web_allow_badges_from = NULL;
74 -
75 -static void web_client_update_acl_matches(struct web_client *w) {
76 - w->acl = WEB_CLIENT_ACL_NONE;
77 -
78 - if(!web_allow_dashboard_from || simple_pattern_matches(web_allow_dashboard_from, w->client_ip))
79 - w->acl |= WEB_CLIENT_ACL_DASHBOARD;
80 -
81 - if(!web_allow_registry_from || simple_pattern_matches(web_allow_registry_from, w->client_ip))
82 - w->acl |= WEB_CLIENT_ACL_REGISTRY;
83 -
84 - if(!web_allow_badges_from || simple_pattern_matches(web_allow_badges_from, w->client_ip))
85 - w->acl |= WEB_CLIENT_ACL_BADGE;
86 -}
87 -
88 -
89 -// --------------------------------------------------------------------------------------
90 -
91 -static void log_connection(struct web_client *w, const char *msg) {
92 - log_access("%llu: %d '[%s]:%s' '%s'", w->id, gettid(), w->client_ip, w->client_port, msg);
93 -}
94 -
95 -// ----------------------------------------------------------------------------
96 -// allocate and free web_clients
97 -
98 -static void web_client_zero(struct web_client *w) {
99 - // zero everything about it - but keep the buffers
100 -
101 - // remember the pointers to the buffers
102 - BUFFER *b1 = w->response.data;
103 - BUFFER *b2 = w->response.header;
104 - BUFFER *b3 = w->response.header_output;
105 -
106 - // empty the buffers
107 - buffer_flush(b1);
108 - buffer_flush(b2);
109 - buffer_flush(b3);
110 -
111 - freez(w->user_agent);
112 -
113 - // zero everything
114 - memset(w, 0, sizeof(struct web_client));
115 -
116 - // restore the pointers of the buffers
117 - w->response.data = b1;
118 - w->response.header = b2;
119 - w->response.header_output = b3;
120 -}
121 -
122 -static void web_client_free(struct web_client *w) {
123 - buffer_free(w->response.header_output);
124 - buffer_free(w->response.header);
125 - buffer_free(w->response.data);
126 - freez(w->user_agent);
127 - freez(w);
128 -}
129 -
130 -static struct web_client *web_client_alloc(void) {
131 - struct web_client *w = callocz(1, sizeof(struct web_client));
132 - w->response.data = buffer_create(NETDATA_WEB_RESPONSE_INITIAL_SIZE);
133 - w->response.header = buffer_create(NETDATA_WEB_RESPONSE_HEADER_SIZE);
134 - w->response.header_output = buffer_create(NETDATA_WEB_RESPONSE_HEADER_SIZE);
135 - return w;
136 -}
137 -
138 -// ----------------------------------------------------------------------------
139 -// web clients caching
140 -
141 -// When clients connect and disconnect, avoid allocating and releasing memory.
142 -// Instead, when new clients get connected, reuse any memory previously allocated
143 -// for serving web clients that are now disconnected.
144 -
145 -// The size of the cache is adaptive. It caches the structures of 2x
146 -// the number of currently connected clients.
147 -
148 -// Comments per server:
149 -// SINGLE-THREADED : 1 cache is maintained
150 -// MULTI-THREADED : 1 cache is maintained
151 -// STATIC-THREADED : 1 cache for each thred of the web server
152 -
153 -struct clients_cache {
154 - pid_t pid;
155 -
156 - struct web_client *used; // the structures of the currently connected clients
157 - size_t used_count; // the count the currently connected clients
158 -
159 - struct web_client *avail; // the cached structures, available for future clients
160 - size_t avail_count; // the number of cached structures
161 -
162 - size_t reused; // the number of re-uses
163 - size_t allocated; // the number of allocations
164 -};
165 -
166 -static __thread struct clients_cache web_clients_cache = {
167 - .pid = 0,
168 - .used = NULL,
169 - .used_count = 0,
170 - .avail = NULL,
171 - .avail_count = 0,
172 - .allocated = 0,
173 - .reused = 0
174 -};
175 -
176 -static inline void web_client_cache_verify(int force) {
177 -#ifdef NETDATA_INTERNAL_CHECKS
178 - static __thread size_t count = 0;
179 - count++;
180 -
181 - if(unlikely(force || count > 1000)) {
182 - count = 0;
183 -
184 - struct web_client *w;
185 - size_t used = 0, avail = 0;
186 - for(w = web_clients_cache.used; w ; w = w->next) used++;
187 - for(w = web_clients_cache.avail; w ; w = w->next) avail++;
188 -
189 - info("web_client_cache has %zu (%zu) used and %zu (%zu) available clients, allocated %zu, reused %zu (hit %zu%%)."
190 - , used, web_clients_cache.used_count
191 - , avail, web_clients_cache.avail_count
192 - , web_clients_cache.allocated
193 - , web_clients_cache.reused
194 - , (web_clients_cache.allocated + web_clients_cache.reused)?(web_clients_cache.reused * 100 / (web_clients_cache.allocated + web_clients_cache.reused)):0
195 - );
196 - }
197 -#else
198 - if(unlikely(force)) {
199 - info("web_client_cache has %zu used and %zu available clients, allocated %zu, reused %zu (hit %zu%%)."
200 - , web_clients_cache.used_count
201 - , web_clients_cache.avail_count
202 - , web_clients_cache.allocated
203 - , web_clients_cache.reused
204 - , (web_clients_cache.allocated + web_clients_cache.reused)?(web_clients_cache.reused * 100 / (web_clients_cache.allocated + web_clients_cache.reused)):0
205 - );
206 - }
207 -#endif
208 -}
209 -
210 -// destroy the cache and free all the memory it uses
211 -static void web_client_cache_destroy(void) {
212 -#ifdef NETDATA_INTERNAL_CHECKS
213 - if(unlikely(web_clients_cache.pid != 0 && web_clients_cache.pid != gettid()))
214 - error("Oops! wrong thread accessing the cache. Expected %d, found %d", (int)web_clients_cache.pid, (int)gettid());
215 -
216 - web_client_cache_verify(1);
217 -#endif
218 -
219 - netdata_thread_disable_cancelability();
220 -
221 - struct web_client *w, *t;
222 -
223 - w = web_clients_cache.used;
224 - while(w) {
225 - t = w;
226 - w = w->next;
227 - web_client_free(t);
228 - }
229 - web_clients_cache.used = NULL;
230 - web_clients_cache.used_count = 0;
231 -
232 - w = web_clients_cache.avail;
233 - while(w) {
234 - t = w;
235 - w = w->next;
236 - web_client_free(t);
237 - }
238 - web_clients_cache.avail = NULL;
239 - web_clients_cache.avail_count = 0;
240 -
241 - netdata_thread_enable_cancelability();
242 -}
243 -
244 -static struct web_client *web_client_get_from_cache_or_allocate() {
245 -
246 -#ifdef NETDATA_INTERNAL_CHECKS
247 - if(unlikely(web_clients_cache.pid == 0))
248 - web_clients_cache.pid = gettid();
249 -
250 - if(unlikely(web_clients_cache.pid != 0 && web_clients_cache.pid != gettid()))
251 - error("Oops! wrong thread accessing the cache. Expected %d, found %d", (int)web_clients_cache.pid, (int)gettid());
252 -#endif
253 -
254 - netdata_thread_disable_cancelability();
255 -
256 - struct web_client *w = web_clients_cache.avail;
257 -
258 - if(w) {
259 - // get it from avail
260 - if (w == web_clients_cache.avail) web_clients_cache.avail = w->next;
261 - if(w->prev) w->prev->next = w->next;
262 - if(w->next) w->next->prev = w->prev;
263 - web_clients_cache.avail_count--;
264 - web_client_zero(w);
265 - web_clients_cache.reused++;
266 - }
267 - else {
268 - // allocate it
269 - w = web_client_alloc();
270 - web_clients_cache.allocated++;
271 - }
272 -
273 - // link it to used web clients
274 - if (web_clients_cache.used) web_clients_cache.used->prev = w;
275 - w->next = web_clients_cache.used;
276 - w->prev = NULL;
277 - web_clients_cache.used = w;
278 - web_clients_cache.used_count++;
279 -
280 - // initialize it
281 - w->id = web_client_connected();
282 - w->mode = WEB_CLIENT_MODE_NORMAL;
283 -
284 - netdata_thread_enable_cancelability();
285 -
286 - return w;
287 -}
288 -
289 -static void web_client_release(struct web_client *w) {
290 -#ifdef NETDATA_INTERNAL_CHECKS
291 - if(unlikely(web_clients_cache.pid != 0 && web_clients_cache.pid != gettid()))
292 - error("Oops! wrong thread accessing the cache. Expected %d, found %d", (int)web_clients_cache.pid, (int)gettid());
293 -
294 - if(unlikely(w->running))
295 - error("%llu: releasing web client from %s port %s, but it still running.", w->id, w->client_ip, w->client_port);
296 -#endif
297 -
298 - debug(D_WEB_CLIENT_ACCESS, "%llu: Closing web client from %s port %s.", w->id, w->client_ip, w->client_port);
299 -
300 - log_connection(w, "DISCONNECTED");
301 - web_client_request_done(w);
302 - web_client_disconnected();
303 -
304 - netdata_thread_disable_cancelability();
305 -
306 - if(web_server_mode != WEB_SERVER_MODE_STATIC_THREADED) {
307 - if (w->ifd != -1) close(w->ifd);
308 - if (w->ofd != -1 && w->ofd != w->ifd) close(w->ofd);
309 - w->ifd = w->ofd = -1;
310 - }
311 -
312 - // unlink it from the used
313 - if (w == web_clients_cache.used) web_clients_cache.used = w->next;
314 - if(w->prev) w->prev->next = w->next;
315 - if(w->next) w->next->prev = w->prev;
316 - web_clients_cache.used_count--;
317 -
318 - if(web_clients_cache.avail_count >= 2 * web_clients_cache.used_count) {
319 - // we have too many of them - free it
320 - web_client_free(w);
321 - }
322 - else {
323 - // link it to the avail
324 - if (web_clients_cache.avail) web_clients_cache.avail->prev = w;
325 - w->next = web_clients_cache.avail;
326 - w->prev = NULL;
327 - web_clients_cache.avail = w;
328 - web_clients_cache.avail_count++;
329 - }
330 -
331 - netdata_thread_enable_cancelability();
332 -}
333 -
334 -
335 -// ----------------------------------------------------------------------------
336 -// high level web clients connection management
337 -
338 -static void web_client_initialize_connection(struct web_client *w) {
339 - int flag = 1;
340 -
341 - if(unlikely(web_client_check_tcp(w) && setsockopt(w->ifd, IPPROTO_TCP, TCP_NODELAY, (char *) &flag, sizeof(int)) != 0))
342 - debug(D_WEB_CLIENT, "%llu: failed to enable TCP_NODELAY on socket fd %d.", w->id, w->ifd);
343 -
344 - flag = 1;
345 - if(unlikely(setsockopt(w->ifd, SOL_SOCKET, SO_KEEPALIVE, (char *) &flag, sizeof(int)) != 0))
346 - debug(D_WEB_CLIENT, "%llu: failed to enable SO_KEEPALIVE on socket fd %d.", w->id, w->ifd);
347 -
348 - web_client_update_acl_matches(w);
349 -
350 - w->origin[0] = '*'; w->origin[1] = '\0';
351 - w->cookie1[0] = '\0'; w->cookie2[0] = '\0';
352 - freez(w->user_agent); w->user_agent = NULL;
353 -
354 - web_client_enable_wait_receive(w);
355 -
356 - log_connection(w, "CONNECTED");
357 -
358 - web_client_cache_verify(0);
359 -}
360 -
361 -static struct web_client *web_client_create_on_fd(int fd, const char *client_ip, const char *client_port) {
362 - struct web_client *w;
363 -
364 - w = web_client_get_from_cache_or_allocate();
365 - w->ifd = w->ofd = fd;
366 -
367 - strncpyz(w->client_ip, client_ip, sizeof(w->client_ip) - 1);
368 - strncpyz(w->client_port, client_port, sizeof(w->client_port) - 1);
369 -
370 - if(unlikely(!*w->client_ip)) strcpy(w->client_ip, "-");
371 - if(unlikely(!*w->client_port)) strcpy(w->client_port, "-");
372 -
373 - web_client_initialize_connection(w);
374 - return(w);
375 -}
376 -
377 -static struct web_client *web_client_create_on_listenfd(int listener) {
378 - struct web_client *w;
379 -
380 - w = web_client_get_from_cache_or_allocate();
381 - w->ifd = w->ofd = accept_socket(listener, SOCK_NONBLOCK, w->client_ip, sizeof(w->client_ip), w->client_port, sizeof(w->client_port), web_allow_connections_from);
382 -
383 - if(unlikely(!*w->client_ip)) strcpy(w->client_ip, "-");
384 - if(unlikely(!*w->client_port)) strcpy(w->client_port, "-");
385 -
386 - if (w->ifd == -1) {
387 - if(errno == EPERM)
388 - log_connection(w, "ACCESS DENIED");
389 - else {
390 - log_connection(w, "CONNECTION FAILED");
391 - error("%llu: Failed to accept new incoming connection.", w->id);
392 - }
393 -
394 - web_client_release(w);
395 - return NULL;
396 - }
397 -
398 - web_client_initialize_connection(w);
399 - return(w);
400 -}
401 -
402 -
403 -// --------------------------------------------------------------------------------------
404 -// the thread of a single client - for the MULTI-THREADED web server
405 -
406 -// 1. waits for input and output, using async I/O
407 -// 2. it processes HTTP requests
408 -// 3. it generates HTTP responses
409 -// 4. it copies data from input to output if mode is FILECOPY
410 -
411 -int web_client_timeout = DEFAULT_DISCONNECT_IDLE_WEB_CLIENTS_AFTER_SECONDS;
412 -int web_client_first_request_timeout = DEFAULT_TIMEOUT_TO_RECEIVE_FIRST_WEB_REQUEST;
413 -long web_client_streaming_rate_t = 0L;
414 -
415 -static void multi_threaded_web_client_worker_main_cleanup(void *ptr) {
416 - struct web_client *w = ptr;
417 - WEB_CLIENT_IS_DEAD(w);
418 - w->running = 0;
419 -}
420 -
421 -static void *multi_threaded_web_client_worker_main(void *ptr) {
422 - netdata_thread_cleanup_push(multi_threaded_web_client_worker_main_cleanup, ptr);
423 -
424 - struct web_client *w = ptr;
425 - w->running = 1;
426 -
427 - struct pollfd fds[2], *ifd, *ofd;
428 - int retval, timeout_ms;
429 - nfds_t fdmax = 0;
430 -
431 - while(!netdata_exit) {
432 - if(unlikely(web_client_check_dead(w))) {
433 - debug(D_WEB_CLIENT, "%llu: client is dead.", w->id);
434 - break;
435 - }
436 - else if(unlikely(!web_client_has_wait_receive(w) && !web_client_has_wait_send(w))) {
437 - debug(D_WEB_CLIENT, "%llu: client is not set for neither receiving nor sending data.", w->id);
438 - break;
439 - }
440 -
441 - if(unlikely(w->ifd < 0 || w->ofd < 0)) {
442 - error("%llu: invalid file descriptor, ifd = %d, ofd = %d (required 0 <= fd", w->id, w->ifd, w->ofd);
443 - break;
444 - }
445 -
446 - if(w->ifd == w->ofd) {
447 - fds[0].fd = w->ifd;
448 - fds[0].events = 0;
449 - fds[0].revents = 0;
450 -
451 - if(web_client_has_wait_receive(w)) fds[0].events |= POLLIN;
452 - if(web_client_has_wait_send(w)) fds[0].events |= POLLOUT;
453 -
454 - fds[1].fd = -1;
455 - fds[1].events = 0;
456 - fds[1].revents = 0;
457 -
458 - ifd = ofd = &fds[0];
459 -
460 - fdmax = 1;
461 - }
462 - else {
463 - fds[0].fd = w->ifd;
464 - fds[0].events = 0;
465 - fds[0].revents = 0;
466 - if(web_client_has_wait_receive(w)) fds[0].events |= POLLIN;
467 - ifd = &fds[0];
468 -
469 - fds[1].fd = w->ofd;
470 - fds[1].events = 0;
471 - fds[1].revents = 0;
472 - if(web_client_has_wait_send(w)) fds[1].events |= POLLOUT;
473 - ofd = &fds[1];
474 -
475 - fdmax = 2;
476 - }
477 -
478 - debug(D_WEB_CLIENT, "%llu: Waiting socket async I/O for %s %s", w->id, web_client_has_wait_receive(w)?"INPUT":"", web_client_has_wait_send(w)?"OUTPUT":"");
479 - errno = 0;
480 - timeout_ms = web_client_timeout * 1000;
481 - retval = poll(fds, fdmax, timeout_ms);
482 -
483 - if(unlikely(netdata_exit)) break;
484 -
485 - if(unlikely(retval == -1)) {
486 - if(errno == EAGAIN || errno == EINTR) {
487 - debug(D_WEB_CLIENT, "%llu: EAGAIN received.", w->id);
488 - continue;
489 - }
490 -
491 - debug(D_WEB_CLIENT, "%llu: LISTENER: poll() failed (input fd = %d, output fd = %d). Closing client.", w->id, w->ifd, w->ofd);
492 - break;
493 - }
494 - else if(unlikely(!retval)) {
495 - debug(D_WEB_CLIENT, "%llu: Timeout while waiting socket async I/O for %s %s", w->id, web_client_has_wait_receive(w)?"INPUT":"", web_client_has_wait_send(w)?"OUTPUT":"");
496 - break;
497 - }
498 -
499 - if(unlikely(netdata_exit)) break;
500 -
501 - int used = 0;
502 - if(web_client_has_wait_send(w) && ofd->revents & POLLOUT) {
503 - used++;
504 - if(web_client_send(w) < 0) {
505 - debug(D_WEB_CLIENT, "%llu: Cannot send data to client. Closing client.", w->id);
506 - break;
507 - }
508 - }
509 -
510 - if(unlikely(netdata_exit)) break;
511 -
512 - if(web_client_has_wait_receive(w) && (ifd->revents & POLLIN || ifd->revents & POLLPRI)) {
513 - used++;
514 - if(web_client_receive(w) < 0) {
515 - debug(D_WEB_CLIENT, "%llu: Cannot receive data from client. Closing client.", w->id);
516 - break;
517 - }
518 -
519 - if(w->mode == WEB_CLIENT_MODE_NORMAL) {
520 - debug(D_WEB_CLIENT, "%llu: Attempting to process received data.", w->id);
521 - web_client_process_request(w);
522 -
523 - // if the sockets are closed, may have transferred this client
524 - // to plugins.d
525 - if(unlikely(w->mode == WEB_CLIENT_MODE_STREAM))
526 - break;
527 - }
528 - }
529 -
530 - if(unlikely(!used)) {
531 - debug(D_WEB_CLIENT_ACCESS, "%llu: Received error on socket.", w->id);
532 - break;
533 - }
534 - }
535 -
536 - if(w->mode != WEB_CLIENT_MODE_STREAM)
537 - log_connection(w, "DISCONNECTED");
538 -
539 - web_client_request_done(w);
540 -
541 - debug(D_WEB_CLIENT, "%llu: done...", w->id);
542 -
543 - // close the sockets/files now
544 - // to free file descriptors
545 - if(w->ifd == w->ofd) {
546 - if(w->ifd != -1) close(w->ifd);
547 - }
548 - else {
549 - if(w->ifd != -1) close(w->ifd);
550 - if(w->ofd != -1) close(w->ofd);
551 - }
552 - w->ifd = -1;
553 - w->ofd = -1;
554 -
555 - netdata_thread_cleanup_pop(1);
556 - return NULL;
557 -}
558 -
559 -// --------------------------------------------------------------------------------------
560 -// the main socket listener - MULTI-THREADED
561 -
562 -// 1. it accepts new incoming requests on our port
563 -// 2. creates a new web_client for each connection received
564 -// 3. spawns a new netdata_thread to serve the client (this is optimal for keep-alive clients)
565 -// 4. cleans up old web_clients that their netdata_threads have been exited
566 -
567 -static void web_client_multi_threaded_web_server_release_clients(void) {
568 - struct web_client *w;
569 - for(w = web_clients_cache.used; w ; ) {
570 - if(unlikely(!w->running && web_client_check_dead(w))) {
571 - struct web_client *t = w->next;
572 - web_client_release(w);
573 - w = t;
574 - }
575 - else
576 - w = w->next;
577 - }
578 -}
579 -
580 -static void web_client_multi_threaded_web_server_stop_all_threads(void) {
581 - struct web_client *w;
582 -
583 - int found = 1;
584 - usec_t max = 2 * USEC_PER_SEC, step = 50000;
585 - for(w = web_clients_cache.used; w ; w = w->next) {
586 - if(w->running) {
587 - found++;
588 - info("stopping web client %s, id %llu", w->client_ip, w->id);
589 - netdata_thread_cancel(w->thread);
590 - }
591 - }
592 -
593 - while(found && max > 0) {
594 - max -= step;
595 - info("Waiting %d web threads to finish...", found);
596 - sleep_usec(step);
597 - found = 0;
598 - for(w = web_clients_cache.used; w ; w = w->next)
599 - if(w->running) found++;
600 - }
601 -
602 - if(found)
603 - error("%d web threads are taking too long to finish. Giving up.", found);
604 -}
605 -
606 -static struct pollfd *socket_listen_main_multi_threaded_fds = NULL;
607 -
608 -static void socket_listen_main_multi_threaded_cleanup(void *data) {
609 - struct netdata_static_thread *static_thread = (struct netdata_static_thread *)data;
610 - static_thread->enabled = NETDATA_MAIN_THREAD_EXITING;
611 -
612 - info("cleaning up...");
613 -
614 - info("releasing allocated memory...");
615 - freez(socket_listen_main_multi_threaded_fds);
616 -
617 - info("closing all sockets...");
618 - listen_sockets_close(&api_sockets);
619 -
620 - info("stopping all running web server threads...");
621 - web_client_multi_threaded_web_server_stop_all_threads();
622 -
623 - info("freeing web clients cache...");
624 - web_client_cache_destroy();
625 -
626 - info("cleanup completed.");
627 - static_thread->enabled = NETDATA_MAIN_THREAD_EXITED;
628 -}
629 -
630 -#define CLEANUP_EVERY_EVENTS 60
631 -void *socket_listen_main_multi_threaded(void *ptr) {
632 - netdata_thread_cleanup_push(socket_listen_main_multi_threaded_cleanup, ptr);
633 -
634 - web_server_mode = WEB_SERVER_MODE_MULTI_THREADED;
635 - web_server_is_multithreaded = 1;
636 -
637 - struct web_client *w;
638 - int retval, counter = 0;
639 -
640 - if(!api_sockets.opened)
641 - fatal("LISTENER: No sockets to listen to.");
642 -
643 - socket_listen_main_multi_threaded_fds = callocz(sizeof(struct pollfd), api_sockets.opened);
644 -
645 - size_t i;
646 - for(i = 0; i < api_sockets.opened ;i++) {
647 - socket_listen_main_multi_threaded_fds[i].fd = api_sockets.fds[i];
648 - socket_listen_main_multi_threaded_fds[i].events = POLLIN;
649 - socket_listen_main_multi_threaded_fds[i].revents = 0;
650 -
651 - info("Listening on '%s'", (api_sockets.fds_names[i])?api_sockets.fds_names[i]:"UNKNOWN");
652 - }
653 -
654 - int timeout_ms = 1 * 1000;
655 -
656 - while(!netdata_exit) {
657 -
658 - // debug(D_WEB_CLIENT, "LISTENER: Waiting...");
659 - retval = poll(socket_listen_main_multi_threaded_fds, api_sockets.opened, timeout_ms);
660 -
661 - if(unlikely(retval == -1)) {
662 - error("LISTENER: poll() failed.");
663 - continue;
664 - }
665 - else if(unlikely(!retval)) {
666 - debug(D_WEB_CLIENT, "LISTENER: poll() timeout.");
667 - counter++;
668 - continue;
669 - }
670 -
671 - for(i = 0 ; i < api_sockets.opened ; i++) {
672 - short int revents = socket_listen_main_multi_threaded_fds[i].revents;
673 -
674 - // check for new incoming connections
675 - if(revents & POLLIN || revents & POLLPRI) {
676 - socket_listen_main_multi_threaded_fds[i].revents = 0;
677 -
678 - w = web_client_create_on_listenfd(socket_listen_main_multi_threaded_fds[i].fd);
679 - if(unlikely(!w)) {
680 - // no need for error log - web_client_create_on_listenfd already logged the error
681 - continue;
682 - }
683 -
684 - if(api_sockets.fds_families[i] == AF_UNIX)
685 - web_client_set_unix(w);
686 - else
687 - web_client_set_tcp(w);
688 -
689 - char tag[NETDATA_THREAD_TAG_MAX + 1];
690 - snprintfz(tag, NETDATA_THREAD_TAG_MAX, "WEB_CLIENT[%llu,[%s]:%s]", w->id, w->client_ip, w->client_port);
691 -
692 - w->running = 1;
693 - if(netdata_thread_create(&w->thread, tag, NETDATA_THREAD_OPTION_DONT_LOG, multi_threaded_web_client_worker_main, w) != 0) {
694 - w->running = 0;
695 - web_client_release(w);
696 - }
697 - }
698 - }
699 -
700 - counter++;
701 - if(counter > CLEANUP_EVERY_EVENTS) {
702 - counter = 0;
703 - web_client_multi_threaded_web_server_release_clients();
704 - }
705 - }
706 -
707 - netdata_thread_cleanup_pop(1);
708 - return NULL;
709 -}
710 -
711 -
712 -// --------------------------------------------------------------------------------------
713 -// the main socket listener - SINGLE-THREADED
714 -
715 -struct web_client *single_threaded_clients[FD_SETSIZE];
716 -
717 -static inline int single_threaded_link_client(struct web_client *w, fd_set *ifds, fd_set *ofds, fd_set *efds, int *max) {
718 - if(unlikely(web_client_check_dead(w) || (!web_client_has_wait_receive(w) && !web_client_has_wait_send(w)))) {
719 - return 1;
720 - }
721 -
722 - if(unlikely(w->ifd < 0 || w->ifd >= (int)FD_SETSIZE || w->ofd < 0 || w->ofd >= (int)FD_SETSIZE)) {
723 - error("%llu: invalid file descriptor, ifd = %d, ofd = %d (required 0 <= fd < FD_SETSIZE (%d)", w->id, w->ifd, w->ofd, (int)FD_SETSIZE);
724 - return 1;
725 - }
726 -
727 - FD_SET(w->ifd, efds);
728 - if(unlikely(*max < w->ifd)) *max = w->ifd;
729 -
730 - if(unlikely(w->ifd != w->ofd)) {
731 - if(*max < w->ofd) *max = w->ofd;
732 - FD_SET(w->ofd, efds);
733 - }
734 -
735 - if(web_client_has_wait_receive(w)) FD_SET(w->ifd, ifds);
736 - if(web_client_has_wait_send(w)) FD_SET(w->ofd, ofds);
737 -
738 - single_threaded_clients[w->ifd] = w;
739 - single_threaded_clients[w->ofd] = w;
740 -
741 - return 0;
742 -}
743 -
744 -static inline int single_threaded_unlink_client(struct web_client *w, fd_set *ifds, fd_set *ofds, fd_set *efds) {
745 - FD_CLR(w->ifd, efds);
746 - if(unlikely(w->ifd != w->ofd)) FD_CLR(w->ofd, efds);
747 -
748 - if(web_client_has_wait_receive(w)) FD_CLR(w->ifd, ifds);
749 - if(web_client_has_wait_send(w)) FD_CLR(w->ofd, ofds);
750 -
751 - single_threaded_clients[w->ifd] = NULL;
752 - single_threaded_clients[w->ofd] = NULL;
753 -
754 - if(unlikely(web_client_check_dead(w) || (!web_client_has_wait_receive(w) && !web_client_has_wait_send(w)))) {
755 - return 1;
756 - }
757 -
758 - return 0;
759 -}
760 -
761 -static void socket_listen_main_single_threaded_cleanup(void *data) {
762 - struct netdata_static_thread *static_thread = (struct netdata_static_thread *)data;
763 - static_thread->enabled = NETDATA_MAIN_THREAD_EXITING;
764 -
765 - info("closing all sockets...");
766 - listen_sockets_close(&api_sockets);
767 -
768 - info("freeing web clients cache...");
769 - web_client_cache_destroy();
770 -
771 - info("cleanup completed.");
772 - static_thread->enabled = NETDATA_MAIN_THREAD_EXITED;
773 -}
774 -
775 -void *socket_listen_main_single_threaded(void *ptr) {
776 - netdata_thread_cleanup_push(socket_listen_main_single_threaded_cleanup, ptr);
777 - web_server_mode = WEB_SERVER_MODE_SINGLE_THREADED;
778 - web_server_is_multithreaded = 0;
779 -
780 - struct web_client *w;
781 -
782 - if(!api_sockets.opened)
783 - fatal("LISTENER: no listen sockets available.");
784 -
785 - size_t i;
786 - for(i = 0; i < (size_t)FD_SETSIZE ; i++)
787 - single_threaded_clients[i] = NULL;
788 -
789 - fd_set ifds, ofds, efds, rifds, rofds, refds;
790 - FD_ZERO (&ifds);
791 - FD_ZERO (&ofds);
792 - FD_ZERO (&efds);
793 - int fdmax = 0;
794 -
795 - for(i = 0; i < api_sockets.opened ; i++) {
796 - if (api_sockets.fds[i] < 0 || api_sockets.fds[i] >= (int)FD_SETSIZE)
797 - fatal("LISTENER: Listen socket %d is not ready, or invalid.", api_sockets.fds[i]);
798 -
799 - info("Listening on '%s'", (api_sockets.fds_names[i])?api_sockets.fds_names[i]:"UNKNOWN");
800 -
801 - FD_SET(api_sockets.fds[i], &ifds);
802 - FD_SET(api_sockets.fds[i], &efds);
803 - if(fdmax < api_sockets.fds[i])
804 - fdmax = api_sockets.fds[i];
805 - }
806 -
807 - while(!netdata_exit) {
808 - debug(D_WEB_CLIENT_ACCESS, "LISTENER: single threaded web server waiting (fdmax = %d)...", fdmax);
809 -
810 - struct timeval tv = { .tv_sec = 1, .tv_usec = 0 };
811 - rifds = ifds;
812 - rofds = ofds;
813 - refds = efds;
814 - int retval = select(fdmax+1, &rifds, &rofds, &refds, &tv);
815 -
816 - if(unlikely(retval == -1)) {
817 - error("LISTENER: select() failed.");
818 - continue;
819 - }
820 - else if(likely(retval)) {
821 - debug(D_WEB_CLIENT_ACCESS, "LISTENER: got something.");
822 -
823 - for(i = 0; i < api_sockets.opened ; i++) {
824 - if (FD_ISSET(api_sockets.fds[i], &rifds)) {
825 - debug(D_WEB_CLIENT_ACCESS, "LISTENER: new connection.");
826 - w = web_client_create_on_listenfd(api_sockets.fds[i]);
827 - if(unlikely(!w))
828 - continue;
829 -
830 - if(api_sockets.fds_families[i] == AF_UNIX)
831 - web_client_set_unix(w);
832 - else
833 - web_client_set_tcp(w);
834 -
835 - if (single_threaded_link_client(w, &ifds, &ofds, &ifds, &fdmax) != 0) {
836 - web_client_release(w);
837 - }
838 - }
839 - }
840 -
841 - for(i = 0 ; i <= (size_t)fdmax ; i++) {
842 - if(likely(!FD_ISSET(i, &rifds) && !FD_ISSET(i, &rofds) && !FD_ISSET(i, &refds)))
843 - continue;
844 -
845 - w = single_threaded_clients[i];
846 - if(unlikely(!w)) {
847 - // error("no client on slot %zu", i);
848 - continue;
849 - }
850 -
851 - if(unlikely(single_threaded_unlink_client(w, &ifds, &ofds, &efds) != 0)) {
852 - // error("failed to unlink client %zu", i);
853 - web_client_release(w);
854 - continue;
855 - }
856 -
857 - if (unlikely(FD_ISSET(w->ifd, &refds) || FD_ISSET(w->ofd, &refds))) {
858 - // error("no input on client %zu", i);
859 - web_client_release(w);
860 - continue;
861 - }
862 -
863 - if (unlikely(web_client_has_wait_receive(w) && FD_ISSET(w->ifd, &rifds))) {
864 - if (unlikely(web_client_receive(w) < 0)) {
865 - // error("cannot read from client %zu", i);
866 - web_client_release(w);
867 - continue;
868 - }
869 -
870 - if (w->mode != WEB_CLIENT_MODE_FILECOPY) {
871 - debug(D_WEB_CLIENT, "%llu: Processing received data.", w->id);
872 - web_client_process_request(w);
873 - }
874 - }
875 -
876 - if (unlikely(web_client_has_wait_send(w) && FD_ISSET(w->ofd, &rofds))) {
877 - if (unlikely(web_client_send(w) < 0)) {
878 - // error("cannot send data to client %zu", i);
879 - debug(D_WEB_CLIENT, "%llu: Cannot send data to client. Closing client.", w->id);
880 - web_client_release(w);
881 - continue;
882 - }
883 - }
884 -
885 - if(unlikely(single_threaded_link_client(w, &ifds, &ofds, &efds, &fdmax) != 0)) {
886 - // error("failed to link client %zu", i);
887 - web_client_release(w);
888 - }
889 - }
890 - }
891 - else {
892 - debug(D_WEB_CLIENT_ACCESS, "LISTENER: single threaded web server timeout.");
893 - }
894 - }
895 -
896 - netdata_thread_cleanup_pop(1);
897 - return NULL;
898 -}
899 -
900 -
901 -// --------------------------------------------------------------------------------------
902 -// the main socket listener - STATIC-THREADED
903 -
904 -struct web_server_static_threaded_worker {
905 - netdata_thread_t thread;
906 -
907 - int id;
908 - int running;
909 -
910 - size_t max_sockets;
911 -
912 - volatile size_t connected;
913 - volatile size_t disconnected;
914 - volatile size_t receptions;
915 - volatile size_t sends;
916 - volatile size_t max_concurrent;
917 -
918 - volatile size_t files_read;
919 - volatile size_t file_reads;
920 -};
921 -
922 -static long long static_threaded_workers_count = 1;
923 -static struct web_server_static_threaded_worker *static_workers_private_data = NULL;
924 -static __thread struct web_server_static_threaded_worker *worker_private = NULL;
925 -
926 -// ----------------------------------------------------------------------------
927 -
928 -static inline int web_server_check_client_status(struct web_client *w) {
929 - if(unlikely(web_client_check_dead(w) || (!web_client_has_wait_receive(w) && !web_client_has_wait_send(w))))
930 - return -1;
931 -
932 - return 0;
933 -}
934 -
935 -// ----------------------------------------------------------------------------
936 -// web server files
937 -
938 -static void *web_server_file_add_callback(POLLINFO *pi, short int *events, void *data) {
939 - struct web_client *w = (struct web_client *)data;
940 -
941 - worker_private->files_read++;
942 -
943 - debug(D_WEB_CLIENT, "%llu: ADDED FILE READ ON FD %d", w->id, pi->fd);
944 - *events = POLLIN;
945 - pi->data = w;
946 - return w;
947 -}
948 -
949 -static void web_werver_file_del_callback(POLLINFO *pi) {
950 - struct web_client *w = (struct web_client *)pi->data;
951 - debug(D_WEB_CLIENT, "%llu: RELEASE FILE READ ON FD %d", w->id, pi->fd);
952 -
953 - w->pollinfo_filecopy_slot = 0;
954 -
955 - if(unlikely(!w->pollinfo_slot)) {
956 - debug(D_WEB_CLIENT, "%llu: CROSS WEB CLIENT CLEANUP (iFD %d, oFD %d)", w->id, pi->fd, w->ofd);
957 - web_client_release(w);
958 - }
959 -}
960 -
961 -static int web_server_file_read_callback(POLLINFO *pi, short int *events) {
962 - struct web_client *w = (struct web_client *)pi->data;
963 -
964 - // if there is no POLLINFO linked to this, it means the client disconnected
965 - // stop the file reading too
966 - if(unlikely(!w->pollinfo_slot)) {
967 - debug(D_WEB_CLIENT, "%llu: PREVENTED ATTEMPT TO READ FILE ON FD %d, ON CLOSED WEB CLIENT", w->id, pi->fd);
968 - return -1;
969 - }
970 -
971 - if(unlikely(w->mode != WEB_CLIENT_MODE_FILECOPY || w->ifd == w->ofd)) {
972 - debug(D_WEB_CLIENT, "%llu: PREVENTED ATTEMPT TO READ FILE ON FD %d, ON NON-FILECOPY WEB CLIENT", w->id, pi->fd);
973 - return -1;
974 - }
975 -
976 - debug(D_WEB_CLIENT, "%llu: READING FILE ON FD %d", w->id, pi->fd);
977 -
978 - worker_private->file_reads++;
979 - ssize_t ret = unlikely(web_client_read_file(w));
980 -
981 - if(likely(web_client_has_wait_send(w))) {
982 - POLLJOB *p = pi->p; // our POLLJOB
983 - POLLINFO *wpi = pollinfo_from_slot(p, w->pollinfo_slot); // POLLINFO of the client socket
984 -
985 - debug(D_WEB_CLIENT, "%llu: SIGNALING W TO SEND (iFD %d, oFD %d)", w->id, pi->fd, wpi->fd);
986 - p->fds[wpi->slot].events |= POLLOUT;
987 - }
988 -
989 - if(unlikely(ret <= 0 || w->ifd == w->ofd)) {
990 - debug(D_WEB_CLIENT, "%llu: DONE READING FILE ON FD %d", w->id, pi->fd);
991 - return -1;
992 - }
993 -
994 - *events = POLLIN;
995 - return 0;
996 -}
997 -
998 -static int web_server_file_write_callback(POLLINFO *pi, short int *events) {
999 - (void)pi;
1000 - (void)events;
1001 -
1002 - error("Writing to web files is not supported!");
1003 -
1004 - return -1;
1005 -}
1006 -
1007 -// ----------------------------------------------------------------------------
1008 -// web server clients
1009 -
1010 -static void *web_server_add_callback(POLLINFO *pi, short int *events, void *data) {
1011 - (void)data;
1012 -
1013 - worker_private->connected++;
1014 -
1015 - size_t concurrent = worker_private->connected - worker_private->disconnected;
1016 - if(unlikely(concurrent > worker_private->max_concurrent))
1017 - worker_private->max_concurrent = concurrent;
1018 -
1019 - *events = POLLIN;
1020 -
1021 - debug(D_WEB_CLIENT_ACCESS, "LISTENER on %d: new connection.", pi->fd);
1022 - struct web_client *w = web_client_create_on_fd(pi->fd, pi->client_ip, pi->client_port);
1023 - w->pollinfo_slot = pi->slot;
1024 -
1025 - if(unlikely(pi->socktype == AF_UNIX))
1026 - web_client_set_unix(w);
1027 - else
1028 - web_client_set_tcp(w);
1029 -
1030 - debug(D_WEB_CLIENT, "%llu: ADDED CLIENT FD %d", w->id, pi->fd);
1031 - return w;
1032 -}
1033 -
1034 -// TCP client disconnected
1035 -static void web_server_del_callback(POLLINFO *pi) {
1036 - worker_private->disconnected++;
1037 -
1038 - struct web_client *w = (struct web_client *)pi->data;
1039 -
1040 - w->pollinfo_slot = 0;
1041 - if(unlikely(w->pollinfo_filecopy_slot)) {
1042 - POLLINFO *fpi = pollinfo_from_slot(pi->p, w->pollinfo_filecopy_slot); // POLLINFO of the client socket
1043 - debug(D_WEB_CLIENT, "%llu: THE CLIENT WILL BE FRED BY READING FILE JOB ON FD %d", w->id, fpi->fd);
1044 - }
1045 - else {
1046 - if(web_client_flag_check(w, WEB_CLIENT_FLAG_DONT_CLOSE_SOCKET))
1047 - pi->flags |= POLLINFO_FLAG_DONT_CLOSE;
1048 -
1049 - debug(D_WEB_CLIENT, "%llu: CLOSING CLIENT FD %d", w->id, pi->fd);
1050 - web_client_release(w);
1051 - }
1052 -}
1053 -
1054 -static int web_server_rcv_callback(POLLINFO *pi, short int *events) {
1055 - worker_private->receptions++;
1056 -
1057 - struct web_client *w = (struct web_client *)pi->data;
1058 - int fd = pi->fd;
1059 -
1060 - if(unlikely(web_client_receive(w) < 0))
1061 - return -1;
1062 -
1063 - debug(D_WEB_CLIENT, "%llu: processing received data on fd %d.", w->id, fd);
1064 - web_client_process_request(w);
1065 -
1066 - if(unlikely(w->mode == WEB_CLIENT_MODE_FILECOPY)) {
1067 - if(w->pollinfo_filecopy_slot == 0) {
1068 - debug(D_WEB_CLIENT, "%llu: FILECOPY DETECTED ON FD %d", w->id, pi->fd);
1069 -
1070 - if (unlikely(w->ifd != -1 && w->ifd != w->ofd && w->ifd != fd)) {
1071 - // add a new socket to poll_events, with the same
1072 - debug(D_WEB_CLIENT, "%llu: CREATING FILECOPY SLOT ON FD %d", w->id, pi->fd);
1073 -
1074 - POLLINFO *fpi = poll_add_fd(
1075 - pi->p
1076 - , w->ifd
1077 - , 0
1078 - , POLLINFO_FLAG_CLIENT_SOCKET
1079 - , "FILENAME"
1080 - , ""
1081 - , web_server_file_add_callback
1082 - , web_werver_file_del_callback
1083 - , web_server_file_read_callback
1084 - , web_server_file_write_callback
1085 - , (void *) w
1086 - );
1087 -
1088 - if(fpi)
1089 - w->pollinfo_filecopy_slot = fpi->slot;
1090 - else {
1091 - error("Failed to add filecopy fd. Closing client.");
1092 - return -1;
1093 - }
1094 - }
1095 - }
1096 - }
1097 - else {
1098 - if(unlikely(w->ifd == fd && web_client_has_wait_receive(w)))
1099 - *events |= POLLIN;
1100 - }
1101 -
1102 - if(unlikely(w->ofd == fd && web_client_has_wait_send(w)))
1103 - *events |= POLLOUT;
1104 -
1105 - return web_server_check_client_status(w);
1106 -}
1107 -
1108 -static int web_server_snd_callback(POLLINFO *pi, short int *events) {
1109 - worker_private->sends++;
1110 -
1111 - struct web_client *w = (struct web_client *)pi->data;
1112 - int fd = pi->fd;
1113 -
1114 - debug(D_WEB_CLIENT, "%llu: sending data on fd %d.", w->id, fd);
1115 -
1116 - if(unlikely(web_client_send(w) < 0))
1117 - return -1;
1118 -
1119 - if(unlikely(w->ifd == fd && web_client_has_wait_receive(w)))
1120 - *events |= POLLIN;
1121 -
1122 - if(unlikely(w->ofd == fd && web_client_has_wait_send(w)))
1123 - *events |= POLLOUT;
1124 -
1125 - return web_server_check_client_status(w);
1126 -}
1127 -
1128 -static void web_server_tmr_callback(void *timer_data) {
1129 - worker_private = (struct web_server_static_threaded_worker *)timer_data;
1130 -
1131 - static __thread RRDSET *st = NULL;
1132 - static __thread RRDDIM *rd_user = NULL, *rd_system = NULL;
1133 -
1134 - if(unlikely(!st)) {
1135 - char id[100 + 1];
1136 - char title[100 + 1];
1137 -
1138 - snprintfz(id, 100, "web_thread%d_cpu", worker_private->id + 1);
1139 - snprintfz(title, 100, "NetData web server thread No %d CPU usage", worker_private->id + 1);
1140 -
1141 - st = rrdset_create_localhost(
1142 - "netdata"
1143 - , id
1144 - , NULL
1145 - , "web"
1146 - , "netdata.web_cpu"
1147 - , title
1148 - , "milliseconds/s"
1149 - , "web"
1150 - , "stats"
1151 - , 132000 + worker_private->id
1152 - , default_rrd_update_every
1153 - , RRDSET_TYPE_STACKED
1154 - );
1155 -
1156 - rd_user = rrddim_add(st, "user", NULL, 1, 1000, RRD_ALGORITHM_INCREMENTAL);
1157 - rd_system = rrddim_add(st, "system", NULL, 1, 1000, RRD_ALGORITHM_INCREMENTAL);
1158 - }
1159 - else
1160 - rrdset_next(st);
1161 -
1162 - struct rusage rusage;
1163 - getrusage(RUSAGE_THREAD, &rusage);
1164 - rrddim_set_by_pointer(st, rd_user, rusage.ru_utime.tv_sec * 1000000ULL + rusage.ru_utime.tv_usec);
1165 - rrddim_set_by_pointer(st, rd_system, rusage.ru_stime.tv_sec * 1000000ULL + rusage.ru_stime.tv_usec);
1166 - rrdset_done(st);
1167 -}
1168 -
1169 -// ----------------------------------------------------------------------------
1170 -// web server worker thread
1171 -
1172 -static void socket_listen_main_static_threaded_worker_cleanup(void *ptr) {
1173 - worker_private = (struct web_server_static_threaded_worker *)ptr;
1174 -
1175 - info("freeing local web clients cache...");
1176 - web_client_cache_destroy();
1177 -
1178 - info("stopped after %zu connects, %zu disconnects (max concurrent %zu), %zu receptions and %zu sends",
1179 - worker_private->connected,
1180 - worker_private->disconnected,
1181 - worker_private->max_concurrent,
1182 - worker_private->receptions,
1183 - worker_private->sends
1184 - );
1185 -
1186 - worker_private->running = 0;
1187 -}
1188 -
1189 -void *socket_listen_main_static_threaded_worker(void *ptr) {
1190 - worker_private = (struct web_server_static_threaded_worker *)ptr;
1191 - worker_private->running = 1;
1192 -
1193 - netdata_thread_cleanup_push(socket_listen_main_static_threaded_worker_cleanup, ptr);
1194 -
1195 - poll_events(&api_sockets
1196 - , web_server_add_callback
1197 - , web_server_del_callback
1198 - , web_server_rcv_callback
1199 - , web_server_snd_callback
1200 - , web_server_tmr_callback
1201 - , web_allow_connections_from
1202 - , NULL
1203 - , web_client_first_request_timeout
1204 - , web_client_timeout
1205 - , default_rrd_update_every * 1000 // timer_milliseconds
1206 - , ptr // timer_data
1207 - , worker_private->max_sockets
1208 - );
1209 -
1210 - netdata_thread_cleanup_pop(1);
1211 - return NULL;
1212 -}
1213 -
1214 -
1215 -// ----------------------------------------------------------------------------
1216 -// web server main thread - also becomes a worker
1217 -
1218 -static void socket_listen_main_static_threaded_cleanup(void *ptr) {
1219 - struct netdata_static_thread *static_thread = (struct netdata_static_thread *)ptr;
1220 - static_thread->enabled = NETDATA_MAIN_THREAD_EXITING;
1221 -
1222 - int i, found = 0;
1223 - usec_t max = 2 * USEC_PER_SEC, step = 50000;
1224 -
1225 - // we start from 1, - 0 is self
1226 - for(i = 1; i < static_threaded_workers_count; i++) {
1227 - if(static_workers_private_data[i].running) {
1228 - found++;
1229 - info("stopping worker %d", i + 1);
1230 - netdata_thread_cancel(static_workers_private_data[i].thread);
1231 - }
1232 - else
1233 - info("found stopped worker %d", i + 1);
1234 - }
1235 -
1236 - while(found && max > 0) {
1237 - max -= step;
1238 - info("Waiting %d static web threads to finish...", found);
1239 - sleep_usec(step);
1240 - found = 0;
1241 -
1242 - // we start from 1, - 0 is self
1243 - for(i = 1; i < static_threaded_workers_count; i++) {
1244 - if (static_workers_private_data[i].running)
1245 - found++;
1246 - }
1247 - }
1248 -
1249 - if(found)
1250 - error("%d static web threads are taking too long to finish. Giving up.", found);
1251 -
1252 - info("closing all web server sockets...");
1253 - listen_sockets_close(&api_sockets);
1254 -
1255 - info("all static web threads stopped.");
1256 - static_thread->enabled = NETDATA_MAIN_THREAD_EXITED;
1257 -}
1258 -
1259 -void *socket_listen_main_static_threaded(void *ptr) {
1260 - netdata_thread_cleanup_push(socket_listen_main_static_threaded_cleanup, ptr);
1261 - web_server_mode = WEB_SERVER_MODE_STATIC_THREADED;
1262 -
1263 - if(!api_sockets.opened)
1264 - fatal("LISTENER: no listen sockets available.");
1265 -
1266 - // 6 threads is the optimal value
1267 - // since 6 are the parallel connections browsers will do
1268 - // so, if the machine has more CPUs, avoid using resources unnecessarily
1269 - int def_thread_count = (processors > 6)?6:processors;
1270 -
1271 - static_threaded_workers_count = config_get_number(CONFIG_SECTION_WEB, "web server threads", def_thread_count);
1272 - if(static_threaded_workers_count < 1) static_threaded_workers_count = 1;
1273 -
1274 - size_t max_sockets = (size_t)config_get_number(CONFIG_SECTION_WEB, "web server max sockets", (long long int)(rlimit_nofile.rlim_cur / 2));
1275 -
1276 - static_workers_private_data = callocz((size_t)static_threaded_workers_count, sizeof(struct web_server_static_threaded_worker));
1277 -
1278 - web_server_is_multithreaded = (static_threaded_workers_count > 1);
1279 -
1280 - int i;
1281 - for(i = 1; i < static_threaded_workers_count; i++) {
1282 - static_workers_private_data[i].id = i;
1283 - static_workers_private_data[i].max_sockets = max_sockets / static_threaded_workers_count;
1284 -
1285 - char tag[50 + 1];
1286 - snprintfz(tag, 50, "WEB_SERVER[static%d]", i+1);
1287 -
1288 - info("starting worker %d", i+1);
1289 - netdata_thread_create(&static_workers_private_data[i].thread, tag, NETDATA_THREAD_OPTION_DEFAULT, socket_listen_main_static_threaded_worker, (void *)&static_workers_private_data[i]);
1290 - }
1291 -
1292 - // and the main one
1293 - static_workers_private_data[0].max_sockets = max_sockets / static_threaded_workers_count;
1294 - socket_listen_main_static_threaded_worker((void *)&static_workers_private_data[0]);
1295 -
1296 - netdata_thread_cleanup_pop(1);
1297 - return NULL;
1298 -}
streaming/Makefile.am new
+12
@@ -0,0 +1,12 @@
1 +# SPDX-License-Identifier: GPL-3.0-or-later
2 +
3 +AUTOMAKE_OPTIONS = subdir-objects
4 +MAINTAINERCLEANFILES = $(srcdir)/Makefile.in
5 +
6 +dist_libconfig_DATA = \
7 + stream.conf \
8 + $(NULL)
9 +
10 +dist_noinst_DATA = \
11 + README.md \
12 + $(NULL)
streaming/README.md
streaming/rrdpush.c renamed
streaming/rrdpush.h renamed
+2 -2
@@ -3,8 +3,8 @@
3 #ifndef NETDATA_RRDPUSH_H
4 #define NETDATA_RRDPUSH_H 1
5
6 -#include "../webserver/web_client.h"
7 -#include "../common.h"
6 +#include "web/server/web_client.h"
7 +#include "daemon/common.h"
8
9 extern unsigned int default_rrdpush_enabled;
10 extern char *default_rrdpush_destination;
streaming/stream.conf renamed
system/Makefile.am
+6 -1
@@ -4,6 +4,7 @@
4 #
5 MAINTAINERCLEANFILES= $(srcdir)/Makefile.in
6 CLEANFILES = \
7 + edit-config \
8 netdata-openrc \
9 netdata.logrotate \
10 netdata.service \
@@ -14,10 +15,14 @@ CLEANFILES = \
15 $(NULL)
16
17 include $(top_srcdir)/build/subst.inc
17 -
18 SUFFIXES = .in
19
20 +dist_config_SCRIPTS = \
21 + edit-config \
22 + $(NULL)
23 +
24 nodist_noinst_DATA = \
25 + edit-config.in \
26 netdata-openrc \
27 netdata.logrotate \
28 netdata.service \
system/edit-config.in renamed
tests/Makefile.am
+2 -1
@@ -1,5 +1,6 @@
1 # SPDX-License-Identifier: GPL-3.0-or-later
2 -MAINTAINERCLEANFILES= $(srcdir)/Makefile.in
2 +
3 +MAINTAINERCLEANFILES = $(srcdir)/Makefile.in
4
5 dist_noinst_DATA = \
6 README.md \
tests/profile/benchmark-line-parsing.c
+70 -26
@@ -383,9 +383,15 @@ struct base {
383 };
384
385 static inline void callback(void *data1, void *data2) {
386 - char *string = data1;
387 - unsigned long long *value = data2;
388 - *value = fast_strtoull(string);
386 + char *string = data1;
387 + unsigned long long *value = data2;
388 + *value = fast_strtoull(string);
389 +}
390 +
391 +static inline void callback_system_strtoull(void *data1, void *data2) {
392 + char *string = data1;
393 + unsigned long long *value = data2;
394 + *value = strtoull(string, NULL, 10);
395 }
396
397
@@ -415,7 +421,7 @@ static inline struct base *entry(struct base *base, const char *name, void *data
421 static inline int check(struct base *base, const char *s) {
422 uint32_t hash = simple_hash2(s);
423
418 - if(likely(hash == base->last->hash && !strcmp(s, base->last->name))) {
424 + if(likely(!strcmp(s, base->last->name))) {
425 base->last->found = 1;
426 base->found++;
427 if(base->last->func) base->last->func(base->last->data1, base->last->data2);
@@ -514,17 +520,17 @@ void test6() {
520 static struct base *base = NULL;
521
522 if(unlikely(!base)) {
517 - base = entry(base, "cache", NUMBER1, &values6[0], callback);
518 - base = entry(base, "rss", NUMBER2, &values6[1], callback);
519 - base = entry(base, "rss_huge", NUMBER3, &values6[2], callback);
520 - base = entry(base, "mapped_file", NUMBER4, &values6[3], callback);
521 - base = entry(base, "writeback", NUMBER5, &values6[4], callback);
522 - base = entry(base, "dirty", NUMBER6, &values6[5], callback);
523 - base = entry(base, "swap", NUMBER7, &values6[6], callback);
524 - base = entry(base, "pgpgin", NUMBER8, &values6[7], callback);
525 - base = entry(base, "pgpgout", NUMBER9, &values6[8], callback);
526 - base = entry(base, "pgfault", NUMBER10, &values6[9], callback);
527 - base = entry(base, "pgmajfault", NUMBER11, &values6[10], callback);
523 + base = entry(base, "cache", NUMBER1, &values6[0], callback_system_strtoull);
524 + base = entry(base, "rss", NUMBER2, &values6[1], callback_system_strtoull);
525 + base = entry(base, "rss_huge", NUMBER3, &values6[2], callback_system_strtoull);
526 + base = entry(base, "mapped_file", NUMBER4, &values6[3], callback_system_strtoull);
527 + base = entry(base, "writeback", NUMBER5, &values6[4], callback_system_strtoull);
528 + base = entry(base, "dirty", NUMBER6, &values6[5], callback_system_strtoull);
529 + base = entry(base, "swap", NUMBER7, &values6[6], callback_system_strtoull);
530 + base = entry(base, "pgpgin", NUMBER8, &values6[7], callback_system_strtoull);
531 + base = entry(base, "pgpgout", NUMBER9, &values6[8], callback_system_strtoull);
532 + base = entry(base, "pgfault", NUMBER10, &values6[9], callback_system_strtoull);
533 + base = entry(base, "pgmajfault", NUMBER11, &values6[10], callback_system_strtoull);
534 }
535
536 begin(base);
@@ -536,6 +542,33 @@ void test6() {
542 }
543 }
544
545 +void test7() {
546 +
547 + static struct base *base = NULL;
548 +
549 + if(unlikely(!base)) {
550 + base = entry(base, "cache", NUMBER1, &values6[0], callback);
551 + base = entry(base, "rss", NUMBER2, &values6[1], callback);
552 + base = entry(base, "rss_huge", NUMBER3, &values6[2], callback);
553 + base = entry(base, "mapped_file", NUMBER4, &values6[3], callback);
554 + base = entry(base, "writeback", NUMBER5, &values6[4], callback);
555 + base = entry(base, "dirty", NUMBER6, &values6[5], callback);
556 + base = entry(base, "swap", NUMBER7, &values6[6], callback);
557 + base = entry(base, "pgpgin", NUMBER8, &values6[7], callback);
558 + base = entry(base, "pgpgout", NUMBER9, &values6[8], callback);
559 + base = entry(base, "pgfault", NUMBER10, &values6[9], callback);
560 + base = entry(base, "pgmajfault", NUMBER11, &values6[10], callback);
561 + }
562 +
563 + begin(base);
564 +
565 + int i;
566 + for(i = 0; strings[i] ; i++) {
567 + if(check(base, strings[i]))
568 + break;
569 + }
570 +}
571 +
572 // ----------------------------------------------------------------------------
573
574
@@ -615,8 +648,13 @@ void main(void)
648 (void)strcmp("1", "2");
649 (void)strtoull("123", NULL, 0);
650
618 - unsigned long i, c1 = 0, c2 = 0, c3 = 0, c4 = 0, c5 = 0, c6 = 0;
619 - unsigned long max = 200000;
651 + unsigned long i, c1 = 0, c2 = 0, c3 = 0, c4 = 0, c5 = 0, c6 = 0, c7;
652 + unsigned long max = 1000000;
653 +
654 + // let the processor get up to speed
655 + begin_clock();
656 + for(i = 0; i <= max ;i++) test1();
657 + c1 = end_clock();
658
659 begin_clock();
660 for(i = 0; i <= max ;i++) test1();
@@ -638,26 +676,32 @@ void main(void)
676 for(i = 0; i <= max ;i++) test5();
677 c5 = end_clock();
678
641 - begin_clock();
642 - for(i = 0; i <= max ;i++) test6();
643 - c6 = end_clock();
679 + begin_clock();
680 + for(i = 0; i <= max ;i++) test6();
681 + c6 = end_clock();
682 +
683 + begin_clock();
684 + for(i = 0; i <= max ;i++) test7();
685 + c7 = end_clock();
686
645 - for(i = 0; i < 11 ; i++)
687 + for(i = 0; i < 11 ; i++)
688 printf("value %lu: %llu %llu %llu %llu %llu %llu\n", i, values1[i], values2[i], values3[i], values4[i], values5[i], values6[i]);
689
690 printf("\n\nRESULTS\n");
649 - printf("test1() in %lu usecs: simple system strcmp().\n"
650 - "test2() in %lu usecs: inline simple_hash() with system strtoull().\n"
691 + printf("test1() in %lu usecs: if-else-if-else-if, simple strcmp() with system strtoull().\n"
692 + "test2() in %lu usecs: inline simple_hash() if-else-if-else-if, with system strtoull().\n"
693 "test3() in %lu usecs: statement expression simple_hash(), system strtoull().\n"
652 - "test4() in %lu usecs: inline simple_hash(), if-continue checks.\n"
653 - "test5() in %lu usecs: inline simple_hash(), if-else-if-else-if (netdata default).\n"
654 - "test6() in %lu usecs: adaptive re-sortable array (wow!)\n"
694 + "test4() in %lu usecs: inline simple_hash(), if-continue checks, system strtoull().\n"
695 + "test5() in %lu usecs: inline simple_hash(), if-else-if-else-if, custom strtoull() (netdata default prior to ARL).\n"
696 + "test6() in %lu usecs: adaptive re-sortable list, system strtoull() (wow!)\n"
697 + "test7() in %lu usecs: adaptive re-sortable list, custom strtoull() (wow!)\n"
698 , c1
699 , c2
700 , c3
701 , c4
702 , c5
703 , c6
704 + , c7
705 );
706
707 }
web/Makefile.am
+9 -116
@@ -1,121 +1,14 @@
1 -#
2 -# Copyright (C) 2015 Alon Bar-Lev <alon.barlev@gmail.com>
1 # SPDX-License-Identifier: GPL-3.0-or-later
4 -#
5 -MAINTAINERCLEANFILES= $(srcdir)/Makefile.in
2
7 -dist_web_DATA = \
8 - demo.html \
9 - demo2.html \
10 - demosites.html \
11 - demosites2.html \
12 - dashboard.html \
13 - dashboard.js \
14 - dashboard_info.js \
15 - dashboard_info_custom_example.js \
16 - dashboard.css \
17 - dashboard.slate.css \
18 - favicon.ico \
19 - goto-host-from-alarm.html \
20 - index.html \
21 - infographic.html \
22 - netdata-swagger.yaml \
23 - netdata-swagger.json \
24 - robots.txt \
25 - refresh-badges.js \
26 - registry.html \
27 - sitemap.xml \
28 - tv.html \
29 - version.txt \
30 - $(NULL)
31 -
32 -weblibdir=$(webdir)/lib
33 -dist_weblib_DATA = \
34 - lib/bootstrap-3.3.7.min.js \
35 - lib/bootstrap-slider-10.0.0.min.js \
36 - lib/bootstrap-table-1.11.0.min.js \
37 - lib/bootstrap-table-export-1.11.0.min.js \
38 - lib/bootstrap-toggle-2.2.2.min.js \
39 - lib/clipboard-polyfill-be05dad.js \
40 - lib/c3-0.4.18.min.js \
41 - lib/d3-4.12.2.min.js \
42 - lib/d3pie-0.2.1-netdata-3.js \
43 - lib/dygraph-c91c859.min.js \
44 - lib/dygraph-smooth-plotter-c91c859.js \
45 - lib/fontawesome-all-5.0.1.min.js \
46 - lib/gauge-1.3.2.min.js \
47 - lib/jquery-2.2.4.min.js \
48 - lib/jquery.easypiechart-97b5824.min.js \
49 - lib/jquery.peity-3.2.0.min.js \
50 - lib/jquery.sparkline-2.1.2.min.js \
51 - lib/lz-string-1.4.4.min.js \
52 - lib/morris-0.5.1.min.js \
53 - lib/pako-1.0.6.min.js \
54 - lib/perfect-scrollbar-0.6.15.min.js \
55 - lib/raphael-2.2.4-min.js \
56 - lib/tableExport-1.6.0.min.js \
57 - $(NULL)
3 +AUTOMAKE_OPTIONS = subdir-objects
4 +MAINTAINERCLEANFILES = $(srcdir)/Makefile.in
5
59 -webcssdir=$(webdir)/css
60 -dist_webcss_DATA = \
61 - css/morris-0.5.1.css \
62 - css/bootstrap-3.3.7.css \
63 - css/bootstrap-theme-3.3.7.min.css \
64 - css/bootstrap-slate-flat-3.3.7.css \
65 - css/bootstrap-slider-10.0.0.min.css \
66 - css/bootstrap-toggle-2.2.2.min.css \
67 - css/c3-0.4.18.min.css \
68 - $(NULL)
6 +SUBDIRS = \
7 + api \
8 + gui \
9 + server \
10 + $(NULL)
11
70 -webfontsdir=$(webdir)/fonts
71 -dist_webfonts_DATA = \
72 - fonts/glyphicons-halflings-regular.eot \
73 - fonts/glyphicons-halflings-regular.svg \
74 - fonts/glyphicons-halflings-regular.ttf \
75 - fonts/glyphicons-halflings-regular.woff \
76 - fonts/glyphicons-halflings-regular.woff2 \
12 +dist_noinst_DATA = \
13 + README.md \
14 $(NULL)
78 -
79 -webimagesdir=$(webdir)/images
80 -dist_webimages_DATA = \
81 - images/alert-128-orange.png \
82 - images/alert-128-red.png \
83 - images/alert-multi-size-orange.ico \
84 - images/alert-multi-size-red.ico \
85 - images/animated.gif \
86 - images/check-mark-2-128-green.png \
87 - images/check-mark-2-multi-size-green.ico \
88 - images/netdata.svg \
89 - images/post.png \
90 - images/seo-performance-16.png \
91 - images/seo-performance-24.png \
92 - images/seo-performance-32.png \
93 - images/seo-performance-48.png \
94 - images/seo-performance-64.png \
95 - images/seo-performance-72.png \
96 - images/seo-performance-114.png \
97 - images/seo-performance-128.png \
98 - images/seo-performance-256.png \
99 - images/seo-performance-512.png \
100 - images/seo-performance-multi-size.ico \
101 - images/seo-performance-multi-size.icns \
102 - $(NULL)
103 -
104 -
105 -webwellknowndir=$(webdir)/.well-known
106 -dist_webwellknown_DATA = \
107 - $(NULL)
108 -
109 -webdntdir=$(webdir)/.well-known/dnt
110 -dist_webdnt_DATA = \
111 - .well-known/dnt/cookies \
112 - $(NULL)
113 -
114 -version.txt:
115 - if test -d "$(top_srcdir)/.git"; then \
116 - git --git-dir="$(top_srcdir)/.git" log -n 1 --format=%H; \
117 - fi > $@.tmp
118 - test -s $@.tmp || echo 0 > $@.tmp
119 - mv $@.tmp $@
120 -
121 -.PHONY: version.txt
web/README.md
web/api/Makefile.am new
+8
@@ -0,0 +1,8 @@
1 +# SPDX-License-Identifier: GPL-3.0-or-later
2 +
3 +AUTOMAKE_OPTIONS = subdir-objects
4 +MAINTAINERCLEANFILES = $(srcdir)/Makefile.in
5 +
6 +dist_noinst_DATA = \
7 + README.md \
8 + $(NULL)
web/api/README.md
web/api/rrd2json.c renamed
web/api/rrd2json.h renamed
web/api/web_api_v1.c renamed
web/api/web_api_v1.h renamed
+1 -1
@@ -3,7 +3,7 @@
3 #ifndef NETDATA_WEB_API_V1_H
4 #define NETDATA_WEB_API_V1_H 1
5
6 -#include "../common.h"
6 +#include "daemon/common.h"
7 #include "web_buffer_svg.h"
8 #include "rrd2json.h"
9
web/api/web_buffer_svg.c renamed
+1 -1
@@ -1,6 +1,6 @@
1 // SPDX-License-Identifier: GPL-3.0-or-later
2
3 -#include "../common.h"
3 +#include "web_buffer_svg.h"
4
5 #define BADGE_HORIZONTAL_PADDING 4
6 #define VERDANA_KERNING 0.2
web/api/web_buffer_svg.h renamed
web/gui/.well-known/dnt/cookies renamed
web/gui/Makefile.am new
+125
@@ -0,0 +1,125 @@
1 +#
2 +# Copyright (C) 2015 Alon Bar-Lev <alon.barlev@gmail.com>
3 +# SPDX-License-Identifier: GPL-3.0-or-later
4 +#
5 +MAINTAINERCLEANFILES= $(srcdir)/Makefile.in
6 +
7 +dist_noinst_DATA = \
8 + README.md \
9 + $(NULL)
10 +
11 +dist_web_DATA = \
12 + demo.html \
13 + demo2.html \
14 + demosites.html \
15 + demosites2.html \
16 + dashboard.html \
17 + dashboard.js \
18 + dashboard_info.js \
19 + dashboard_info_custom_example.js \
20 + dashboard.css \
21 + dashboard.slate.css \
22 + favicon.ico \
23 + goto-host-from-alarm.html \
24 + index.html \
25 + infographic.html \
26 + netdata-swagger.yaml \
27 + netdata-swagger.json \
28 + robots.txt \
29 + refresh-badges.js \
30 + registry.html \
31 + sitemap.xml \
32 + tv.html \
33 + version.txt \
34 + $(NULL)
35 +
36 +weblibdir=$(webdir)/lib
37 +dist_weblib_DATA = \
38 + lib/bootstrap-3.3.7.min.js \
39 + lib/bootstrap-slider-10.0.0.min.js \
40 + lib/bootstrap-table-1.11.0.min.js \
41 + lib/bootstrap-table-export-1.11.0.min.js \
42 + lib/bootstrap-toggle-2.2.2.min.js \
43 + lib/clipboard-polyfill-be05dad.js \
44 + lib/c3-0.4.18.min.js \
45 + lib/d3-4.12.2.min.js \
46 + lib/d3pie-0.2.1-netdata-3.js \
47 + lib/dygraph-c91c859.min.js \
48 + lib/dygraph-smooth-plotter-c91c859.js \
49 + lib/fontawesome-all-5.0.1.min.js \
50 + lib/gauge-1.3.2.min.js \
51 + lib/jquery-2.2.4.min.js \
52 + lib/jquery.easypiechart-97b5824.min.js \
53 + lib/jquery.peity-3.2.0.min.js \
54 + lib/jquery.sparkline-2.1.2.min.js \
55 + lib/lz-string-1.4.4.min.js \
56 + lib/morris-0.5.1.min.js \
57 + lib/pako-1.0.6.min.js \
58 + lib/perfect-scrollbar-0.6.15.min.js \
59 + lib/raphael-2.2.4-min.js \
60 + lib/tableExport-1.6.0.min.js \
61 + $(NULL)
62 +
63 +webcssdir=$(webdir)/css
64 +dist_webcss_DATA = \
65 + css/morris-0.5.1.css \
66 + css/bootstrap-3.3.7.css \
67 + css/bootstrap-theme-3.3.7.min.css \
68 + css/bootstrap-slate-flat-3.3.7.css \
69 + css/bootstrap-slider-10.0.0.min.css \
70 + css/bootstrap-toggle-2.2.2.min.css \
71 + css/c3-0.4.18.min.css \
72 + $(NULL)
73 +
74 +webfontsdir=$(webdir)/fonts
75 +dist_webfonts_DATA = \
76 + fonts/glyphicons-halflings-regular.eot \
77 + fonts/glyphicons-halflings-regular.svg \
78 + fonts/glyphicons-halflings-regular.ttf \
79 + fonts/glyphicons-halflings-regular.woff \
80 + fonts/glyphicons-halflings-regular.woff2 \
81 + $(NULL)
82 +
83 +webimagesdir=$(webdir)/images
84 +dist_webimages_DATA = \
85 + images/alert-128-orange.png \
86 + images/alert-128-red.png \
87 + images/alert-multi-size-orange.ico \
88 + images/alert-multi-size-red.ico \
89 + images/animated.gif \
90 + images/check-mark-2-128-green.png \
91 + images/check-mark-2-multi-size-green.ico \
92 + images/netdata.svg \
93 + images/post.png \
94 + images/seo-performance-16.png \
95 + images/seo-performance-24.png \
96 + images/seo-performance-32.png \
97 + images/seo-performance-48.png \
98 + images/seo-performance-64.png \
99 + images/seo-performance-72.png \
100 + images/seo-performance-114.png \
101 + images/seo-performance-128.png \
102 + images/seo-performance-256.png \
103 + images/seo-performance-512.png \
104 + images/seo-performance-multi-size.ico \
105 + images/seo-performance-multi-size.icns \
106 + $(NULL)
107 +
108 +
109 +webwellknowndir=$(webdir)/.well-known
110 +dist_webwellknown_DATA = \
111 + $(NULL)
112 +
113 +webdntdir=$(webdir)/.well-known/dnt
114 +dist_webdnt_DATA = \
115 + .well-known/dnt/cookies \
116 + $(NULL)
117 +
118 +version.txt:
119 + if test -d "$(top_srcdir)/.git"; then \
120 + git --git-dir="$(top_srcdir)/.git" log -n 1 --format=%H; \
121 + fi > $@.tmp
122 + test -s $@.tmp || echo 0 > $@.tmp
123 + mv $@.tmp $@
124 +
125 +.PHONY: version.txt
web/gui/README.md
web/gui/css/bootstrap-3.3.7.css renamed
web/gui/css/bootstrap-slate-flat-3.3.7.css renamed
web/gui/css/bootstrap-slider-10.0.0.min.css renamed
web/gui/css/bootstrap-theme-3.3.7.min.css renamed
web/gui/css/bootstrap-toggle-2.2.2.min.css renamed
web/gui/css/c3-0.4.18.min.css renamed
web/gui/css/morris-0.5.1.css renamed
web/gui/dashboard.css renamed
web/gui/dashboard.html renamed
web/gui/dashboard.js renamed
web/gui/dashboard.slate.css renamed
web/gui/dashboard_info.js renamed
web/gui/dashboard_info_custom_example.js renamed
web/gui/demo.html renamed
web/gui/demo2.html renamed
web/gui/demosites.html renamed
+2 -2
@@ -706,9 +706,9 @@ p {
706 and APM metrics via the embedded <b><a href="https://github.com/netdata/netdata/wiki/statsd" target="_blank" data-ga-category="Outbound links" data-ga-action="Nav click" data-ga-label=statsd>statsd server</a></b>.
707 </div>
708 <div class=grid-cell><h3><span class=star>&#x2605;</span> Out of the box</h3>
709 - <p>netdata supports <a href="https://github.com/netdata/netdata/tree/master/conf.d/python.d" target="_blank" data-ga-category="Outbound links" data-ga-action="Nav click" data-ga-label=AutoDetection>auto-detection</a> for everything. It collects more than 5000 metrics automatically, with
709 + <p>netdata supports <a href="https://github.com/netdata/netdata/tree/master/collectors/python.d.plugin" target="_blank" data-ga-category="Outbound links" data-ga-action="Nav click" data-ga-label=AutoDetection>auto-detection</a> for everything. It collects more than 5000 metrics automatically, with
710 <strong>zero configuration</strong>, it has <strong>zero dependencies</strong>, requires <strong>zero
711 - maintenance</strong> and comes with more than <a href="https://github.com/netdata/netdata/tree/master/conf.d/health.d" target="_blank" data-ga-category="Outbound links" data-ga-action="Nav click" data-ga-label=AlarmConfigs>100 alarms</a> pre-configured to detect common
711 + maintenance</strong> and comes with more than <a href="https://github.com/netdata/netdata/tree/master/health/health.d" target="_blank" data-ga-category="Outbound links" data-ga-action="Nav click" data-ga-label=AlarmConfigs>100 alarms</a> pre-configured to detect common
712 failures, performance and availability issues.
713 </div>
714 <div class=grid-cell><h3><span class=star>&#x2605;</span> In real-time</h3>
web/gui/demosites2.html renamed
web/gui/favicon.ico renamed
web/gui/fonts/glyphicons-halflings-regular.eot renamed
web/gui/fonts/glyphicons-halflings-regular.svg renamed
web/gui/fonts/glyphicons-halflings-regular.ttf renamed
web/gui/fonts/glyphicons-halflings-regular.woff renamed
web/gui/fonts/glyphicons-halflings-regular.woff2 renamed
web/gui/goto-host-from-alarm.html renamed
web/gui/images/README.md renamed
web/gui/images/alert-128-orange.png renamed
web/gui/images/alert-128-red.png renamed
web/gui/images/alert-multi-size-orange.ico renamed
web/gui/images/alert-multi-size-red.ico renamed
web/gui/images/animated.gif renamed
web/gui/images/check-mark-2-128-green.png renamed
web/gui/images/check-mark-2-multi-size-green.ico renamed
web/gui/images/netdata.svg renamed
web/gui/images/post.png renamed
web/gui/images/seo-performance-114.png renamed
web/gui/images/seo-performance-128.png renamed
web/gui/images/seo-performance-16.png renamed
web/gui/images/seo-performance-24.png renamed
web/gui/images/seo-performance-256.png renamed
web/gui/images/seo-performance-32.png renamed
web/gui/images/seo-performance-48.png renamed
web/gui/images/seo-performance-512.png renamed
web/gui/images/seo-performance-64.png renamed
web/gui/images/seo-performance-72.png renamed
web/gui/images/seo-performance-multi-size.icns renamed
web/gui/images/seo-performance-multi-size.ico renamed
web/gui/index.html renamed
web/gui/infographic.html renamed
web/gui/lib/bootstrap-3.3.7.min.js renamed
web/gui/lib/bootstrap-slider-10.0.0.min.js renamed
web/gui/lib/bootstrap-table-1.11.0.min.js renamed
web/gui/lib/bootstrap-table-export-1.11.0.min.js renamed
web/gui/lib/bootstrap-toggle-2.2.2.min.js renamed
web/gui/lib/c3-0.4.18.min.js renamed
web/gui/lib/clipboard-polyfill-be05dad.js renamed
web/gui/lib/d3-4.12.2.min.js renamed
web/gui/lib/d3pie-0.2.1-netdata-3.js renamed
web/gui/lib/dygraph-c91c859.min.js renamed
web/gui/lib/dygraph-smooth-plotter-c91c859.js renamed
web/gui/lib/fontawesome-all-5.0.1.min.js renamed
web/gui/lib/gauge-1.3.2.min.js renamed
web/gui/lib/jquery-2.2.4.min.js renamed
web/gui/lib/jquery.easypiechart-97b5824.min.js renamed
web/gui/lib/jquery.peity-3.2.0.min.js renamed
web/gui/lib/jquery.sparkline-2.1.2.min.js renamed
web/gui/lib/lz-string-1.4.4.min.js renamed
web/gui/lib/morris-0.5.1.min.js renamed
web/gui/lib/pako-1.0.6.min.js renamed
web/gui/lib/perfect-scrollbar-0.6.15.min.js renamed
web/gui/lib/raphael-2.2.4-min.js renamed
web/gui/lib/tableExport-1.6.0.min.js renamed
web/gui/netdata-swagger.json renamed
web/gui/netdata-swagger.yaml renamed
web/gui/refresh-badges.js renamed
web/gui/registry.html renamed
web/gui/robots.txt renamed
web/gui/sitemap.xml renamed
web/gui/tv.html renamed
web/server/Makefile.am new
+14
@@ -0,0 +1,14 @@
1 +# SPDX-License-Identifier: GPL-3.0-or-later
2 +
3 +AUTOMAKE_OPTIONS = subdir-objects
4 +MAINTAINERCLEANFILES = $(srcdir)/Makefile.in
5 +
6 +SUBDIRS = \
7 + single \
8 + multi \
9 + static \
10 + $(NULL)
11 +
12 +dist_noinst_DATA = \
13 + README.md \
14 + $(NULL)
web/server/README.md
web/server/multi/Makefile.am new
+11
@@ -0,0 +1,11 @@
1 +# SPDX-License-Identifier: GPL-3.0-or-later
2 +
3 +AUTOMAKE_OPTIONS = subdir-objects
4 +MAINTAINERCLEANFILES = $(srcdir)/Makefile.in
5 +
6 +SUBDIRS = \
7 + $(NULL)
8 +
9 +dist_noinst_DATA = \
10 + README.md \
11 + $(NULL)
web/server/multi/README.md
web/server/multi/multi-threaded.c new
+314
@@ -0,0 +1,314 @@
1 +// SPDX-License-Identifier: GPL-3.0-or-later
2 +
3 +#define WEB_SERVER_INTERNALS 1
4 +#include "multi-threaded.h"
5 +
6 +// --------------------------------------------------------------------------------------
7 +// the thread of a single client - for the MULTI-THREADED web server
8 +
9 +// 1. waits for input and output, using async I/O
10 +// 2. it processes HTTP requests
11 +// 3. it generates HTTP responses
12 +// 4. it copies data from input to output if mode is FILECOPY
13 +
14 +int web_client_timeout = DEFAULT_DISCONNECT_IDLE_WEB_CLIENTS_AFTER_SECONDS;
15 +int web_client_first_request_timeout = DEFAULT_TIMEOUT_TO_RECEIVE_FIRST_WEB_REQUEST;
16 +long web_client_streaming_rate_t = 0L;
17 +
18 +static void multi_threaded_web_client_worker_main_cleanup(void *ptr) {
19 + struct web_client *w = ptr;
20 + WEB_CLIENT_IS_DEAD(w);
21 + w->running = 0;
22 +}
23 +
24 +static void *multi_threaded_web_client_worker_main(void *ptr) {
25 + netdata_thread_cleanup_push(multi_threaded_web_client_worker_main_cleanup, ptr);
26 +
27 + struct web_client *w = ptr;
28 + w->running = 1;
29 +
30 + struct pollfd fds[2], *ifd, *ofd;
31 + int retval, timeout_ms;
32 + nfds_t fdmax = 0;
33 +
34 + while(!netdata_exit) {
35 + if(unlikely(web_client_check_dead(w))) {
36 + debug(D_WEB_CLIENT, "%llu: client is dead.", w->id);
37 + break;
38 + }
39 + else if(unlikely(!web_client_has_wait_receive(w) && !web_client_has_wait_send(w))) {
40 + debug(D_WEB_CLIENT, "%llu: client is not set for neither receiving nor sending data.", w->id);
41 + break;
42 + }
43 +
44 + if(unlikely(w->ifd < 0 || w->ofd < 0)) {
45 + error("%llu: invalid file descriptor, ifd = %d, ofd = %d (required 0 <= fd", w->id, w->ifd, w->ofd);
46 + break;
47 + }
48 +
49 + if(w->ifd == w->ofd) {
50 + fds[0].fd = w->ifd;
51 + fds[0].events = 0;
52 + fds[0].revents = 0;
53 +
54 + if(web_client_has_wait_receive(w)) fds[0].events |= POLLIN;
55 + if(web_client_has_wait_send(w)) fds[0].events |= POLLOUT;
56 +
57 + fds[1].fd = -1;
58 + fds[1].events = 0;
59 + fds[1].revents = 0;
60 +
61 + ifd = ofd = &fds[0];
62 +
63 + fdmax = 1;
64 + }
65 + else {
66 + fds[0].fd = w->ifd;
67 + fds[0].events = 0;
68 + fds[0].revents = 0;
69 + if(web_client_has_wait_receive(w)) fds[0].events |= POLLIN;
70 + ifd = &fds[0];
71 +
72 + fds[1].fd = w->ofd;
73 + fds[1].events = 0;
74 + fds[1].revents = 0;
75 + if(web_client_has_wait_send(w)) fds[1].events |= POLLOUT;
76 + ofd = &fds[1];
77 +
78 + fdmax = 2;
79 + }
80 +
81 + debug(D_WEB_CLIENT, "%llu: Waiting socket async I/O for %s %s", w->id, web_client_has_wait_receive(w)?"INPUT":"", web_client_has_wait_send(w)?"OUTPUT":"");
82 + errno = 0;
83 + timeout_ms = web_client_timeout * 1000;
84 + retval = poll(fds, fdmax, timeout_ms);
85 +
86 + if(unlikely(netdata_exit)) break;
87 +
88 + if(unlikely(retval == -1)) {
89 + if(errno == EAGAIN || errno == EINTR) {
90 + debug(D_WEB_CLIENT, "%llu: EAGAIN received.", w->id);
91 + continue;
92 + }
93 +
94 + debug(D_WEB_CLIENT, "%llu: LISTENER: poll() failed (input fd = %d, output fd = %d). Closing client.", w->id, w->ifd, w->ofd);
95 + break;
96 + }
97 + else if(unlikely(!retval)) {
98 + debug(D_WEB_CLIENT, "%llu: Timeout while waiting socket async I/O for %s %s", w->id, web_client_has_wait_receive(w)?"INPUT":"", web_client_has_wait_send(w)?"OUTPUT":"");
99 + break;
100 + }
101 +
102 + if(unlikely(netdata_exit)) break;
103 +
104 + int used = 0;
105 + if(web_client_has_wait_send(w) && ofd->revents & POLLOUT) {
106 + used++;
107 + if(web_client_send(w) < 0) {
108 + debug(D_WEB_CLIENT, "%llu: Cannot send data to client. Closing client.", w->id);
109 + break;
110 + }
111 + }
112 +
113 + if(unlikely(netdata_exit)) break;
114 +
115 + if(web_client_has_wait_receive(w) && (ifd->revents & POLLIN || ifd->revents & POLLPRI)) {
116 + used++;
117 + if(web_client_receive(w) < 0) {
118 + debug(D_WEB_CLIENT, "%llu: Cannot receive data from client. Closing client.", w->id);
119 + break;
120 + }
121 +
122 + if(w->mode == WEB_CLIENT_MODE_NORMAL) {
123 + debug(D_WEB_CLIENT, "%llu: Attempting to process received data.", w->id);
124 + web_client_process_request(w);
125 +
126 + // if the sockets are closed, may have transferred this client
127 + // to plugins.d
128 + if(unlikely(w->mode == WEB_CLIENT_MODE_STREAM))
129 + break;
130 + }
131 + }
132 +
133 + if(unlikely(!used)) {
134 + debug(D_WEB_CLIENT_ACCESS, "%llu: Received error on socket.", w->id);
135 + break;
136 + }
137 + }
138 +
139 + if(w->mode != WEB_CLIENT_MODE_STREAM)
140 + web_server_log_connection(w, "DISCONNECTED");
141 +
142 + web_client_request_done(w);
143 +
144 + debug(D_WEB_CLIENT, "%llu: done...", w->id);
145 +
146 + // close the sockets/files now
147 + // to free file descriptors
148 + if(w->ifd == w->ofd) {
149 + if(w->ifd != -1) close(w->ifd);
150 + }
151 + else {
152 + if(w->ifd != -1) close(w->ifd);
153 + if(w->ofd != -1) close(w->ofd);
154 + }
155 + w->ifd = -1;
156 + w->ofd = -1;
157 +
158 + netdata_thread_cleanup_pop(1);
159 + return NULL;
160 +}
161 +
162 +// --------------------------------------------------------------------------------------
163 +// the main socket listener - MULTI-THREADED
164 +
165 +// 1. it accepts new incoming requests on our port
166 +// 2. creates a new web_client for each connection received
167 +// 3. spawns a new netdata_thread to serve the client (this is optimal for keep-alive clients)
168 +// 4. cleans up old web_clients that their netdata_threads have been exited
169 +
170 +static void web_client_multi_threaded_web_server_release_clients(void) {
171 + struct web_client *w;
172 + for(w = web_clients_cache.used; w ; ) {
173 + if(unlikely(!w->running && web_client_check_dead(w))) {
174 + struct web_client *t = w->next;
175 + web_client_release(w);
176 + w = t;
177 + }
178 + else
179 + w = w->next;
180 + }
181 +}
182 +
183 +static void web_client_multi_threaded_web_server_stop_all_threads(void) {
184 + struct web_client *w;
185 +
186 + int found = 1;
187 + usec_t max = 2 * USEC_PER_SEC, step = 50000;
188 + for(w = web_clients_cache.used; w ; w = w->next) {
189 + if(w->running) {
190 + found++;
191 + info("stopping web client %s, id %llu", w->client_ip, w->id);
192 + netdata_thread_cancel(w->thread);
193 + }
194 + }
195 +
196 + while(found && max > 0) {
197 + max -= step;
198 + info("Waiting %d web threads to finish...", found);
199 + sleep_usec(step);
200 + found = 0;
201 + for(w = web_clients_cache.used; w ; w = w->next)
202 + if(w->running) found++;
203 + }
204 +
205 + if(found)
206 + error("%d web threads are taking too long to finish. Giving up.", found);
207 +}
208 +
209 +static struct pollfd *socket_listen_main_multi_threaded_fds = NULL;
210 +
211 +static void socket_listen_main_multi_threaded_cleanup(void *data) {
212 + struct netdata_static_thread *static_thread = (struct netdata_static_thread *)data;
213 + static_thread->enabled = NETDATA_MAIN_THREAD_EXITING;
214 +
215 + info("cleaning up...");
216 +
217 + info("releasing allocated memory...");
218 + freez(socket_listen_main_multi_threaded_fds);
219 +
220 + info("closing all sockets...");
221 + listen_sockets_close(&api_sockets);
222 +
223 + info("stopping all running web server threads...");
224 + web_client_multi_threaded_web_server_stop_all_threads();
225 +
226 + info("freeing web clients cache...");
227 + web_client_cache_destroy();
228 +
229 + info("cleanup completed.");
230 + static_thread->enabled = NETDATA_MAIN_THREAD_EXITED;
231 +}
232 +
233 +#define CLEANUP_EVERY_EVENTS 60
234 +void *socket_listen_main_multi_threaded(void *ptr) {
235 + netdata_thread_cleanup_push(socket_listen_main_multi_threaded_cleanup, ptr);
236 +
237 + web_server_mode = WEB_SERVER_MODE_MULTI_THREADED;
238 + web_server_is_multithreaded = 1;
239 +
240 + struct web_client *w;
241 + int retval, counter = 0;
242 +
243 + if(!api_sockets.opened)
244 + fatal("LISTENER: No sockets to listen to.");
245 +
246 + socket_listen_main_multi_threaded_fds = callocz(sizeof(struct pollfd), api_sockets.opened);
247 +
248 + size_t i;
249 + for(i = 0; i < api_sockets.opened ;i++) {
250 + socket_listen_main_multi_threaded_fds[i].fd = api_sockets.fds[i];
251 + socket_listen_main_multi_threaded_fds[i].events = POLLIN;
252 + socket_listen_main_multi_threaded_fds[i].revents = 0;
253 +
254 + info("Listening on '%s'", (api_sockets.fds_names[i])?api_sockets.fds_names[i]:"UNKNOWN");
255 + }
256 +
257 + int timeout_ms = 1 * 1000;
258 +
259 + while(!netdata_exit) {
260 +
261 + // debug(D_WEB_CLIENT, "LISTENER: Waiting...");
262 + retval = poll(socket_listen_main_multi_threaded_fds, api_sockets.opened, timeout_ms);
263 +
264 + if(unlikely(retval == -1)) {
265 + error("LISTENER: poll() failed.");
266 + continue;
267 + }
268 + else if(unlikely(!retval)) {
269 + debug(D_WEB_CLIENT, "LISTENER: poll() timeout.");
270 + counter++;
271 + continue;
272 + }
273 +
274 + for(i = 0 ; i < api_sockets.opened ; i++) {
275 + short int revents = socket_listen_main_multi_threaded_fds[i].revents;
276 +
277 + // check for new incoming connections
278 + if(revents & POLLIN || revents & POLLPRI) {
279 + socket_listen_main_multi_threaded_fds[i].revents = 0;
280 +
281 + w = web_client_create_on_listenfd(socket_listen_main_multi_threaded_fds[i].fd);
282 + if(unlikely(!w)) {
283 + // no need for error log - web_client_create_on_listenfd already logged the error
284 + continue;
285 + }
286 +
287 + if(api_sockets.fds_families[i] == AF_UNIX)
288 + web_client_set_unix(w);
289 + else
290 + web_client_set_tcp(w);
291 +
292 + char tag[NETDATA_THREAD_TAG_MAX + 1];
293 + snprintfz(tag, NETDATA_THREAD_TAG_MAX, "WEB_CLIENT[%llu,[%s]:%s]", w->id, w->client_ip, w->client_port);
294 +
295 + w->running = 1;
296 + if(netdata_thread_create(&w->thread, tag, NETDATA_THREAD_OPTION_DONT_LOG, multi_threaded_web_client_worker_main, w) != 0) {
297 + w->running = 0;
298 + web_client_release(w);
299 + }
300 + }
301 + }
302 +
303 + counter++;
304 + if(counter > CLEANUP_EVERY_EVENTS) {
305 + counter = 0;
306 + web_client_multi_threaded_web_server_release_clients();
307 + }
308 + }
309 +
310 + netdata_thread_cleanup_pop(1);
311 + return NULL;
312 +}
313 +
314 +
web/server/multi/multi-threaded.h new
+10
@@ -0,0 +1,10 @@
1 +// SPDX-License-Identifier: GPL-3.0-or-later
2 +
3 +#ifndef NETDATA_WEB_SERVER_MULTI_THREADED_H
4 +#define NETDATA_WEB_SERVER_MULTI_THREADED_H
5 +
6 +#include "web/server/web_server.h"
7 +
8 +extern void *socket_listen_main_multi_threaded(void *ptr);
9 +
10 +#endif //NETDATA_WEB_SERVER_MULTI_THREADED_H
web/server/single/Makefile.am new
+11
@@ -0,0 +1,11 @@
1 +# SPDX-License-Identifier: GPL-3.0-or-later
2 +
3 +AUTOMAKE_OPTIONS = subdir-objects
4 +MAINTAINERCLEANFILES = $(srcdir)/Makefile.in
5 +
6 +SUBDIRS = \
7 + $(NULL)
8 +
9 +dist_noinst_DATA = \
10 + README.md \
11 + $(NULL)
web/server/single/README.md
web/server/single/single-threaded.c new
+194
@@ -0,0 +1,194 @@
1 +// SPDX-License-Identifier: GPL-3.0-or-later
2 +
3 +#define WEB_SERVER_INTERNALS 1
4 +#include "single-threaded.h"
5 +
6 +// --------------------------------------------------------------------------------------
7 +// the main socket listener - SINGLE-THREADED
8 +
9 +struct web_client *single_threaded_clients[FD_SETSIZE];
10 +
11 +static inline int single_threaded_link_client(struct web_client *w, fd_set *ifds, fd_set *ofds, fd_set *efds, int *max) {
12 + if(unlikely(web_client_check_dead(w) || (!web_client_has_wait_receive(w) && !web_client_has_wait_send(w)))) {
13 + return 1;
14 + }
15 +
16 + if(unlikely(w->ifd < 0 || w->ifd >= (int)FD_SETSIZE || w->ofd < 0 || w->ofd >= (int)FD_SETSIZE)) {
17 + error("%llu: invalid file descriptor, ifd = %d, ofd = %d (required 0 <= fd < FD_SETSIZE (%d)", w->id, w->ifd, w->ofd, (int)FD_SETSIZE);
18 + return 1;
19 + }
20 +
21 + FD_SET(w->ifd, efds);
22 + if(unlikely(*max < w->ifd)) *max = w->ifd;
23 +
24 + if(unlikely(w->ifd != w->ofd)) {
25 + if(*max < w->ofd) *max = w->ofd;
26 + FD_SET(w->ofd, efds);
27 + }
28 +
29 + if(web_client_has_wait_receive(w)) FD_SET(w->ifd, ifds);
30 + if(web_client_has_wait_send(w)) FD_SET(w->ofd, ofds);
31 +
32 + single_threaded_clients[w->ifd] = w;
33 + single_threaded_clients[w->ofd] = w;
34 +
35 + return 0;
36 +}
37 +
38 +static inline int single_threaded_unlink_client(struct web_client *w, fd_set *ifds, fd_set *ofds, fd_set *efds) {
39 + FD_CLR(w->ifd, efds);
40 + if(unlikely(w->ifd != w->ofd)) FD_CLR(w->ofd, efds);
41 +
42 + if(web_client_has_wait_receive(w)) FD_CLR(w->ifd, ifds);
43 + if(web_client_has_wait_send(w)) FD_CLR(w->ofd, ofds);
44 +
45 + single_threaded_clients[w->ifd] = NULL;
46 + single_threaded_clients[w->ofd] = NULL;
47 +
48 + if(unlikely(web_client_check_dead(w) || (!web_client_has_wait_receive(w) && !web_client_has_wait_send(w)))) {
49 + return 1;
50 + }
51 +
52 + return 0;
53 +}
54 +
55 +static void socket_listen_main_single_threaded_cleanup(void *data) {
56 + struct netdata_static_thread *static_thread = (struct netdata_static_thread *)data;
57 + static_thread->enabled = NETDATA_MAIN_THREAD_EXITING;
58 +
59 + info("closing all sockets...");
60 + listen_sockets_close(&api_sockets);
61 +
62 + info("freeing web clients cache...");
63 + web_client_cache_destroy();
64 +
65 + info("cleanup completed.");
66 + static_thread->enabled = NETDATA_MAIN_THREAD_EXITED;
67 +}
68 +
69 +void *socket_listen_main_single_threaded(void *ptr) {
70 + netdata_thread_cleanup_push(socket_listen_main_single_threaded_cleanup, ptr);
71 + web_server_mode = WEB_SERVER_MODE_SINGLE_THREADED;
72 + web_server_is_multithreaded = 0;
73 +
74 + struct web_client *w;
75 +
76 + if(!api_sockets.opened)
77 + fatal("LISTENER: no listen sockets available.");
78 +
79 + size_t i;
80 + for(i = 0; i < (size_t)FD_SETSIZE ; i++)
81 + single_threaded_clients[i] = NULL;
82 +
83 + fd_set ifds, ofds, efds, rifds, rofds, refds;
84 + FD_ZERO (&ifds);
85 + FD_ZERO (&ofds);
86 + FD_ZERO (&efds);
87 + int fdmax = 0;
88 +
89 + for(i = 0; i < api_sockets.opened ; i++) {
90 + if (api_sockets.fds[i] < 0 || api_sockets.fds[i] >= (int)FD_SETSIZE)
91 + fatal("LISTENER: Listen socket %d is not ready, or invalid.", api_sockets.fds[i]);
92 +
93 + info("Listening on '%s'", (api_sockets.fds_names[i])?api_sockets.fds_names[i]:"UNKNOWN");
94 +
95 + FD_SET(api_sockets.fds[i], &ifds);
96 + FD_SET(api_sockets.fds[i], &efds);
97 + if(fdmax < api_sockets.fds[i])
98 + fdmax = api_sockets.fds[i];
99 + }
100 +
101 + while(!netdata_exit) {
102 + debug(D_WEB_CLIENT_ACCESS, "LISTENER: single threaded web server waiting (fdmax = %d)...", fdmax);
103 +
104 + struct timeval tv = { .tv_sec = 1, .tv_usec = 0 };
105 + rifds = ifds;
106 + rofds = ofds;
107 + refds = efds;
108 + int retval = select(fdmax+1, &rifds, &rofds, &refds, &tv);
109 +
110 + if(unlikely(retval == -1)) {
111 + error("LISTENER: select() failed.");
112 + continue;
113 + }
114 + else if(likely(retval)) {
115 + debug(D_WEB_CLIENT_ACCESS, "LISTENER: got something.");
116 +
117 + for(i = 0; i < api_sockets.opened ; i++) {
118 + if (FD_ISSET(api_sockets.fds[i], &rifds)) {
119 + debug(D_WEB_CLIENT_ACCESS, "LISTENER: new connection.");
120 + w = web_client_create_on_listenfd(api_sockets.fds[i]);
121 + if(unlikely(!w))
122 + continue;
123 +
124 + if(api_sockets.fds_families[i] == AF_UNIX)
125 + web_client_set_unix(w);
126 + else
127 + web_client_set_tcp(w);
128 +
129 + if (single_threaded_link_client(w, &ifds, &ofds, &ifds, &fdmax) != 0) {
130 + web_client_release(w);
131 + }
132 + }
133 + }
134 +
135 + for(i = 0 ; i <= (size_t)fdmax ; i++) {
136 + if(likely(!FD_ISSET(i, &rifds) && !FD_ISSET(i, &rofds) && !FD_ISSET(i, &refds)))
137 + continue;
138 +
139 + w = single_threaded_clients[i];
140 + if(unlikely(!w)) {
141 + // error("no client on slot %zu", i);
142 + continue;
143 + }
144 +
145 + if(unlikely(single_threaded_unlink_client(w, &ifds, &ofds, &efds) != 0)) {
146 + // error("failed to unlink client %zu", i);
147 + web_client_release(w);
148 + continue;
149 + }
150 +
151 + if (unlikely(FD_ISSET(w->ifd, &refds) || FD_ISSET(w->ofd, &refds))) {
152 + // error("no input on client %zu", i);
153 + web_client_release(w);
154 + continue;
155 + }
156 +
157 + if (unlikely(web_client_has_wait_receive(w) && FD_ISSET(w->ifd, &rifds))) {
158 + if (unlikely(web_client_receive(w) < 0)) {
159 + // error("cannot read from client %zu", i);
160 + web_client_release(w);
161 + continue;
162 + }
163 +
164 + if (w->mode != WEB_CLIENT_MODE_FILECOPY) {
165 + debug(D_WEB_CLIENT, "%llu: Processing received data.", w->id);
166 + web_client_process_request(w);
167 + }
168 + }
169 +
170 + if (unlikely(web_client_has_wait_send(w) && FD_ISSET(w->ofd, &rofds))) {
171 + if (unlikely(web_client_send(w) < 0)) {
172 + // error("cannot send data to client %zu", i);
173 + debug(D_WEB_CLIENT, "%llu: Cannot send data to client. Closing client.", w->id);
174 + web_client_release(w);
175 + continue;
176 + }
177 + }
178 +
179 + if(unlikely(single_threaded_link_client(w, &ifds, &ofds, &efds, &fdmax) != 0)) {
180 + // error("failed to link client %zu", i);
181 + web_client_release(w);
182 + }
183 + }
184 + }
185 + else {
186 + debug(D_WEB_CLIENT_ACCESS, "LISTENER: single threaded web server timeout.");
187 + }
188 + }
189 +
190 + netdata_thread_cleanup_pop(1);
191 + return NULL;
192 +}
193 +
194 +
web/server/single/single-threaded.h new
+10
@@ -0,0 +1,10 @@
1 +// SPDX-License-Identifier: GPL-3.0-or-later
2 +
3 +#ifndef NETDATA_WEB_SERVER_SINGLE_THREADED_H
4 +#define NETDATA_WEB_SERVER_SINGLE_THREADED_H
5 +
6 +#include "web/server/web_server.h"
7 +
8 +extern void *socket_listen_main_single_threaded(void *ptr);
9 +
10 +#endif //NETDATA_WEB_SERVER_SINGLE_THREADED_H
web/server/static/Makefile.am new
+11
@@ -0,0 +1,11 @@
1 +# SPDX-License-Identifier: GPL-3.0-or-later
2 +
3 +AUTOMAKE_OPTIONS = subdir-objects
4 +MAINTAINERCLEANFILES = $(srcdir)/Makefile.in
5 +
6 +SUBDIRS = \
7 + $(NULL)
8 +
9 +dist_noinst_DATA = \
10 + README.md \
11 + $(NULL)
web/server/static/README.md
web/server/static/static-threaded.c new
+422
@@ -0,0 +1,422 @@
1 +// SPDX-License-Identifier: GPL-3.0-or-later
2 +
3 +#define WEB_SERVER_INTERNALS 1
4 +#include "static-threaded.h"
5 +
6 +// ----------------------------------------------------------------------------
7 +// high level web clients connection management
8 +
9 +static struct web_client *web_client_create_on_fd(int fd, const char *client_ip, const char *client_port) {
10 + struct web_client *w;
11 +
12 + w = web_client_get_from_cache_or_allocate();
13 + w->ifd = w->ofd = fd;
14 +
15 + strncpyz(w->client_ip, client_ip, sizeof(w->client_ip) - 1);
16 + strncpyz(w->client_port, client_port, sizeof(w->client_port) - 1);
17 +
18 + if(unlikely(!*w->client_ip)) strcpy(w->client_ip, "-");
19 + if(unlikely(!*w->client_port)) strcpy(w->client_port, "-");
20 +
21 + web_client_initialize_connection(w);
22 + return(w);
23 +}
24 +
25 +// --------------------------------------------------------------------------------------
26 +// the main socket listener - STATIC-THREADED
27 +
28 +struct web_server_static_threaded_worker {
29 + netdata_thread_t thread;
30 +
31 + int id;
32 + int running;
33 +
34 + size_t max_sockets;
35 +
36 + volatile size_t connected;
37 + volatile size_t disconnected;
38 + volatile size_t receptions;
39 + volatile size_t sends;
40 + volatile size_t max_concurrent;
41 +
42 + volatile size_t files_read;
43 + volatile size_t file_reads;
44 +};
45 +
46 +static long long static_threaded_workers_count = 1;
47 +static struct web_server_static_threaded_worker *static_workers_private_data = NULL;
48 +static __thread struct web_server_static_threaded_worker *worker_private = NULL;
49 +
50 +// ----------------------------------------------------------------------------
51 +
52 +static inline int web_server_check_client_status(struct web_client *w) {
53 + if(unlikely(web_client_check_dead(w) || (!web_client_has_wait_receive(w) && !web_client_has_wait_send(w))))
54 + return -1;
55 +
56 + return 0;
57 +}
58 +
59 +// ----------------------------------------------------------------------------
60 +// web server files
61 +
62 +static void *web_server_file_add_callback(POLLINFO *pi, short int *events, void *data) {
63 + struct web_client *w = (struct web_client *)data;
64 +
65 + worker_private->files_read++;
66 +
67 + debug(D_WEB_CLIENT, "%llu: ADDED FILE READ ON FD %d", w->id, pi->fd);
68 + *events = POLLIN;
69 + pi->data = w;
70 + return w;
71 +}
72 +
73 +static void web_werver_file_del_callback(POLLINFO *pi) {
74 + struct web_client *w = (struct web_client *)pi->data;
75 + debug(D_WEB_CLIENT, "%llu: RELEASE FILE READ ON FD %d", w->id, pi->fd);
76 +
77 + w->pollinfo_filecopy_slot = 0;
78 +
79 + if(unlikely(!w->pollinfo_slot)) {
80 + debug(D_WEB_CLIENT, "%llu: CROSS WEB CLIENT CLEANUP (iFD %d, oFD %d)", w->id, pi->fd, w->ofd);
81 + web_client_release(w);
82 + }
83 +}
84 +
85 +static int web_server_file_read_callback(POLLINFO *pi, short int *events) {
86 + struct web_client *w = (struct web_client *)pi->data;
87 +
88 + // if there is no POLLINFO linked to this, it means the client disconnected
89 + // stop the file reading too
90 + if(unlikely(!w->pollinfo_slot)) {
91 + debug(D_WEB_CLIENT, "%llu: PREVENTED ATTEMPT TO READ FILE ON FD %d, ON CLOSED WEB CLIENT", w->id, pi->fd);
92 + return -1;
93 + }
94 +
95 + if(unlikely(w->mode != WEB_CLIENT_MODE_FILECOPY || w->ifd == w->ofd)) {
96 + debug(D_WEB_CLIENT, "%llu: PREVENTED ATTEMPT TO READ FILE ON FD %d, ON NON-FILECOPY WEB CLIENT", w->id, pi->fd);
97 + return -1;
98 + }
99 +
100 + debug(D_WEB_CLIENT, "%llu: READING FILE ON FD %d", w->id, pi->fd);
101 +
102 + worker_private->file_reads++;
103 + ssize_t ret = unlikely(web_client_read_file(w));
104 +
105 + if(likely(web_client_has_wait_send(w))) {
106 + POLLJOB *p = pi->p; // our POLLJOB
107 + POLLINFO *wpi = pollinfo_from_slot(p, w->pollinfo_slot); // POLLINFO of the client socket
108 +
109 + debug(D_WEB_CLIENT, "%llu: SIGNALING W TO SEND (iFD %d, oFD %d)", w->id, pi->fd, wpi->fd);
110 + p->fds[wpi->slot].events |= POLLOUT;
111 + }
112 +
113 + if(unlikely(ret <= 0 || w->ifd == w->ofd)) {
114 + debug(D_WEB_CLIENT, "%llu: DONE READING FILE ON FD %d", w->id, pi->fd);
115 + return -1;
116 + }
117 +
118 + *events = POLLIN;
119 + return 0;
120 +}
121 +
122 +static int web_server_file_write_callback(POLLINFO *pi, short int *events) {
123 + (void)pi;
124 + (void)events;
125 +
126 + error("Writing to web files is not supported!");
127 +
128 + return -1;
129 +}
130 +
131 +// ----------------------------------------------------------------------------
132 +// web server clients
133 +
134 +static void *web_server_add_callback(POLLINFO *pi, short int *events, void *data) {
135 + (void)data;
136 +
137 + worker_private->connected++;
138 +
139 + size_t concurrent = worker_private->connected - worker_private->disconnected;
140 + if(unlikely(concurrent > worker_private->max_concurrent))
141 + worker_private->max_concurrent = concurrent;
142 +
143 + *events = POLLIN;
144 +
145 + debug(D_WEB_CLIENT_ACCESS, "LISTENER on %d: new connection.", pi->fd);
146 + struct web_client *w = web_client_create_on_fd(pi->fd, pi->client_ip, pi->client_port);
147 + w->pollinfo_slot = pi->slot;
148 +
149 + if(unlikely(pi->socktype == AF_UNIX))
150 + web_client_set_unix(w);
151 + else
152 + web_client_set_tcp(w);
153 +
154 + debug(D_WEB_CLIENT, "%llu: ADDED CLIENT FD %d", w->id, pi->fd);
155 + return w;
156 +}
157 +
158 +// TCP client disconnected
159 +static void web_server_del_callback(POLLINFO *pi) {
160 + worker_private->disconnected++;
161 +
162 + struct web_client *w = (struct web_client *)pi->data;
163 +
164 + w->pollinfo_slot = 0;
165 + if(unlikely(w->pollinfo_filecopy_slot)) {
166 + POLLINFO *fpi = pollinfo_from_slot(pi->p, w->pollinfo_filecopy_slot); // POLLINFO of the client socket
167 + debug(D_WEB_CLIENT, "%llu: THE CLIENT WILL BE FRED BY READING FILE JOB ON FD %d", w->id, fpi->fd);
168 + }
169 + else {
170 + if(web_client_flag_check(w, WEB_CLIENT_FLAG_DONT_CLOSE_SOCKET))
171 + pi->flags |= POLLINFO_FLAG_DONT_CLOSE;
172 +
173 + debug(D_WEB_CLIENT, "%llu: CLOSING CLIENT FD %d", w->id, pi->fd);
174 + web_client_release(w);
175 + }
176 +}
177 +
178 +static int web_server_rcv_callback(POLLINFO *pi, short int *events) {
179 + worker_private->receptions++;
180 +
181 + struct web_client *w = (struct web_client *)pi->data;
182 + int fd = pi->fd;
183 +
184 + if(unlikely(web_client_receive(w) < 0))
185 + return -1;
186 +
187 + debug(D_WEB_CLIENT, "%llu: processing received data on fd %d.", w->id, fd);
188 + web_client_process_request(w);
189 +
190 + if(unlikely(w->mode == WEB_CLIENT_MODE_FILECOPY)) {
191 + if(w->pollinfo_filecopy_slot == 0) {
192 + debug(D_WEB_CLIENT, "%llu: FILECOPY DETECTED ON FD %d", w->id, pi->fd);
193 +
194 + if (unlikely(w->ifd != -1 && w->ifd != w->ofd && w->ifd != fd)) {
195 + // add a new socket to poll_events, with the same
196 + debug(D_WEB_CLIENT, "%llu: CREATING FILECOPY SLOT ON FD %d", w->id, pi->fd);
197 +
198 + POLLINFO *fpi = poll_add_fd(
199 + pi->p
200 + , w->ifd
201 + , 0
202 + , POLLINFO_FLAG_CLIENT_SOCKET
203 + , "FILENAME"
204 + , ""
205 + , web_server_file_add_callback
206 + , web_werver_file_del_callback
207 + , web_server_file_read_callback
208 + , web_server_file_write_callback
209 + , (void *) w
210 + );
211 +
212 + if(fpi)
213 + w->pollinfo_filecopy_slot = fpi->slot;
214 + else {
215 + error("Failed to add filecopy fd. Closing client.");
216 + return -1;
217 + }
218 + }
219 + }
220 + }
221 + else {
222 + if(unlikely(w->ifd == fd && web_client_has_wait_receive(w)))
223 + *events |= POLLIN;
224 + }
225 +
226 + if(unlikely(w->ofd == fd && web_client_has_wait_send(w)))
227 + *events |= POLLOUT;
228 +
229 + return web_server_check_client_status(w);
230 +}
231 +
232 +static int web_server_snd_callback(POLLINFO *pi, short int *events) {
233 + worker_private->sends++;
234 +
235 + struct web_client *w = (struct web_client *)pi->data;
236 + int fd = pi->fd;
237 +
238 + debug(D_WEB_CLIENT, "%llu: sending data on fd %d.", w->id, fd);
239 +
240 + if(unlikely(web_client_send(w) < 0))
241 + return -1;
242 +
243 + if(unlikely(w->ifd == fd && web_client_has_wait_receive(w)))
244 + *events |= POLLIN;
245 +
246 + if(unlikely(w->ofd == fd && web_client_has_wait_send(w)))
247 + *events |= POLLOUT;
248 +
249 + return web_server_check_client_status(w);
250 +}
251 +
252 +static void web_server_tmr_callback(void *timer_data) {
253 + worker_private = (struct web_server_static_threaded_worker *)timer_data;
254 +
255 + static __thread RRDSET *st = NULL;
256 + static __thread RRDDIM *rd_user = NULL, *rd_system = NULL;
257 +
258 + if(unlikely(!st)) {
259 + char id[100 + 1];
260 + char title[100 + 1];
261 +
262 + snprintfz(id, 100, "web_thread%d_cpu", worker_private->id + 1);
263 + snprintfz(title, 100, "NetData web server thread No %d CPU usage", worker_private->id + 1);
264 +
265 + st = rrdset_create_localhost(
266 + "netdata"
267 + , id
268 + , NULL
269 + , "web"
270 + , "netdata.web_cpu"
271 + , title
272 + , "milliseconds/s"
273 + , "web"
274 + , "stats"
275 + , 132000 + worker_private->id
276 + , default_rrd_update_every
277 + , RRDSET_TYPE_STACKED
278 + );
279 +
280 + rd_user = rrddim_add(st, "user", NULL, 1, 1000, RRD_ALGORITHM_INCREMENTAL);
281 + rd_system = rrddim_add(st, "system", NULL, 1, 1000, RRD_ALGORITHM_INCREMENTAL);
282 + }
283 + else
284 + rrdset_next(st);
285 +
286 + struct rusage rusage;
287 + getrusage(RUSAGE_THREAD, &rusage);
288 + rrddim_set_by_pointer(st, rd_user, rusage.ru_utime.tv_sec * 1000000ULL + rusage.ru_utime.tv_usec);
289 + rrddim_set_by_pointer(st, rd_system, rusage.ru_stime.tv_sec * 1000000ULL + rusage.ru_stime.tv_usec);
290 + rrdset_done(st);
291 +}
292 +
293 +// ----------------------------------------------------------------------------
294 +// web server worker thread
295 +
296 +static void socket_listen_main_static_threaded_worker_cleanup(void *ptr) {
297 + worker_private = (struct web_server_static_threaded_worker *)ptr;
298 +
299 + info("freeing local web clients cache...");
300 + web_client_cache_destroy();
301 +
302 + info("stopped after %zu connects, %zu disconnects (max concurrent %zu), %zu receptions and %zu sends",
303 + worker_private->connected,
304 + worker_private->disconnected,
305 + worker_private->max_concurrent,
306 + worker_private->receptions,
307 + worker_private->sends
308 + );
309 +
310 + worker_private->running = 0;
311 +}
312 +
313 +void *socket_listen_main_static_threaded_worker(void *ptr) {
314 + worker_private = (struct web_server_static_threaded_worker *)ptr;
315 + worker_private->running = 1;
316 +
317 + netdata_thread_cleanup_push(socket_listen_main_static_threaded_worker_cleanup, ptr);
318 +
319 + poll_events(&api_sockets
320 + , web_server_add_callback
321 + , web_server_del_callback
322 + , web_server_rcv_callback
323 + , web_server_snd_callback
324 + , web_server_tmr_callback
325 + , web_allow_connections_from
326 + , NULL
327 + , web_client_first_request_timeout
328 + , web_client_timeout
329 + , default_rrd_update_every * 1000 // timer_milliseconds
330 + , ptr // timer_data
331 + , worker_private->max_sockets
332 + );
333 +
334 + netdata_thread_cleanup_pop(1);
335 + return NULL;
336 +}
337 +
338 +
339 +// ----------------------------------------------------------------------------
340 +// web server main thread - also becomes a worker
341 +
342 +static void socket_listen_main_static_threaded_cleanup(void *ptr) {
343 + struct netdata_static_thread *static_thread = (struct netdata_static_thread *)ptr;
344 + static_thread->enabled = NETDATA_MAIN_THREAD_EXITING;
345 +
346 + int i, found = 0;
347 + usec_t max = 2 * USEC_PER_SEC, step = 50000;
348 +
349 + // we start from 1, - 0 is self
350 + for(i = 1; i < static_threaded_workers_count; i++) {
351 + if(static_workers_private_data[i].running) {
352 + found++;
353 + info("stopping worker %d", i + 1);
354 + netdata_thread_cancel(static_workers_private_data[i].thread);
355 + }
356 + else
357 + info("found stopped worker %d", i + 1);
358 + }
359 +
360 + while(found && max > 0) {
361 + max -= step;
362 + info("Waiting %d static web threads to finish...", found);
363 + sleep_usec(step);
364 + found = 0;
365 +
366 + // we start from 1, - 0 is self
367 + for(i = 1; i < static_threaded_workers_count; i++) {
368 + if (static_workers_private_data[i].running)
369 + found++;
370 + }
371 + }
372 +
373 + if(found)
374 + error("%d static web threads are taking too long to finish. Giving up.", found);
375 +
376 + info("closing all web server sockets...");
377 + listen_sockets_close(&api_sockets);
378 +
379 + info("all static web threads stopped.");
380 + static_thread->enabled = NETDATA_MAIN_THREAD_EXITED;
381 +}
382 +
383 +void *socket_listen_main_static_threaded(void *ptr) {
384 + netdata_thread_cleanup_push(socket_listen_main_static_threaded_cleanup, ptr);
385 + web_server_mode = WEB_SERVER_MODE_STATIC_THREADED;
386 +
387 + if(!api_sockets.opened)
388 + fatal("LISTENER: no listen sockets available.");
389 +
390 + // 6 threads is the optimal value
391 + // since 6 are the parallel connections browsers will do
392 + // so, if the machine has more CPUs, avoid using resources unnecessarily
393 + int def_thread_count = (processors > 6)?6:processors;
394 +
395 + static_threaded_workers_count = config_get_number(CONFIG_SECTION_WEB, "web server threads", def_thread_count);
396 + if(static_threaded_workers_count < 1) static_threaded_workers_count = 1;
397 +
398 + size_t max_sockets = (size_t)config_get_number(CONFIG_SECTION_WEB, "web server max sockets", (long long int)(rlimit_nofile.rlim_cur / 2));
399 +
400 + static_workers_private_data = callocz((size_t)static_threaded_workers_count, sizeof(struct web_server_static_threaded_worker));
401 +
402 + web_server_is_multithreaded = (static_threaded_workers_count > 1);
403 +
404 + int i;
405 + for(i = 1; i < static_threaded_workers_count; i++) {
406 + static_workers_private_data[i].id = i;
407 + static_workers_private_data[i].max_sockets = max_sockets / static_threaded_workers_count;
408 +
409 + char tag[50 + 1];
410 + snprintfz(tag, 50, "WEB_SERVER[static%d]", i+1);
411 +
412 + info("starting worker %d", i+1);
413 + netdata_thread_create(&static_workers_private_data[i].thread, tag, NETDATA_THREAD_OPTION_DEFAULT, socket_listen_main_static_threaded_worker, (void *)&static_workers_private_data[i]);
414 + }
415 +
416 + // and the main one
417 + static_workers_private_data[0].max_sockets = max_sockets / static_threaded_workers_count;
418 + socket_listen_main_static_threaded_worker((void *)&static_workers_private_data[0]);
419 +
420 + netdata_thread_cleanup_pop(1);
421 + return NULL;
422 +}
web/server/static/static-threaded.h new
+10
@@ -0,0 +1,10 @@
1 +// SPDX-License-Identifier: GPL-3.0-or-later
2 +
3 +#ifndef NETDATA_WEB_SERVER_STATIC_THREADED_H
4 +#define NETDATA_WEB_SERVER_STATIC_THREADED_H
5 +
6 +#include "web/server/web_server.h"
7 +
8 +extern void *socket_listen_main_static_threaded(void *ptr);
9 +
10 +#endif //NETDATA_WEB_SERVER_STATIC_THREADED_H
web/server/web_client.c renamed
web/server/web_client.h renamed
+2 -2
@@ -3,7 +3,7 @@
3 #ifndef NETDATA_WEB_CLIENT_H
4 #define NETDATA_WEB_CLIENT_H 1
5
6 -#include "../libnetdata/libnetdata.h"
6 +#include "libnetdata/libnetdata.h"
7
8 #ifdef NETDATA_WITH_ZLIB
9 extern int web_enable_gzip,
@@ -191,6 +191,6 @@ extern void buffer_data_options2string(BUFFER *wb, uint32_t options);
191
192 extern int mysendfile(struct web_client *w, char *filename);
193
194 -#include "../common.h"
194 +#include "daemon/common.h"
195
196 #endif
web/server/web_client_cache.c new
+231
@@ -0,0 +1,231 @@
1 +// SPDX-License-Identifier: GPL-3.0-or-later
2 +
3 +#define WEB_SERVER_INTERNALS 1
4 +#include "web_client_cache.h"
5 +
6 +// ----------------------------------------------------------------------------
7 +// allocate and free web_clients
8 +
9 +static void web_client_zero(struct web_client *w) {
10 + // zero everything about it - but keep the buffers
11 +
12 + // remember the pointers to the buffers
13 + BUFFER *b1 = w->response.data;
14 + BUFFER *b2 = w->response.header;
15 + BUFFER *b3 = w->response.header_output;
16 +
17 + // empty the buffers
18 + buffer_flush(b1);
19 + buffer_flush(b2);
20 + buffer_flush(b3);
21 +
22 + freez(w->user_agent);
23 +
24 + // zero everything
25 + memset(w, 0, sizeof(struct web_client));
26 +
27 + // restore the pointers of the buffers
28 + w->response.data = b1;
29 + w->response.header = b2;
30 + w->response.header_output = b3;
31 +}
32 +
33 +static void web_client_free(struct web_client *w) {
34 + buffer_free(w->response.header_output);
35 + buffer_free(w->response.header);
36 + buffer_free(w->response.data);
37 + freez(w->user_agent);
38 + freez(w);
39 +}
40 +
41 +static struct web_client *web_client_alloc(void) {
42 + struct web_client *w = callocz(1, sizeof(struct web_client));
43 + w->response.data = buffer_create(NETDATA_WEB_RESPONSE_INITIAL_SIZE);
44 + w->response.header = buffer_create(NETDATA_WEB_RESPONSE_HEADER_SIZE);
45 + w->response.header_output = buffer_create(NETDATA_WEB_RESPONSE_HEADER_SIZE);
46 + return w;
47 +}
48 +
49 +// ----------------------------------------------------------------------------
50 +// web clients caching
51 +
52 +// When clients connect and disconnect, avoid allocating and releasing memory.
53 +// Instead, when new clients get connected, reuse any memory previously allocated
54 +// for serving web clients that are now disconnected.
55 +
56 +// The size of the cache is adaptive. It caches the structures of 2x
57 +// the number of currently connected clients.
58 +
59 +// Comments per server:
60 +// SINGLE-THREADED : 1 cache is maintained
61 +// MULTI-THREADED : 1 cache is maintained
62 +// STATIC-THREADED : 1 cache for each thred of the web server
63 +
64 +__thread struct clients_cache web_clients_cache = {
65 + .pid = 0,
66 + .used = NULL,
67 + .used_count = 0,
68 + .avail = NULL,
69 + .avail_count = 0,
70 + .allocated = 0,
71 + .reused = 0
72 +};
73 +
74 +inline void web_client_cache_verify(int force) {
75 +#ifdef NETDATA_INTERNAL_CHECKS
76 + static __thread size_t count = 0;
77 + count++;
78 +
79 + if(unlikely(force || count > 1000)) {
80 + count = 0;
81 +
82 + struct web_client *w;
83 + size_t used = 0, avail = 0;
84 + for(w = web_clients_cache.used; w ; w = w->next) used++;
85 + for(w = web_clients_cache.avail; w ; w = w->next) avail++;
86 +
87 + info("web_client_cache has %zu (%zu) used and %zu (%zu) available clients, allocated %zu, reused %zu (hit %zu%%)."
88 + , used, web_clients_cache.used_count
89 + , avail, web_clients_cache.avail_count
90 + , web_clients_cache.allocated
91 + , web_clients_cache.reused
92 + , (web_clients_cache.allocated + web_clients_cache.reused)?(web_clients_cache.reused * 100 / (web_clients_cache.allocated + web_clients_cache.reused)):0
93 + );
94 + }
95 +#else
96 + if(unlikely(force)) {
97 + info("web_client_cache has %zu used and %zu available clients, allocated %zu, reused %zu (hit %zu%%)."
98 + , web_clients_cache.used_count
99 + , web_clients_cache.avail_count
100 + , web_clients_cache.allocated
101 + , web_clients_cache.reused
102 + , (web_clients_cache.allocated + web_clients_cache.reused)?(web_clients_cache.reused * 100 / (web_clients_cache.allocated + web_clients_cache.reused)):0
103 + );
104 + }
105 +#endif
106 +}
107 +
108 +// destroy the cache and free all the memory it uses
109 +void web_client_cache_destroy(void) {
110 +#ifdef NETDATA_INTERNAL_CHECKS
111 + if(unlikely(web_clients_cache.pid != 0 && web_clients_cache.pid != gettid()))
112 + error("Oops! wrong thread accessing the cache. Expected %d, found %d", (int)web_clients_cache.pid, (int)gettid());
113 +
114 + web_client_cache_verify(1);
115 +#endif
116 +
117 + netdata_thread_disable_cancelability();
118 +
119 + struct web_client *w, *t;
120 +
121 + w = web_clients_cache.used;
122 + while(w) {
123 + t = w;
124 + w = w->next;
125 + web_client_free(t);
126 + }
127 + web_clients_cache.used = NULL;
128 + web_clients_cache.used_count = 0;
129 +
130 + w = web_clients_cache.avail;
131 + while(w) {
132 + t = w;
133 + w = w->next;
134 + web_client_free(t);
135 + }
136 + web_clients_cache.avail = NULL;
137 + web_clients_cache.avail_count = 0;
138 +
139 + netdata_thread_enable_cancelability();
140 +}
141 +
142 +struct web_client *web_client_get_from_cache_or_allocate() {
143 +
144 +#ifdef NETDATA_INTERNAL_CHECKS
145 + if(unlikely(web_clients_cache.pid == 0))
146 + web_clients_cache.pid = gettid();
147 +
148 + if(unlikely(web_clients_cache.pid != 0 && web_clients_cache.pid != gettid()))
149 + error("Oops! wrong thread accessing the cache. Expected %d, found %d", (int)web_clients_cache.pid, (int)gettid());
150 +#endif
151 +
152 + netdata_thread_disable_cancelability();
153 +
154 + struct web_client *w = web_clients_cache.avail;
155 +
156 + if(w) {
157 + // get it from avail
158 + if (w == web_clients_cache.avail) web_clients_cache.avail = w->next;
159 + if(w->prev) w->prev->next = w->next;
160 + if(w->next) w->next->prev = w->prev;
161 + web_clients_cache.avail_count--;
162 + web_client_zero(w);
163 + web_clients_cache.reused++;
164 + }
165 + else {
166 + // allocate it
167 + w = web_client_alloc();
168 + web_clients_cache.allocated++;
169 + }
170 +
171 + // link it to used web clients
172 + if (web_clients_cache.used) web_clients_cache.used->prev = w;
173 + w->next = web_clients_cache.used;
174 + w->prev = NULL;
175 + web_clients_cache.used = w;
176 + web_clients_cache.used_count++;
177 +
178 + // initialize it
179 + w->id = web_client_connected();
180 + w->mode = WEB_CLIENT_MODE_NORMAL;
181 +
182 + netdata_thread_enable_cancelability();
183 +
184 + return w;
185 +}
186 +
187 +void web_client_release(struct web_client *w) {
188 +#ifdef NETDATA_INTERNAL_CHECKS
189 + if(unlikely(web_clients_cache.pid != 0 && web_clients_cache.pid != gettid()))
190 + error("Oops! wrong thread accessing the cache. Expected %d, found %d", (int)web_clients_cache.pid, (int)gettid());
191 +
192 + if(unlikely(w->running))
193 + error("%llu: releasing web client from %s port %s, but it still running.", w->id, w->client_ip, w->client_port);
194 +#endif
195 +
196 + debug(D_WEB_CLIENT_ACCESS, "%llu: Closing web client from %s port %s.", w->id, w->client_ip, w->client_port);
197 +
198 + web_server_log_connection(w, "DISCONNECTED");
199 + web_client_request_done(w);
200 + web_client_disconnected();
201 +
202 + netdata_thread_disable_cancelability();
203 +
204 + if(web_server_mode != WEB_SERVER_MODE_STATIC_THREADED) {
205 + if (w->ifd != -1) close(w->ifd);
206 + if (w->ofd != -1 && w->ofd != w->ifd) close(w->ofd);
207 + w->ifd = w->ofd = -1;
208 + }
209 +
210 + // unlink it from the used
211 + if (w == web_clients_cache.used) web_clients_cache.used = w->next;
212 + if(w->prev) w->prev->next = w->next;
213 + if(w->next) w->next->prev = w->prev;
214 + web_clients_cache.used_count--;
215 +
216 + if(web_clients_cache.avail_count >= 2 * web_clients_cache.used_count) {
217 + // we have too many of them - free it
218 + web_client_free(w);
219 + }
220 + else {
221 + // link it to the avail
222 + if (web_clients_cache.avail) web_clients_cache.avail->prev = w;
223 + w->next = web_clients_cache.avail;
224 + w->prev = NULL;
225 + web_clients_cache.avail = w;
226 + web_clients_cache.avail_count++;
227 + }
228 +
229 + netdata_thread_enable_cancelability();
230 +}
231 +
web/server/web_client_cache.h new
+29
@@ -0,0 +1,29 @@
1 +// SPDX-License-Identifier: GPL-3.0-or-later
2 +
3 +#ifndef NETDATA_WEB_CLIENT_CACHE_H
4 +#define NETDATA_WEB_CLIENT_CACHE_H
5 +
6 +#include "web_server.h"
7 +
8 +struct clients_cache {
9 + pid_t pid;
10 +
11 + struct web_client *used; // the structures of the currently connected clients
12 + size_t used_count; // the count the currently connected clients
13 +
14 + struct web_client *avail; // the cached structures, available for future clients
15 + size_t avail_count; // the number of cached structures
16 +
17 + size_t reused; // the number of re-uses
18 + size_t allocated; // the number of allocations
19 +};
20 +
21 +extern __thread struct clients_cache web_clients_cache;
22 +
23 +extern void web_client_release(struct web_client *w);
24 +extern void web_client_release(struct web_client *w);
25 +extern struct web_client *web_client_get_from_cache_or_allocate();
26 +extern void web_client_cache_destroy(void);
27 +extern void web_client_cache_verify(int force);
28 +
29 +#endif //NETDATA_WEB_CLIENT_CACHE_H
web/server/web_server.c new
+145
@@ -0,0 +1,145 @@
1 +// SPDX-License-Identifier: GPL-3.0-or-later
2 +
3 +#define WEB_SERVER_INTERNALS 1
4 +#include "web_server.h"
5 +
6 +// this file includes 3 web servers:
7 +//
8 +// 1. single-threaded, based on select()
9 +// 2. multi-threaded, based on poll() that spawns threads to handle the requests, based on select()
10 +// 3. static-threaded, based on poll() using a fixed number of threads (configured at netdata.conf)
11 +
12 +WEB_SERVER_MODE web_server_mode = WEB_SERVER_MODE_STATIC_THREADED;
13 +
14 +// --------------------------------------------------------------------------------------
15 +
16 +WEB_SERVER_MODE web_server_mode_id(const char *mode) {
17 + if(!strcmp(mode, "none"))
18 + return WEB_SERVER_MODE_NONE;
19 + else if(!strcmp(mode, "single") || !strcmp(mode, "single-threaded"))
20 + return WEB_SERVER_MODE_SINGLE_THREADED;
21 + else if(!strcmp(mode, "static") || !strcmp(mode, "static-threaded"))
22 + return WEB_SERVER_MODE_STATIC_THREADED;
23 + else // if(!strcmp(mode, "multi") || !strcmp(mode, "multi-threaded"))
24 + return WEB_SERVER_MODE_MULTI_THREADED;
25 +}
26 +
27 +const char *web_server_mode_name(WEB_SERVER_MODE id) {
28 + switch(id) {
29 + case WEB_SERVER_MODE_NONE:
30 + return "none";
31 +
32 + case WEB_SERVER_MODE_SINGLE_THREADED:
33 + return "single-threaded";
34 +
35 + case WEB_SERVER_MODE_STATIC_THREADED:
36 + return "static-threaded";
37 +
38 + default:
39 + case WEB_SERVER_MODE_MULTI_THREADED:
40 + return "multi-threaded";
41 + }
42 +}
43 +
44 +// --------------------------------------------------------------------------------------
45 +// API sockets
46 +
47 +LISTEN_SOCKETS api_sockets = {
48 + .config_section = CONFIG_SECTION_WEB,
49 + .default_bind_to = "*",
50 + .default_port = API_LISTEN_PORT,
51 + .backlog = API_LISTEN_BACKLOG
52 +};
53 +
54 +int api_listen_sockets_setup(void) {
55 + int socks = listen_sockets_setup(&api_sockets);
56 +
57 + if(!socks)
58 + fatal("LISTENER: Cannot listen on any API socket. Exiting...");
59 +
60 + return socks;
61 +}
62 +
63 +
64 +// --------------------------------------------------------------------------------------
65 +// access lists
66 +
67 +SIMPLE_PATTERN *web_allow_connections_from = NULL;
68 +SIMPLE_PATTERN *web_allow_streaming_from = NULL;
69 +SIMPLE_PATTERN *web_allow_netdataconf_from = NULL;
70 +
71 +// WEB_CLIENT_ACL
72 +SIMPLE_PATTERN *web_allow_dashboard_from = NULL;
73 +SIMPLE_PATTERN *web_allow_registry_from = NULL;
74 +SIMPLE_PATTERN *web_allow_badges_from = NULL;
75 +
76 +void web_client_update_acl_matches(struct web_client *w) {
77 + w->acl = WEB_CLIENT_ACL_NONE;
78 +
79 + if(!web_allow_dashboard_from || simple_pattern_matches(web_allow_dashboard_from, w->client_ip))
80 + w->acl |= WEB_CLIENT_ACL_DASHBOARD;
81 +
82 + if(!web_allow_registry_from || simple_pattern_matches(web_allow_registry_from, w->client_ip))
83 + w->acl |= WEB_CLIENT_ACL_REGISTRY;
84 +
85 + if(!web_allow_badges_from || simple_pattern_matches(web_allow_badges_from, w->client_ip))
86 + w->acl |= WEB_CLIENT_ACL_BADGE;
87 +}
88 +
89 +
90 +// --------------------------------------------------------------------------------------
91 +
92 +void web_server_log_connection(struct web_client *w, const char *msg) {
93 + log_access("%llu: %d '[%s]:%s' '%s'", w->id, gettid(), w->client_ip, w->client_port, msg);
94 +}
95 +
96 +// --------------------------------------------------------------------------------------
97 +
98 +void web_client_initialize_connection(struct web_client *w) {
99 + int flag = 1;
100 +
101 + if(unlikely(web_client_check_tcp(w) && setsockopt(w->ifd, IPPROTO_TCP, TCP_NODELAY, (char *) &flag, sizeof(int)) != 0))
102 + debug(D_WEB_CLIENT, "%llu: failed to enable TCP_NODELAY on socket fd %d.", w->id, w->ifd);
103 +
104 + flag = 1;
105 + if(unlikely(setsockopt(w->ifd, SOL_SOCKET, SO_KEEPALIVE, (char *) &flag, sizeof(int)) != 0))
106 + debug(D_WEB_CLIENT, "%llu: failed to enable SO_KEEPALIVE on socket fd %d.", w->id, w->ifd);
107 +
108 + web_client_update_acl_matches(w);
109 +
110 + w->origin[0] = '*'; w->origin[1] = '\0';
111 + w->cookie1[0] = '\0'; w->cookie2[0] = '\0';
112 + freez(w->user_agent); w->user_agent = NULL;
113 +
114 + web_client_enable_wait_receive(w);
115 +
116 + web_server_log_connection(w, "CONNECTED");
117 +
118 + web_client_cache_verify(0);
119 +}
120 +
121 +struct web_client *web_client_create_on_listenfd(int listener) {
122 + struct web_client *w;
123 +
124 + w = web_client_get_from_cache_or_allocate();
125 + w->ifd = w->ofd = accept_socket(listener, SOCK_NONBLOCK, w->client_ip, sizeof(w->client_ip), w->client_port, sizeof(w->client_port), web_allow_connections_from);
126 +
127 + if(unlikely(!*w->client_ip)) strcpy(w->client_ip, "-");
128 + if(unlikely(!*w->client_port)) strcpy(w->client_port, "-");
129 +
130 + if (w->ifd == -1) {
131 + if(errno == EPERM)
132 + web_server_log_connection(w, "ACCESS DENIED");
133 + else {
134 + web_server_log_connection(w, "CONNECTION FAILED");
135 + error("%llu: Failed to accept new incoming connection.", w->id);
136 + }
137 +
138 + web_client_release(w);
139 + return NULL;
140 + }
141 +
142 + web_client_initialize_connection(w);
143 + return(w);
144 +}
145 +
web/server/web_server.h renamed
+15 -4
@@ -3,7 +3,7 @@
3 #ifndef NETDATA_WEB_SERVER_H
4 #define NETDATA_WEB_SERVER_H 1
5
6 -#include "../common.h"
6 +#include "daemon/common.h"
7 #include "web_client.h"
8
9 #ifndef API_LISTEN_PORT
@@ -33,9 +33,6 @@ extern WEB_SERVER_MODE web_server_mode;
33 extern WEB_SERVER_MODE web_server_mode_id(const char *mode);
34 extern const char *web_server_mode_name(WEB_SERVER_MODE id);
35
36 -extern void *socket_listen_main_multi_threaded(void *ptr);
37 -extern void *socket_listen_main_single_threaded(void *ptr);
38 -extern void *socket_listen_main_static_threaded(void *ptr);
36 extern int api_listen_sockets_setup(void);
37
38 #define DEFAULT_TIMEOUT_TO_RECEIVE_FIRST_WEB_REQUEST 60
@@ -44,4 +41,18 @@ extern int web_client_timeout;
41 extern int web_client_first_request_timeout;
42 extern long web_client_streaming_rate_t;
43
44 +#ifdef WEB_SERVER_INTERNALS
45 +extern LISTEN_SOCKETS api_sockets;
46 +extern void web_client_update_acl_matches(struct web_client *w);
47 +extern void web_server_log_connection(struct web_client *w, const char *msg);
48 +extern void web_client_initialize_connection(struct web_client *w);
49 +extern struct web_client *web_client_create_on_listenfd(int listener);
50 +
51 +#include "web_client_cache.h"
52 +#endif // WEB_SERVER_INTERNALS
53 +
54 +#include "single/single-threaded.h"
55 +#include "multi/multi-threaded.h"
56 +#include "static/static-threaded.h"
57 +
58 #endif /* NETDATA_WEB_SERVER_H */