Răsfoiți Sursa

feat: add optional GitHub attribution link in HTML report and improve configuration section

TheHuman00 8 luni în urmă
părinte
comite
fbd08eb2d0
2 a modificat fișierele cu 25 adăugiri și 9 ștergeri
  1. 10 6
      README.md
  2. 15 3
      chrony-network-stats.sh

+ 10 - 6
README.md

@@ -7,12 +7,13 @@ Demo here : [https://thehuman00.github.io/demo-chrony-stats.github.io/](https://
 
 ## Features
 
-- **Multi-period time views**: View Chrony statistics across day, week, and month periods with tabbed interface
-- **HTML report**: Creates a styled HTML page with embedded graphs and raw `chronyc` command outputs
-- **Network monitoring**: vnStat integration for comprehensive network traffic analysis
+- **Multi-period time views**: View Chrony statistics across day, week, and month periods
+- **HTML report**: HTML page with graphs and raw `chronyc` command outputs
+- **Network monitoring**: withvnStat
 - **Chrony statistics**
-- **Data quality**: Filters aberrant values during Chrony restarts to maintain graph readability
-- **Lightweight**: Designed to be resource-efficient, with minimal overhead and no heavy dependencies
+- **Data quality**: Filters aberrant values during Chrony restarts
+- **Lightweight**
+- **Optional GitHub attribution**: It's completely optional by default - feel free to use it however you want, no credit needed! 👍
 
 ## Prerequisites
 
@@ -78,6 +79,10 @@ The script includes a configuration section at the top of `chrony-network-stats.
    ## that distort the graph scale. This parameter filters out values above the threshold,
    ## creating gaps in the graph instead of displaying misleading spikes.
    SERVER_STATS_UPPER_LIMIT=100000
+
+   ## You can display or not the link to the chrony-stats GitHub repository in the HTML page
+   ## It's completely optional by default - feel free to use it however you want, no credit needed! 👍
+   GITHUB_REPO_LINK_SHOW="no"
    #########################
    [...]
    ```
@@ -93,7 +98,6 @@ The script includes a configuration section at the top of `chrony-network-stats.
 
 2. **View the Output**:
    - The HTML report is generated at `/var/www/chrony-network-stats/index.html`
-   - Features tabbed interface with Day/Week/Month views for Chrony statistics
    - Serves this file via a web server (e.g., Apache or Nginx)
 
    [See here how to serve via nginx in localhost](nginx.md)

+ 15 - 3
chrony-network-stats.sh

@@ -1,7 +1,7 @@
 #!/bin/bash
 set -e
 
-#### Configuration ####
+####################### Configuration ######################
 INTERFACE="eth0"
 
 PAGE_TITLE="Network Traffic and Chrony Statistics for ${INTERFACE}"
@@ -17,10 +17,15 @@ HEIGHT=300
 TIMEOUT_SECONDS=5
 
 ## When chrony restarts, it can generate abnormally high statistical values (e.g., 12M packets)
-## that distort the graph scale. This parameter filters out values above the threshold,
+## This parameter filters out values above the threshold,
 ## creating gaps in the graph instead of displaying misleading spikes.
 SERVER_STATS_UPPER_LIMIT=100000
-#######################
+
+## You can display the link to the repo 'chrony-stats' in the HTML footer
+## Not required | Default: no
+GITHUB_REPO_LINK_SHOW="no"
+
+##############################################################
 
 log_message() {
     local level="$1"
@@ -612,6 +617,13 @@ generate_html() {
 
         <footer>
             <p>Page generated on: ${GENERATED_TIMESTAMP}</p>
+EOF
+    if [[ "$GITHUB_REPO_LINK_SHOW" == "yes" ]]; then
+        cat >>"$OUTPUT_DIR/$HTML_FILENAME" <<EOF
+            <p>Made with ❤️ by TheHuman00 | <a href="https://github.com/TheHuman00/chrony-stats" target="_blank">View on GitHub</a></p>
+EOF
+    fi
+    cat >>"$OUTPUT_DIR/$HTML_FILENAME" <<EOF
         </footer>
     </div>