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
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Changelog

## v3.0.10
Updated on 2025-Dec-07
* FIXED: Bug fix in a CLI menu function to get the full value of notification parameters from the configuration file.
* FIXED: Bug fix in a WebUI JS function to get the full value of notification parameters from the configuration file.
* FIXED: Modified WebUI text message to show default interval of 5 minutes. Functionality was correct. This is just a correction to the text string.

## v3.0.9
Updated on 2025-Nov-27
* FIXED: In some rare situations, the setting for the ping test server IP address went "missing" from the configuration file, and the value could no longer be modified by the user.
Expand Down
89 changes: 54 additions & 35 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="25120710"
readonly SCRIPT_VERSTAG="25120718"
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 @@ -3478,24 +3478,34 @@ Validate_Float()
fi
}

##----------------------------------------##
## Modified by Martinski W. [2025-Dec-07] ##
##----------------------------------------##
Notification_String()
{
NOTIFICATION_STRING=""
while true
do
printf "\\n${BOLD}Enter $1:${CLEARFORMAT} "
printf "\n${BOLD}Enter ${1}:${CLRct}"
if echo "$1" | grep -qE '.* API Token$'
then printf "\n"
else printf " "
fi
read -r NOTIFICATION_STRING
if [ "$NOTIFICATION_STRING" = "e" ]; then
if [ "$NOTIFICATION_STRING" = "e" ]
then
NOTIFICATION_STRING=""
break
else
printf "${BOLD}${WARN}Is this correct? (y/n):${CLEARFORMAT} "
printf "${BOLD}${WARN}Is this correct? (y/n):${CLRct} "
read -r CONFIRM_INPUT
case "$CONFIRM_INPUT" in
y|Y)
if [ "$1" = "To name" ]; then
if [ "$1" = "To name" ]
then
sed -i 's/^TO_NAME=.*$/TO_NAME='"$NOTIFICATION_STRING"'/' "$EMAIL_CONF"
elif [ "$1" = "Username" ]; then
elif [ "$1" = "Username" ]
then
sed -i 's/^USERNAME=.*$/USERNAME='"$NOTIFICATION_STRING"'/' "$EMAIL_CONF"
else
Conf_Parameters update "$1" "$NOTIFICATION_STRING"
Expand All @@ -3515,15 +3525,15 @@ Notification_Number()
NOTIFICATION_NUMBER=""
while true
do
printf "\\n${BOLD}Enter $1:${CLEARFORMAT} "
printf "\n${BOLD}Enter ${1}:${CLRct} "
read -r NOTIFICATION_NUMBER
if [ "$NOTIFICATION_NUMBER" = "e" ]; then
NOTIFICATION_NUMBER=""
break
elif ! Validate_Number "$NOTIFICATION_NUMBER"; then
printf "\\n${ERR}Please enter a number${CLEARFORMAT}\\n"
printf "\n${ERR}Please enter a number${CLRct}\n"
else
printf "${BOLD}${WARN}Is this correct? (y/n):${CLEARFORMAT} "
printf "${BOLD}${WARN}Is this correct? (y/n):${CLRct} "
read -r CONFIRM_INPUT
case "$CONFIRM_INPUT" in
y|Y)
Expand Down Expand Up @@ -3905,6 +3915,9 @@ Menu_WebhookNotifications()
done
}

##----------------------------------------##
## Modified by Martinski W. [2025-Dec-07] ##
##----------------------------------------##
Menu_PushoverNotifications()
{
while true
Expand All @@ -3919,13 +3932,13 @@ Menu_PushoverNotifications()
if [ -z "$NOTIFICATIONS_PUSHOVER_LIST" ]; then
NOTIFICATIONS_PUSHOVER_LIST="All devices"
fi
printf "1. Toggle Pushover notifications (subject to type configuration)\\n Currently: ${BOLD}${NOTIFICATIONS_PUSHOVER}${CLEARFORMAT}\\n\\n"
printf "\\n${BOLD}${UNDERLINE}Pushover Configuration${CLEARFORMAT}\\n"
printf "c1. Set API token\\n Currently: ${SETTING}%s${CLEARFORMAT}\\n\\n" "$(Conf_Parameters check NOTIFICATIONS_PUSHOVER_API)"
printf "c2. Set User key\\n Currently: ${SETTING}%s${CLEARFORMAT}\\n\\n" "$(Conf_Parameters check NOTIFICATIONS_PUSHOVER_USERKEY)"
printf "c3. Set list of Pushover devices for %s\\n Current devices: ${SETTING}${NOTIFICATIONS_PUSHOVER_LIST}${CLEARFORMAT}\\n\\n" "$SCRIPT_NAME"
printf "cs. Send a test pushover notification\\n\\n"
printf "e. Go back\n\n"
printf " 1. Toggle Pushover notifications (subject to type configuration)\n Currently: ${BOLD}${NOTIFICATIONS_PUSHOVER}${CLRct}\n\n"
printf " ${BOLD}${GRNct}${UNDERLINE}Pushover Configuration${CLRct}\n\n"
printf "c1. Set Pushover API Token\n Currently: ${SETTING}%s${CLEARFORMAT}\n\n" "$(Conf_Parameters check NOTIFICATIONS_PUSHOVER_API)"
printf "c2. Set Pushover User Key\n Currently: ${SETTING}%s${CLEARFORMAT}\n\n" "$(Conf_Parameters check NOTIFICATIONS_PUSHOVER_USERKEY)"
printf "c3. Set list of Pushover devices for %s\n Current devices: ${SETTING}${NOTIFICATIONS_PUSHOVER_LIST}${CLEARFORMAT}\n\n" "$SCRIPT_NAME"
printf "cs. Send a test pushover notification\n\n"
printf " e. Go back\n\n"
printf "${BOLD}##############################################################${CLEARFORMAT}\n"
printf "\n"

Expand Down Expand Up @@ -4122,6 +4135,9 @@ Menu_CustomActions()
done
}

##----------------------------------------##
## Modified by Martinski W. [2025-Dec-07] ##
##----------------------------------------##
Menu_HealthcheckNotifications()
{
while true
Expand All @@ -4132,12 +4148,12 @@ Menu_HealthcheckNotifications()
then NOTIFICATIONS_HEALTHCHECK="${PASS}Enabled"
else NOTIFICATIONS_HEALTHCHECK="${ERR}Disabled"
fi
printf "1. Toggle healthchecks.io\\n Currently: ${BOLD}${NOTIFICATIONS_HEALTHCHECK}${CLEARFORMAT}\\n\\n"
printf "\\n${BOLD}${UNDERLINE}Healthcheck Configuration${CLEARFORMAT}\\n\\n"
printf "c1. Set Healthcheck UUID\\n Currently: ${SETTING}%s${CLEARFORMAT}\\n\\n" "$(Conf_Parameters check NOTIFICATIONS_HEALTHCHECK_UUID)"
printf "Cron schedule for Healthchecks.io configuration: ${SETTING}%s${CLEARFORMAT}\\n\\n" "$(cru l | grep "$SCRIPT_NAME" | cut -f1-5 -d' ')"
printf "cs. Send a test healthcheck notification\\n\\n"
printf "e. Go back\n\n"
printf " 1. Toggle healthchecks.io\n Currently: ${BOLD}${NOTIFICATIONS_HEALTHCHECK}${CLRct}\n\n"
printf " ${BOLD}${GRNct}${UNDERLINE}Healthcheck Configuration${CLRct}\n\n"
printf "c1. Set Healthcheck UUID\n Currently: ${SETTING}%s${CLEARFORMAT}\n\n" "$(Conf_Parameters check NOTIFICATIONS_HEALTHCHECK_UUID)"
printf "Cron schedule for Healthchecks.io configuration: ${SETTING}%s${CLEARFORMAT}\n\n" "$(cru l | grep "$SCRIPT_NAME" | cut -f1-5 -d' ')"
printf "cs. Send a test healthcheck notification\n\n"
printf " e. Go back\n\n"
printf "${BOLD}##############################################################${CLEARFORMAT}\n"
printf "\n"

Expand Down Expand Up @@ -4171,6 +4187,9 @@ Menu_HealthcheckNotifications()
done
}

##----------------------------------------##
## Modified by Martinski W. [2025-Dec-07] ##
##----------------------------------------##
Menu_InfluxDB()
{
while true
Expand All @@ -4181,17 +4200,17 @@ Menu_InfluxDB()
then NOTIFICATIONS_INFLUXDB="${PASS}Enabled"
else NOTIFICATIONS_INFLUXDB="${ERR}Disabled"
fi
printf "1. Toggle InfluxDB exporting\\n Currently: ${BOLD}${NOTIFICATIONS_INFLUXDB}${CLEARFORMAT}\\n\\n"
printf "\\n${BOLD}${UNDERLINE}InfluxDB Configuration${CLEARFORMAT}\\n\\n"
printf "c1. Set InfluxDB Host\\n Currently: ${SETTING}%s${CLEARFORMAT}\\n\\n" "$(Conf_Parameters check NOTIFICATIONS_INFLUXDB_HOST)"
printf "c2. Set InfluxDB Port\\n Currently: ${SETTING}%s${CLEARFORMAT}\\n\\n" "$(Conf_Parameters check NOTIFICATIONS_INFLUXDB_PORT)"
printf "c3. Set InfluxDB Database\\n Currently: ${SETTING}%s${CLEARFORMAT}\\n\\n" "$(Conf_Parameters check NOTIFICATIONS_INFLUXDB_DB)"
printf "c4. Set InfluxDB Version\\n Currently: ${SETTING}%s${CLEARFORMAT}\\n\\n" "$(Conf_Parameters check NOTIFICATIONS_INFLUXDB_VERSION)"
printf "c5. Set InfluxDB Username (v1.8+ only)\\n Currently: ${SETTING}%s${CLEARFORMAT}\\n\\n" "$(Conf_Parameters check NOTIFICATIONS_INFLUXDB_USERNAME)"
printf "c6. Set InfluxDB Password (v1.8+ only)\\n\\n"
printf "c7. Set InfluxDB API Token (v2.x only)\\n Currently: ${SETTING}%s${CLEARFORMAT}\\n\\n" "$(Conf_Parameters check NOTIFICATIONS_INFLUXDB_APITOKEN)"
printf "cs. Send test data to InfluxDB\\n\\n"
printf "e. Go back\n\n"
printf " 1. Toggle InfluxDB exporting\n Currently: ${BOLD}${NOTIFICATIONS_INFLUXDB}${CLRct}\n\n"
printf " ${BOLD}${GRNct}${UNDERLINE}InfluxDB Configuration${CLRct}\n\n"
printf "c1. Set InfluxDB Host\n Currently: ${SETTING}%s${CLEARFORMAT}\n\n" "$(Conf_Parameters check NOTIFICATIONS_INFLUXDB_HOST)"
printf "c2. Set InfluxDB Port\n Currently: ${SETTING}%s${CLEARFORMAT}\n\n" "$(Conf_Parameters check NOTIFICATIONS_INFLUXDB_PORT)"
printf "c3. Set InfluxDB Database\n Currently: ${SETTING}%s${CLEARFORMAT}\n\n" "$(Conf_Parameters check NOTIFICATIONS_INFLUXDB_DB)"
printf "c4. Set InfluxDB Version\n Currently: ${SETTING}%s${CLEARFORMAT}\n\n" "$(Conf_Parameters check NOTIFICATIONS_INFLUXDB_VERSION)"
printf "c5. Set InfluxDB Username (v1.8+ only)\\n Currently: ${SETTING}%s${CLEARFORMAT}\n\n" "$(Conf_Parameters check NOTIFICATIONS_INFLUXDB_USERNAME)"
printf "c6. Set InfluxDB Password (v1.8+ only)\n\n"
printf "c7. Set InfluxDB API Token (v2.x only)\n Currently: ${SETTING}%s${CLEARFORMAT}\n\n" "$(Conf_Parameters check NOTIFICATIONS_INFLUXDB_APITOKEN)"
printf "cs. Send test data to InfluxDB\n\n"
printf " e. Go back\n\n"
printf "${BOLD}##############################################################${CLEARFORMAT}\n"
printf "\n"

Expand Down Expand Up @@ -4255,7 +4274,7 @@ Menu_Notifications()
while true
do
ScriptHeader
printf " ${BOLD}${GRNct}${UNDERLINE}Notification Types${CLEARFORMAT}\n\n"
printf " ${BOLD}${GRNct}${UNDERLINE}Notification Types${CLRct}\n\n"
printf " 1. Ping test success\n"
printf " Current methods: ${SETTING}$(NotificationMethods check PingTestOK)${CLEARFORMAT}\n\n"
printf " 2. Ping test failure\n"
Expand All @@ -4270,7 +4289,7 @@ Menu_Notifications()
printf " Current threshold: ${SETTING}$(Conf_Parameters check NOTIFICATIONS_LINEQUALITYTHRESHOLD_VALUE) %%${CLEARFORMAT}\n"
printf " Current methods: ${SETTING}$(NotificationMethods check LineQualityThreshold)${CLEARFORMAT}\n\n"

printf "\n ${BOLD}${GRNct}${UNDERLINE}Notification Methods and Integrations${CLEARFORMAT}\n\n"
printf "\n ${BOLD}${GRNct}${UNDERLINE}Notification Methods and Integrations${CLEARFORMAT}\n\n"
NOTIFICATION_SETTING=""
if ToggleNotificationTypes check NOTIFICATIONS_EMAIL
then NOTIFICATION_SETTING="${PASS}Enabled"
Expand Down
80 changes: 38 additions & 42 deletions connmonstats_www.asp

Large diffs are not rendered by default.

20 changes: 14 additions & 6 deletions connmonstats_www.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**----------------------------**/
/** Last Modified: 2025-Nov-16 **/
/** Last Modified: 2025-Dec-07 **/
/**----------------------------**/

iziToast.settings({
Expand Down Expand Up @@ -1521,7 +1521,7 @@ function getEmailpwFile()
}

/**----------------------------------------**/
/** Modified by Martinski W. [2025-Nov-14] **/
/** Modified by Martinski W. [2025-Dec-07] **/
/**----------------------------------------**/
function getConfigFile()
{
Expand All @@ -1534,17 +1534,23 @@ function getConfigFile()
},
success: function (data)
{
let settingname, settingvalue;
let settingname, settingvalue, equalSignIndx;
var configdata = data.split('\n');
configdata = configdata.filter(Boolean);

for (var indx = 0; indx < configdata.length; indx++)
{
if (configdata[indx].length === 0 || configdata[indx].match('^[ ]*#') !== null)
if (configdata[indx].length === 0 ||
configdata[indx].match('^[ ]*#') !== null)
{ continue; } //Skip comments & empty lines//

settingname = configdata[indx].split('=')[0];
settingvalue = configdata[indx].split('=')[1].replace(/(\r\n|\n|\r)/gm,'');

equalSignIndx = configdata[indx].indexOf('=');
if (equalSignIndx !== -1)
{ settingvalue = configdata[indx].slice(equalSignIndx + 1).replace(/(\r\n|\n|\r)/gm,''); }
else
{ continue; }

if (settingname.match(/^JFFS_MSGLOGTIME/) != null)
{ continue; } //Skip this config setting//
Expand Down Expand Up @@ -1610,7 +1616,9 @@ function getConfigFile()
for (var i2 = 0; i2 < linequalitythresholdtypearray.length; i2++)
{ $('#connmon_linequalitythreshold_' + linequalitythresholdtypearray[i2].toLowerCase()).prop('checked', true); }
}
else if (settingname.indexOf('notifications_email_list') !== -1 || settingname.indexOf('notifications_pushover_list') !== -1 || settingname.indexOf('notifications_webhook_list') !== -1)
else if (settingname.indexOf('notifications_email_list') !== -1 ||
settingname.indexOf('notifications_webhook_list') !== -1 ||
settingname.indexOf('notifications_pushover_list') !== -1)
{
eval('document.form.connmon_' + settingname).value = settingvalue.replace(/,/g, '\n');
}
Expand Down