diff --git a/.gitignore b/.gitignore index c64d759547..f24583ac28 100644 --- a/.gitignore +++ b/.gitignore @@ -145,6 +145,6 @@ sitespeed-result/ python.d/python-modules-installer.sh # documentation generated files -htmldoc/src -htmldoc/build -htmldoc/mkdocs.yml +docs/generator/src +docs/generator/build +docs/generator/mkdocs.yml diff --git a/Makefile.am b/Makefile.am index 82c98a4c13..09abf845ba 100644 --- a/Makefile.am +++ b/Makefile.am @@ -62,22 +62,22 @@ dist_noinst_DATA= \ netdata.cppcheck \ netdata.spec \ package.json \ - doc/Add-more-charts-to-netdata.md \ - doc/Demo-Sites.md \ - doc/Donations-netdata-has-received.md \ - doc/Netdata-Security-and-Disclosure-Information.md \ - doc/Performance.md \ - doc/Running-behind-apache.md \ - doc/Running-behind-caddy.md \ - doc/Running-behind-lighttpd.md \ - doc/Running-behind-nginx.md \ - doc/Third-Party-Plugins.md \ - doc/a-github-star-is-important.md \ - doc/high-performance-netdata.md \ - doc/netdata-for-IoT.md \ - doc/netdata-security.md \ - doc/Why-Netdata.md \ - htmldoc/themes/material/partials/footer.html \ + docs/Add-more-charts-to-netdata.md \ + docs/Demo-Sites.md \ + docs/Donations-netdata-has-received.md \ + docs/Netdata-Security-and-Disclosure-Information.md \ + docs/Performance.md \ + docs/Running-behind-apache.md \ + docs/Running-behind-caddy.md \ + docs/Running-behind-lighttpd.md \ + docs/Running-behind-nginx.md \ + docs/Third-Party-Plugins.md \ + docs/a-github-star-is-important.md \ + docs/high-performance-netdata.md \ + docs/netdata-for-IoT.md \ + docs/netdata-security.md \ + docs/Why-Netdata.md \ + docs/generator/themes/material/partials/footer.html \ installer/README.md \ installer/UNINSTALL.md \ installer/UPDATE.md \ @@ -92,11 +92,11 @@ dist_noinst_SCRIPTS= \ kickstart-static64.sh \ netdata-installer.sh \ installer/functions.sh \ - htmldoc/buildhtml.sh \ - htmldoc/buildyaml.sh \ - htmldoc/checklinks.sh \ - htmldoc/requirements.txt \ - htmldoc/runtime.txt \ + docs/generator/buildhtml.sh \ + docs/generator/buildyaml.sh \ + docs/generator/checklinks.sh \ + docs/generator/requirements.txt \ + docs/generator/runtime.txt \ $(NULL) # ----------------------------------------------------------------------------- diff --git a/daemon/config/README.md b/daemon/config/README.md index 1a64c45460..87f1450d12 100755 --- a/daemon/config/README.md +++ b/daemon/config/README.md @@ -36,7 +36,7 @@ debug log|`/var/log/netdata/debug.log`|The filename to save debug information. T error log|`/var/log/netdata/error.log`|The filename to save error messages for netdata daemon and all plugins (`stderr` is sent here for all netdata programs, including the plugins). You can also set it to `syslog` to send the errors to syslog, or `none` to disable this log. access log|`/var/log/netdata/access.log`|The filename to save the log of web clients accessing netdata charts. You can also set it to `syslog` to send the access log to syslog, or `none` to disable this log. memory mode|save|When set to `save` netdata will save its round robin database on exit and load it on startup. When set to `map` the cache files will be updated in real time (check `man mmap` - do not set this on systems with heavy load or slow disks - the disks will continuously sync the in-memory database of netdata). When set to `ram` the round robin database will be temporary and it will be lost when netdata exits. -update every|1|The frequency in seconds, for data collection. For more information see [Performance](../../doc/Performance.md#performance). +update every|1|The frequency in seconds, for data collection. For more information see [Performance](../../docs/Performance.md#performance). run as user|`netdata`|The user netdata will run as. web files owner|`netdata`|The user that owns the web static files. Netdata will refuse to serve a file that is not owned by this user, even if it has read access to that file. If the user given is not found, netdata will only serve files owned by user given in `run as user`. http port listen backlog|100|The port backlog. Check `man 2 listen`. @@ -107,7 +107,7 @@ External plugins will have only 2 options at `netdata.conf`: setting | default | info :------:|:-------:|:---- -update every|the value of `[global].update every` setting|The frequency in seconds the plugin should collect values. For more information check [Performance](../../doc/Performance.md#performance). +update every|the value of `[global].update every` setting|The frequency in seconds the plugin should collect values. For more information check [Performance](../../docs/Performance.md#performance). command options|*empty*|Additional command line options to pass to the plugin. External plugins that need additional configuration may support a dedicated file in `/etc/netdata`. Check their documentation. diff --git a/docker/Dockerfile b/docker/Dockerfile index 46a39e9ba5..2bad518ede 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -88,7 +88,7 @@ COPY --from=builder /app / RUN \ # Apply permissions as described in - # https://github.com/netdata/netdata/tree/master/doc/netdata-security.md#netdata-directories + # https://github.com/netdata/netdata/tree/master/docs/netdata-security.md#netdata-directories chown -R root:netdata /etc/netdata && \ chown -R netdata:netdata /var/cache/netdata /var/lib/netdata /usr/share/netdata && \ chown -R root:netdata /usr/lib/netdata && \ diff --git a/doc/Add-more-charts-to-netdata.md b/docs/Add-more-charts-to-netdata.md similarity index 100% rename from doc/Add-more-charts-to-netdata.md rename to docs/Add-more-charts-to-netdata.md diff --git a/doc/Demo-Sites.md b/docs/Demo-Sites.md similarity index 100% rename from doc/Demo-Sites.md rename to docs/Demo-Sites.md diff --git a/doc/Donations-netdata-has-received.md b/docs/Donations-netdata-has-received.md similarity index 100% rename from doc/Donations-netdata-has-received.md rename to docs/Donations-netdata-has-received.md diff --git a/doc/GettingStarted.md b/docs/GettingStarted.md similarity index 100% rename from doc/GettingStarted.md rename to docs/GettingStarted.md diff --git a/doc/Netdata-Security-and-Disclosure-Information.md b/docs/Netdata-Security-and-Disclosure-Information.md similarity index 100% rename from doc/Netdata-Security-and-Disclosure-Information.md rename to docs/Netdata-Security-and-Disclosure-Information.md diff --git a/doc/Performance.md b/docs/Performance.md similarity index 100% rename from doc/Performance.md rename to docs/Performance.md diff --git a/doc/Running-behind-apache.md b/docs/Running-behind-apache.md similarity index 100% rename from doc/Running-behind-apache.md rename to docs/Running-behind-apache.md diff --git a/doc/Running-behind-caddy.md b/docs/Running-behind-caddy.md similarity index 100% rename from doc/Running-behind-caddy.md rename to docs/Running-behind-caddy.md diff --git a/doc/Running-behind-lighttpd.md b/docs/Running-behind-lighttpd.md similarity index 100% rename from doc/Running-behind-lighttpd.md rename to docs/Running-behind-lighttpd.md diff --git a/doc/Running-behind-nginx.md b/docs/Running-behind-nginx.md similarity index 100% rename from doc/Running-behind-nginx.md rename to docs/Running-behind-nginx.md diff --git a/doc/Third-Party-Plugins.md b/docs/Third-Party-Plugins.md similarity index 100% rename from doc/Third-Party-Plugins.md rename to docs/Third-Party-Plugins.md diff --git a/doc/Why-Netdata.md b/docs/Why-Netdata.md similarity index 100% rename from doc/Why-Netdata.md rename to docs/Why-Netdata.md diff --git a/doc/a-github-star-is-important.md b/docs/a-github-star-is-important.md similarity index 100% rename from doc/a-github-star-is-important.md rename to docs/a-github-star-is-important.md diff --git a/docs/generator/buildhtml.sh b/docs/generator/buildhtml.sh new file mode 100755 index 0000000000..82196d66f0 --- /dev/null +++ b/docs/generator/buildhtml.sh @@ -0,0 +1,60 @@ +#!/bin/bash + +# buildhtml.sh + +# Builds the html static site, using mkdocs +# Assumes that the script is executed either from the htmldoc folder (by netlify), or from the root repo dir (as originally intended) +currentdir=$(pwd | awk -F '/' '{print $NF}') +echo "$currentdir" +if [ "$currentdir" = "generator" ]; then + cd ../.. +fi +GENERATOR_DIR="docs/generator" + +# Copy all netdata .md files to docs/generator/src. Exclude htmldoc itself and also the directory node_modules generatord by Netlify +echo "Copying files" +rm -rf ${GENERATOR_DIR}/src +find . -type d \( -path ./${GENERATOR_DIR} -o -path ./node_modules \) -prune -o -name "*.md" -print | cpio -pd ${GENERATOR_DIR}/src + +# Modify the first line of the main README.md, to enable proper static html generation +sed -i '0,/# netdata /s//# Introduction\n\n/' ${GENERATOR_DIR}/src/README.md + +# Remove specific files that don't belong in the documentation +declare -a EXCLUDE_LIST=( + "HISTORICAL_CHANGELOG.md" + "collectors/charts.d.plugin/mem_apps/README.md" + "collectors/charts.d.plugin/postfix/README.md" + "collectors/charts.d.plugin/tomcat/README.md" + "collectors/charts.d.plugin/sensors/README.md" + "collectors/charts.d.plugin/cpu_apps/README.md" + "collectors/charts.d.plugin/squid/README.md" + "collectors/charts.d.plugin/nginx/README.md" + "collectors/charts.d.plugin/hddtemp/README.md" + "collectors/charts.d.plugin/cpufreq/README.md" + "collectors/charts.d.plugin/mysql/README.md" + "collectors/charts.d.plugin/exim/README.md" + "collectors/charts.d.plugin/apache/README.md" + "collectors/charts.d.plugin/load_average/README.md" + "collectors/charts.d.plugin/phpfpm/README.md" +) +for f in "${EXCLUDE_LIST[@]}"; do + rm "${GENERATOR_DIR}/src/$f" +done + +echo "Creating mkdocs.yaml" + +# Generate mkdocs.yaml +${GENERATOR_DIR}/buildyaml.sh >${GENERATOR_DIR}/mkdocs.yml + +echo "Fixing links" + +# Fix links (recursively, all types, executing replacements) +${GENERATOR_DIR}/checklinks.sh -rax +if [ $? -eq 1 ]; then exit 1; fi + +echo "Calling mkdocs" + +# Build html docs +mkdocs build --config-file=${GENERATOR_DIR}/mkdocs.yml + +echo "Finished" diff --git a/htmldoc/buildyaml.sh b/docs/generator/buildyaml.sh similarity index 73% rename from htmldoc/buildyaml.sh rename to docs/generator/buildyaml.sh index 039a40c191..14e019fabb 100755 --- a/htmldoc/buildyaml.sh +++ b/docs/generator/buildyaml.sh @@ -1,6 +1,7 @@ #!/bin/bash -cd htmldoc/src +GENERATOR_DIR="docs/generator" +cd ${GENERATOR_DIR}/src # create yaml nav subtree with all the files directly under a specific directory # arguments: @@ -11,36 +12,35 @@ cd htmldoc/src # maxdepth - how many levels of subdirectories do I include in the yaml in this section. 1 means just the top level and is the default if left empty # excludefirstlevel - Optional param. If passed, mindepth is set to 2, to exclude the READMEs in the first directory level -navpart () { - tabs=$1 - dir=$2 - file=$3 - section=$4 - maxdepth=$5 - excludefirstlevel=$6 - spc="" - - i=1 - while [ ${i} -lt ${tabs} ] ; do - spc=" $spc" - i=$[$i + 1] - done - - if [ -z "$file" ] ; then file='*' ; fi - if [[ ! -z "$section" ]] ; then echo "$spc- ${section}:" ; fi - if [ -z "$maxdepth" ] ; then maxdepth=1; fi - if [[ ! -z "$excludefirstlevel" ]] ; then mindepth=2 ; else mindepth=1; fi - - for f in $(find $dir -mindepth $mindepth -maxdepth $maxdepth -name "${file}.md" -printf '%h\0%d\0%p\n' | sort -t '\0' -n | awk -F '\0' '{print $3}'); do - # If I'm adding a section, I need the child links to be one level deeper than the requested level in "tabs" - if [ -z "$section" ] ; then - echo "$spc- '$f'" - else - echo "$spc - '$f'" - fi - done -} +navpart() { + tabs=$1 + dir=$2 + file=$3 + section=$4 + maxdepth=$5 + excludefirstlevel=$6 + spc="" + i=1 + while [ ${i} -lt ${tabs} ]; do + spc=" $spc" + i=$((i + 1)) + done + + if [ -z "$file" ]; then file='*'; fi + if [[ -n $section ]]; then echo "$spc- ${section}:"; fi + if [ -z "$maxdepth" ]; then maxdepth=1; fi + if [[ -n $excludefirstlevel ]]; then mindepth=2; else mindepth=1; fi + + for f in $(find $dir -mindepth $mindepth -maxdepth $maxdepth -name "${file}.md" -printf '%h\0%d\0%p\n' | sort -t '\0' -n | awk -F '\0' '{print $3}'); do + # If I'm adding a section, I need the child links to be one level deeper than the requested level in "tabs" + if [ -z "$section" ]; then + echo "$spc- '$f'" + else + echo "$spc - '$f'" + fi + done +} echo -e 'site_name: NetData Documentation repo_url: https://github.com/netdata/netdata @@ -51,6 +51,7 @@ copyright: NetData, 2018 docs_dir: src site_dir: build #use_directory_urls: false +strict: true theme: name: "material" custom_dir: themes/material @@ -100,11 +101,11 @@ nav:' navpart 1 . README "About" -echo -ne " - 'doc/Why-Netdata.md' - - 'doc/Demo-Sites.md' - - 'doc/netdata-security.md' - - 'doc/Donations-netdata-has-received.md' - - 'doc/a-github-star-is-important.md' +echo -ne " - 'docs/Why-Netdata.md' + - 'docs/Demo-Sites.md' + - 'docs/netdata-security.md' + - 'docs/Donations-netdata-has-received.md' + - 'docs/a-github-star-is-important.md' - REDISTRIBUTED.md - CHANGELOG.md " @@ -116,7 +117,7 @@ echo -ne "- Installation: - 'installer/UNINSTALL.md' " -echo -ne "- 'doc/GettingStarted.md' +echo -ne "- 'docs/GettingStarted.md' " echo -ne "- Running netdata: @@ -127,23 +128,22 @@ navpart 2 daemon/config navpart 2 web/server "" "Web server" navpart 3 web/server "" "" 2 excludefirstlevel echo -ne " - Running behind another web server: - - 'doc/Running-behind-nginx.md' - - 'doc/Running-behind-apache.md' - - 'doc/Running-behind-lighttpd.md' - - 'doc/Running-behind-caddy.md' + - 'docs/Running-behind-nginx.md' + - 'docs/Running-behind-apache.md' + - 'docs/Running-behind-lighttpd.md' + - 'docs/Running-behind-caddy.md' " #navpart 2 system navpart 2 database navpart 2 registry -echo -ne " - 'doc/Performance.md' - - 'doc/netdata-for-IoT.md' - - 'doc/high-performance-netdata.md' +echo -ne " - 'docs/Performance.md' + - 'docs/netdata-for-IoT.md' + - 'docs/high-performance-netdata.md' " - navpart 1 collectors "" "Data collection" 1 -echo -ne " - 'doc/Add-more-charts-to-netdata.md' +echo -ne " - 'docs/Add-more-charts-to-netdata.md' - Internal plugins: " navpart 3 collectors/proc.plugin @@ -165,7 +165,7 @@ navpart 3 collectors/apps.plugin navpart 3 collectors/fping.plugin navpart 3 collectors/freeipmi.plugin -echo -ne " - 'doc/Third-Party-Plugins.md' +echo -ne " - 'docs/Third-Party-Plugins.md' " navpart 1 health README "Alarms and notifications" @@ -189,7 +189,7 @@ navpart 2 web/api/queries "" "Queries" 2 echo -ne "- Hacking netdata: - CONTRIBUTING.md - CODE_OF_CONDUCT.md - - 'doc/Netdata-Security-and-Disclosure-Information.md' + - 'docs/Netdata-Security-and-Disclosure-Information.md' - CONTRIBUTORS.md " navpart 2 makeself "" "" 4 @@ -198,9 +198,3 @@ navpart 2 libnetdata "" "libnetdata" 4 navpart 2 contrib navpart 2 tests navpart 2 diagrams/data_structures - - - - - - diff --git a/htmldoc/checklinks.sh b/docs/generator/checklinks.sh similarity index 74% rename from htmldoc/checklinks.sh rename to docs/generator/checklinks.sh index aa9c7262fc..628c6aee5c 100755 --- a/htmldoc/checklinks.sh +++ b/docs/generator/checklinks.sh @@ -1,15 +1,18 @@ #!/bin/bash +# shellcheck disable=SC2181 # Doc link checker # Validates and tries to fix all links that will cause issues either in the repo, or in the html site +GENERATOR_DIR="docs/generator" + dbg () { - if [ $VERBOSE -eq 1 ] ; then printf "%s\n" "${1}" ; fi + 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) + echo "Usage: docs/generator/checklinks.sh [-r OR -f <fname>] [OPTIONS] + -r Recursively check all mds in all child directories, except docs/generator and node_modules (which is generatord 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. @@ -19,13 +22,13 @@ printhelp () { -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) + -l Check relative links to the netdata repo (and replace them with links that the html static site can live with, under docs/generator/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 + if [ "$EXECUTE" -eq 0 ] ; then echo "-- SHOULD EXECUTE: $1" else dbg "-- EXECUTING: $1" @@ -37,7 +40,7 @@ ck_netdata_absolute () { f=$1 alnk=$2 lnkinfile=$3 - testURL $alnk + testURL "$alnk" if [[ $f =~ ^(.*)/([^/]*)$ ]] ; then fpath="${BASH_REMATCH[1]}" @@ -45,7 +48,7 @@ ck_netdata_absolute () { fi if [ $? -eq 0 ] ; then - rlnk=$(echo $alnk | sed 's/https:\/\/github.com\/netdata\/netdata\/....\/master\///g') + rlnk=$(echo "$alnk" | sed 's/https:\/\/github.com\/netdata\/netdata\/....\/master\///g') case $rlnk in \#* ) dbg "-- (#somelink)" ;; */ ) dbg "-- # (path/)" ;; @@ -80,13 +83,13 @@ ck_netdata_absolute () { rest="${BASH_REMATCH[2]}" dbg "-- Target file is at $abspath" fi - relativelink=$(realpath --relative-to=$fpath $abspath) + 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') + srch=$(echo "$lnkinfile" | sed 's/\//\\\//g') + if [ "$relativelink" = "." ] ; then + rplc=$(echo "$rest" | sed 's/\//\\\//g') else - rplc=$(echo $relativelink/$rest | sed 's/\//\\\//g') + rplc=$(echo "$relativelink/$rest" | sed 's/\//\\\//g') fi fix "sed -i 's/($srch)/($rplc)/g' $f" else @@ -100,9 +103,9 @@ ck_netdata_absolute () { } testURL () { - if [ $TESTURLS -eq 0 ] ; then return 0 ; fi + if [ "$TESTURLS" -eq 0 ] ; then return 0 ; fi dbg "-- Testing URL $1" - curl -sS $1 > /dev/null + curl -sS "$1" > /dev/null if [ $? -gt 0 ] ; then return 1 fi @@ -116,7 +119,7 @@ testinternal () { ilnk=${3} header=${ilnk//-/} dbg "-- Searching for \"$header\" in $ifile" - tr -d ',_.:? `'< $ifile | sed 's/-//g' | grep -i "^\#*$header\$" >/dev/null + tr -d ',_.:? `'< "$ifile" | sed 's/-//g' | grep -i "^\\#*$header\$" >/dev/null if [ $? -eq 0 ] ; then dbg "-- $ilnk found in $ifile" return 0 @@ -171,34 +174,34 @@ ck_netdata_relative () { case "$rlnk" in \#* ) dbg "-- # (#somelink)" - testinternal $f $f $rlnk + testinternal "$f" "$f" "$rlnk" ;; */ ) dbg "-- # (path/)" TRGT="$fpath/${rlnk}README.md" - testf $f $TRGT + testf "$f" "$TRGT" if [ $? -eq 0 ] ; then - if [ $fname != "README.md" ] ; then s="../$rlnk"; fi + 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 + testf "$f" "$TRGT" if [ $? -eq 0 ] ; then - testinternal $f $TRGT $LNK + testinternal "$f" "$TRGT" "$LNK" if [ $? -eq 0 ] ; then - if [ $fname != "README.md" ] ; then s="../$rlnk"; fi + if [ "$fname" != "README.md" ] ; then s="../$rlnk"; fi fi fi fi ;; *.md ) dbg "-- # (path/filename.md) -> htmldoc (path/filename/)" - testf $f "$fpath/$rlnk" + testf "$f" "$fpath/$rlnk" if [ $? -eq 0 ] ; then if [[ $rlnk =~ ^(.*)/(.*).md$ ]] ; then if [ "${BASH_REMATCH[2]}" = "README" ] ; then @@ -206,18 +209,18 @@ ck_netdata_relative () { else s="../${BASH_REMATCH[1]}/${BASH_REMATCH[2]}/" fi - if [ $fname != "README.md" ] ; then s="../$s"; fi + if [ "$fname" != "README.md" ] ; then s="../$s"; fi fi fi ;; - *.md#* ) + *.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 + testf "$f" "$TRGT" if [ $? -eq 0 ] ; then - testinternal $f $TRGT $LNK + testinternal "$f" "$TRGT" "$LNK" if [ $? -eq 0 ] ; then if [[ $lnk =~ ^(.*)/(.*).md#(.*)$ ]] ; then if [ "${BASH_REMATCH[2]}" = "README" ] ; then @@ -225,24 +228,24 @@ ck_netdata_relative () { else s="../${BASH_REMATCH[1]}/${BASH_REMATCH[2]}/#${BASH_REMATCH[3]}" fi - if [ $fname != "README.md" ] ; then s="../$s"; 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 + testf "$f" "$TRGT" if [ $? -eq 0 ] ; then - testinternal $f $TRGT $LNK + testinternal "$f" "$TRGT" "$LNK" if [ $? -eq 0 ] ; then if [[ $rlnk =~ ^(.*)#(.*)$ ]] ; then s="${BASH_REMATCH[1]}/#${BASH_REMATCH[2]}" - if [ $fname != "README.md" ] ; then s="../$s"; fi + if [ "$fname" != "README.md" ] ; then s="../$s"; fi fi fi fi @@ -251,7 +254,7 @@ ck_netdata_relative () { * ) if [ -f "$fpath/$rlnk" ] ; then dbg "-- # (path/someotherfile) $rlnk" - if [ $fpath = "." ] ; then + if [ "$fpath" = "." ] ; then s="https://github.com/netdata/netdata/tree/master/$rlnk" else s="https://github.com/netdata/netdata/tree/master/$fpath/$rlnk" @@ -259,10 +262,10 @@ ck_netdata_relative () { else if [ -d "$fpath/$rlnk" ] ; then dbg "-- # (path) -> htmldoc (path/)" - testf $f "$fpath/$rlnk/README.md" + testf "$f" "$fpath/$rlnk/README.md" if [ $? -eq 0 ] ; then s="$rlnk/" - if [ $fname != "README.md" ] ; then s="../$s"; fi + if [ "$fname" != "README.md" ] ; then s="../$s"; fi fi else echo "-- ERROR: $f - $rlnk is neither a file or a directory. Giving up!" @@ -273,9 +276,9 @@ ck_netdata_relative () { 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" + srch=$(echo "$rlnk" | sed 's/\//\\\//g') + rplc=$(echo "$s" | sed 's/\//\\\//g') + fix "sed -i 's/($srch)/($rplc)/g' $GENERATOR_DIR/src/$f" fi } @@ -283,26 +286,26 @@ ck_netdata_relative () { checklinks () { f=$1 dbg "Checking $f" - while read l ; do + while read -r l ; do for word in $l ; do if [[ $word =~ .*\]\(([^\(\) ]*)\).* ]] ; then lnk="${BASH_REMATCH[1]}" - if [ -z $lnk ] ; then continue ; fi + 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 + 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 + 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 [ "$CHKEXTERNAL" -eq 1 ] ; then + testURL "$lnk" if [ $? -eq 1 ] ; then echo "-- ERROR: $f - $lnk is a broken link" EXITCODE=1 @@ -311,12 +314,12 @@ checklinks () { ;; * ) dbg "-- Relative link $lnk" - if [ $CHKRELATIVE -eq 1 ] ; then ck_netdata_relative $f $lnk ; fi + if [ "$CHKRELATIVE" -eq 1 ] ; then ck_netdata_relative "$f" "$lnk" ; fi ;; esac fi done - done < $f + done < "$f" } TESTURLS=0 @@ -372,20 +375,20 @@ done EXITCODE=0 -if [ -z ${file} ] ; then +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 + for f in $(find . -type d \( -path ./${GENERATOR_DIR} -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 + checklinks "$file" fi exit $EXITCODE diff --git a/htmldoc/requirements.txt b/docs/generator/requirements.txt similarity index 100% rename from htmldoc/requirements.txt rename to docs/generator/requirements.txt diff --git a/htmldoc/runtime.txt b/docs/generator/runtime.txt similarity index 100% rename from htmldoc/runtime.txt rename to docs/generator/runtime.txt diff --git a/htmldoc/themes/material/partials/footer.html b/docs/generator/themes/material/partials/footer.html similarity index 100% rename from htmldoc/themes/material/partials/footer.html rename to docs/generator/themes/material/partials/footer.html diff --git a/doc/high-performance-netdata.md b/docs/high-performance-netdata.md similarity index 100% rename from doc/high-performance-netdata.md rename to docs/high-performance-netdata.md diff --git a/doc/netdata-for-IoT.md b/docs/netdata-for-IoT.md similarity index 100% rename from doc/netdata-for-IoT.md rename to docs/netdata-for-IoT.md diff --git a/doc/netdata-security.md b/docs/netdata-security.md similarity index 100% rename from doc/netdata-security.md rename to docs/netdata-security.md diff --git a/htmldoc/buildhtml.sh b/htmldoc/buildhtml.sh deleted file mode 100755 index cced6ffb5d..0000000000 --- a/htmldoc/buildhtml.sh +++ /dev/null @@ -1,55 +0,0 @@ -#!/bin/bash - -# buildhtml.sh - -# Builds the html static site, using mkdocs -# Assumes that the script is executed either from the htmldoc folder (by netlify), or from the root repo dir (as originally intended) -currentdir=$(pwd | awk -F '/' '{print $NF}') -if [ $currentdir = "htmldoc" ] ; then - cd .. -fi - - -# 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//# Introduction\n\n/' htmldoc/src/README.md - -# Remove specific files that don't belong in the documentation -rm htmldoc/src/HISTORICAL_CHANGELOG.md -rm htmldoc/src/collectors/charts.d.plugin/mem_apps/README.md -rm htmldoc/src/collectors/charts.d.plugin/postfix/README.md -rm htmldoc/src/collectors/charts.d.plugin/tomcat/README.md -rm htmldoc/src/collectors/charts.d.plugin/sensors/README.md -rm htmldoc/src/collectors/charts.d.plugin/cpu_apps/README.md -rm htmldoc/src/collectors/charts.d.plugin/squid/README.md -rm htmldoc/src/collectors/charts.d.plugin/nginx/README.md -rm htmldoc/src/collectors/charts.d.plugin/hddtemp/README.md -rm htmldoc/src/collectors/charts.d.plugin/cpufreq/README.md -rm htmldoc/src/collectors/charts.d.plugin/mysql/README.md -rm htmldoc/src/collectors/charts.d.plugin/exim/README.md -rm htmldoc/src/collectors/charts.d.plugin/apache/README.md -rm htmldoc/src/collectors/charts.d.plugin/load_average/README.md -rm htmldoc/src/collectors/charts.d.plugin/phpfpm/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" - diff --git a/installer/README.md b/installer/README.md index fca430438b..3658b50d8d 100644 --- a/installer/README.md +++ b/installer/README.md @@ -63,7 +63,7 @@ For automated installs, append a space + `--dont-wait` to the command line. You </details> <br/> -Once Netdata is installed, see [Getting Started](../doc/GettingStarted.md). +Once Netdata is installed, see [Getting Started](../docs/GettingStarted.md). --- @@ -128,7 +128,7 @@ sh /tmp/kickstart-static64.sh </details> <br/> -Once Netdata is installed, see [Getting Started](../doc/GettingStarted.md). +Once Netdata is installed, see [Getting Started](../docs/GettingStarted.md). --- @@ -390,7 +390,7 @@ When Netdata is first installed, it will run as _root_. This may or may not be a 1. Creat a group `netdata` via the Synology group interface. Give it no access to anything. 2. Create a user `netdata` via the Synology user interface. Give it no access to anything and a random password. Assign the user to the `netdata` group. Netdata will chuid to this user when running. -3. Change ownership of the following directories, as defined in [Netdata Security](../doc/netdata-security.md#security-design): +3. Change ownership of the following directories, as defined in [Netdata Security](../docs/netdata-security.md#security-design): ``` $ chown -R root:netdata /opt/netdata/usr/share/netdata diff --git a/netlify.toml b/netlify.toml index 1643a3fccb..9279412409 100644 --- a/netlify.toml +++ b/netlify.toml @@ -2,11 +2,11 @@ # unless otherwise overridden by more specific contexts. [build] # Directory to change to before starting a build. - base = "htmldoc/" + base = "/docs/generator" # Directory (relative to root of your repo) that contains the deploy-ready # HTML files and assets generated by the build. - publish = "htmldoc/build" + publish = "docs/generator/build" # Default build command. command = "./buildhtml.sh" diff --git a/registry/README.md b/registry/README.md index d35b33821c..a29df3ac67 100644 --- a/registry/README.md +++ b/registry/README.md @@ -46,7 +46,7 @@ The registry keeps track of 3 entities: ## Who talks to the registry? -Your web browser **only**! Check here if this is against your policies: [how to not send any information to a thirdparty server](../doc/netdata-security.md#security-design) +Your web browser **only**! Check here if this is against your policies: [how to not send any information to a thirdparty server](../docs/netdata-security.md#security-design) Your netdata servers do not talk to the registry. This is a UML diagram of its operation: diff --git a/web/gui/demosites.html b/web/gui/demosites.html index a5288d651f..9d7eba4c7b 100644 --- a/web/gui/demosites.html +++ b/web/gui/demosites.html @@ -699,21 +699,21 @@ p { network, firewall, <a href="https://github.com/netdata/netdata/tree/master/collectors/tc.plugin" target="_blank" data-ga-category="Outbound links" data-ga-action="Nav click" data-ga-label=QoS>QoS</a>, NFS, ZFS, etc). <br/> Detailed performance metrics for dozens of - <b><a href="https://github.com/netdata/netdata/blob/master/doc/Add-more-charts-to-netdata.md#add-more-charts-to-netdata" target="_blank" data-ga-category="Outbound links" data-ga-action="Nav click" data-ga-label=AddMoreCharts>applications</a></b> + <b><a href="https://github.com/netdata/netdata/blob/master/docs/Add-more-charts-to-netdata.md#add-more-charts-to-netdata" target="_blank" data-ga-category="Outbound links" data-ga-action="Nav click" data-ga-label=AddMoreCharts>applications</a></b> (such as web servers, databases servers, email servers, DNS servers, etc). <br/> Visualize metrics collected from <b><a href="https://github.com/netdata/netdata/blob/master/collectors/node.d.plugin/snmp" target="_blank" data-ga-category="Outbound links" data-ga-action="Nav click" data-ga-label=SNMP>SNMP devices</a></b>, and APM metrics via the embedded <b><a href="https://github.com/netdata/netdata/tree/master/collectors/statsd.plugin" target="_blank" data-ga-category="Outbound links" data-ga-action="Nav click" data-ga-label=statsd>statsd server</a></b>. </div> <div class=grid-cell><h3><span class=star>★</span> Out of the box</h3> - <p>netdata supports <a href="https://github.com/netdata/netdata/tree/master/doc/Why-Netdata.md#simplicity" 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 + <p>netdata supports <a href="https://github.com/netdata/netdata/tree/master/docs/Why-Netdata.md#simplicity" 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 <strong>zero configuration</strong>, it has <strong>zero dependencies</strong>, requires <strong>zero 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 failures, performance and availability issues. </div> <div class=grid-cell><h3><span class=star>★</span> In real-time</h3> <p>netdata collects thousands of metrics per server <strong>per second</strong>, - with <a href="https://github.com/netdata/netdata/blob/master/doc/Performance.md#netdata-performance" target="_blank" data-ga-category="Outbound links" data-ga-action="Nav click" data-ga-label=Performance>just 1% CPU</a> + with <a href="https://github.com/netdata/netdata/blob/master/docs/Performance.md#netdata-performance" target="_blank" data-ga-category="Outbound links" data-ga-action="Nav click" data-ga-label=Performance>just 1% CPU</a> utilization of a single core, <a href="https://github.com/netdata/netdata/tree/master/database" target="_blank" data-ga-category="Outbound links" data-ga-action="Nav click" data-ga-label=MemoryRequirements>a few MB of RAM</a> and no disk I/O at all. View everything on <strong>stunning</strong> real-time interactive web dashboards, even when netdata is @@ -727,7 +727,7 @@ p { (such as email, slack.com, pushover.net, pushbullet.com, telegram.org, twilio.com). </div> <div class=grid-cell><h3><span class=star>★</span> Embeddable</h3> - <p>netdata has minimal dependencies and can run <b><a href="https://github.com/netdata/netdata/blob/master/doc/netdata-for-IoT.md#netdata-for-iot" target="_blank" data-ga-category="Outbound links" data-ga-action="Nav click" data-ga-label=IoT>even weak on IoT devices</a></b>. Also, its charts can be embedded on any web site. + <p>netdata has minimal dependencies and can run <b><a href="https://github.com/netdata/netdata/blob/master/docs/netdata-for-IoT.md#netdata-for-iot" target="_blank" data-ga-category="Outbound links" data-ga-action="Nav click" data-ga-label=IoT>even weak on IoT devices</a></b>. Also, its charts can be embedded on any web site. </div> <div class=grid-cell><h3><span class=star>★</span> Customizable</h3> <p><a href="https://github.com/netdata/netdata/tree/master/web/gui/custom#custom-dashboards" target="_blank" data-ga-category="Outbound links" data-ga-action="Nav click" data-ga-label=CustomDashboards>Custom dashboards</a> can be built using simple HTML (no javascript necessary). diff --git a/web/gui/index.html b/web/gui/index.html index c6d460bf59..994ff2a593 100644 --- a/web/gui/index.html +++ b/web/gui/index.html @@ -418,7 +418,7 @@ <div class="p"> <b><a href="https://github.com/netdata/netdata/wiki" target="_blank">netdata</a></b> is free, open-source software. If you decide to use it, - <strong><a href="https://github.com/netdata/netdata/tree/master/doc/a-github-star-is-important.md" target="_blank">it is important to give netdata a star at GitHub</a></strong>. + <strong><a href="https://github.com/netdata/netdata/tree/master/docs/a-github-star-is-important.md" target="_blank">it is important to give netdata a star at GitHub</a></strong>. </div> <div class="p"> Enjoy real-time performance monitoring! diff --git a/web/gui/main.js b/web/gui/main.js index 22b558850e..ac3688267a 100644 --- a/web/gui/main.js +++ b/web/gui/main.js @@ -1612,7 +1612,7 @@ function renderPage(menus, data) { html += mhead + shtml + '</div></div><hr role="separator"/>'; } - sidebar += '<li class="" style="padding-top:15px;"><a href="https://github.com/netdata/netdata/blob/master/doc/Add-more-charts-to-netdata.md#add-more-charts-to-netdata" target="_blank"><i class="fas fa-plus"></i> add more charts</a></li>'; + sidebar += '<li class="" style="padding-top:15px;"><a href="https://github.com/netdata/netdata/blob/master/docs/Add-more-charts-to-netdata.md#add-more-charts-to-netdata" target="_blank"><i class="fas fa-plus"></i> add more charts</a></li>'; sidebar += '<li class=""><a href="https://github.com/netdata/netdata/tree/master/health#Health-monitoring" target="_blank"><i class="fas fa-plus"></i> add more alarms</a></li>'; sidebar += '<li class="" style="margin:20px;color:#666;"><small>netdata on <b>' + data.hostname.toString() + '</b>, collects every ' + ((data.update_every === 1) ? 'second' : data.update_every.toString() + ' seconds') + ' <b>' + data.dimensions_count.toLocaleString() + '</b> metrics, presented as <b>' + data.charts_count.toLocaleString() + '</b> charts and monitored by <b>' + data.alarms_count.toLocaleString() + '</b> alarms, using ' + Math.round(data.rrd_memory_bytes / 1024 / 1024).toLocaleString() + ' MB of memory for ' + NETDATA.seconds4human(data.update_every * data.history, {space: ' '}) + ' of real-time history.<br/> <br/><b>netdata</b><br/>v' + data.version.toString() + '</small></li>'; sidebar += '</ul>';