Skip to content

Instantly share code, notes, and snippets.

#!/bin/bash
# Call this script as follows: watch -d -t ./monitor_iri.sh
node=$(curl http://localhost:14265 -X POST -H 'X-IOTA-API-Version: 1.4.1' 'Content-Type: application/json' -d '{"command": "getNodeInfo"}' 2>/dev/null)
neighbors=$(curl http://localhost:14265 -X POST -H 'X-IOTA-API-Version: 1.4.1' 'Content-Type: application/json' -d '{"command": "getNeighbors"}' 2>/dev/null)
echo $node | jq -r '["IRI","Latest","Solid","Tips"], ["--------------------------------------------------------------------------------"], ([.appVersion, .latestMilestoneIndex, .latestSolidSubtangleMilestoneIndex, .tips]) | @tsv'
echo ''
echo $neighbors | jq -r '["All","New","Sent","Invalid","Type","Address"], ["--------------------------------------------------------------------------------"], (.neighbors | .[] | [.numberOfAllTransactions, .numberOfNewTransactions, .numberOfSentTransactions, .numberOfInvalidTransactions, .connectionType, .address]) | @tsv'