The following script, creates an HTML file, to be presented by any webserver
#!/bin/bash
# --- Configuration ---
OUTPUT_FILE="/path_to_output_file/firo_nodes.html"
# Define your nodes in the format: "Alias:IP_Address:SSH_User"
NODES=(
"HomeSRV:79.177.xx.xx:user"
"Big1:xxx.61.xxx.175:user"
"Big2:yyy.53.yyy.98:user"
)
FIRO_CLI="/usr/local/bin/firo-cli"
# ---------------------
DATE=$(date "+%Y-%m-%d %H:%M:%S")
COUNTER=1 # Initialize serial number counter
# 1. Generate the HTML Header and CSS
cat <<EOF > $OUTPUT_FILE
<!DOCTYPE html>
<html>
<head>
<title>FIRO Masternode Monitor</title>
<style>
body { font-family: 'Segoe UI', Arial, sans-serif; background-color: #0d1117; color: #c9d1d9; margin: 40px; }
h2 { color: #ffffff; border-bottom: 2px solid #d11e4f; padding-bottom: 10px; }
.timestamp { font-size: 0.85em; color: #8b949e; margin-bottom: 20px; }
table { width: 100%; border-collapse: collapse; background: #161b22; border-radius: 8px; overflow: hidden; box-shadow: 0 10px 30px rgba(0,0,0,0.5); }
th, td { padding: 12px 15px; border: 1px solid #30363d; text-align: left; }
th { background-color: #d11e4f; color: white; text-transform: uppercase; font-size: 0.85em; letter-spacing: 1px; }
.center { text-align: center; width: 30px; color: #8b949e; }
.online { color: #3fb950; font-weight: bold; }
.offline { color: #f85149; font-weight: bold; }
.warning { color: #d29922; font-weight: bold; }
.version-text { font-family: monospace; color: #58a6ff; }
tr:hover { background-color: #21262d; }
</style>
</head>
<body>
<h2>FIRO Masternode Fleet Status</h2>
<p class="timestamp">Last Sync: $DATE</p>
<table>
<tr>
<th class="center">#</th>
<th>Node Alias</th>
<th>IP Address</th>
<th>Status</th>
<th>Version</th>
<th>Peers</th>
<th>Height</th>
</tr>
EOF
# 2. Loop through nodes
for NODE_INFO in "${NODES[@]}"; do
IFS=':' read -r NAME IP USER <<< "$NODE_INFO"
# Execute remote commands
REMOTE_DATA=$(ssh -o ConnectTimeout=5 -p 8122 -o StrictHostKeyChecking=no ${USER}@${IP} \
"$FIRO_CLI evoznode status && $FIRO_CLI getnetworkinfo && $FIRO_CLI getblockcount" 2>/dev/null)
if [ -z "$REMOTE_DATA" ]; then
STATUS_HTML="<span class='offline'>OFFLINE</span>"
VERSION_HTML="---"
CONN_HTML="0"
BLOCK_HEIGHT="N/A"
else
# Parse the multi-JSON output
STATE=$(echo "$REMOTE_DATA" | jq -s -r '.[0].state')
VERSION=$(echo "$REMOTE_DATA" | jq -s -r '.[1].version')
SUBVER=$(echo "$REMOTE_DATA" | jq -s -r '.[1].subversion' | tr -d '/')
CONN_COUNT=$(echo "$REMOTE_DATA" | jq -s -r '.[1].connections')
BLOCK_HEIGHT=$(echo "$REMOTE_DATA" | jq -s -r '.[2]')
# Logic: Status Color
if [[ "$STATE" == "READY" || "$STATE" == "ENABLED" ]]; then
STATUS_HTML="<span class='online'>$STATE</span>"
else
STATUS_HTML="<span class='warning'>$STATE</span>"
fi
# Logic: Connection Warning
if [ "$CONN_COUNT" -lt 8 ]; then
CONN_HTML="<span class='warning'>$CONN_COUNT</span>"
else
CONN_HTML="<span class='online'>$CONN_COUNT</span>"
fi
VERSION_HTML="<span class='version-text'>$SUBVER ($VERSION)</span>"
fi
# Append row
cat <<EOF >> $OUTPUT_FILE
<tr>
<td class="center">$COUNTER</td>
<td>$NAME</td>
<td>$IP</td>
<td>$STATUS_HTML</td>
<td>$VERSION_HTML</td>
<td>$CONN_HTML</td>
<td>$BLOCK_HEIGHT</td>
</tr>
EOF
((COUNTER++)) # Increment serial number
done
# 3. Close HTML
echo "</table></body></html>" >> $OUTPUT_FILE