mirror of
https://github.com/netdata/netdata.git
synced 2025-04-28 22:52:30 +00:00
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
This commit is contained in:
parent
055d5284b9
commit
ac7deb42f8
26 changed files with 447 additions and 45 deletions
CONTRIBUTING.mdREADME.md
backends
collectors
apps.plugin
cgroups.plugin
diskspace.plugin
fping.plugin
node.d.plugin
python.d.plugin
tc.plugin
daemon
doc
health
htmldoc
libnetdata/adaptive_resortable_list
streaming
web
|
@ -37,9 +37,9 @@ Most of our documentation is in markdown (.md) files inside the netdata GitHub p
|
|||
|
||||
## Developers
|
||||
|
||||
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/).
|
||||
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).
|
||||
|
||||
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/).
|
||||
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/).
|
||||
|
||||
|
||||
### Contributions Ground Rules
|
||||
|
|
|
@ -184,7 +184,7 @@ Function|Description|Documentation
|
|||
**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)
|
||||
**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)
|
||||
**Archive**|A lockless independent worker is down-sampling the metrics and pushes them to **backend** time-series databases.|[`backends`](backends/)
|
||||
**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)
|
||||
**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)
|
||||
|
||||
The result is a highly efficient, low latency system, supporting multiple readers and one writer on each metric.
|
||||
|
||||
|
@ -357,7 +357,7 @@ Its [Plugin API](collectors/plugins.d/) supports all programing languages (anyth
|
|||
|
||||
#### Web Servers
|
||||
- **[Apache and lighttpd](collectors/python.d.plugin/apache/)** - `mod-status` (v2.2, v2.4) and cache log statistics, for multiple servers.
|
||||
- **[IPFS](python.d.plugin/ipfs/)** - bandwidth, peers.
|
||||
- **[IPFS](collectors/python.d.plugin/ipfs/)** - bandwidth, peers.
|
||||
- **[LiteSpeed](collectors/python.d.plugin/litespeed/)** - reads the litespeed rtreport files to collect metrics.
|
||||
- **[Nginx](collectors/python.d.plugin/nginx/)** - `stub-status`, for multiple servers.
|
||||
- **[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
|
|||
#### Hardware Sensors
|
||||
- **[IPMI](collectors/freeipmi.plugin/)** - enterprise hardware sensors and events.
|
||||
- **[lm-sensors](collectors/python.d.plugin/sensors/)** - temperature, voltage, fans, power, humidity, etc.
|
||||
- **[Nvidia](collectors/charts.d.plugin/nvidia_smi/)** - collects information for Nvidia GPUs.
|
||||
- **[Nvidia](collectors/python.d.plugin/nvidia_smi/)** - collects information for Nvidia GPUs.
|
||||
- **[RPi](collectors/charts.d.plugin/sensors/)** - Raspberry Pi temperature sensors.
|
||||
- **[w1sensor](collectors/python.d.plugin/w1sensor/)** - collects data from connected 1-Wire sensors.
|
||||
|
||||
#### UPSes
|
||||
- **[apcupsd](charts.d.plugin/apcupsd/)** - load, charge, battery voltage, temperature, utility metrics, output metrics
|
||||
- **[apcupsd](collectors/charts.d.plugin/apcupsd/)** - load, charge, battery voltage, temperature, utility metrics, output metrics
|
||||
- **[NUT](collectors/charts.d.plugin/nut/)** - load, charge, battery voltage, temperature, utility metrics, output metrics
|
||||
- **[Linux Power Supply](collectors/python.d.plugin/linux_power_supply/)** - collects metrics reported by power supply drivers on Linux.
|
||||
|
||||
|
|
|
@ -110,7 +110,7 @@ of `netdata.conf` from your netdata):
|
|||
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.
|
||||
|
||||
netdata also ships [`nc-backend.sh`](https://github.com/netdata/netdata/tree/master/backends/nc-backend.sh),
|
||||
netdata also ships [`nc-backend.sh`](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.
|
||||
|
@ -185,7 +185,7 @@ netdata provides 5 charts:
|
|||
|
||||
## alarms
|
||||
|
||||
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)
|
||||
The latest version of the alarms configuration for monitoring the backend is [here](../health/health.d/backend.conf)
|
||||
|
||||
netdata adds 4 alarms:
|
||||
|
||||
|
|
|
@ -7,7 +7,7 @@ for every process found running.
|
|||
|
||||
Since netdata needs to present this information in charts and track them through time,
|
||||
instead of presenting a `top` like list, `apps.plugin` uses a pre-defined list of **process groups**
|
||||
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
|
||||
to which it assigns all running processes. This list is [customizable](apps_groups.conf) and netdata
|
||||
ships with a good default for most cases (to edit it on your system run `/etc/netdata/edit-config apps_groups.conf`).
|
||||
|
||||
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
|
|||
a predefined set of members (of course, only process groups found running are reported).
|
||||
|
||||
> If you find that `apps.plugin` categorizes standard applications as `other`, we would be
|
||||
> glad to accept pull requests improving the [defaults](https://github.com/netdata/netdata/tree/master/collectors/apps.plugin/apps_groups.conf) shipped with netdata.
|
||||
> glad to accept pull requests improving the [defaults](apps_groups.conf) shipped with netdata.
|
||||
|
||||
Unlike traditional process monitoring tools (like `top`), `apps.plugin` is able to account the resource
|
||||
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:
|
|||
|
||||
The above are reported:
|
||||
|
||||
- For **Applications** per [target configured](https://github.com/netdata/netdata/tree/master/collectors/apps.plugin/apps_groups.conf).
|
||||
- For **Applications** per [target configured](apps_groups.conf).
|
||||
- For **Users** per username or UID (when the username is not available).
|
||||
- For **User Groups** per groupname or GID (when groupname is not available).
|
||||
|
||||
|
@ -85,7 +85,7 @@ its CPU resources will be cut in half, and data collection will be once every 2
|
|||
|
||||
## Configuration
|
||||
|
||||
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)).
|
||||
The configuration file is `/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`.
|
||||
|
||||
The configuration file works accepts multiple lines, each having this format:
|
||||
|
@ -341,7 +341,7 @@ So, the `ssh` session is using 95% CPU time.
|
|||
Why `ssh`?
|
||||
|
||||
`apps.plugin` groups all processes based on its configuration file
|
||||
[`/etc/netdata/apps_groups.conf`](https://github.com/netdata/netdata/tree/master/collectors/apps.plugin/apps_groups.conf)
|
||||
[`/etc/netdata/apps_groups.conf`](apps_groups.conf)
|
||||
(to edit it on your system run `/etc/netdata/edit-config apps_groups.conf`).
|
||||
The default configuration has nothing for `bash`, but it has for `sshd`, so netdata accumulates
|
||||
all ssh sessions to a dimension on the charts, called `ssh`. This includes all the processes in
|
||||
|
|
|
@ -87,7 +87,7 @@ For this mapping netdata provides 2 configuration options:
|
|||
|
||||
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.
|
||||
|
||||
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.
|
||||
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.
|
||||
|
||||
## Monitoring systemd services
|
||||
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
> for disks performance monitoring, see the `proc` plugin, [here](../proc.plugin/#monitoring-disks-performance-with-netdata)
|
||||
|
||||
# diskspace.plugin
|
||||
|
||||
This plugin monitors the disk space usage of mounted disks, under Linux.
|
||||
|
||||
> for disks performance monitoring, see the `proc` plugin, [here](../proc.plugin/#monitoring-disks)
|
||||
|
||||
|
|
|
@ -37,7 +37,7 @@ fping_opts="-R -b 56 -i 1 -r 0 -t 5000"
|
|||
## alarms
|
||||
|
||||
netdata will automatically attach a few alarms for each host.
|
||||
Check the [latest versions of the fping alarms](https://github.com/netdata/netdata/blob/master/health/health.d/fping.conf)
|
||||
Check the [latest versions of the fping alarms](../../health/health.d/fping.conf)
|
||||
|
||||
## Additional Tips
|
||||
|
||||
|
|
|
@ -45,7 +45,7 @@ For more information check the **[[Installation]]** guide.
|
|||
## configuring `node.d.plugin`
|
||||
|
||||
`node.d.plugin` can work even without any configuration. Its default configuration file is
|
||||
[/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`).
|
||||
[/etc/netdata/node.d.conf](node.d.conf) (to edit it on your system run `/etc/netdata/edit-config node.d.conf`).
|
||||
|
||||
## configuring `node.d.plugin` modules
|
||||
|
||||
|
@ -229,4 +229,4 @@ The `service` object defines a set of functions to allow you send information to
|
|||
---
|
||||
|
||||
*FIXME: document an operational node.d.plugin data collector - the best example is the
|
||||
[snmp collector](https://github.com/netdata/netdata/tree/master/collectors/node.d.plugin/snmp/snmp.node.js)*
|
||||
[snmp collector](snmp/snmp.node.js)*
|
||||
|
|
|
@ -106,7 +106,7 @@ the use of `netdata`s ```go_expvar``` module.
|
|||
|
||||
### Using netdata go_expvar module
|
||||
|
||||
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)
|
||||
The `go_expvar` module is disabled by default. To enable it, edit [`python.d.conf`](../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`:
|
||||
|
||||
|
@ -124,7 +124,7 @@ go_expvar: yes
|
|||
...
|
||||
```
|
||||
|
||||
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)
|
||||
Next, we need to edit the module configuration file (found at [`/etc/netdata/python.d/go_expvar.conf`](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:
|
||||
|
|
|
@ -6,7 +6,7 @@ Charts are created dynamically.
|
|||
|
||||
### configuration
|
||||
|
||||
For detailed configuration information please read [`sensors.conf`](https://github.com/netdata/netdata/tree/master/collectors/python.d.plugin/sensors/sensors.conf) file.
|
||||
For detailed configuration information please read [`sensors.conf`](sensors.conf) file.
|
||||
|
||||
### possible issues
|
||||
|
||||
|
|
|
@ -119,4 +119,4 @@ You can disable the default charts by set `defaults.<chart-id>: false`.
|
|||
|
||||
The dimension name of extras charts should replace `.` to `_`.
|
||||
|
||||
Please check [springboot.conf](https://github.com/netdata/netdata/tree/master/collectors/python.d.plugin/springboot/springboot.conf) for more examples.
|
||||
Please check [springboot.conf](springboot.conf) for more examples.
|
||||
|
|
|
@ -8,6 +8,6 @@ Charts are created dynamically based on the number of detected sensors.
|
|||
|
||||
### configuration
|
||||
|
||||
For detailed configuration information please read [`w1sensor.conf`](https://github.com/netdata/netdata/tree/master/collectors/python.d.plugin/w1sensor/w1sensor.conf) file.
|
||||
For detailed configuration information please read [`w1sensor.conf`](w1sensor.conf) file.
|
||||
|
||||
---
|
||||
|
|
|
@ -197,5 +197,5 @@ alarm|description|minimum<br/>requests|warning|critical
|
|||
|
||||
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).
|
||||
|
||||
[**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).
|
||||
[**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).
|
||||
|
||||
|
|
|
@ -9,10 +9,10 @@ Netdata monitors `tc` QoS classes for all interfaces.
|
|||
If you also use [FireQOS](http://firehol.org/tutorial/fireqos-new-user/) it will collect
|
||||
interface and class names.
|
||||
|
||||
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
|
||||
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).
|
||||
|
||||
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
|
||||
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.
|
||||
|
||||
|
|
|
@ -468,7 +468,7 @@ When you compile netdata with debugging:
|
|||
|
||||
1. compiler optimizations for your CPU are disabled (netdata will run somewhat slower)
|
||||
|
||||
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.
|
||||
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.
|
||||
|
||||
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.
|
||||
|
||||
|
|
|
@ -89,7 +89,7 @@ In netdata v1.9+ there is also access list support, like this:
|
|||
|
||||
#### use an authenticating web server in proxy mode
|
||||
|
||||
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).
|
||||
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).
|
||||
|
||||
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):
|
||||
|
||||
|
@ -151,7 +151,7 @@ Of course, there are many more methods you could use to protect netdata:
|
|||
|
||||
## registry or how to not send any information to a third party server
|
||||
|
||||
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:
|
||||
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:
|
||||
- Your public ip where the browser runs
|
||||
- The url where you open the web-ui in the browser (via http request referer)
|
||||
- The hostnames of the netdata servers
|
||||
|
|
|
@ -485,8 +485,7 @@ The external script will be called for all status changes.
|
|||
|
||||
## Examples
|
||||
|
||||
|
||||
Check the **[health.d directory](health.d/)** for all alarms shipped with netdata.
|
||||
Check the `health/health.d/` directory for all alarms shipped with netdata.
|
||||
|
||||
Here are a few examples:
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
# Netdata alarm notifications
|
||||
|
||||
The `exec` line in health configuration defines an external script that will be called once
|
||||
the alarm is triggered. The default script is **[alarm-notify.sh](https://github.com/netdata/netdata/tree/master/health/notifications/alarm-notify.sh.in)**.
|
||||
the alarm is triggered. The default script is **[alarm-notify.sh](alarm-notify.sh.in)**.
|
||||
|
||||
You can change the default script globally by editing `/etc/netdata/netdata.conf`.
|
||||
|
||||
|
@ -15,7 +15,7 @@ It uses **roles**. For example `sysadmin`, `webmaster`, `dba`, etc.
|
|||
|
||||
Each alarm is assigned to one or more roles, using the `to` line of the alarm configuration.
|
||||
Then `alarm-notify.sh` uses its own configuration file `/etc/netdata/health_alarm_notify.conf`
|
||||
the default is [here](https://github.com/netdata/netdata/tree/master/health/notifications/health_alarm_notify.conf)
|
||||
the default is [here](health_alarm_notify.conf)
|
||||
(to edit it on your system run `/etc/netdata/edit-config health_alarm_notify.conf`)
|
||||
to find the destination address of the notification for each method.
|
||||
|
||||
|
@ -31,7 +31,7 @@ So, for example the `sysadmin` role may send:
|
|||
|
||||
## Configuration
|
||||
|
||||
Edit [`/etc/netdata/health_alarm_notify.conf`](https://github.com/netdata/netdata/tree/master/health/notifications/health_alarm_notify.conf)
|
||||
Edit [`/etc/netdata/health_alarm_notify.conf`](health_alarm_notify.conf)
|
||||
by running `/etc/netdata/edit-config health_alarm_notify.conf`:
|
||||
|
||||
- settings per notification method:
|
||||
|
|
|
@ -6,16 +6,28 @@
|
|||
# Assumes that the script is executed from the root netdata folder, by calling htmldoc/buildhtml.sh
|
||||
|
||||
# Copy all netdata .md files to htmldoc/src. Exclude htmldoc itself and also the directory node_modules generated by Netlify
|
||||
echo "Copying files"
|
||||
rm -rf htmldoc/src
|
||||
find . -type d \( -path ./htmldoc -o -path ./node_modules \) -prune -o -name "*.md" -print | cpio -pd htmldoc/src
|
||||
|
||||
# Modify the first line of the main README.md, to enable proper static html generation
|
||||
sed -i '0,/# netdata /s//# Introducing NetData\n\n/' htmldoc/src/README.md
|
||||
|
||||
echo "Creating mkdocs.yaml"
|
||||
|
||||
# Generate mkdocs.yaml
|
||||
htmldoc/buildyaml.sh > htmldoc/mkdocs.yml
|
||||
|
||||
echo "Fixing links"
|
||||
|
||||
# Fix links (recursively, all types, executing replacements)
|
||||
htmldoc/checklinks.sh -rax
|
||||
if [ $? -eq 1 ] ; then exit 1 ; fi
|
||||
|
||||
echo "Calling mkdocs"
|
||||
|
||||
# Build html docs
|
||||
mkdocs build --config-file=htmldoc/mkdocs.yml
|
||||
|
||||
echo "Finished"
|
||||
|
||||
|
|
390
htmldoc/checklinks.sh
Executable file
390
htmldoc/checklinks.sh
Executable file
|
@ -0,0 +1,390 @@
|
|||
#!/bin/bash
|
||||
|
||||
# Doc link checker
|
||||
# Validates and tries to fix all links that will cause issues either in the repo, or in the html site
|
||||
|
||||
dbg () {
|
||||
if [ $VERBOSE -eq 1 ] ; then printf "%s\n" "${1}" ; fi
|
||||
}
|
||||
|
||||
printhelp () {
|
||||
echo "Usage: htmldoc/checklinks.sh [-r OR -f <fname>] [OPTIONS]
|
||||
-r Recursively check all mds in all child directories, except htmldoc and node_modules (which is generated by netlify)
|
||||
-f Just check the passed md file
|
||||
General Options:
|
||||
-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.
|
||||
-u trys to follow URLs using curl
|
||||
-v Outputs debugging messages
|
||||
By default, nothing is actually checked. The following options tell it what to check:
|
||||
-a Check all link types
|
||||
-w Check wiki links (and just warn if you see one)
|
||||
-b Check absolute links to the netdata repo (and change them to relative). Only checks links to https://github.com/netdata/netdata/????/master*
|
||||
-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)
|
||||
-e Check external links, outside the wiki or the repo (useless without adding the -u option, to verify that they're not broken)
|
||||
"
|
||||
}
|
||||
|
||||
fix () {
|
||||
if [ $EXECUTE -eq 0 ] ; then
|
||||
echo "-- SHOULD EXECUTE: $1"
|
||||
else
|
||||
dbg "-- EXECUTING: $1"
|
||||
eval "$1"
|
||||
fi
|
||||
}
|
||||
|
||||
ck_netdata_absolute () {
|
||||
f=$1
|
||||
alnk=$2
|
||||
lnkinfile=$3
|
||||
testURL $alnk
|
||||
|
||||
if [[ $f =~ ^(.*)/([^/]*)$ ]] ; then
|
||||
fpath="${BASH_REMATCH[1]}"
|
||||
dbg "-- Current file is at $fpath"
|
||||
fi
|
||||
|
||||
if [ $? -eq 0 ] ; then
|
||||
rlnk=$(echo $alnk | sed 's/https:\/\/github.com\/netdata\/netdata\/....\/master\///g')
|
||||
case $rlnk in
|
||||
\#* ) dbg "-- (#somelink)" ;;
|
||||
*/ ) dbg "-- # (path/)" ;;
|
||||
*/#* ) dbg "-- # (path/#somelink)" ;;
|
||||
*/*.md ) dbg "-- # (path/filename.md)" ;;
|
||||
*/*.md#* ) dbg "-- # (path/filename.md#somelink)" ;;
|
||||
*#* )
|
||||
dbg "-- # (path#somelink) -> (path/#somelink)"
|
||||
if [[ $rlnk =~ ^(.*)#(.*)$ ]] ; then
|
||||
dbg "-- $rlnk -> ${BASH_REMATCH[1]}/#${BASH_REMATCH[2]}"
|
||||
rlnk="${BASH_REMATCH[1]}/#${BASH_REMATCH[2]}"
|
||||
fi
|
||||
;;
|
||||
* )
|
||||
if [ -f "$rlnk" ] ; then
|
||||
dbg "-- # (path/someotherfile) $rlnk"
|
||||
else
|
||||
if [ -d "$rlnk" ] ; then
|
||||
dbg "-- # (path) -> (path/)"
|
||||
rlnk="$rlnk/"
|
||||
else
|
||||
echo "-- ERROR: $f - $alnk is neither a file nor a directory. Giving up!"
|
||||
EXITCODE=1
|
||||
return
|
||||
fi
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
|
||||
if [[ $rlnk =~ ^(.*)/([^/]*)$ ]] ; then
|
||||
abspath="${BASH_REMATCH[1]}"
|
||||
rest="${BASH_REMATCH[2]}"
|
||||
dbg "-- Target file is at $abspath"
|
||||
fi
|
||||
relativelink=$(realpath --relative-to=$fpath $abspath)
|
||||
if [ $? -eq 0 ] ; then
|
||||
srch=$(echo $lnkinfile | sed 's/\//\\\//g')
|
||||
if [ $relativelink = "." ] ; then
|
||||
rplc=$(echo $rest | sed 's/\//\\\//g')
|
||||
else
|
||||
rplc=$(echo $relativelink/$rest | sed 's/\//\\\//g')
|
||||
fi
|
||||
fix "sed -i 's/($srch)/($rplc)/g' $f"
|
||||
else
|
||||
echo "-- ERROR: $f - Can't determine relative path of $alnk"
|
||||
fi
|
||||
else
|
||||
echo "-- ERROR: $f - $alnk is a broken link"
|
||||
EXITCODE=1
|
||||
return
|
||||
fi
|
||||
}
|
||||
|
||||
testURL () {
|
||||
if [ $TESTURLS -eq 0 ] ; then return 0 ; fi
|
||||
dbg "-- Testing URL $1"
|
||||
curl -sS $1 > /dev/null
|
||||
if [ $? -gt 0 ] ; then
|
||||
return 1
|
||||
fi
|
||||
return 0
|
||||
}
|
||||
|
||||
testinternal () {
|
||||
# Check if the header referred to by the internal link exists in the same file
|
||||
ifile=${1}
|
||||
ilnk=${2}
|
||||
header=${ilnk//-/}
|
||||
dbg "-- Searching for \"$header\" in $ifile"
|
||||
tr -d ',_.:? `'< $ifile | sed 's/-//g' | grep -i "^\#*$header\$" >/dev/null
|
||||
if [ $? -eq 0 ] ; then
|
||||
dbg "-- $ilnk found in $ifile"
|
||||
return 0
|
||||
else
|
||||
echo "-- ERROR: $ifile - $ilnk header not found in the file"
|
||||
EXITCODE=1
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
testf () {
|
||||
sf=$1
|
||||
tf=$2
|
||||
|
||||
if [ -f "$tf" ] ; then
|
||||
dbg "-- $tf exists"
|
||||
return 0
|
||||
else
|
||||
echo "-- ERROR: $sf - $tf does not exist"
|
||||
EXITCODE=1
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
ck_netdata_relative () {
|
||||
f=${1}
|
||||
rlnk=${2}
|
||||
dbg "-- Checking relative link $rlnk"
|
||||
fpath="."
|
||||
fname="$f"
|
||||
# First ensure that the link works in the repo, then try to fix it in htmldocs
|
||||
if [[ $f =~ ^(.*)/([^/]*)$ ]] ; then
|
||||
fpath="${BASH_REMATCH[1]}"
|
||||
fname="${BASH_REMATCH[2]}"
|
||||
dbg "-- Current file is at $fpath"
|
||||
else
|
||||
dbg "-- Current file is at root directory"
|
||||
fi
|
||||
# Cases to handle:
|
||||
# (#somelink)
|
||||
# (path/)
|
||||
# (path/#somelink)
|
||||
# (path/filename.md) -> htmldoc (path/filename/)
|
||||
# (path/filename.md#somelink) -> htmldoc (path/filename/#somelink)
|
||||
# (path#somelink) -> htmldoc (path/#somelink)
|
||||
# (path/someotherfile) -> htmldoc (absolutelink)
|
||||
# (path) -> htmldoc (path/)
|
||||
|
||||
TRGT=""
|
||||
s=""
|
||||
|
||||
case "$rlnk" in
|
||||
\#* )
|
||||
dbg "-- # (#somelink)"
|
||||
testinternal $f $rlnk
|
||||
;;
|
||||
*/ )
|
||||
dbg "-- # (path/)"
|
||||
TRGT="$fpath/${rlnk}README.md"
|
||||
testf $f $TRGT
|
||||
if [ $? -eq 0 ] ; then
|
||||
if [ $fname != "README.md" ] ; then s="../$rlnk"; fi
|
||||
fi
|
||||
;;
|
||||
*/#* )
|
||||
dbg "-- # (path/#somelink)"
|
||||
if [[ $rlnk =~ ^(.*)/#(.*)$ ]] ; then
|
||||
TRGT="$fpath/${BASH_REMATCH[1]}/README.md"
|
||||
LNK="#${BASH_REMATCH[2]}"
|
||||
dbg "-- Look for $LNK in $TRGT"
|
||||
testf $f $TRGT
|
||||
if [ $? -eq 0 ] ; then
|
||||
testinternal $TRGT $LNK
|
||||
if [ $? -eq 0 ] ; then
|
||||
if [ $fname != "README.md" ] ; then s="../$rlnk"; fi
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
;;
|
||||
*.md )
|
||||
dbg "-- # (path/filename.md) -> htmldoc (path/filename/)"
|
||||
testf $f "$fpath/$rlnk"
|
||||
if [ $? -eq 0 ] ; then
|
||||
if [[ $rlnk =~ ^(.*)/(.*).md$ ]] ; then
|
||||
if [ "${BASH_REMATCH[2]}" = "README" ] ; then
|
||||
s="../${BASH_REMATCH[1]}/"
|
||||
else
|
||||
s="../${BASH_REMATCH[1]}/${BASH_REMATCH[2]}/"
|
||||
fi
|
||||
if [ $fname != "README.md" ] ; then s="../$s"; fi
|
||||
fi
|
||||
fi
|
||||
;;
|
||||
*.md#* )
|
||||
dbg "-- # (path/filename.md#somelink) -> htmldoc (path/filename/#somelink)"
|
||||
if [[ $rlnk =~ ^(.*)#(.*)$ ]] ; then
|
||||
TRGT="$fpath/${BASH_REMATCH[1]}"
|
||||
LNK="#${BASH_REMATCH[2]}"
|
||||
testf $f $TRGT
|
||||
if [ $? -eq 0 ] ; then
|
||||
testinternal $TRGT $LNK
|
||||
if [ $? -eq 0 ] ; then
|
||||
if [[ $lnk =~ ^(.*)/(.*).md#(.*)$ ]] ; then
|
||||
if [ "${BASH_REMATCH[2]}" = "README" ] ; then
|
||||
s="../${BASH_REMATCH[1]}/#${BASH_REMATCH[3]}"
|
||||
else
|
||||
s="../${BASH_REMATCH[1]}/${BASH_REMATCH[2]}/#${BASH_REMATCH[3]}"
|
||||
fi
|
||||
if [ $fname != "README.md" ] ; then s="../$s"; fi
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
;;
|
||||
*#* )
|
||||
dbg "-- # (path#somelink) -> (path/#somelink)"
|
||||
if [[ $rlnk =~ ^(.*)#(.*)$ ]] ; then
|
||||
TRGT="$fpath/${BASH_REMATCH[1]}/README.md"
|
||||
LNK="#${BASH_REMATCH[2]}"
|
||||
testf $f $TRGT
|
||||
if [ $? -eq 0 ] ; then
|
||||
testinternal $TRGT $LNK
|
||||
if [ $? -eq 0 ] ; then
|
||||
if [[ $rlnk =~ ^(.*)#(.*)$ ]] ; then
|
||||
s="${BASH_REMATCH[1]}/#${BASH_REMATCH[2]}"
|
||||
if [ $fname != "README.md" ] ; then s="../$s"; fi
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
;;
|
||||
* )
|
||||
if [ -f "$fpath/$rlnk" ] ; then
|
||||
dbg "-- # (path/someotherfile) $rlnk"
|
||||
if [ $fpath = "." ] ; then
|
||||
s="https://github.com/netdata/netdata/tree/master/$rlnk"
|
||||
else
|
||||
s="https://github.com/netdata/netdata/tree/master/$fpath/$rlnk"
|
||||
fi
|
||||
else
|
||||
if [ -d "$fpath/$rlnk" ] ; then
|
||||
dbg "-- # (path) -> htmldoc (path/)"
|
||||
testf $f "$fpath/$rlnk/README.md"
|
||||
if [ $? -eq 0 ] ; then
|
||||
s="$rlnk/"
|
||||
if [ $fname != "README.md" ] ; then s="../$s"; fi
|
||||
fi
|
||||
else
|
||||
echo "-- ERROR: $f - $rlnk is neither a file or a directory. Giving up!"
|
||||
EXITCODE=1
|
||||
fi
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
|
||||
if [[ ! -z $s ]] ; then
|
||||
srch=$(echo $rlnk | sed 's/\//\\\//g')
|
||||
rplc=$(echo $s | sed 's/\//\\\//g')
|
||||
fix "sed -i 's/($srch)/($rplc)/g' htmldoc/src/$f"
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
checklinks () {
|
||||
f=$1
|
||||
dbg "Checking $f"
|
||||
while read l ; do
|
||||
for word in $l ; do
|
||||
if [[ $word =~ .*\]\(([^\(\) ]*)\).* ]] ; then
|
||||
lnk="${BASH_REMATCH[1]}"
|
||||
if [ -z $lnk ] ; then continue ; fi
|
||||
dbg "-$lnk"
|
||||
case "$lnk" in
|
||||
mailto:* ) dbg "-- Mailto link, ignoring" ;;
|
||||
https://github.com/netdata/netdata/wiki* )
|
||||
dbg "-- Wiki Link $lnk"
|
||||
if [ $CHKWIKI -eq 1 ] ; then echo "-- WARNING: $f - $lnk points to the wiki. Please replace it manually" ; fi
|
||||
;;
|
||||
https://github.com/netdata/netdata/????/master* )
|
||||
dbg "-- Absolute link $lnk"
|
||||
if [ $CHKABSOLUTE -eq 1 ] ; then ck_netdata_absolute $f $lnk $lnk ; fi
|
||||
;;
|
||||
http* )
|
||||
dbg "-- External link $lnk"
|
||||
if [ $CHKEXTERNAL -eq 1 ] ; then
|
||||
testURL $lnk
|
||||
if [ $? -eq 1 ] ; then
|
||||
echo "-- ERROR: $f - $lnk is a broken link"
|
||||
EXITCODE=1
|
||||
fi
|
||||
fi
|
||||
;;
|
||||
* )
|
||||
dbg "-- Relative link $lnk"
|
||||
if [ $CHKRELATIVE -eq 1 ] ; then ck_netdata_relative $f $lnk ; fi
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
done
|
||||
done < $f
|
||||
}
|
||||
|
||||
TESTURLS=0
|
||||
VERBOSE=0
|
||||
RECURSIVE=0
|
||||
EXECUTE=0
|
||||
CHKWIKI=0
|
||||
CHKABSOLUTE=0
|
||||
CHKEXTERNAL=0
|
||||
CHKRELATIVE=0
|
||||
while getopts :f:rxuvwbela option
|
||||
do
|
||||
case "$option" in
|
||||
f)
|
||||
file=$OPTARG
|
||||
;;
|
||||
r)
|
||||
RECURSIVE=1
|
||||
;;
|
||||
x)
|
||||
EXECUTE=1
|
||||
;;
|
||||
u)
|
||||
TESTURLS=1
|
||||
;;
|
||||
v)
|
||||
VERBOSE=1
|
||||
;;
|
||||
w)
|
||||
CHKWIKI=1
|
||||
;;
|
||||
b)
|
||||
CHKABSOLUTE=1
|
||||
;;
|
||||
e)
|
||||
CHKEXTERNAL=1
|
||||
;;
|
||||
l)
|
||||
CHKRELATIVE=1
|
||||
;;
|
||||
a)
|
||||
CHKWIKI=1
|
||||
CHKABSOLUTE=1
|
||||
CHKEXTERNAL=1
|
||||
CHKRELATIVE=1
|
||||
;;
|
||||
*)
|
||||
printhelp
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
EXITCODE=0
|
||||
|
||||
if [ -z ${file} ] ; then
|
||||
if [ $RECURSIVE -eq 0 ] ; then
|
||||
printhelp
|
||||
exit 1
|
||||
fi
|
||||
for f in $(find . -type d \( -path ./htmldoc -o -path ./node_modules \) -prune -o -name "*.md" -print); do
|
||||
checklinks $f
|
||||
done
|
||||
else
|
||||
if [ $RECURSIVE -eq 1 ] ; then
|
||||
printhelp
|
||||
exit 1
|
||||
fi
|
||||
checklinks $file
|
||||
fi
|
||||
|
||||
exit $EXITCODE
|
|
@ -85,7 +85,7 @@ Compared to unoptimized code (test No 1: 4.6sec):
|
|||
- before ARL netdata was using test No **7** with hashing and a custom `str2ull()` to achieve 602ms.
|
||||
- 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).
|
||||
|
||||
[Check the source code of this test](https://github.com/netdata/netdata/tree/master/tests/profile/benchmark-value-pairs.c).
|
||||
[Check the source code of this test](../../tests/profile/benchmark-value-pairs.c).
|
||||
|
||||
## Limitations
|
||||
|
||||
|
|
|
@ -100,7 +100,7 @@ this host).
|
|||
|
||||
### streaming configuration
|
||||
|
||||
A new file is introduced: [stream.conf](https://github.com/netdata/netdata/tree/master/streaming/stream.conf) (to edit it on your system run
|
||||
A new file is introduced: [stream.conf](stream.conf) (to edit it on your system run
|
||||
`/etc/netdata/edit-config stream.conf`). This file holds streaming configuration for both the
|
||||
sending and the receiving netdata.
|
||||
|
||||
|
@ -404,7 +404,7 @@ When they maintain a database, they can also run health checks (alarms and notif
|
|||
for the remote host that is streaming the metrics.
|
||||
|
||||
To configure a proxy, configure it as a receiving and a sending netdata at the same time,
|
||||
using [stream.conf](https://github.com/netdata/netdata/tree/master/streaming/stream.conf).
|
||||
using [stream.conf](stream.conf).
|
||||
|
||||
The sending side of a netdata proxy, connects and disconnects to the final destination of the
|
||||
metrics, following the same pattern of the receiving side.
|
||||
|
|
|
@ -12,9 +12,9 @@ For our convenience, netdata provides 2 more layers:
|
|||
|
||||
## customizing the standard dashboards
|
||||
|
||||
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.
|
||||
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.
|
||||
|
||||
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).
|
||||
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).
|
||||
|
||||
You have to copy the example file under a new name, so that it will not be overwritten with netdata updates.
|
||||
|
||||
|
|
|
@ -243,7 +243,7 @@ These are options dedicated to badges:
|
|||
</script>
|
||||
```
|
||||
|
||||
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).
|
||||
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).
|
||||
|
||||
---
|
||||
|
||||
|
|
|
@ -9,9 +9,9 @@ You can:
|
|||
|
||||
netdata charts can also be added to existing web pages.
|
||||
|
||||
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)**.
|
||||
Check this **[very simple working example of a custom dashboard](http://netdata.firehol.org/demo.html)**, and its **[html source](../demo.html)**.
|
||||
|
||||
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:
|
||||
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:
|
||||
|
||||

|
||||
--
|
||||
|
|
|
@ -86,8 +86,8 @@ Netdata supports access lists in `netdata.conf`:
|
|||
- `allow badges from` checks if the API request is for a badge. Badges are not matched by `allow dashboard from`.
|
||||
|
||||
- `allow streaming from` checks if the slave willing to stream metrics to this netdata is allowed.
|
||||
This can be controlled per API KEY and MACHINE GUID in [stream.conf](https://github.com/netdata/netdata/tree/master/streaming/stream.conf).
|
||||
The setting in `netdata.conf` is checked before the ones in [stream.conf](https://github.com/netdata/netdata/tree/master/streaming/stream.conf).
|
||||
This can be controlled per API KEY and MACHINE GUID in [stream.conf](../../streaming/stream.conf).
|
||||
The setting in `netdata.conf` is checked before the ones in [stream.conf](../../streaming/stream.conf).
|
||||
|
||||
- `allow netdata.conf from` checks the IP to allow `http://netdata.host:19999/netdata.conf`.
|
||||
By default it allows only private lans.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue