@cryptotaxi247 / netdata-1 / commits / ac7deb42f

Documentation links sanity checker (#4701)

* Fix broken links * Fixed link * Added links checker * link updates from the link checker * Final corrections to allow checklinks to run without errors * Removed whitespace * Fixed codacy errors/warnings

Chris Akritidis committed Nov 22, 2018 at 00:44 UTC ac7deb42f84e2f66a5d86f4d6f259d49ee7b7960
26 files changed +447 -45
CONTRIBUTING.md
+2 -2
@@ -37,9 +37,9 @@ Most of our documentation is in markdown (.md) files inside the netdata GitHub p
37
38 ## Developers
39
40 -We expect most contributions to be for new data collection plugins. You can read about how external plugins work [here](collectors/plugins.d/). Additional instructions are available for [Node.js plugins](collectors/node.d/) and [Python plugis](collectors/python.d/).
40 +We expect most contributions to be for new data collection plugins. You can read about how external plugins work [here](collectors/plugins.d/). Additional instructions are available for [Node.js plugins](collectors/node.d.plugin) and [Python plugis](collectors/python.d.plugin).
41
42 -Of course we appreciate contributions for any other part of the NetData agent, including the [deamon](deamon/), [backends for long term archiving](backends/), innovative ways of using the [REST API](web/api) to create cool [Custom Dashboards](web/gui/custom/) or to include NetData charts in other applications, similarly to what can be done with [Confluence](web/gui/confluence/).
42 +Of course we appreciate contributions for any other part of the NetData agent, including the [daemon](daemon), [backends for long term archiving](backends/), innovative ways of using the [REST API](web/api) to create cool [Custom Dashboards](web/gui/custom/) or to include NetData charts in other applications, similarly to what can be done with [Confluence](web/gui/confluence/).
43
44
45 ### Contributions Ground Rules
README.md
+4 -4
@@ -184,7 +184,7 @@ Function|Description|Documentation
184 **Check**|A lockless independent watchdog is evaluating **health checks** on the collected metrics, triggers alarms, maintains a health transaction log and dispatches alarm notifications.|[`health`](health/#health-monitoring)
185 **Stream**|An lockless independent worker is streaming metrics, in full detail and in real-time, to remote netdata servers, as soon as they are collected.|[`streaming`](streaming/#metrics-streaming)
186 **Archive**|A lockless independent worker is down-sampling the metrics and pushes them to **backend** time-series databases.|[`backends`](backends/)
187 -**Query**|Multiple independent workers are attached to the [internal web server](server/#netdata-web-server), servicing API requests, including [data queries](web/api/queries/#database-queries).|[`web/api`](web/api/#api)
187 +**Query**|Multiple independent workers are attached to the [internal web server](web/server/#netdata-web-server), servicing API requests, including [data queries](web/api/queries/#database-queries).|[`web/api`](web/api/#api)
188
189 The result is a highly efficient, low latency system, supporting multiple readers and one writer on each metric.
190
@@ -357,7 +357,7 @@ Its [Plugin API](collectors/plugins.d/) supports all programing languages (anyth
357
358 #### Web Servers
359 - **[Apache and lighttpd](collectors/python.d.plugin/apache/)** - `mod-status` (v2.2, v2.4) and cache log statistics, for multiple servers.
360 -- **[IPFS](python.d.plugin/ipfs/)** - bandwidth, peers.
360 +- **[IPFS](collectors/python.d.plugin/ipfs/)** - bandwidth, peers.
361 - **[LiteSpeed](collectors/python.d.plugin/litespeed/)** - reads the litespeed rtreport files to collect metrics.
362 - **[Nginx](collectors/python.d.plugin/nginx/)** - `stub-status`, for multiple servers.
363 - **[Nginx+](collectors/python.d.plugin/nginx_plus/)** - connects to multiple nginx_plus servers (local or remote) to collect real-time performance metrics.
@@ -411,12 +411,12 @@ Its [Plugin API](collectors/plugins.d/) supports all programing languages (anyth
411 #### Hardware Sensors
412 - **[IPMI](collectors/freeipmi.plugin/)** - enterprise hardware sensors and events.
413 - **[lm-sensors](collectors/python.d.plugin/sensors/)** - temperature, voltage, fans, power, humidity, etc.
414 -- **[Nvidia](collectors/charts.d.plugin/nvidia_smi/)** - collects information for Nvidia GPUs.
414 +- **[Nvidia](collectors/python.d.plugin/nvidia_smi/)** - collects information for Nvidia GPUs.
415 - **[RPi](collectors/charts.d.plugin/sensors/)** - Raspberry Pi temperature sensors.
416 - **[w1sensor](collectors/python.d.plugin/w1sensor/)** - collects data from connected 1-Wire sensors.
417
418 #### UPSes
419 -- **[apcupsd](charts.d.plugin/apcupsd/)** - load, charge, battery voltage, temperature, utility metrics, output metrics
419 +- **[apcupsd](collectors/charts.d.plugin/apcupsd/)** - load, charge, battery voltage, temperature, utility metrics, output metrics
420 - **[NUT](collectors/charts.d.plugin/nut/)** - load, charge, battery voltage, temperature, utility metrics, output metrics
421 - **[Linux Power Supply](collectors/python.d.plugin/linux_power_supply/)** - collects metrics reported by power supply drivers on Linux.
422
backends/README.md
+2 -2
@@ -110,7 +110,7 @@ of `netdata.conf` from your netdata):
110 When multiple servers are defined, netdata will try the next one when the first one fails. This allows
111 you to load-balance different servers: give your backend servers in different order on each netdata.
112
113 - netdata also ships [`nc-backend.sh`](https://github.com/netdata/netdata/tree/master/backends/nc-backend.sh),
113 + netdata also ships [`nc-backend.sh`](nc-backend.sh),
114 a script that can be used as a fallback backend to save the metrics to disk and push them to the
115 time-series database when it becomes available again. It can also be used to monitor / trace / debug
116 the metrics netdata generates.
@@ -185,7 +185,7 @@ netdata provides 5 charts:
185
186 ## alarms
187
188 -The latest version of the alarms configuration for monitoring the backend is [here](https://github.com/netdata/netdata/tree/master/health/health.d/backend.conf)
188 +The latest version of the alarms configuration for monitoring the backend is [here](../health/health.d/backend.conf)
189
190 netdata adds 4 alarms:
191
collectors/apps.plugin/README.md
+5 -5
@@ -7,7 +7,7 @@ for every process found running.
7
8 Since netdata needs to present this information in charts and track them through time,
9 instead of presenting a `top` like list, `apps.plugin` uses a pre-defined list of **process groups**
10 -to which it assigns all running processes. This list is [customizable](https://github.com/netdata/netdata/tree/master/collectors/apps.plugin/apps_groups.conf) and netdata
10 +to which it assigns all running processes. This list is [customizable](apps_groups.conf) and netdata
11 ships with a good default for most cases (to edit it on your system run `/etc/netdata/edit-config apps_groups.conf`).
12
13 So, `apps.plugin` builds a process tree (much like `ps fax` does in Linux), and groups
@@ -15,7 +15,7 @@ processes together (evaluating both child and parent processes) so that the resu
15 a predefined set of members (of course, only process groups found running are reported).
16
17 > If you find that `apps.plugin` categorizes standard applications as `other`, we would be
18 -> glad to accept pull requests improving the [defaults](https://github.com/netdata/netdata/tree/master/collectors/apps.plugin/apps_groups.conf) shipped with netdata.
18 +> glad to accept pull requests improving the [defaults](apps_groups.conf) shipped with netdata.
19
20 Unlike traditional process monitoring tools (like `top`), `apps.plugin` is able to account the resource
21 utilization of exit processes. Their utilization is accounted at their currently running parents.
@@ -55,7 +55,7 @@ Each of these sections provides the same number of charts:
55
56 The above are reported:
57
58 -- For **Applications** per [target configured](https://github.com/netdata/netdata/tree/master/collectors/apps.plugin/apps_groups.conf).
58 +- For **Applications** per [target configured](apps_groups.conf).
59 - For **Users** per username or UID (when the username is not available).
60 - For **User Groups** per groupname or GID (when groupname is not available).
61
@@ -85,7 +85,7 @@ its CPU resources will be cut in half, and data collection will be once every 2
85
86 ## Configuration
87
88 -The configuration file is `/etc/netdata/apps_groups.conf` (the default is [here](https://github.com/netdata/netdata/tree/master/collectors/apps.plugin/apps_groups.conf)).
88 +The configuration file is `/etc/netdata/apps_groups.conf` (the default is [here](apps_groups.conf)).
89 To edit it on your system run `/etc/netdata/edit-config apps_groups.conf`.
90
91 The configuration file works accepts multiple lines, each having this format:
@@ -341,7 +341,7 @@ So, the `ssh` session is using 95% CPU time.
341 Why `ssh`?
342
343 `apps.plugin` groups all processes based on its configuration file
344 -[`/etc/netdata/apps_groups.conf`](https://github.com/netdata/netdata/tree/master/collectors/apps.plugin/apps_groups.conf)
344 +[`/etc/netdata/apps_groups.conf`](apps_groups.conf)
345 (to edit it on your system run `/etc/netdata/edit-config apps_groups.conf`).
346 The default configuration has nothing for `bash`, but it has for `sshd`, so netdata accumulates
347 all ssh sessions to a dimension on the charts, called `ssh`. This includes all the processes in
collectors/cgroups.plugin/README.md
+1 -1
@@ -87,7 +87,7 @@ For this mapping netdata provides 2 configuration options:
87
88 The whole point for the additional pattern list, is to limit the number of times the script will be called. Without this pattern list, the script might be called thousands of times, depending on the number of cgroups available in the system.
89
90 -The above pattern list is matched against the path of the cgroup. For matched cgroups, netdata calls the script [cgroup-name.sh](https://github.com/netdata/netdata/blob/master/collectors/cgroups.plugin/cgroup-name.sh.in) to get its name. This script queries `docker`, or applies heuristics to find give a name for the cgroup.
90 +The above pattern list is matched against the path of the cgroup. For matched cgroups, netdata calls the script [cgroup-name.sh](cgroup-name.sh.in) to get its name. This script queries `docker`, or applies heuristics to find give a name for the cgroup.
91
92 ## Monitoring systemd services
93
collectors/diskspace.plugin/README.md
+3 -2
@@ -1,5 +1,6 @@
1 -> for disks performance monitoring, see the `proc` plugin, [here](../proc.plugin/#monitoring-disks-performance-with-netdata)
2 -
1 # diskspace.plugin
2
3 This plugin monitors the disk space usage of mounted disks, under Linux.
4 +
5 +> for disks performance monitoring, see the `proc` plugin, [here](../proc.plugin/#monitoring-disks)
6 +
collectors/fping.plugin/README.md
+1 -1
@@ -37,7 +37,7 @@ fping_opts="-R -b 56 -i 1 -r 0 -t 5000"
37 ## alarms
38
39 netdata will automatically attach a few alarms for each host.
40 -Check the [latest versions of the fping alarms](https://github.com/netdata/netdata/blob/master/health/health.d/fping.conf)
40 +Check the [latest versions of the fping alarms](../../health/health.d/fping.conf)
41
42 ## Additional Tips
43
collectors/node.d.plugin/README.md
+2 -2
@@ -45,7 +45,7 @@ For more information check the **[[Installation]]** guide.
45 ## configuring `node.d.plugin`
46
47 `node.d.plugin` can work even without any configuration. Its default configuration file is
48 -[/etc/netdata/node.d.conf](https://github.com/netdata/netdata/tree/master/collectors/node.d.plugin/node.d.conf) (to edit it on your system run `/etc/netdata/edit-config node.d.conf`).
48 +[/etc/netdata/node.d.conf](node.d.conf) (to edit it on your system run `/etc/netdata/edit-config node.d.conf`).
49
50 ## configuring `node.d.plugin` modules
51
@@ -229,4 +229,4 @@ The `service` object defines a set of functions to allow you send information to
229 ---
230
231 *FIXME: document an operational node.d.plugin data collector - the best example is the
232 -[snmp collector](https://github.com/netdata/netdata/tree/master/collectors/node.d.plugin/snmp/snmp.node.js)*
232 +[snmp collector](snmp/snmp.node.js)*
collectors/python.d.plugin/go_expvar/README.md
+2 -2
@@ -106,7 +106,7 @@ the use of `netdata`s ```go_expvar``` module.
106
107 ### Using netdata go_expvar module
108
109 -The `go_expvar` module is disabled by default. To enable it, edit [`python.d.conf`](https://github.com/netdata/netdata/tree/master/collectors/python.d.plugin/python.d.conf)
109 +The `go_expvar` module is disabled by default. To enable it, edit [`python.d.conf`](../python.d.conf)
110 (to edit it on your system run `/etc/netdata/edit-config python.d.conf`), and change the `go_expvar`
111 variable to `yes`:
112
@@ -124,7 +124,7 @@ go_expvar: yes
124 ...
125 ```
126
127 -Next, we need to edit the module configuration file (found at [`/etc/netdata/python.d/go_expvar.conf`](https://github.com/netdata/netdata/tree/master/collectors/python.d.plugin/go_expvar/go_expvar.conf) by default)
127 +Next, we need to edit the module configuration file (found at [`/etc/netdata/python.d/go_expvar.conf`](go_expvar.conf) by default)
128 (to edit it on your system run `/etc/netdata/edit-config python.d/go_expvar.conf`).
129 The module configuration consists of jobs, where each job can be used to monitor a separate Go application.
130 Let's see a sample job configuration:
collectors/python.d.plugin/sensors/README.md
+1 -1
@@ -6,7 +6,7 @@ Charts are created dynamically.
6
7 ### configuration
8
9 -For detailed configuration information please read [`sensors.conf`](https://github.com/netdata/netdata/tree/master/collectors/python.d.plugin/sensors/sensors.conf) file.
9 +For detailed configuration information please read [`sensors.conf`](sensors.conf) file.
10
11 ### possible issues
12
collectors/python.d.plugin/springboot/README.md
+1 -1
@@ -119,4 +119,4 @@ You can disable the default charts by set `defaults.<chart-id>: false`.
119
120 The dimension name of extras charts should replace `.` to `_`.
121
122 -Please check [springboot.conf](https://github.com/netdata/netdata/tree/master/collectors/python.d.plugin/springboot/springboot.conf) for more examples.
122 +Please check [springboot.conf](springboot.conf) for more examples.
collectors/python.d.plugin/w1sensor/README.md
+1 -1
@@ -8,6 +8,6 @@ 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/tree/master/collectors/python.d.plugin/w1sensor/w1sensor.conf) file.
11 +For detailed configuration information please read [`w1sensor.conf`](w1sensor.conf) file.
12
13 ---
collectors/python.d.plugin/web_log/README.md
+1 -1
@@ -197,5 +197,5 @@ alarm|description|minimum<br/>requests|warning|critical
197
198 The column `minimum requests` state the minimum number of requests required for the alarm to be evaluated. We found that when the site is receiving requests above this rate, these alarms are pretty accurate (i.e. no false-positives).
199
200 -[**netdata**](https://my-netdata.io/) alarms are [user configurable](../../../health/health.d). So, even [`web_log` alarms can be adapted to your needs](../../../health/health.d/web_log.conf).
200 +[**netdata**](https://my-netdata.io/) alarms are user configurable. Sample config files can be found under directory `health/health.d` of the netdata github repository. So, even [`web_log` alarms can be adapted to your needs](../../../health/health.d/web_log.conf).
201
collectors/tc.plugin/README.md
+2 -2
@@ -9,10 +9,10 @@ Netdata monitors `tc` QoS classes for all interfaces.
9 If you also use [FireQOS](http://firehol.org/tutorial/fireqos-new-user/) it will collect
10 interface and class names.
11
12 -There is a [shell helper](https://github.com/netdata/netdata/tree/master/collectors/tc.plugin/tc-qos-helper.sh.in) for this (all parsing is done by the plugin
12 +There is a [shell helper](tc-qos-helper.sh.in) for this (all parsing is done by the plugin
13 in `C` code - this shell script is just a configuration for the command to run to get `tc` output).
14
15 -The source of the tc plugin is [here](https://github.com/netdata/netdata/tree/master/collectors/tc.plugin/plugin_tc.c). It is somewhat complex, because a state
15 +The source of the tc plugin is [here](plugin_tc.c). It is somewhat complex, because a state
16 machine was needed to keep track of all the `tc` classes, including the pseudo classes tc
17 dynamically creates.
18
daemon/README.md
+1 -1
@@ -468,7 +468,7 @@ When you compile netdata with debugging:
468
469 1. compiler optimizations for your CPU are disabled (netdata will run somewhat slower)
470
471 -2. a lot of code is added all over netdata, to log debug messages to `/var/log/netdata/debug.log`. However, nothing is printed by default. netdata allows you to select which sections of netdata you want to trace. Tracing is activated via the config option `debug flags`. It accepts a hex number, to enable or disable specific sections. You can find the options supported at [log.h](https://github.com/netdata/netdata/blob/master/libnetdata/log/log.h). They are the `D_*` defines. The value `0xffffffffffffffff` will enable all possible debug flags.
471 +2. a lot of code is added all over netdata, to log debug messages to `/var/log/netdata/debug.log`. However, nothing is printed by default. netdata allows you to select which sections of netdata you want to trace. Tracing is activated via the config option `debug flags`. It accepts a hex number, to enable or disable specific sections. You can find the options supported at [log.h](../libnetdata/log/log.h). They are the `D_*` defines. The value `0xffffffffffffffff` will enable all possible debug flags.
472
473 Once netdata is compiled with debugging and tracing is enabled for a few sections, the file `/var/log/netdata/debug.log` will contain the messages.
474
doc/netdata-security.md
+2 -2
@@ -89,7 +89,7 @@ In netdata v1.9+ there is also access list support, like this:
89
90 #### use an authenticating web server in proxy mode
91
92 -Use **one nginx** (or one apache) server to provide authentication in front of **all your netdata servers**. So, you will be accessing all your netdata with URLs like `http://nginx.host/netdata/{NETDATA_HOSTNAME}/` and authentication will be shared among all of them (you will sign-in once for all your servers). Check [this wiki page for more information on configuring nginx for such a setup](https://github.com/netdata/netdata/blob/master/doc/Running-behind-nginx.md#netdata-via-nginx).
92 +Use **one nginx** (or one apache) server to provide authentication in front of **all your netdata servers**. So, you will be accessing all your netdata with URLs like `http://nginx.host/netdata/{NETDATA_HOSTNAME}/` and authentication will be shared among all of them (you will sign-in once for all your servers). Check [this wiki page for more information on configuring nginx for such a setup](Running-behind-nginx.md#netdata-via-nginx).
93
94 To use this method, you should firewall protect all your netdata servers, so that only the nginx IP will allowed to directly access netdata. To do this, run this on each of your servers (or use your firewall manager):
95
@@ -151,7 +151,7 @@ Of course, there are many more methods you could use to protect netdata:
151
152 ## registry or how to not send any information to a third party server
153
154 -The default configuration uses a public registry under registry.my-netdata.io (more information about the registry here: [mynetdata-menu-item](https://github.com/netdata/netdata/tree/master/registry) ). Please be aware that if you use that public registry, you submit at least the following information to a third party server, which might violate your security policies:
154 +The default configuration uses a public registry under registry.my-netdata.io (more information about the registry here: [mynetdata-menu-item](../registry/) ). Please be aware that if you use that public registry, you submit at least the following information to a third party server, which might violate your security policies:
155 - Your public ip where the browser runs
156 - The url where you open the web-ui in the browser (via http request referer)
157 - The hostnames of the netdata servers
health/README.md
+1 -2
@@ -485,8 +485,7 @@ The external script will be called for all status changes.
485
486 ## Examples
487
488 -
489 -Check the **[health.d directory](health.d/)** for all alarms shipped with netdata.
488 +Check the `health/health.d/` directory for all alarms shipped with netdata.
489
490 Here are a few examples:
491
health/notifications/README.md
+3 -3
@@ -1,7 +1,7 @@
1 # Netdata alarm notifications
2
3 The `exec` line in health configuration defines an external script that will be called once
4 -the alarm is triggered. The default script is **[alarm-notify.sh](https://github.com/netdata/netdata/tree/master/health/notifications/alarm-notify.sh.in)**.
4 +the alarm is triggered. The default script is **[alarm-notify.sh](alarm-notify.sh.in)**.
5
6 You can change the default script globally by editing `/etc/netdata/netdata.conf`.
7
@@ -15,7 +15,7 @@ It uses **roles**. For example `sysadmin`, `webmaster`, `dba`, etc.
15
16 Each alarm is assigned to one or more roles, using the `to` line of the alarm configuration.
17 Then `alarm-notify.sh` uses its own configuration file `/etc/netdata/health_alarm_notify.conf`
18 -the default is [here](https://github.com/netdata/netdata/tree/master/health/notifications/health_alarm_notify.conf)
18 +the default is [here](health_alarm_notify.conf)
19 (to edit it on your system run `/etc/netdata/edit-config health_alarm_notify.conf`)
20 to find the destination address of the notification for each method.
21
@@ -31,7 +31,7 @@ So, for example the `sysadmin` role may send:
31
32 ## Configuration
33
34 -Edit [`/etc/netdata/health_alarm_notify.conf`](https://github.com/netdata/netdata/tree/master/health/notifications/health_alarm_notify.conf)
34 +Edit [`/etc/netdata/health_alarm_notify.conf`](health_alarm_notify.conf)
35 by running `/etc/netdata/edit-config health_alarm_notify.conf`:
36
37 - settings per notification method:
htmldoc/buildhtml.sh
+12
@@ -6,16 +6,28 @@
6 # Assumes that the script is executed from the root netdata folder, by calling htmldoc/buildhtml.sh
7
8 # Copy all netdata .md files to htmldoc/src. Exclude htmldoc itself and also the directory node_modules generated by Netlify
9 +echo "Copying files"
10 rm -rf htmldoc/src
11 find . -type d \( -path ./htmldoc -o -path ./node_modules \) -prune -o -name "*.md" -print | cpio -pd htmldoc/src
12
13 # Modify the first line of the main README.md, to enable proper static html generation
14 sed -i '0,/# netdata /s//# Introducing NetData\n\n/' htmldoc/src/README.md
15
16 +echo "Creating mkdocs.yaml"
17 +
18 # Generate mkdocs.yaml
19 htmldoc/buildyaml.sh > htmldoc/mkdocs.yml
20
21 +echo "Fixing links"
22 +
23 +# Fix links (recursively, all types, executing replacements)
24 +htmldoc/checklinks.sh -rax
25 +if [ $? -eq 1 ] ; then exit 1 ; fi
26 +
27 +echo "Calling mkdocs"
28 +
29 # Build html docs
30 mkdocs build --config-file=htmldoc/mkdocs.yml
31
32 +echo "Finished"
33
htmldoc/checklinks.sh new
+390
@@ -0,0 +1,390 @@
1 +#!/bin/bash
2 +
3 +# Doc link checker
4 +# Validates and tries to fix all links that will cause issues either in the repo, or in the html site
5 +
6 +dbg () {
7 + if [ $VERBOSE -eq 1 ] ; then printf "%s\n" "${1}" ; fi
8 +}
9 +
10 +printhelp () {
11 + echo "Usage: htmldoc/checklinks.sh [-r OR -f <fname>] [OPTIONS]
12 + -r Recursively check all mds in all child directories, except htmldoc and node_modules (which is generated by netlify)
13 + -f Just check the passed md file
14 + General Options:
15 + -x Execute commands. By default the script runs in test mode with no files changed by the script (results and fixes are just shown). Use -x to have it apply the changes.
16 + -u trys to follow URLs using curl
17 + -v Outputs debugging messages
18 + By default, nothing is actually checked. The following options tell it what to check:
19 + -a Check all link types
20 + -w Check wiki links (and just warn if you see one)
21 + -b Check absolute links to the netdata repo (and change them to relative). Only checks links to https://github.com/netdata/netdata/????/master*
22 + -l Check relative links to the netdata repo (and replace them with links that the html static site can live with, under htmldoc/src only)
23 + -e Check external links, outside the wiki or the repo (useless without adding the -u option, to verify that they're not broken)
24 + "
25 +}
26 +
27 +fix () {
28 + if [ $EXECUTE -eq 0 ] ; then
29 + echo "-- SHOULD EXECUTE: $1"
30 + else
31 + dbg "-- EXECUTING: $1"
32 + eval "$1"
33 + fi
34 +}
35 +
36 +ck_netdata_absolute () {
37 + f=$1
38 + alnk=$2
39 + lnkinfile=$3
40 + testURL $alnk
41 +
42 + if [[ $f =~ ^(.*)/([^/]*)$ ]] ; then
43 + fpath="${BASH_REMATCH[1]}"
44 + dbg "-- Current file is at $fpath"
45 + fi
46 +
47 + if [ $? -eq 0 ] ; then
48 + rlnk=$(echo $alnk | sed 's/https:\/\/github.com\/netdata\/netdata\/....\/master\///g')
49 + case $rlnk in
50 + \#* ) dbg "-- (#somelink)" ;;
51 + */ ) dbg "-- # (path/)" ;;
52 + */#* ) dbg "-- # (path/#somelink)" ;;
53 + */*.md ) dbg "-- # (path/filename.md)" ;;
54 + */*.md#* ) dbg "-- # (path/filename.md#somelink)" ;;
55 + *#* )
56 + dbg "-- # (path#somelink) -> (path/#somelink)"
57 + if [[ $rlnk =~ ^(.*)#(.*)$ ]] ; then
58 + dbg "-- $rlnk -> ${BASH_REMATCH[1]}/#${BASH_REMATCH[2]}"
59 + rlnk="${BASH_REMATCH[1]}/#${BASH_REMATCH[2]}"
60 + fi
61 + ;;
62 + * )
63 + if [ -f "$rlnk" ] ; then
64 + dbg "-- # (path/someotherfile) $rlnk"
65 + else
66 + if [ -d "$rlnk" ] ; then
67 + dbg "-- # (path) -> (path/)"
68 + rlnk="$rlnk/"
69 + else
70 + echo "-- ERROR: $f - $alnk is neither a file nor a directory. Giving up!"
71 + EXITCODE=1
72 + return
73 + fi
74 + fi
75 + ;;
76 + esac
77 +
78 + if [[ $rlnk =~ ^(.*)/([^/]*)$ ]] ; then
79 + abspath="${BASH_REMATCH[1]}"
80 + rest="${BASH_REMATCH[2]}"
81 + dbg "-- Target file is at $abspath"
82 + fi
83 + relativelink=$(realpath --relative-to=$fpath $abspath)
84 + if [ $? -eq 0 ] ; then
85 + srch=$(echo $lnkinfile | sed 's/\//\\\//g')
86 + if [ $relativelink = "." ] ; then
87 + rplc=$(echo $rest | sed 's/\//\\\//g')
88 + else
89 + rplc=$(echo $relativelink/$rest | sed 's/\//\\\//g')
90 + fi
91 + fix "sed -i 's/($srch)/($rplc)/g' $f"
92 + else
93 + echo "-- ERROR: $f - Can't determine relative path of $alnk"
94 + fi
95 + else
96 + echo "-- ERROR: $f - $alnk is a broken link"
97 + EXITCODE=1
98 + return
99 + fi
100 +}
101 +
102 +testURL () {
103 + if [ $TESTURLS -eq 0 ] ; then return 0 ; fi
104 + dbg "-- Testing URL $1"
105 + curl -sS $1 > /dev/null
106 + if [ $? -gt 0 ] ; then
107 + return 1
108 + fi
109 + return 0
110 +}
111 +
112 +testinternal () {
113 + # Check if the header referred to by the internal link exists in the same file
114 + ifile=${1}
115 + ilnk=${2}
116 + header=${ilnk//-/}
117 + dbg "-- Searching for \"$header\" in $ifile"
118 + tr -d ',_.:? `'< $ifile | sed 's/-//g' | grep -i "^\#*$header\$" >/dev/null
119 + if [ $? -eq 0 ] ; then
120 + dbg "-- $ilnk found in $ifile"
121 + return 0
122 + else
123 + echo "-- ERROR: $ifile - $ilnk header not found in the file"
124 + EXITCODE=1
125 + return 1
126 + fi
127 +}
128 +
129 +testf () {
130 + sf=$1
131 + tf=$2
132 +
133 + if [ -f "$tf" ] ; then
134 + dbg "-- $tf exists"
135 + return 0
136 + else
137 + echo "-- ERROR: $sf - $tf does not exist"
138 + EXITCODE=1
139 + return 1
140 + fi
141 +}
142 +
143 +ck_netdata_relative () {
144 + f=${1}
145 + rlnk=${2}
146 + dbg "-- Checking relative link $rlnk"
147 + fpath="."
148 + fname="$f"
149 + # First ensure that the link works in the repo, then try to fix it in htmldocs
150 + if [[ $f =~ ^(.*)/([^/]*)$ ]] ; then
151 + fpath="${BASH_REMATCH[1]}"
152 + fname="${BASH_REMATCH[2]}"
153 + dbg "-- Current file is at $fpath"
154 + else
155 + dbg "-- Current file is at root directory"
156 + fi
157 + # Cases to handle:
158 + # (#somelink)
159 + # (path/)
160 + # (path/#somelink)
161 + # (path/filename.md) -> htmldoc (path/filename/)
162 + # (path/filename.md#somelink) -> htmldoc (path/filename/#somelink)
163 + # (path#somelink) -> htmldoc (path/#somelink)
164 + # (path/someotherfile) -> htmldoc (absolutelink)
165 + # (path) -> htmldoc (path/)
166 +
167 + TRGT=""
168 + s=""
169 +
170 + case "$rlnk" in
171 + \#* )
172 + dbg "-- # (#somelink)"
173 + testinternal $f $rlnk
174 + ;;
175 + */ )
176 + dbg "-- # (path/)"
177 + TRGT="$fpath/${rlnk}README.md"
178 + testf $f $TRGT
179 + if [ $? -eq 0 ] ; then
180 + if [ $fname != "README.md" ] ; then s="../$rlnk"; fi
181 + fi
182 + ;;
183 + */#* )
184 + dbg "-- # (path/#somelink)"
185 + if [[ $rlnk =~ ^(.*)/#(.*)$ ]] ; then
186 + TRGT="$fpath/${BASH_REMATCH[1]}/README.md"
187 + LNK="#${BASH_REMATCH[2]}"
188 + dbg "-- Look for $LNK in $TRGT"
189 + testf $f $TRGT
190 + if [ $? -eq 0 ] ; then
191 + testinternal $TRGT $LNK
192 + if [ $? -eq 0 ] ; then
193 + if [ $fname != "README.md" ] ; then s="../$rlnk"; fi
194 + fi
195 + fi
196 + fi
197 + ;;
198 + *.md )
199 + dbg "-- # (path/filename.md) -> htmldoc (path/filename/)"
200 + testf $f "$fpath/$rlnk"
201 + if [ $? -eq 0 ] ; then
202 + if [[ $rlnk =~ ^(.*)/(.*).md$ ]] ; then
203 + if [ "${BASH_REMATCH[2]}" = "README" ] ; then
204 + s="../${BASH_REMATCH[1]}/"
205 + else
206 + s="../${BASH_REMATCH[1]}/${BASH_REMATCH[2]}/"
207 + fi
208 + if [ $fname != "README.md" ] ; then s="../$s"; fi
209 + fi
210 + fi
211 + ;;
212 + *.md#* )
213 + dbg "-- # (path/filename.md#somelink) -> htmldoc (path/filename/#somelink)"
214 + if [[ $rlnk =~ ^(.*)#(.*)$ ]] ; then
215 + TRGT="$fpath/${BASH_REMATCH[1]}"
216 + LNK="#${BASH_REMATCH[2]}"
217 + testf $f $TRGT
218 + if [ $? -eq 0 ] ; then
219 + testinternal $TRGT $LNK
220 + if [ $? -eq 0 ] ; then
221 + if [[ $lnk =~ ^(.*)/(.*).md#(.*)$ ]] ; then
222 + if [ "${BASH_REMATCH[2]}" = "README" ] ; then
223 + s="../${BASH_REMATCH[1]}/#${BASH_REMATCH[3]}"
224 + else
225 + s="../${BASH_REMATCH[1]}/${BASH_REMATCH[2]}/#${BASH_REMATCH[3]}"
226 + fi
227 + if [ $fname != "README.md" ] ; then s="../$s"; fi
228 + fi
229 + fi
230 + fi
231 + fi
232 + ;;
233 + *#* )
234 + dbg "-- # (path#somelink) -> (path/#somelink)"
235 + if [[ $rlnk =~ ^(.*)#(.*)$ ]] ; then
236 + TRGT="$fpath/${BASH_REMATCH[1]}/README.md"
237 + LNK="#${BASH_REMATCH[2]}"
238 + testf $f $TRGT
239 + if [ $? -eq 0 ] ; then
240 + testinternal $TRGT $LNK
241 + if [ $? -eq 0 ] ; then
242 + if [[ $rlnk =~ ^(.*)#(.*)$ ]] ; then
243 + s="${BASH_REMATCH[1]}/#${BASH_REMATCH[2]}"
244 + if [ $fname != "README.md" ] ; then s="../$s"; fi
245 + fi
246 + fi
247 + fi
248 + fi
249 + ;;
250 + * )
251 + if [ -f "$fpath/$rlnk" ] ; then
252 + dbg "-- # (path/someotherfile) $rlnk"
253 + if [ $fpath = "." ] ; then
254 + s="https://github.com/netdata/netdata/tree/master/$rlnk"
255 + else
256 + s="https://github.com/netdata/netdata/tree/master/$fpath/$rlnk"
257 + fi
258 + else
259 + if [ -d "$fpath/$rlnk" ] ; then
260 + dbg "-- # (path) -> htmldoc (path/)"
261 + testf $f "$fpath/$rlnk/README.md"
262 + if [ $? -eq 0 ] ; then
263 + s="$rlnk/"
264 + if [ $fname != "README.md" ] ; then s="../$s"; fi
265 + fi
266 + else
267 + echo "-- ERROR: $f - $rlnk is neither a file or a directory. Giving up!"
268 + EXITCODE=1
269 + fi
270 + fi
271 + ;;
272 + esac
273 +
274 + if [[ ! -z $s ]] ; then
275 + srch=$(echo $rlnk | sed 's/\//\\\//g')
276 + rplc=$(echo $s | sed 's/\//\\\//g')
277 + fix "sed -i 's/($srch)/($rplc)/g' htmldoc/src/$f"
278 + fi
279 +}
280 +
281 +
282 +checklinks () {
283 + f=$1
284 + dbg "Checking $f"
285 + while read l ; do
286 + for word in $l ; do
287 + if [[ $word =~ .*\]\(([^\(\) ]*)\).* ]] ; then
288 + lnk="${BASH_REMATCH[1]}"
289 + if [ -z $lnk ] ; then continue ; fi
290 + dbg "-$lnk"
291 + case "$lnk" in
292 + mailto:* ) dbg "-- Mailto link, ignoring" ;;
293 + https://github.com/netdata/netdata/wiki* )
294 + dbg "-- Wiki Link $lnk"
295 + if [ $CHKWIKI -eq 1 ] ; then echo "-- WARNING: $f - $lnk points to the wiki. Please replace it manually" ; fi
296 + ;;
297 + https://github.com/netdata/netdata/????/master* )
298 + dbg "-- Absolute link $lnk"
299 + if [ $CHKABSOLUTE -eq 1 ] ; then ck_netdata_absolute $f $lnk $lnk ; fi
300 + ;;
301 + http* )
302 + dbg "-- External link $lnk"
303 + if [ $CHKEXTERNAL -eq 1 ] ; then
304 + testURL $lnk
305 + if [ $? -eq 1 ] ; then
306 + echo "-- ERROR: $f - $lnk is a broken link"
307 + EXITCODE=1
308 + fi
309 + fi
310 + ;;
311 + * )
312 + dbg "-- Relative link $lnk"
313 + if [ $CHKRELATIVE -eq 1 ] ; then ck_netdata_relative $f $lnk ; fi
314 + ;;
315 + esac
316 + fi
317 + done
318 + done < $f
319 +}
320 +
321 +TESTURLS=0
322 +VERBOSE=0
323 +RECURSIVE=0
324 +EXECUTE=0
325 +CHKWIKI=0
326 +CHKABSOLUTE=0
327 +CHKEXTERNAL=0
328 +CHKRELATIVE=0
329 +while getopts :f:rxuvwbela option
330 +do
331 + case "$option" in
332 + f)
333 + file=$OPTARG
334 + ;;
335 + r)
336 + RECURSIVE=1
337 + ;;
338 + x)
339 + EXECUTE=1
340 + ;;
341 + u)
342 + TESTURLS=1
343 + ;;
344 + v)
345 + VERBOSE=1
346 + ;;
347 + w)
348 + CHKWIKI=1
349 + ;;
350 + b)
351 + CHKABSOLUTE=1
352 + ;;
353 + e)
354 + CHKEXTERNAL=1
355 + ;;
356 + l)
357 + CHKRELATIVE=1
358 + ;;
359 + a)
360 + CHKWIKI=1
361 + CHKABSOLUTE=1
362 + CHKEXTERNAL=1
363 + CHKRELATIVE=1
364 + ;;
365 + *)
366 + printhelp
367 + exit 1
368 + ;;
369 + esac
370 +done
371 +
372 +EXITCODE=0
373 +
374 +if [ -z ${file} ] ; then
375 + if [ $RECURSIVE -eq 0 ] ; then
376 + printhelp
377 + exit 1
378 + fi
379 + for f in $(find . -type d \( -path ./htmldoc -o -path ./node_modules \) -prune -o -name "*.md" -print); do
380 + checklinks $f
381 + done
382 +else
383 + if [ $RECURSIVE -eq 1 ] ; then
384 + printhelp
385 + exit 1
386 + fi
387 + checklinks $file
388 +fi
389 +
390 +exit $EXITCODE
libnetdata/adaptive_resortable_list/README.md
+1 -1
@@ -85,7 +85,7 @@ Compared to unoptimized code (test No 1: 4.6sec):
85 - before ARL netdata was using test No **7** with hashing and a custom `str2ull()` to achieve 602ms.
86 - the current ARL implementation is test No **9** that needs only 157ms (29 times faster vs unoptimized code, about 4 times faster vs optimized code).
87
88 -[Check the source code of this test](https://github.com/netdata/netdata/tree/master/tests/profile/benchmark-value-pairs.c).
88 +[Check the source code of this test](../../tests/profile/benchmark-value-pairs.c).
89
90 ## Limitations
91
streaming/README.md
+2 -2
@@ -100,7 +100,7 @@ this host).
100
101 ### streaming configuration
102
103 -A new file is introduced: [stream.conf](https://github.com/netdata/netdata/tree/master/streaming/stream.conf) (to edit it on your system run
103 +A new file is introduced: [stream.conf](stream.conf) (to edit it on your system run
104 `/etc/netdata/edit-config stream.conf`). This file holds streaming configuration for both the
105 sending and the receiving netdata.
106
@@ -404,7 +404,7 @@ When they maintain a database, they can also run health checks (alarms and notif
404 for the remote host that is streaming the metrics.
405
406 To configure a proxy, configure it as a receiving and a sending netdata at the same time,
407 -using [stream.conf](https://github.com/netdata/netdata/tree/master/streaming/stream.conf).
407 +using [stream.conf](stream.conf).
408
409 The sending side of a netdata proxy, connects and disconnects to the final destination of the
410 metrics, following the same pattern of the receiving side.
web/README.md
+2 -2
@@ -12,9 +12,9 @@ For our convenience, netdata provides 2 more layers:
12
13 ## customizing the standard dashboards
14
15 -Charts information is stored at /usr/share/netdata/web/[dashboard_info.js](https://github.com/netdata/netdata/blob/master/web/dashboard_info.js). This file includes information that is rendered on the dashboard, controls chart colors, section and subsection heading, titles, etc.
15 +Charts information is stored at /usr/share/netdata/web/[dashboard_info.js](gui/dashboard_info.js). This file includes information that is rendered on the dashboard, controls chart colors, section and subsection heading, titles, etc.
16
17 -If you change that file, your changes will be overwritten when netdata is updated. You can preserve your settings by creating a new such file (there is /usr/share/netdata/web/[dashboard_info_custom.example.js](https://github.com/netdata/netdata/blob/master/web/dashboard_info_custom_example.js) you can use to start with).
17 +If you change that file, your changes will be overwritten when netdata is updated. You can preserve your settings by creating a new such file (there is /usr/share/netdata/web/[dashboard_info_custom.example.js](gui/dashboard_info_custom_example.js) you can use to start with).
18
19 You have to copy the example file under a new name, so that it will not be overwritten with netdata updates.
20
web/api/badges/README.md
+1 -1
@@ -243,7 +243,7 @@ These are options dedicated to badges:
243 </script>
244 ```
245
246 -A more advanced badges refresh method is to include `http://your.netdata.ip:19999/refresh-badges.js` in your page. For more information and use example, [check this](https://github.com/netdata/netdata/blob/master/web/gui/refresh-badges.js).
246 +A more advanced badges refresh method is to include `http://your.netdata.ip:19999/refresh-badges.js` in your page. For more information and use example, [check this](../../gui/refresh-badges.js).
247
248 ---
249
web/gui/custom/README.md
+2 -2
@@ -9,9 +9,9 @@ You can:
9
10 netdata charts can also be added to existing web pages.
11
12 -Check this **[very simple working example of a custom dashboard](http://netdata.firehol.org/demo.html)**, and its **[html source](https://github.com/netdata/netdata/blob/master/web/gui/demo.html)**.
12 +Check this **[very simple working example of a custom dashboard](http://netdata.firehol.org/demo.html)**, and its **[html source](../demo.html)**.
13
14 -If you plan to put it on TV, check **[tv.html](https://github.com/netdata/netdata/blob/master/web/gui/tv.html)**. This is a screenshot of it, monitoring 2 servers on the same page:
14 +If you plan to put it on TV, check **[tv.html](../tv.html)**. This is a screenshot of it, monitoring 2 servers on the same page:
15
16 ![image](https://cloud.githubusercontent.com/assets/2662304/14252187/d8d5f78e-fa8e-11e5-990d-99821d38c874.png)
17 --
web/server/README.md
+2 -2
@@ -86,8 +86,8 @@ Netdata supports access lists in `netdata.conf`:
86 - `allow badges from` checks if the API request is for a badge. Badges are not matched by `allow dashboard from`.
87
88 - `allow streaming from` checks if the slave willing to stream metrics to this netdata is allowed.
89 - This can be controlled per API KEY and MACHINE GUID in [stream.conf](https://github.com/netdata/netdata/tree/master/streaming/stream.conf).
90 - The setting in `netdata.conf` is checked before the ones in [stream.conf](https://github.com/netdata/netdata/tree/master/streaming/stream.conf).
89 + This can be controlled per API KEY and MACHINE GUID in [stream.conf](../../streaming/stream.conf).
90 + The setting in `netdata.conf` is checked before the ones in [stream.conf](../../streaming/stream.conf).
91
92 - `allow netdata.conf from` checks the IP to allow `http://netdata.host:19999/netdata.conf`.
93 By default it allows only private lans.