Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -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.
Expand Down
27 changes: 14 additions & 13 deletions connmon.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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)}')"
Expand All @@ -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="
Expand Down Expand Up @@ -3487,7 +3487,7 @@ SendHealthcheckPing()
}

##----------------------------------------##
## Modified by Martinski W. [2025-Dec-11] ##
## Modified by Martinski W. [2025-Dec-12] ##
##----------------------------------------##
SendToInfluxDB()
{
Expand Down Expand Up @@ -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" \
Expand Down
16 changes: 8 additions & 8 deletions connmonstats_www.asp

Large diffs are not rendered by default.

29 changes: 18 additions & 11 deletions connmonstats_www.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**----------------------------**/
/** Last Modified: 2025-Dec-07 **/
/** Last Modified: 2025-Dec-12 **/
/**----------------------------**/

iziToast.settings({
Expand Down Expand Up @@ -1123,7 +1123,7 @@ function parseLastXData(data)
}

/**----------------------------------------**/
/** Modified by Martinski W. [2025-Nov-14] **/
/** Modified by Martinski W. [2025-Dec-12] **/
/**----------------------------------------**/
$.fn.serializeObject = function()
{
Expand All @@ -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' &&
Expand All @@ -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' &&
Expand Down Expand Up @@ -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 || '';
}
});
Expand Down Expand Up @@ -1742,7 +1744,8 @@ function getEmailInfo() {
});
}

function getChangelogFile() {
function getChangelogFile()
{
$.ajax({
url: '/ext/connmon/changelog.htm',
dataType: 'text',
Expand All @@ -1756,7 +1759,8 @@ function getChangelogFile() {
});
}

function getVersionNumber(versiontype) {
function getVersionNumber(versiontype)
{
var versionprop;
if (versiontype === 'local') {
versionprop = customSettings.connmon_version_local;
Expand All @@ -1773,7 +1777,8 @@ function getVersionNumber(versiontype) {
}
}

function getVersionChangelogFile() {
function getVersionChangelogFile()
{
$.ajax({
url: '/ext/connmon/detect_changelog.js',
dataType: 'script',
Expand All @@ -1789,7 +1794,8 @@ function getVersionChangelogFile() {
});
}

function buildLastXTableNoData() {
function buildLastXTableNoData()
{
var tablehtml = '<table width="100%" border="1" align="center" cellpadding="4" cellspacing="0" bordercolor="#6b8fa3" class="sortTable">';
tablehtml += '<tr>';
tablehtml += '<td colspan="6" class="nodata">';
Expand Down Expand Up @@ -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);
Expand Down