Index: /branches/amp_4_0/platform/tools/install_grafana.sh
===================================================================
--- /branches/amp_4_0/platform/tools/install_grafana.sh	(revision 2691)
+++ /branches/amp_4_0/platform/tools/install_grafana.sh	(working copy)
@@ -9,7 +9,7 @@
 INFLUXDB_PORT="8086"
 INFLUXDB_ORG="AN"
 INFLUXDB_BUCKET="AMP"
-INFLUXDB_TOKEN_FILE="/opt/influxdb2_token.toml"
+INFLUXDB_TOKEN_FILE="/opt/influxdb3_token.toml"
 LOG_FILE="/var/log/install_grafana.log"
 
 #---------------------------
Index: /branches/amp_4_0/platform/tools/install_influxdb3.sh
===================================================================
--- /branches/amp_4_0/platform/tools/install_influxdb3.sh	(nonexistent)
+++ /branches/amp_4_0/platform/tools/install_influxdb3.sh	(working copy)
@@ -0,0 +1,214 @@
+#!/bin/bash
+
+# This script installs InfluxDB 3.x on a Rocky Linux 9 system,
+# sets up an initial configuration, and creates a token.
+
+set -e
+
+# --- Configuration ---
+LOG_FILE="/var/log/install_influxdb3.log"
+CONFIG_FILE="/opt/influxdb3_token.toml"
+INFLUXDB_HOST="http://localhost:8181" # Correct port for InfluxDB 3.x
+INFLUXDB_DATABASE="amp_database"
+
+log_info() {
+  echo "[INFO] $(date +'%Y-%m-%d %H:%M:%S') $1" | tee -a "$LOG_FILE"
+}
+
+log_error() {
+  echo "[ERROR] $(date +'%Y-%m-%d %H:%M:%S') $1" >&2 | tee -a "$LOG_FILE"
+}
+
+check_command() {
+  if ! command -v "$1" &> /dev/null; then
+    log_error "$1 command not found. Please install it."
+    exit 1
+  fi
+}
+
+# --- Prerequisites Check ---
+log_info "Checking for required commands..."
+check_command curl
+check_command sudo
+
+# --- InfluxDB 3.x Automated Installer (Embedded) ---
+log_info "Using the embedded InfluxDB 3.x quick installer script..."
+
+# Define the installer script content to be executed non-interactively
+INFLUXDB_INSTALLER_SCRIPT=$(cat << 'EOF'
+#!/bin/sh -e
+
+readonly GREEN='\033[0;32m'
+readonly BOLD='\033[1m'
+readonly BOLDGREEN='\033[1;32m'
+readonly DIM='\033[2m'
+readonly NC='\033[0m' # No Color
+
+ARCHITECTURE=$(uname -m)
+ARTIFACT=""
+OS=""
+INSTALL_LOC=/usr/local/bin
+BINARY_NAME="influxdb3"
+PORT=8181
+
+INFLUXDB_VERSION="3.3.0"
+EDITION="Core"
+EDITION_TAG="core"
+
+### OS AND ARCHITECTURE DETECTION ###
+case "$(uname -s)" in
+    Linux*)     OS="Linux";;
+    Darwin*)    OS="Darwin";;
+    *)          OS="UNKNOWN";;
+esac
+
+if [ "${OS}" = "Linux" ]; then
+    if [ "${ARCHITECTURE}" = "x86_64" ] || [ "${ARCHITECTURE}" = "amd64" ]; then
+        ARTIFACT="linux_amd64"
+    elif [ "${ARCHITECTURE}" = "aarch64" ] || [ "${ARCHITECTURE}" = "arm64" ]; then
+        ARTIFACT="linux_arm64"
+    fi
+elif [ "${OS}" = "Darwin" ]; then
+    ARTIFACT="darwin_arm64"
+fi
+
+[ -n "${ARTIFACT}" ] || {
+    printf "Unfortunately this script doesn't support your '${OS}' | '${ARCHITECTURE}' setup.\n"
+    exit 1
+}
+
+URL="https://dl.influxdata.com/influxdb/releases/influxdb3-${EDITION_TAG}-${INFLUXDB_VERSION}_${ARTIFACT}.tar.gz"
+
+printf "${BOLD}Downloading InfluxDB 3 %s to %s${NC}\n" "$EDITION" "$INSTALL_LOC"
+mkdir -p "$INSTALL_LOC"
+curl -sSL "${URL}" -o "$INSTALL_LOC/influxdb3-${EDITION_TAG}.tar.gz"
+
+printf "${BOLD}Verifying '%s/influxdb3-${EDITION_TAG}.tar.gz'${NC}\n" "$INSTALL_LOC"
+curl -sSL "${URL}.sha256" -o "$INSTALL_LOC/influxdb3-${EDITION_TAG}.tar.gz.sha256"
+dl_sha=$(cut -d ' ' -f 1 "$INSTALL_LOC/influxdb3-${EDITION_TAG}.tar.gz.sha256" | grep -E '^[0-9a-f]{64}$')
+if [ -z "$dl_sha" ]; then
+    printf "Could not find properly formatted SHA256 in '%s/influxdb3-${EDITION_TAG}.tar.gz.sha256'. Aborting.\n" "$INSTALL_LOC"
+    exit 1
+fi
+ch_sha=$(sha256sum "$INSTALL_LOC/influxdb3-${EDITION_TAG}.tar.gz" | cut -d ' ' -f 1)
+if [ "$ch_sha" = "$dl_sha" ]; then
+    printf " (OK: %s = %s)${NC}\n" "$ch_sha" "$dl_sha"
+else
+    printf " (ERROR: %s != %s). Aborting.${NC}\n" "$ch_sha" "$dl_sha"
+    exit 1
+fi
+rm "$INSTALL_LOC/influxdb3-${EDITION_TAG}.tar.gz.sha256"
+
+printf "${BOLD}Extracting and Processing${NC}\n"
+TAR_LEVEL=0
+if tar -tf "$INSTALL_LOC/influxdb3-${EDITION_TAG}.tar.gz" | grep -q '[a-zA-Z0-9]/influxdb3$' ; then
+    TAR_LEVEL=1
+fi
+tar -xf "$INSTALL_LOC/influxdb3-${EDITION_TAG}.tar.gz" --strip-components="${TAR_LEVEL}" -C "$INSTALL_LOC"
+rm "$INSTALL_LOC/influxdb3-${EDITION_TAG}.tar.gz"
+
+printf "${BOLDGREEN}✓ InfluxDB 3 ${EDITION} is now installed. Nice!${NC}\n"
+EOF
+)
+
+# Execute the installer script as root
+echo "$INFLUXDB_INSTALLER_SCRIPT" | sudo bash
+
+# --- InfluxDB 3.x Systemd Service Configuration ---
+log_info "Creating and configuring systemd service for InfluxDB 3.x..."
+SERVICE_FILE="/etc/systemd/system/influxdb3.service"
+sudo bash -c "cat > $SERVICE_FILE" <<EOF
+[Unit]
+Description=InfluxDB 3.x Service
+After=network-online.target
+
+[Service]
+ExecStart=/usr/local/bin/influxdb3 serve --node-id=node0 --object-store=file --data-dir /var/lib/influxdb --http-bind=0.0.0.0:8181
+Restart=always
+User=influxdb
+Group=influxdb
+
+[Install]
+WantedBy=multi-user.target
+EOF
+
+# Create the user and group for the service
+if ! getent group influxdb >/dev/null; then
+  sudo groupadd --system influxdb
+fi
+if ! getent passwd influxdb >/dev/null; then
+  sudo useradd --system -g influxdb -d /var/lib/influxdb -s /sbin/nologin -c "InfluxDB User" influxdb
+fi
+
+# Ensure necessary directories and permissions
+sudo mkdir -p /var/lib/influxdb
+sudo chown -R influxdb:influxdb /var/lib/influxdb
+
+# Reload systemd, start, and enable the service
+sudo systemctl daemon-reload
+log_info "Starting and enabling influxdb3 service..."
+sudo systemctl enable --now influxdb3
+
+if [ $? -ne 0 ]; then
+  log_error "Failed to enable and start the influxdb3 service."
+  exit 1
+fi
+
+# --- Wait for InfluxDB 3.x to start ---
+log_info "Waiting for InfluxDB 3.x service to start..."
+sleep 15
+
+# --- Create an Initial Admin Token ---
+log_info "Creating an initial admin token and storing it..."
+INFLUXDB3_CLI_PATH="/usr/local/bin/influxdb3"
+
+# Provide an empty line (pressing Enter) to the create token command to bypass interactive prompt.
+RAW_AUTH_OUTPUT=$(echo "" | sudo "$INFLUXDB3_CLI_PATH" create token --admin)
+
+# Filter the output to find the line with "Token:" and extract the token value cleanly.
+# - Remove ANSI escape codes
+# - Trim leading/trailing spaces
+# - Remove carriage returns/newlines
+ADMIN_TOKEN=$(echo "$RAW_AUTH_OUTPUT" \
+  | grep 'Token:' \
+  | cut -d ':' -f 2- \
+  | sed 's/\x1b\[[0-9;]*m//g' \
+  | tr -d '\r\n' \
+  | xargs)
+
+if [ -n "$ADMIN_TOKEN" ]; then
+  log_info "Successfully created initial admin token."
+  {
+    echo "[influxdb]"
+    echo "token = \"$ADMIN_TOKEN\""
+  } | sudo tee "$CONFIG_FILE" > /dev/null
+  sudo chmod 600 "$CONFIG_FILE"
+  log_info "Admin token stored securely in $CONFIG_FILE."
+else
+  log_error "Failed to create initial admin token."
+  log_error "Raw output from token creation command: $RAW_AUTH_OUTPUT"
+  exit 1
+fi
+
+# --- Verify Installation and Token ---
+log_info "Verifying InfluxDB 3.x installation..."
+log_info "Attempting to create the database using the new token."
+
+STORED_TOKEN=$(grep '^token = ' "$CONFIG_FILE" \
+  | cut -d '"' -f 2 \
+  | sed 's/\x1b\[[0-9;]*m//g' \
+  | tr -d '\r\n' \
+  | xargs)
+
+# Use the InfluxDB 3 CLI to create the database
+if sudo "$INFLUXDB3_CLI_PATH" create database "$INFLUXDB_DATABASE" --token "$STORED_TOKEN"; then
+  log_info "Successfully created/verified database '$INFLUXDB_DATABASE' with the new token."
+else
+  log_error "Failed to create or verify database '$INFLUXDB_DATABASE'."
+  exit 1
+fi
+
+log_info "InfluxDB 3.x installed and configured!"
+log_info "Installation logs are available in $LOG_FILE."
+
+exit 0
Index: /branches/amp_4_0/platform/tools/install_telegraf.sh
===================================================================
--- /branches/amp_4_0/platform/tools/install_telegraf.sh	(revision 2691)
+++ /branches/amp_4_0/platform/tools/install_telegraf.sh	(working copy)
@@ -4,7 +4,7 @@
 
 # --- Configuration ---
 LOG_FILE="/var/log/install_telegraf.log"
-CONFIG_FILE="/opt/influxdb2_token.toml"
+CONFIG_FILE="/opt/influxdb3_token.toml"
 TELEGRAF_CONFIG_DIR="/etc/telegraf/telegraf.d"
 TELEGRAF_CONFIG="/etc/telegraf/telegraf.conf"
 INFLUXDB_HOST="http://localhost:8086"
