### Install connmon on AsusWRT-Merlin Source: https://context7.com/amtm-osr/connmon/llms.txt Download and install connmon using curl. Ensure the script is executable and then run the install command. ```sh # Download and install connmon /usr/sbin/curl -fsL --retry 3 "https://raw.githubusercontent.com/AMTM-OSR/connmon/master/connmon.sh" -o "/jffs/scripts/connmon" && chmod 0755 /jffs/scripts/connmon && /jffs/scripts/connmon install ``` -------------------------------- ### Cron Schedule Configuration Source: https://context7.com/amtm-osr/connmon/llms.txt Examples of cron-style notation for scheduling automatic ping tests. ```sh # Every 5 minutes (default) SCHDAYS=* SCHHOURS=* SCHMINS=*/5 # Every hour at minute 0 SCHDAYS=* SCHHOURS=* SCHMINS=0 # Every 15 minutes during business hours (8 AM to 6 PM) SCHDAYS=Mon,Tues,Wed,Thurs,Fri SCHHOURS=8-18 SCHMINS=*/15 # Every 30 minutes on weekdays only SCHDAYS=1-5 SCHHOURS=* SCHMINS=*/30 # Specific times: 6 AM, 12 PM, 6 PM, 12 AM SCHDAYS=* SCHHOURS=0,6,12,18 SCHMINS=0 # Weekend only, every 10 minutes SCHDAYS=0,6 SCHHOURS=* SCHMINS=*/10 ``` -------------------------------- ### Launch connmon Menu Source: https://github.com/amtm-osr/connmon/blob/master/README.md Execute this command to open the connmon menu after installation. If it fails, use the full path to the script. ```sh connmon ``` ```sh /jffs/scripts/connmon ``` -------------------------------- ### connmon Configuration Parameters Source: https://context7.com/amtm-osr/connmon/llms.txt Example configuration file showing core settings for ping tests, scheduling, data retention, notifications (Email, Discord, Pushover, Healthchecks.io, InfluxDB), and threshold triggers. ```sh # Core ping test settings PINGSERVER=8.8.8.8 # IP address or domain name to ping PINGDURATION=30 # Duration of each ping test in seconds (10-60) AUTOMATICMODE=true # Enable/disable automatic scheduled tests # Schedule settings (cron format) SCHDAYS=* # Days of week (* = every day, 0=Sun, 6=Sat) SCHHOURS=* # Hours to run tests (* = every hour, 0-23) SCHMINS=*/5 # Minutes (* = every minute, */5 = every 5 minutes) # Data retention and display DAYSTOKEEP=30 # Number of days to retain data (15-365) LASTXRESULTS=10 # Number of recent results to show in WebUI (5-100) OUTPUTTIMEMODE=unix # Time format for CSV exports (unix or non-unix) STORAGELOCATION=jffs # Storage location (jffs or usb) EXCLUDEFROMQOS=true # Exclude ping tests from QoS # Email notification settings NOTIFICATIONS_EMAIL=false NOTIFICATIONS_EMAIL_LIST= # Comma-separated email addresses # Discord webhook settings NOTIFICATIONS_WEBHOOK=false NOTIFICATIONS_WEBHOOK_LIST= # Comma-separated webhook URLs # Pushover settings NOTIFICATIONS_PUSHOVER=false NOTIFICATIONS_PUSHOVER_API= NOTIFICATIONS_PUSHOVER_USERKEY= NOTIFICATIONS_PUSHOVER_LIST= # Comma-separated device names # Custom scripts NOTIFICATIONS_CUSTOM=false # Enable custom user scripts in userscripts.d/ # Healthchecks.io integration NOTIFICATIONS_HEALTHCHECK=false NOTIFICATIONS_HEALTHCHECK_UUID= # InfluxDB integration NOTIFICATIONS_INFLUXDB=false NOTIFICATIONS_INFLUXDB_HOST= NOTIFICATIONS_INFLUXDB_PORT=8086 NOTIFICATIONS_INFLUXDB_PROTO=http NOTIFICATIONS_INFLUXDB_DB=connmon NOTIFICATIONS_INFLUXDB_ORG=homenet NOTIFICATIONS_INFLUXDB_VERSION=2.0 NOTIFICATIONS_INFLUXDB_USERNAME= NOTIFICATIONS_INFLUXDB_PASSWORD= NOTIFICATIONS_INFLUXDB_APITOKEN= # Notification triggers - specify methods: None, Email, Webhook, Pushover, Custom NOTIFICATIONS_PINGTEST=None # Notify on each ping test NOTIFICATIONS_PINGTEST_FAILED=None # Notify on ping test failure NOTIFICATIONS_PINGTHRESHOLD=None # Notify when ping exceeds threshold NOTIFICATIONS_JITTERTHRESHOLD=None # Notify when jitter exceeds threshold NOTIFICATIONS_LINEQUALITYTHRESHOLD=None # Notify when quality below threshold # Threshold values NOTIFICATIONS_PINGTHRESHOLD_VALUE=30 # Ping threshold in ms NOTIFICATIONS_JITTERTHRESHOLD_VALUE=15 # Jitter threshold in ms NOTIFICATIONS_LINEQUALITYTHRESHOLD_VALUE=75 # Line quality threshold in % ``` -------------------------------- ### Install connmon Source: https://github.com/amtm-osr/connmon/blob/master/README.md Use this command to install connmon on your AsusWRT Merlin router. Ensure you have Entware installed and jffs scripts enabled. ```sh /usr/sbin/curl -fsL --retry 3 "https://raw.githubusercontent.com/AMTM-OSR/connmon/master/connmon.sh" -o "/jffs/scripts/connmon" && chmod 0755 /jffs/scripts/connmon && /jffs/scripts/connmon install ``` -------------------------------- ### Get Connmon Database Statistics Source: https://context7.com/amtm-osr/connmon/llms.txt Retrieve statistics about the connmon SQLite database, including the total number of records and the oldest and newest timestamps. ```sql sqlite3 /jffs/addons/connmon.d/connstats.db "SELECT COUNT(*) as Records, MIN(datetime(Timestamp,'unixepoch','localtime')) as Oldest, MAX(datetime(Timestamp,'unixepoch','localtime')) as Newest FROM connstats;" ``` -------------------------------- ### Connmon Startup Script Integration Source: https://context7.com/amtm-osr/connmon/llms.txt Illustrates how connmon is integrated into the AsusWRT-Merlin startup process via the post-mount script for automatic initialization upon system mount. ```shell # post-mount script entry (created automatically during install) # File: /jffs/scripts/post-mount [ -x "${1}/entware/bin/opkg" ] && [ -x /jffs/scripts/connmon ] && /jffs/scripts/connmon startup "$@" & # connmon # service-event script entry (created automatically during install) ``` -------------------------------- ### Service Event and Manual Startup Source: https://context7.com/amtm-osr/connmon/llms.txt Commands for handling service events and manually triggering the connmon startup process. ```bash if echo "$2" | /bin/grep -q "connmon"; then { /jffs/scripts/connmon service_event "$@" & }; fi # connmon # Manual startup (useful after system changes) connmon startup force ``` -------------------------------- ### Launch connmon CLI Menu Source: https://context7.com/amtm-osr/connmon/llms.txt Access the interactive command-line interface for connmon configuration and management. If the direct command fails, use the full path. ```sh # Launch connmon interactive menu connmon ``` ```sh # Alternative with full path (if above doesn't work) /jffs/scripts/connmon ``` -------------------------------- ### Configure Email Notifications Source: https://context7.com/amtm-osr/connmon/llms.txt Set up email notification settings by creating or modifying the email configuration file. This includes sender/recipient addresses, router name, credentials, and SMTP server details. ```shell # Email configuration file format cat > /jffs/addons/amtm/mail/email.conf << 'EOF' # Email settings (mail envelope) FROM_ADDRESS="router@example.com" TO_NAME="Admin" TO_ADDRESS="admin@example.com" FRIENDLY_ROUTER_NAME="MyRouter" # Email credentials USERNAME="your_email@gmail.com" # Password is stored encrypted in emailpw.enc # Server settings SMTP="smtp.gmail.com" PORT="465" PROTOCOL="smtps" SSL_FLAG="" EOF # Common SMTP server settings: # Gmail: smtp.gmail.com Port: 465 Protocol: smtps # mail.com: smtp.mail.com Port: 587 Protocol: smtp # Yahoo: smtp.mail.yahoo.com Port: 465 Protocol: smtps # Outlook: smtp-mail.outlook.com Port: 587 Protocol: smtp # Note: For Gmail with 2FA, use an App Password instead of your regular password ``` -------------------------------- ### Create Custom Notification Script Source: https://context7.com/amtm-osr/connmon/llms.txt Create and make executable a custom shell script for connmon notifications. This script handles different trigger types and allows for custom logging or actions. ```shell #!/bin/sh # Arguments passed to script based on trigger type: # # PingTestOK: # $1 = "PingTestOK" # $2 = Date/Time stamp # $3 = Ping (ms) # $4 = Jitter (ms) # $5 = Line Quality (%) # $6 = Ping Target # # PingTestFailed: # $1 = "PingTestFailed" # $2 = Date/Time stamp # $3 = Ping Target # # PingThreshold / JitterThreshold / LineQualityThreshold: # $1 = Trigger type # $2 = Date/Time stamp # $3 = Current value # $4 = Threshold value # $5 = Ping Target TRIGGER_TYPE="$1" DATETIME="$2" case "$TRIGGER_TYPE" in PingTestOK) PING="$3" JITTER="$4" QUALITY="$5" TARGET="$6" logger -t "connmon_custom" "Ping test OK: ${PING}, Jitter: ${JITTER}, Quality: ${QUALITY}" # Add your custom notification code here ;; PingTestFailed) TARGET="$3" logger -t "connmon_custom" "Ping test FAILED to ${TARGET}" # Add your custom notification code here ;; PingThreshold|JitterThreshold|LineQualityThreshold) VALUE="$3" THRESHOLD="$4" TARGET="$5" logger -t "connmon_custom" "${TRIGGER_TYPE}: ${VALUE} exceeded threshold ${THRESHOLD}" # Add your custom notification code here ;; esac ``` ```shell chmod +x /jffs/addons/connmon.d/userscripts.d/my_notification.sh ``` -------------------------------- ### Run connmon Commands Source: https://context7.com/amtm-osr/connmon/llms.txt Execute various connmon functions from the command line, including generating tests, managing scheduled tests, updating, database maintenance, and uninstallation. ```sh # Run a ping test immediately and save to database connmon generate ``` ```sh # Enable automatic ping tests (scheduled via cron) connmon enable ``` ```sh # Disable automatic ping tests connmon disable ``` ```sh # Check for and apply available updates connmon update ``` ```sh # Force update to latest version connmon forceupdate ``` ```sh # Run database maintenance (normally runs automatically at 3:03 AM daily) connmon trimdb ``` ```sh # Generate CSV exports from database connmon outputcsv ``` ```sh # Display help information connmon help ``` ```sh # Display about information connmon about ``` ```sh # Uninstall connmon completely connmon uninstall ``` -------------------------------- ### Create connmon Custom User Scripts Directory Source: https://context7.com/amtm-osr/connmon/llms.txt Ensures the directory for custom user scripts is created, allowing integration with any notification service. ```sh # Create userscripts directory (if not exists) mkdir -p /jffs/addons/connmon.d/userscripts.d/ ``` -------------------------------- ### WebUI URL Format Source: https://context7.com/amtm-osr/connmon/llms.txt Typical URL formats for accessing the connmon WebUI via a router admin panel. ```sh # Get the WebUI URL programmatically # The URL is displayed when running the connmon menu # Typical WebUI URL format: # http://router.asus.com/user1.asp (or user2.asp, etc.) # https://192.168.1.1/user1.asp ``` -------------------------------- ### Export Connmon Data to CSV Source: https://context7.com/amtm-osr/connmon/llms.txt Export connmon statistics data from the last 7 days to a CSV file using sqlite3. Includes headers for clarity. ```sql sqlite3 -header -csv /jffs/addons/connmon.d/connstats.db "SELECT * FROM connstats WHERE Timestamp >= strftime('%s','now','-7 day');" > weekly_data.csv ``` -------------------------------- ### Configure InfluxDB Notifications Source: https://context7.com/amtm-osr/connmon/llms.txt Configure connmon to send ping test data to an InfluxDB instance. This involves setting connection details and authentication tokens. ```shell # InfluxDB 2.x configuration example # Set in connmon configuration file or via WebUI NOTIFICATIONS_INFLUXDB=true NOTIFICATIONS_INFLUXDB_HOST=192.168.1.100 NOTIFICATIONS_INFLUXDB_PORT=8086 NOTIFICATIONS_INFLUXDB_PROTO=http NOTIFICATIONS_INFLUXDB_DB=connmon # Bucket name in InfluxDB 2.x NOTIFICATIONS_INFLUXDB_ORG=homenet # Organization name NOTIFICATIONS_INFLUXDB_VERSION=2.0 NOTIFICATIONS_INFLUXDB_APITOKEN=your_token_here # Data format sent to InfluxDB (Line Protocol): # PingTest,Router=MODEL,Source=connmon Jitter=VALUE,LineQuality=VALUE,PingAvrg=VALUE,PingServer="TARGET" TIMESTAMP # Example Grafana query for InfluxDB 2.x (Flux): # from(bucket: "connmon") # |> range(start: -24h) # |> filter(fn: (r) => r._measurement == "PingTest") # |> filter(fn: (r) => r._field == "PingAvrg" or r._field == "Jitter" or r._field == "LineQuality") ``` -------------------------------- ### Query Recent Ping Results Source: https://context7.com/amtm-osr/connmon/llms.txt Query the connmon SQLite database for the 10 most recent ping test results, including timestamp, ping, jitter, line quality, and target. ```sql sqlite3 /jffs/addons/connmon.d/connstats.db "SELECT datetime(Timestamp,'unixepoch','localtime') as Time, Ping, Jitter, LineQuality, PingTarget FROM connstats ORDER BY Timestamp DESC LIMIT 10;" ``` -------------------------------- ### Connmon Database Table Schema Source: https://context7.com/amtm-osr/connmon/llms.txt Defines the schema for the connstats table in the connmon SQLite database, detailing the columns and their data types. ```sql CREATE TABLE connstats ( StatID INTEGER PRIMARY KEY NOT NULL, Timestamp NUMERIC NOT NULL, Ping REAL NOT NULL, Jitter REAL NOT NULL, LineQuality REAL NOT NULL, PingTarget TEXT NOT NULL, PingDuration NUMERIC ); ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.