From 342a33c63992bb74334dcac2022d580091b45cf8 Mon Sep 17 00:00:00 2001 From: Roland Haeder Date: Thu, 14 Apr 2016 21:49:43 +0200 Subject: [PATCH] Continued a bit: - user list is now "basicly finished" - added monitoring script for cron-job based monitoring MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Roland Häder --- monitor/.monitor-cron.sh | 6 ++ monitor/README.txt | 24 ++++++ monitor/monitor-cron.sh | 33 +++++++++ nbproject/faces-config.NavData | 74 +++++++++---------- .../localization/bundle_de_DE.properties | 17 +++++ .../localization/bundle_en_US.properties | 14 ++++ web/admin/admin_user_list.xhtml | 53 ++++++++++++- web/resources/css/cssLayout.css | 12 +++ 8 files changed, 195 insertions(+), 38 deletions(-) create mode 100644 monitor/.monitor-cron.sh create mode 100644 monitor/README.txt create mode 100755 monitor/monitor-cron.sh diff --git a/monitor/.monitor-cron.sh b/monitor/.monitor-cron.sh new file mode 100644 index 00000000..fb44abae --- /dev/null +++ b/monitor/.monitor-cron.sh @@ -0,0 +1,6 @@ +#!/bin/bash + +# URL based on project name may sometimes fail, so you have to set it "statically" here: +PROJECT_URL="http://glassfish-base-url.invalid/${PROJECT_NAME}/" +PROJECT_USER="user" +PROJECT_PASSWORD="password" diff --git a/monitor/README.txt b/monitor/README.txt new file mode 100644 index 00000000..6527106e --- /dev/null +++ b/monitor/README.txt @@ -0,0 +1,24 @@ +How to use this monitoring scripts: +----------------------------------- + +1) Copy .monitor-config.sh to ${HOME}/.monitor-pizzaservice-war-cron.sh + Please note that your clone path must be 'pizzaservice-war' then. + +2) Execute "crontab -e" as same user + +3) Add line such as: + +PATH="/bla/foo/bin:/bar/bin" +SHELL="/bin/bash" + +*/10 * * * * cd ${HOME}/checkouts/pizzaservice-war/monitor/ && ./monitor-cron.sh + +Please make sure PATH and SHELL are set (maybe prevents some problems). + +4) Save the file and let it install it. + +5) You are done. + +Now every 10 minutes the connection to your glassfish is tested by a HEAD +request. Please don't set it to high as this may cause huge load on your server +even when it is only a HEAD request. diff --git a/monitor/monitor-cron.sh b/monitor/monitor-cron.sh new file mode 100755 index 00000000..8596595b --- /dev/null +++ b/monitor/monitor-cron.sh @@ -0,0 +1,33 @@ +#!/bin/bash + +# Find project name +PROJECT_NAME="${PWD%/*}" +PROJECT_NAME="${PROJECT_NAME##*/}" + +# FQFN for temporary file +MONITOR_TEMP_FILE="/tmp/${PROJECT_NAME}.down" + +# Construct FQFN for configuration file +CONFIG_FILE="${HOME}/.monitor-${PROJECT_NAME}-cron.sh" + +. "${CONFIG_FILE}" || exit 255 + +MONITOR_OUTPUT=`lynx -dump -head "${PROJECT_URL}" -auth="${PROJECT_USER}:${PROJECT_PASSWORD}" | head -n 1` + +if [ "${MONITOR_OUTPUT}" != "HTTP/1.1 200 OK" ] +then + if [ ! -f "${MONITOR_TEMP_FILE}" ] + then + echo "$0: ${PROJECT_NAME} is DOWN, status: '${MONITOR_OUTPUT}'" + echo "${MONITOR_OUTPUT}" > ${MONITOR_TEMP_FILE} + exit 1 + fi +elif [ -f "${MONITOR_TEMP_FILE}" ] +then + PREVIOUS_STATUS=`cat "${MONITOR_TEMP_FILE}"` + echo "$0: ${PROJECT_NAME} is UP again, old status was: '${PREVIOUS_STATUS}'" + rm -f "${MONITOR_TEMP_FILE}" +fi + +# All fine +exit 0 diff --git a/nbproject/faces-config.NavData b/nbproject/faces-config.NavData index 820dd593..7513fe97 100644 --- a/nbproject/faces-config.NavData +++ b/nbproject/faces-config.NavData @@ -2,44 +2,44 @@ - - - - - - - - - + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/java/org/mxchange/localization/bundle_de_DE.properties b/src/java/org/mxchange/localization/bundle_de_DE.properties index 4c9d1c41..1d12106e 100644 --- a/src/java/org/mxchange/localization/bundle_de_DE.properties +++ b/src/java/org/mxchange/localization/bundle_de_DE.properties @@ -439,3 +439,20 @@ ADMIN_LIST_MOBILE_PROVIDER_ENTRY_CREATED=Erstellt: ADMIN_LINK_EDIT_DELETE_MOBILE_PROVIDER_TITLE=Aendern oder loeschen des Handyanbieters ADMIN_ADD_USER_ENTER_PASSWORD1=Passwort eingeben: ADMIN_ADD_USER_ENTER_PASSWORD2=Passwort wiederholen: +ADMIN_LIST_USER_ID=Benutzer-Id: +ADMIN_LIST_USER_NAME=Benutzername: +ADMIN_LIST_USER_GENDER=Anrede: +ADMIN_LIST_USER_FIRST_NAME=Vorname: +ADMIN_LIST_USER_FAMILY_NAME=Nachname: +ADMIN_LIST_USER_ACCOUNT_STATUS=Account-Status: +ADMIN_LIST_USER_PROFILE_MODE=Profilsichtbarkeit: +ADMIN_LIST_USER_CREATED=Angemeldet seit: +#@TODO Please fix German umlauts! +USER_ACCOUNT_STATUS_CONFIRMED=Bestaetigt +#@TODO Please fix German umlauts! +USER_ACCOUNT_STATUS_UNCONFIRMED=Unbestaetigt +USER_ACCOUNT_STATUS_LOCKED=Gesperrt +USER_PROFILE_MODE_INVISIBLE=Durchsichtig +USER_PROFILE_MODE_MEMBERS=Nur Mitglieder +#@TODO Please fix German umlauts! +USER_PROFILE_MODE_PUBLIC=Oeffentlich diff --git a/src/java/org/mxchange/localization/bundle_en_US.properties b/src/java/org/mxchange/localization/bundle_en_US.properties index 9c9f3553..18715d8f 100644 --- a/src/java/org/mxchange/localization/bundle_en_US.properties +++ b/src/java/org/mxchange/localization/bundle_en_US.properties @@ -366,3 +366,17 @@ ADMIN_LIST_MOBILE_PROVIDER_ENTRY_CREATED=Created: ADMIN_LINK_EDIT_DELETE_MOBILE_PROVIDER_TITLE=Edit or delete mobile provider ADMIN_ADD_USER_ENTER_PASSWORD1=Enter password: ADMIN_ADD_USER_ENTER_PASSWORD2=Repeat password: +ADMIN_LIST_USER_ID=User id: +ADMIN_LIST_USER_NAME=User name: +ADMIN_LIST_USER_GENDER=Gender: +ADMIN_LIST_USER_FIRST_NAME=First name: +ADMIN_LIST_USER_FAMILY_NAME=Family name: +ADMIN_LIST_USER_ACCOUNT_STATUS=Account status: +ADMIN_LIST_USER_PROFILE_MODE=Profile visibility: +ADMIN_LIST_USER_CREATED=Registered: +USER_ACCOUNT_STATUS_CONFIRMED=Confirmed +USER_ACCOUNT_STATUS_UNCONFIRMED=Unconfirmed +USER_ACCOUNT_STATUS_LOCKED=Locked +USER_PROFILE_MODE_INVISIBLE=Invisible +USER_PROFILE_MODE_MEMBERS=Only members +USER_PROFILE_MODE_PUBLIC=Public diff --git a/web/admin/admin_user_list.xhtml b/web/admin/admin_user_list.xhtml index b8b0e353..e8bc9179 100644 --- a/web/admin/admin_user_list.xhtml +++ b/web/admin/admin_user_list.xhtml @@ -14,7 +14,58 @@ - + + + #{msg.ADMIN_LIST_USER_ID} + + + + + + + + #{msg.ADMIN_LIST_USER_NAME} + + + + + + #{msg.ADMIN_LIST_USER_GENDER} + + + + + + #{msg.ADMIN_LIST_USER_FIRST_NAME} + + + + + + #{msg.ADMIN_LIST_USER_FAMILY_NAME} + + + + + + #{msg.ADMIN_LIST_USER_ACCOUNT_STATUS} + + + + + + #{msg.ADMIN_LIST_USER_PROFILE_MODE} + + + + + + #{msg.ADMIN_LIST_USER_CREATED} + + + + +
diff --git a/web/resources/css/cssLayout.css b/web/resources/css/cssLayout.css index dbc9c59d..bf62f151 100644 --- a/web/resources/css/cssLayout.css +++ b/web/resources/css/cssLayout.css @@ -201,3 +201,15 @@ ul.footer_nav li.footer_copyright { .okay { color: #00aa00; } + +.user_status_confirmed { + color: #00aa00; +} + +.user_status_unconfirmed { + color: #00aaaa; +} + +.user_status_unconfirmed { + color: #aa0000; +} -- 2.39.5