Files
Cactidocumentation/bin/build_html_docs.sh
Thomas Vincent 57b8088e13 docs: comprehensive validation audit, Spine poller overhaul, and technical refactor (#229)
* docs: comprehensive audit, Spine poller overhaul, and technical refactor

- Overhaul Spine documentation (Spine.md) with complete end-to-end guide: architecture, prerequisites for modern distros (EL8/9 CRB, Ubuntu 22/24, Debian 11/12, FreeBSD), SUID root permissions, secure spine.conf setup (0640), Web UI configuration (Paths, Poller type, Data Collectors tuning), MySQL max_connections sizing, and troubleshooting.
- Fix broken links and anchors (Hardening, SNMP data queries, Hook API references).
- Fix broken image reference in Sites.md (add-site.JPG -> add-site.png).
- Fix syntax errors in documentation PHP code blocks, including invalid parenthesization, missing SQL execute quotes, and malformed comments in FAQ.
- Fix DevOps installation commands: use config.php.dist, correct systemctl service names for MySQL/MariaDB/PHP-FPM, remove nonexistent php-json, add missing composer install, and correct Debian/Ubuntu systemd environment path.
- Correct grammatical errors, repeated words, and typos across all markdown documents.
- Remove obsolete unreferenced duplicate installation guides.

Signed-off-by: Thomas Vincent <thomasvincent@gmail.com>

* docs: correct reviewed examples and guidance

Signed-off-by: Thomas Vincent <thomasvincent@gmail.com>

* docs: correct guidance that disagrees with the Cacti source

Verified each claim against include/global_arrays.php, lib/auth.php,
lib/functions.php, host_templates.php and the Spine config parser. The
notable ones: api_plugin_safe_exec() does not exist on either branch,
Spine reads DB_Pass rather than DB_Password, and the CDEF special data
source table was missing five entries and renamed four others.

Signed-off-by: Thomas Vincent <thomasvincent@gmail.com>

* docs: wrap Spine prose and fence the connection sizing formula

The formula's bare asterisks rendered as emphasis, dropping the multiplication signs.

Signed-off-by: Thomas Vincent <thomasvincent@gmail.com>

* chore: refresh copyright year in scripts and issue templates

Signed-off-by: Thomas Vincent <thomasvincent@gmail.com>

---------

Signed-off-by: Thomas Vincent <thomasvincent@gmail.com>
2026-09-08 09:41:21 -04:00

110 lines
3.1 KiB
Bash
Executable File

#!/bin/bash
# +-------------------------------------------------------------------------+
# | Copyright (C) 2004-2026 The Cacti Group |
# | |
# | This program is free software; you can redistribute it and/or |
# | modify it under the terms of the GNU General Public License |
# | as published by the Free Software Foundation; either version 2 |
# | of the License, or (at your option) any later version. |
# | |
# | This program is distributed in the hope that it will be useful, |
# | but WITHOUT ANY WARRANTY; without even the implied warranty of |
# | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
# | GNU General Public License for more details. |
# +-------------------------------------------------------------------------+
# | http://www.cacti.net/ |
# +-------------------------------------------------------------------------+
#
# Helper script to build HTML documentation from markdown source
# define script variables
UTILS="pandoc"
ODIR="html"
# check if for required utilities
ERROR=""
for UTIL in ${UTILS}
do
if ! which "${UTIL}" 1>/dev/null 2>&1
then
ERROR="${ERROR} - ${UTIL}\n"
fi
done
if [ -n "${ERROR}" ]
then
echo "ERROR: Required utilities not found"
echo
echo "Please install the following utilities:"
echo "${ERROR}"
exit 1
fi
# make sure pandoc has lua support
if ! pandoc --help | grep 'lua-filter' 1>/dev/null 2>&1
then
echo "ERROR: Required LUA Filter support not found in Pandoc utility"
echo " Make sure you have version 2.3.1 or higher installed"
exit 1
fi
# determine base path of the repository
BASE_PATH="$( cd "$(dirname "$0")" ; pwd -P | sed 's/\/bin//')"
# create output directory if needed
if [ ! -d "${BASE_PATH}/${ODIR}/images" ]
then
if ! mkdir -p "${BASE_PATH}/${ODIR}/images"
then
echo "ERROR: Unable to create output directory: ${ODIR}"
exit 1
fi
fi
# copy image resources
echo "Copying images..."
if ! cp -r "${BASE_PATH}/images/"* "${BASE_PATH}/${ODIR}/images/"
then
echo "ERROR: Failed to copy images"
exit 1
fi
# copy css resourse
echo "Copying css..."
if ! cp -r "${BASE_PATH}/resources/css/"* "${BASE_PATH}/${ODIR}/"
then
echo "ERROR: Failed to copy images"
exit 1
fi
# process markdown files into html
echo "Converting files..."
for FILE in $(find "${BASE_PATH}" -name "*.md")
do
IFILE=${FILE//$BASE_PATH\/}
OFILE=${ODIR}/${IFILE//.md/.html}
TITLE=$(grep "^# " "$FILE" | head -1 | sed 's/# //')
# handle special case for table of contents
if [ "${IFILE}" = "README.md" ]
then
OFILE="${ODIR}/Table-of-Contents.html"
fi
echo " '${IFILE}' => '${OFILE}'"
pandoc --from=gfm --to=html5 "${IFILE}" \
--standalone \
--output="${BASE_PATH}/${OFILE}" \
--lua-filter="${BASE_PATH}/resources/build/pandoc_links_to_html.lua" \
--css=Cacti-Github.css \
--metadata=pagetitle:"$TITLE" \
-T "Cacti"
done
# done
exit 0