-
Notifications
You must be signed in to change notification settings - Fork 17
Expand file tree
/
Copy pathsolana_commission.sh
More file actions
17 lines (12 loc) · 901 Bytes
/
solana_commission.sh
File metadata and controls
17 lines (12 loc) · 901 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
#!/bin/bash
IDENTITY=$1
VOTE_ACCOUNT=$2
NODE=${3:-"http://localhost:8899"}
COMMISSIONS=$(curl -s -X POST -H "Content-Type: application/json" -d "[ \
{\"jsonrpc\":\"2.0\", \"id\":\"identity\", \"method\":\"getBalance\", \"params\":[\"${IDENTITY}\"]}, \
{\"jsonrpc\":\"2.0\", \"id\":\"vote\", \"method\":\"getBalance\", \"params\":[\"${VOTE_ACCOUNT}\"]} \
]" ${NODE})
VOTE_COMMISSION=$(echo "$COMMISSIONS" | jq '.[] | select(.id=="vote") | .result.value | tonumber') #'
IDENTITY_COMMISSION=$(echo "$COMMISSIONS" | jq '.[] | select(.id=="identity") | .result.value | tonumber')
echo "opentech_solana_collected_commission{address=\"vote\"} $VOTE_COMMISSION" > /var/lib/node_exporter/opentech_solana_collected_commission.prom
echo "opentech_solana_collected_commission{address=\"identity\"} $IDENTITY_COMMISSION" >> /var/lib/node_exporter/opentech_solana_collected_commission.prom