#!/bin/bash # Fetch system information in JSON response=$(curl -s 'http://localnode.local.mesh/cgi-bin/sysinfo.json') node=$(echo "$response" | jq -r '.node') hostname=$(echo "$response" | jq -r '.hostname') # Display node and hostname echo "Node: $node" echo "Hostname: $hostname" # Pretty-print the full JSON response #echo -e "\nFull System Information (Formatted):" #echo "$response" | jq # Fetch and display link information in a human-readable format response_link_info=$(curl -s 'http://localnode.local.mesh/cgi-bin/sysinfo.json?link_info=1') echo -e "\nLink Information (Formatted):" echo "$response_link_info" | jq -r '.link_info | to_entries[] | "\(.value.hostname): Link Quality=\(.value.linkQuality), Link Cost=\(.value.linkCost), Interface=\(.value.olsrInterface)"' # Optionally, display other key data echo -e "\nSystem Uptime:" echo "$response" | jq -r '.sysinfo.uptime' echo -e "\nInterfaces:" echo "$response" | jq -r '.interfaces[] | "\(.name): MAC Address=\(.mac)\(.ip // "")"' echo -e "\nNode Details:" echo "$response" | jq -r '.node_details | to_entries[] | "\(.key): \(.value)"'