foglamp script modified to accommodate changes in ping
@@ -299,9 +299,23 @@ foglamp_status() {
if [[ "$1" == "silent" ]]; then
echo "0"
else
- tot_sec=`echo $result | cut -d":" -f2 | cut -d"." -f1`
+
+ uptime_sec=`echo ${result} | tr -d ' ' | grep -o '"uptime".*' | cut -d":" -f2 | cut -d"." -f1`
+ record_read=`echo ${result} | tr -d ' ' | grep -o '"dataRead".*' | cut -d":" -f2 | cut -d"," -f1 | sed -e 's/}//g'`
+ record_sent=`echo ${result} | tr -d ' ' | grep -o '"dataSent".*' | cut -d":" -f2 | cut -d"," -f1 | sed -e 's/}//g'`
+ record_purged=`echo ${result} | tr -d ' ' | grep -o '"dataPurged".*' | cut -d":" -f2 | cut -d"," -f1 | sed -e 's/}//g'`
+ auth_opt=`echo ${result} | tr -d ' ' | grep -o '"authenticationOptional".*' | cut -d":" -f2 | cut -d"," -f1 | sed -e 's/}//g'`
+ if [[ "${auth_opt}" == "true" ]]; then
+ req_auth="does not require"
+ else
+ req_auth="requires"
+ fi
+
foglamp_log "info" "FogLAMP v${FOGLAMP_VERSION} running." "outonly" "pretty"
- foglamp_log "info" "FogLAMP uptime: $tot_sec seconds." "outonly" "pretty"
+ foglamp_log "info" "FogLAMP Uptime: ${uptime_sec} seconds." "outonly" "pretty"
+ foglamp_log "info" "FogLAMP Records: ${record_read} read, ${record_sent} sent, ${record_purged} purged." "outonly" "pretty"
+
+ foglamp_log "info" "FogLAMP ${req_auth} authentication." "outonly" "pretty"
# Show Services
foglamp_log "info" "=== FogLAMP services:" "outonly" "pretty"
@@ -335,12 +349,18 @@ foglamp_status() {
esac
}
+
+##
## Print FogLAMP Version
+##
foglamp_print_version() {
echo "FogLAMP version ${FOGLAMP_VERSION}, DB schema version ${FOGLAMP_SCHEMA}"
}
+
+##
## Get FogLAMP version from VERSION file
+##
get_foglamp_version() {
FOGLAMP_VERSION_FILE="${FOGLAMP_ROOT}/VERSION"
FOGLAMP_VERSION=`cat ${FOGLAMP_VERSION_FILE} | tr -d ' ' | grep -i "FOGLAMP_VERSION=" | sed -e 's/\(.*\)=\(.*\)/\2/g'`
@@ -356,26 +376,29 @@ get_foglamp_version() {
fi
}
-# Get FogLAMP rest API URL
+
+##
+## Get FogLAMP rest API URL
+##
get_rest_api_url() {
pid_file=${FOGLAMP_DATA}/var/run/foglamp.core.pid
export PYTHONPATH=${FOGLAMP_ROOT}
if [[ -f ${pid_file} ]]; then
-
REST_API_URL=`cat ${pid_file} | python3 -m scripts.common.json_parse get_rest_api_url_from_pid`
fi
# Sets a default value if it not possible to determine the proper value using the pid file
if [ ! "${REST_API_URL}" ]; then
-
export REST_API_URL=http://localhost:8081
fi
}
+##
## FogLAMP Script Help
+##
foglamp_help() {
echo "${USAGE}
