Skip to content

Instantly share code, notes, and snippets.

@bitkevin
Created January 2, 2019 15:06
Show Gist options
  • Save bitkevin/020da1b66eb616accece8bf0d669f109 to your computer and use it in GitHub Desktop.
Save bitkevin/020da1b66eb616accece8bf0d669f109 to your computer and use it in GitHub Desktop.
#!/bin/bash
IP=$1
STATS_JSON=`echo -n '{"command":"summary"}' | nc "$1" 4028 |json_pp`
GHS_5s=`echo "$STATS_JSON" | grep "GHS 5s" |awk -F'"' '{print $4}'`
GHS_avg=`echo "$STATS_JSON" | grep "GHS av" |awk -F':' '{print $2}' |awk -F',' '{print $1}' | tr -d '[:space:]'`
DATESTR=`date '+%Y-%m-%d %H:%M:%S'`
FILE=`date '+%Y-%m-%d'`
echo $DATESTR,$GHS_5s,$GHS_avg >> /home/xxx/dev/"$1"-"$FILE".txt
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment