diff --git a/README.md b/README.md index 7b471bf..0552b47 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ # connmon ## v3.0.10 -### Updated on 2025-Dec-11 +### Updated on 2025-Dec-12 ## About connmon is an internet connection monitoring tool for AsusWRT Merlin with charts for daily, weekly and monthly summaries. diff --git a/connmon.sh b/connmon.sh index db3db65..e1ba37b 100644 --- a/connmon.sh +++ b/connmon.sh @@ -37,7 +37,7 @@ ### Start of script variables ### readonly SCRIPT_NAME="connmon" readonly SCRIPT_VERSION="v3.0.10" -readonly SCRIPT_VERSTAG="25121123" +readonly SCRIPT_VERSTAG="25121222" SCRIPT_BRANCH="develop" SCRIPT_REPO="https://raw.githubusercontent.com/AMTM-OSR/$SCRIPT_NAME/$SCRIPT_BRANCH" readonly SCRIPT_DIR="/jffs/addons/$SCRIPT_NAME.d" @@ -466,21 +466,21 @@ Validate_Domain() } ##----------------------------------------## -## Modified by Martinski W. [2025-Dec-07] ## +## Modified by Martinski W. [2025-Dec-12] ## ##----------------------------------------## Conf_FromSettings() { SETTINGSFILE="/jffs/addons/custom_settings.txt" - TMPFILE="/tmp/connmon_settings.txt" + TEMP_FILE="/tmp/connmon_settings.txt" if [ -f "$SETTINGSFILE" ] then - if [ "$(grep "^connmon_" $SETTINGSFILE | grep -v "version" -c)" -gt 0 ] + if [ "$(grep "^connmon_" $SETTINGSFILE | grep -Ecv '_version_[ls]')" -gt 0 ] then Print_Output true "Updated settings from WebUI found, merging into $SCRIPT_CONF" "$PASS" cp -a "$SCRIPT_CONF" "${SCRIPT_CONF}.bak" - grep "^connmon_" "$SETTINGSFILE" | grep -v "version" > "$TMPFILE" - sed -i "s/^connmon_//g;s/ /=/g" "$TMPFILE" + grep "^connmon_" "$SETTINGSFILE" | grep -Ev '_version_[ls]' > "$TEMP_FILE" + sed -i "s/^connmon_//g;s/ /=/g" "$TEMP_FILE" while IFS='' read -r line || [ -n "$line" ] do SETTINGNAME="$(echo "$line" | cut -d'=' -f1 | awk '{print toupper($1)}')" @@ -492,13 +492,13 @@ Conf_FromSettings() SETTINGVALUE="$(echo "$SETTINGVALUE" | sed 's~||||~,~g')" fi sed -i "s~$SETTINGNAME=.*~$SETTINGNAME=$SETTINGVALUE~" "$SCRIPT_CONF" - done < "$TMPFILE" + done < "$TEMP_FILE" - grep '^connmon_version' "$SETTINGSFILE" > "$TMPFILE" + grep -E '^connmon_version_[ls]' "$SETTINGSFILE" > "$TEMP_FILE" sed -i "\\~connmon_~d" "$SETTINGSFILE" mv -f "$SETTINGSFILE" "${SETTINGSFILE}.bak" - cat "${SETTINGSFILE}.bak" "$TMPFILE" > "$SETTINGSFILE" - rm -f "$TMPFILE" + cat "${SETTINGSFILE}.bak" "$TEMP_FILE" > "$SETTINGSFILE" + rm -f "$TEMP_FILE" rm -f "${SETTINGSFILE}.bak" if diff -U0 "$SCRIPT_CONF" "${SCRIPT_CONF}.bak" | grep -qE "[-+]STORAGELOCATION=" @@ -3487,7 +3487,7 @@ SendHealthcheckPing() } ##----------------------------------------## -## Modified by Martinski W. [2025-Dec-11] ## +## Modified by Martinski W. [2025-Dec-12] ## ##----------------------------------------## SendToInfluxDB() { @@ -3525,8 +3525,9 @@ SendToInfluxDB() else routerID="$(echo "$ROUTER_MODEL" | sed 's/ /_/g')" fi - dataTags="Jitter=${JITTER},LineQuality=${LINEQUAL},PingAvrg=${PING},PingServer=${pingTARGET},Source=$SCRIPT_NAME" - dataFields="Router=\"${ROUTER_MODEL}\"" + ## Variable ping test results are assigned to InfluxDB data "fields" ## + dataTags="Router=${routerID},Source=${SCRIPT_NAME}" + dataFields="Jitter=${JITTER},LineQuality=${LINEQUAL},PingAvrg=${PING},PingServer=\"${PING_TARGET}\"" curl -vSL --retry 4 --retry-delay 5 --connect-timeout 60 -o "$curlOutLogFile" \ "${INFLUXDB_PROTO}://${INFLUXDB_HOST}:${INFLUXDB_PORT}/api/v2/write?org=${INFLUXDB_ORG}&bucket=${INFLUXDB_BID}&precision=s" \ diff --git a/connmonstats_www.asp b/connmonstats_www.asp index 6eaa015..6e6c2eb 100644 --- a/connmonstats_www.asp +++ b/connmonstats_www.asp @@ -33,7 +33,7 @@ p{font-weight:bolder}thead.collapsible-jquery{color:#fff;padding:0;width:100%;bo @@ -1060,7 +1060,7 @@ function getCookie(e,t){if(null!==cookie.get("conn_"+e)){if("string"===t)return id="table_connmonemailconfig"> - Email notifications + Email Notifications @@ -1517,7 +1517,7 @@ function getCookie(e,t){if(null!==cookie.get("conn_"+e)){if("string"===t)return id="table_healthchecksioconfig"> - Healthchecks.io monitoring + Healthchecks.io Monitoring @@ -1594,7 +1594,7 @@ function getCookie(e,t){if(null!==cookie.get("conn_"+e)){if("string"===t)return class="FormTable SettingsTable" id="table_influxdbconfig"> - InfluxDB exporting + InfluxDB Exporting @@ -1676,15 +1676,15 @@ function getCookie(e,t){if(null!==cookie.get("conn_"+e)){if("string"===t)return data-lpignore="true" /> - + InfluxDB Version - + - + diff --git a/connmonstats_www.js b/connmonstats_www.js index e32423b..675ce88 100644 --- a/connmonstats_www.js +++ b/connmonstats_www.js @@ -1,5 +1,5 @@ /**----------------------------**/ -/** Last Modified: 2025-Dec-07 **/ +/** Last Modified: 2025-Dec-12 **/ /**----------------------------**/ iziToast.settings({ @@ -1123,7 +1123,7 @@ function parseLastXData(data) } /**----------------------------------------**/ -/** Modified by Martinski W. [2025-Nov-14] **/ +/** Modified by Martinski W. [2025-Dec-12] **/ /**----------------------------------------**/ $.fn.serializeObject = function() { @@ -1133,13 +1133,13 @@ $.fn.serializeObject = function() { if (o[this.name] !== undefined && this.name.indexOf('connmon') !== -1 && - this.name.indexOf('version') === -1 && this.name.indexOf('ipaddr') === -1 && this.name.indexOf('domain') === -1 && this.name.indexOf('schdays') === -1 && this.name.indexOf('pushover_list') === -1 && this.name.indexOf('pushover_list') === -1 && this.name.indexOf('webhook_list') === -1 && + this.name.indexOf('connmon_version_') === -1 && this.name !== 'connmon_notifications_pingtest' && this.name !== 'connmon_notifications_pingtest_failed' && this.name !== 'connmon_notifications_pingthreshold' && @@ -1152,13 +1152,13 @@ $.fn.serializeObject = function() o[this.name].push(this.value || ''); } else if (this.name.indexOf('connmon') !== -1 && - this.name.indexOf('version') === -1 && this.name.indexOf('ipaddr') === -1 && this.name.indexOf('domain') === -1 && this.name.indexOf('schdays') === -1 && this.name.indexOf('pushover_list') === -1 && this.name.indexOf('pushover_list') === -1 && this.name.indexOf('webhook_list') === -1 && + this.name.indexOf('connmon_version_') === -1 && this.name !== 'connmon_notifications_pingtest' && this.name !== 'connmon_notifications_pingtest_failed' && this.name !== 'connmon_notifications_pingthreshold' && @@ -1304,13 +1304,15 @@ $.fn.serializeObjectEmail = function() var o = customSettings; var a = this.serializeArray(); $.each(a, function () { - if (o[this.name] !== undefined && this.name.indexOf('email_') !== -1 && this.name.indexOf('show_pass') === -1) { + if (o[this.name] !== undefined && this.name.indexOf('email_') !== -1 && this.name.indexOf('show_pass') === -1) + { if (!o[this.name].push) { o[this.name] = [o[this.name]]; } o[this.name].push(this.value || ''); } - else if (this.name.indexOf('email_') !== -1 && this.name.indexOf('show_pass') === -1) { + else if (this.name.indexOf('email_') !== -1 && this.name.indexOf('show_pass') === -1) + { o[this.name] = this.value || ''; } }); @@ -1742,7 +1744,8 @@ function getEmailInfo() { }); } -function getChangelogFile() { +function getChangelogFile() +{ $.ajax({ url: '/ext/connmon/changelog.htm', dataType: 'text', @@ -1756,7 +1759,8 @@ function getChangelogFile() { }); } -function getVersionNumber(versiontype) { +function getVersionNumber(versiontype) +{ var versionprop; if (versiontype === 'local') { versionprop = customSettings.connmon_version_local; @@ -1773,7 +1777,8 @@ function getVersionNumber(versiontype) { } } -function getVersionChangelogFile() { +function getVersionChangelogFile() +{ $.ajax({ url: '/ext/connmon/detect_changelog.js', dataType: 'script', @@ -1789,7 +1794,8 @@ function getVersionChangelogFile() { }); } -function buildLastXTableNoData() { +function buildLastXTableNoData() +{ var tablehtml = ''; tablehtml += ''; tablehtml += '
'; @@ -2066,7 +2072,8 @@ function saveConfig(section) default: var disabledfields = $('#' + section).find('[disabled]'); disabledfields.prop('disabled', false); - document.getElementById('amng_custom').value = JSON.stringify($('#' + section).find('input,select,textarea').serializeObject()); + var updateSettings = JSON.stringify($('#' + section).find('input,select,textarea').serializeObject()); + document.getElementById('amng_custom').value = updateSettings; document.formScriptActions.action_script.value = 'start_addon_settings;start_connmonconfig'; document.formScriptActions.submit(); disabledfields.prop('disabled', true);