#!/bin/bash

if [ -f /usr/share/lib/geth-utils/geth-utils.include.sh ]; then source /usr/share/lib/geth-utils/geth-utils.include.sh; fi
if [ -f /etc/geth-utils/geth.conf ]; then source /etc/geth-utils/geth.conf; fi
if [ "$1" = "-c" -o "$1" = "--chain" ]; then CMDLINECHAIN="$2";shift;shift; fi; _defineChain

GETH="geth --nousb --metrics --datadir $GETHDIR/$CHAIN -ipcpath $GETHDIR/$CHAIN/geth.ipc"
LOGFILE=$GETHDIR/$CHAIN/eth.log


_usage () {
   echo "Usage: `basename $0` [ -c CHAIN | --chain CHAIN ]"
   echo "Usage: `basename $0` [ -h | --help ]"
   echo "Usage: `basename $0` [ -v | --version ]"
}

_version () {
   echo "them-geth-utils Version $GVERSION"
}

if [ "$1" = "-h" -o "$1" = "--help" ]; then
   _usage
   exit 17
fi

if [ "$1" = "-v" -o "$1" == "--version" ]; then
   _version
   exit 17
fi

echo "Doing `basename $0` for Chain $CHAIN"

echo "Calling: $GETH monitor --refresh 1 --rows 3 --attach $GETHDIR/$CHAIN/geth.ipc ..."
               $GETH monitor --refresh 1 --rows 3 --attach $GETHDIR/$CHAIN/geth.ipc \
 chain/execution/AvgRate01Min \
 chain/inserts/AvgRate01Min \
 chain/validation/AvgRate01Min \
 chain/write/AvgRate01Min \
 eth/misc/in/traffic/AvgRate01Min \
 eth/misc/out/traffic/AvgRate01Min \
 system/disk/readdata/AvgRate01Min \
 system/disk/writedata/AvgRate01Min \
 system/memory/inuse/AvgRate01Min \


# - discv5/InboundTraffic/AvgRate01Min
# - discv5/OutboundTraffic/AvgRate01Min
# - eth/db/chaindata/compact/input/AvgRate01Min
# - eth/db/chaindata/compact/output/AvgRate01Min
# - eth/db/chaindata/compact/time/AvgRate01Min
# - eth/db/chaindata/compact/writedelay/counter/AvgRate01Min
# - eth/db/chaindata/compact/writedelay/duration/AvgRate01Min
# - eth/db/chaindata/disk/read/AvgRate01Min
# - eth/db/chaindata/disk/write/AvgRate01Min
# - eth/downloader/bodies/drop/AvgRate01Min
# - eth/downloader/bodies/in/AvgRate01Min
# - eth/downloader/bodies/req/AvgRate01Min
# - eth/downloader/bodies/timeout/AvgRate01Min
# - eth/downloader/headers/drop/AvgRate01Min
# - eth/downloader/headers/in/AvgRate01Min
# - eth/downloader/headers/req/AvgRate01Min
# - eth/downloader/headers/timeout/AvgRate01Min
# - eth/downloader/receipts/drop/AvgRate01Min
# - eth/downloader/receipts/in/AvgRate01Min
# - eth/downloader/receipts/req/AvgRate01Min
# - eth/downloader/receipts/timeout/AvgRate01Min
# - eth/downloader/states/drop/AvgRate01Min
# - eth/downloader/states/in/AvgRate01Min
# - eth/fetcher/fetch/bodies/AvgRate01Min
# - eth/fetcher/fetch/headers/AvgRate01Min
# - eth/fetcher/filter/bodies/in/AvgRate01Min
# - eth/fetcher/filter/bodies/out/AvgRate01Min
# - eth/fetcher/filter/headers/in/AvgRate01Min
# - eth/fetcher/filter/headers/out/AvgRate01Min
# - eth/fetcher/prop/announces/dos/AvgRate01Min
# - eth/fetcher/prop/announces/drop/AvgRate01Min
# - eth/fetcher/prop/announces/in/AvgRate01Min
# - eth/fetcher/prop/announces/out/AvgRate01Min
# - eth/fetcher/prop/broadcasts/dos/AvgRate01Min
# - eth/fetcher/prop/broadcasts/drop/AvgRate01Min
# - eth/fetcher/prop/broadcasts/in/AvgRate01Min
# - eth/fetcher/prop/broadcasts/out/AvgRate01Min
# - eth/misc/in/packets/AvgRate01Min
# - eth/misc/out/packets/AvgRate01Min
# - eth/prop/blocks/in/packets/AvgRate01Min
# - eth/prop/blocks/in/traffic/AvgRate01Min
# - eth/prop/blocks/out/packets/AvgRate01Min
# - eth/prop/blocks/out/traffic/AvgRate01Min
# - eth/prop/hashes/in/packets/AvgRate01Min
# - eth/prop/hashes/in/traffic/AvgRate01Min
# - eth/prop/hashes/out/packets/AvgRate01Min
# - eth/prop/hashes/out/traffic/AvgRate01Min
# - eth/prop/txns/in/packets/AvgRate01Min
# - eth/prop/txns/in/traffic/AvgRate01Min
# - eth/prop/txns/out/packets/AvgRate01Min
# - eth/prop/txns/out/traffic/AvgRate01Min
# - eth/req/bodies/in/packets/AvgRate01Min
# - eth/req/bodies/in/traffic/AvgRate01Min
# - eth/req/bodies/out/packets/AvgRate01Min
# - eth/req/bodies/out/traffic/AvgRate01Min
# - eth/req/headers/in/packets/AvgRate01Min
# - eth/req/headers/in/traffic/AvgRate01Min
# - eth/req/headers/out/packets/AvgRate01Min
# - eth/req/headers/out/traffic/AvgRate01Min
# - eth/req/receipts/in/packets/AvgRate01Min
# - eth/req/receipts/in/traffic/AvgRate01Min
# - eth/req/receipts/out/packets/AvgRate01Min
# - eth/req/receipts/out/traffic/AvgRate01Min
# - eth/req/states/in/packets/AvgRate01Min
# - eth/req/states/in/traffic/AvgRate01Min
# - eth/req/states/out/packets/AvgRate01Min
# - eth/req/states/out/traffic/AvgRate01Min
# - les/misc/in/packets/AvgRate01Min
# - les/misc/in/traffic/AvgRate01Min
# - les/misc/out/packets/AvgRate01Min
# - les/misc/out/traffic/AvgRate01Min
# - p2p/InboundConnects/AvgRate01Min
# - p2p/InboundTraffic/AvgRate01Min
# - p2p/OutboundConnects/AvgRate01Min
# - p2p/OutboundTraffic/AvgRate01Min
# - system/disk/readcount/AvgRate01Min
# - system/disk/writecount/AvgRate01Min
# - system/memory/allocs/AvgRate01Min
# - system/memory/frees/AvgRate01Min
# - system/memory/pauses/AvgRate01Min
# - trie/memcache/clean/hit/AvgRate01Min
# - trie/memcache/clean/miss/AvgRate01Min
# - trie/memcache/clean/read/AvgRate01Min
# - trie/memcache/clean/write/AvgRate01Min
# - trie/memcache/commit/nodes/AvgRate01Min
# - trie/memcache/commit/size/AvgRate01Min
# - trie/memcache/flush/nodes/AvgRate01Min
# - trie/memcache/flush/size/AvgRate01Min
# - trie/memcache/gc/nodes/AvgRate01Min
# - trie/memcache/gc/size/AvgRate01Min

