Do you mind to share that batch?
I dont have programmer skills
Sure thing. If you want the batch version I would split it up into two scripts, one to get the info and one to compile to csv. Make a new folder, where you will put everything into. First put a list called
miners.txt that looks something like this:
A1 - 192.168.1.3
A2 - 192.168.1.7
A3 - 192.168.1.5
A4 - 192.168.1.6
B1 - 192.168.2.3
B2 - 192.168.2.4
and so on... Location can be anything you want, even just 1 2 3 etc. Just make sure it is like
(location) - (IP) on each line, nothing blank or different format.
In this folder you also need a powershell script. Make one and call it
clearNull.ps1, with this source:
Get-ChildItem ".\_\" | ForEach { (Get-Content $($_.fullname)) -replace "`0", "" | Set-Content $($_.fullname) -NoNewline }
Now make a .bat file for multithreading. Make one and call it
_T.bat with the below source. You will need ncat on your system or just download ncat.exe from online and drop it in the folder.
@echo off
echo Antminer S9 Information Gathering Thread
echo.
setlocal enableextensions enabledelayedexpansion
for /f %%a in ('copy /Z "%~dpf0" nul') do set "CR=%%a"
for /F "tokens=*" %%A in (_%1.tim) do (
for /f "tokens=1,3" %%a in ("%%A") do (
set "tx=%%a"
echo {"command":"stats+"} | ncat %%b 4028 -w 1 > .\_\!tx!.txt 2> .\_\!tx!_.txt
)
)
exit
Now make a batch file (call it whatever) for spawning the threads to collect the info. This is the first script you would run, to gather all the info from your miners.
@echo off
echo Antminer S9 Information Gatherer
echo tim-bc bitcointalk 2018-06-08
echo.
echo Performing step 1 of 5 (Prepare Filesystem)...
del /f /s /q .\_\ >nul 2>&1
del /f *.tim >nul 2>&1
echo Done
echo.
setlocal enableextensions enabledelayedexpansion
echo Performing step 2 of 5 (Prepare Threads)...
sort miners.txt /o _.tim
set line=-1
for /f %%a in ('copy /Z "%~dpf0" nul') do set "CR=%%a"
for /F "tokens=*" %%A in (_.tim) do (
set /a "line=1+!line!"
set /a "_tim=!line!/10"
echo %%A>>_!_tim!.tim
for /f "tokens=1" %%a in ("%%A") do (
)
)
echo Done
echo.
echo Performing step 3 of 5 (Run Threads)...
for /f "tokens=*" %%i in ('tasklist /FI "IMAGENAME eq conhost.exe" ^| find /C "conhost"') do set _=%%i
for /l %%i in (0, 1, %_tim%) do (
start _T %%i
)
echo Waiting for threads to complete...
:bitcointalk
for /f "tokens=*" %%i in ('tasklist /FI "IMAGENAME eq conhost.exe" ^| find /C "conhost"') do set __=%%i
if %__% gtr %_% (
timeout /t 1 >nul
goto bitcointalk
)
echo.
echo Performing step 4 of 5 (Clean Filesystem)...
for /r %%F in (.\*) do if %%~zF==0 del "%%F"
del /f *.tim >nul 2>&1
echo Done
echo.
echo Performing step 5 of 5 (Clean Files)...
set ThisScriptsDirectory=%~dp0
set PowerShellScriptPath=%ThisScriptsDirectory%clearNull.ps1
PowerShell -NoProfile -ExecutionPolicy Bypass -Command "& '%PowerShellScriptPath%'";
echo Done
echo.
echo Press any key to exit...
pause>nul
This will make one thread per 10 miners. If you want to change this number just edit the line _tim=!line!/10" and change to your liking.
After you have done all this, if you run the script you see the results in a folder in a bunch of different text files. Make a batch file (in the main folder) with this source to parse these text files into a csv:
@echo off
echo Antminer S9 Information Compiler
echo(
echo Location,Elapsed,Realtime Hashrate,Average Hashrate,Left Hashrate,Center Hashrate,Right Hashrate,Boards Detected,Chips Detected (Left),Chips Detected (Center),Chips Detected (Right),Fans Detected,Faster Fan Speed,Slower Fan Speed,Optimal Frequency,Average Frequency,Left Frequency,Center Frequency,Right Frequency,ASIC Temp (Left),ASIC Temp (Center),ASIC Temp (Right),Ambient Temp (Left),Ambient Temp (Center),Ambient Temp (Right),%% Hardware Error,Firmware Version,Miner Version,Miner ID>__.csv
setlocal enableextensions enabledelayedexpansion
for %%f in (.\_\*.txt) do (
set "_location=%%f"
if exist .\_\!_location!.txt (
for /f "delims=" %%a in (.\_\!_location!.txt) do set tx=%%a
set tx=!tx:"=!
set tx=!tx::=!
set tx=!tx:%%=!
set "_=!tx:*Elapsed=!"
for /f "tokens=1 delims=," %%a in ("!_!") do set _elapsed=%%a
set "_=!tx:*GHS 5s=!"
for /f "tokens=1 delims=," %%a in ("!_!") do set _rt=%%a
set "_=!tx:*GHS av=!"
for /f "tokens=1 delims=," %%a in ("!_!") do set _avg=%%a
set "_=!tx:*chain_rate6=!"
for /f "tokens=1 delims=," %%a in ("!_!") do set _rtright=%%a
set "_=!tx:*chain_rate7=!"
for /f "tokens=1 delims=," %%a in ("!_!") do set _rtcentre=%%a
set "_=!tx:*chain_rate8=!"
for /f "tokens=1 delims=," %%a in ("!_!") do set _rtleft=%%a
set "_=!tx:*Device Hardware=!"
for /f "tokens=1 delims=," %%a in ("!_!") do set _hw=%%a
set "_=!tx:*miner_count=!"
for /f "tokens=1 delims=," %%a in ("!_!") do set _chains=%%a
set "_=!tx:*chain_acn6=!"
for /f "tokens=1 delims=," %%a in ("!_!") do set _asicright=%%a
set "_=!tx:*chain_acn7=!"
for /f "tokens=1 delims=," %%a in ("!_!") do set _asiccentre=%%a
set "_=!tx:*chain_acn8=!"
for /f "tokens=1 delims=," %%a in ("!_!") do set _asicleft=%%a
set "_=!tx:*fan_num=!"
for /f "tokens=1 delims=," %%a in ("!_!") do set _f=%%a
set "_=!tx:*fan3=!"
for /f "tokens=1 delims=," %%a in ("!_!") do set _f3=%%a
set "_=!tx:*fan6=!"
for /f "tokens=1 delims=," %%a in ("!_!") do set _f6=%%a
set "_intake=!_f3!"
set "_exhaust=!_f6!"
IF !_f6! GTR !_f3! (
set "_intake=!_f6!"
set "_exhaust=!_f3!"
)
set "_=!tx:*frequency=!"
for /f "tokens=1 delims=," %%a in ("!_!") do set _freq=%%a
set "_=!tx:*total_freqavg=!"
for /f "tokens=1 delims=," %%a in ("!_!") do set _freqavg=%%a
set "_=!tx:*freq_avg6=!"
for /f "tokens=1 delims=," %%a in ("!_!") do set _freqright=%%a
set "_=!tx:*freq_avg7=!"
for /f "tokens=1 delims=," %%a in ("!_!") do set _freqcentre=%%a
set "_=!tx:*freq_avg8=!"
for /f "tokens=1 delims=," %%a in ("!_!") do set _freqleft=%%a
set "_=!tx:*temp6=!"
for /f "tokens=1 delims=," %%a in ("!_!") do set _localright=%%a
set "_=!tx:*temp7=!"
for /f "tokens=1 delims=," %%a in ("!_!") do set _localcentre=%%a
set "_=!tx:*temp8=!"
for /f "tokens=1 delims=," %%a in ("!_!") do set _localleft=%%a
set "_=!tx:*temp2_6=!"
for /f "tokens=1 delims=," %%a in ("!_!") do set _chipright=%%a
set "_=!tx:*temp2_7=!"
for /f "tokens=1 delims=," %%a in ("!_!") do set _chipcentre=%%a
set "_=!tx:*temp2_8=!"
for /f "tokens=1 delims=," %%a in ("!_!") do set _chipleft=%%a
set "_=!tx:*CompileTime=!"
for /f "tokens=1 delims=," %%a in ("!_!") do set _fw=%%a
for /f "tokens=2,3,6" %%a in ("!_fw!") do set "_sfw=%%c %%a %%b"
set "_=!tx:*miner_version=!"
for /f "tokens=1 delims=,}" %%a in ("!_!") do set _bv=%%a
set "_=!tx:*miner_id=!"
for /f "tokens=1 delims={}" %%a in ("!_!") do set _bid=%%a
echo !_location!,!_elapsed!,!_rt!,!_avg!,!_rtleft!,!_rtcentre!,!_rtright!,!_chains!,!_asicleft!,!_asiccentre!,!_asicright!,!_f!,!_intake!,!_exhaust!,!_freq!,!_freqavg!,!_freqleft!,!_freqcentre!,!_freqright!,!_chipleft!,!_chipcentre!,!_chipright!,!_localleft!,!_localcentre!,!_localright!,!_hw!,!_sfw!,!_bv!,!_bid!>>__.csv
)
)
echo Processed miners. Miner data can be found in __.csv
echo Press any key to exit...
pause>nul
Together, these batch scripts will produce you a csv with your miner's location (whatever format you use), time elapsed hashing to pool, realtime hashrate (5s average), average hashrate, realtime on each board, how many boards are plugged in, how many chips detected on each board, number of fans detected, faster fan speed, slower fan speed, optimal frequency, average freq, freq on each board,
chip temperature for each board, local/pcb temp for each board, hw errors for each board, firmware compile date, miner version, miner internal ID
Enjoy!