From 58809b212791ea0982800ce9b99a3941b93d4234 Mon Sep 17 00:00:00 2001 From: 3err0 Date: Wed, 22 May 2019 15:21:44 +0800 Subject: [PATCH] message --- AntMinerGetAllstats | 22 ++++++++++++++++++++++ README.md | 6 +++++- rebootasic | 17 +++++++++++++++++ 3 files changed, 44 insertions(+), 1 deletion(-) create mode 100755 AntMinerGetAllstats create mode 100755 rebootasic diff --git a/AntMinerGetAllstats b/AntMinerGetAllstats new file mode 100755 index 0000000..75e9b69 --- /dev/null +++ b/AntMinerGetAllstats @@ -0,0 +1,22 @@ +#!/bin/bash + +up=`/usr/bin/fping -c1 -t300 $1 &> /dev/null ; echo $?` + +if [ $up = 0 ]; then + +set -o errexit +set -o nounset + +ADDRESS=$1 +PORT=$2 + +stats_raw=`echo '{"command":"stats"}' | nc $ADDRESS $PORT | tr -d '\0\n'` +stats_raw=$(sed 's/}{/\},{/' <<< "$stats_raw") + +STATS=$(jq '.STATS' <<< "$stats_raw") + +#fan_num=$(jq -r '.[1].fan_num' <<< "$STATS") + +echo $STATS + +fi diff --git a/README.md b/README.md index 0fd4889..5f9aac2 100644 --- a/README.md +++ b/README.md @@ -1 +1,5 @@ -# zabbix \ No newline at end of file +# zabbix + +#Antminer scripts (Antminer S9, L3 ...) +AntMinerGetAllstats - Feech asic JSON information +rebootasic - Reboot asic wihtout ssh diff --git a/rebootasic b/rebootasic new file mode 100755 index 0000000..1f5d1d7 --- /dev/null +++ b/rebootasic @@ -0,0 +1,17 @@ +#!/usr/bin/env python + +import httplib2 +import sys + +URL = "http://"+sys.argv[1]+"/cgi-bin/reboot.cgi" +USER = "root" +PASS = "root" + +h = httplib2.Http(cache=None, timeout=0.1) +h.add_credentials(USER, PASS) +try: + resp = h.request(URL, "GET", headers={'cache-control':'no-cache'}) + resp + print"OK" +except: + print"Asic not avalible"