Hi everyone. I have been in to crypto mining now for 5 months and since then I have kept searching for a way to monitor my mining rig. So that I get email notification every time mining gets stopped or I could restart mining automatically in case of a crash. All my searches for this went in vain as I didn’t find any mining monitoring software which could solve my problem. Every mining monitor which I found had limitations like some are paid only, can monitor some particular algo and pool.I could not find a universal monitor that can work with any algo/pool.
Finally, I decided to make one for myself and you all can use it. I have been working on this from the last 2 weeks as I am not a professional programmer however for pros it might be a couple of hours work. At last, the script is working as I wanted.
I have made Windows Powershell script which can
- monitor the temperature of GPU’s continuously and act accordingly if GPU temperatures go above or below from specified threshold. In case of miner crash, GPUs will stop working and cool down to trigger the script to re-run the miner.
- monitor for active internet connection, if somehow your internet connection goes down script will automatically connect mining rig to other defined internet connection.
I live in a remote area so network stability is an issue at my region. I have two different internet connections if one goes down miner will automatically get connected to the other one. - in case of a stoppage of mining (restarting mining software, restarting mining rig) you will be notified via email. So that you can act accordingly. If you don’t know your mining rig is not working you will be losing money during that time. This instant email notification will rescue you in that case.
- if somehow your whole system freeze up then nothing will work not even my script. I have a different solution for that, check part 4 of this tutorial series to know more.
This Mining Monitoring Tutorial consists of 4 articles.
Currently, you are in the first one. In part 1 of the tutorial, you will learn how to automatically restart the mining software in case of a crash.
Check Other Parts Here ( Script is ready for all parts and successfully tested, all I need is time to write the articles. Will be done within a week )
Complete Mining Monitoring Series
Check Here to Know Best altcoin to mine with GTX 1080 Ti
Automatically Restart Mining Software: Steps
1. Create a shortcut of your mining batch file and rename it to jkcrypto
2. Place shortcut in ” C:\Users\All Users\Microsoft\Windows\Start Menu\Programs\Startup “
3. Download script package from here – Part1 and extract it in ” C:\ ” drive. So all script files will be @ “C:\MinerMonitor\”
<# This Script is Provided By https://jkcrypto.com/ #> $Log = "LogFile.log" $Date = Get-Date $script:startTime = Get-Date $failtestcount = 0 $minerrestartno = 0 #set gpu temperature if goes below and above miner software will restart $temptrig = 35 $tempmaxallow = 80 #enter total number of gpus currently connected to rig $totoalgpuno = 7 #Miner Software name in task manager $minername = "ccminer*" #Enter miner path if not in startup, otherwise leave as it is $Minerpath = "C:\Users\All Users\Microsoft\Windows\Start Menu\Programs\Startup\jkcrypto.lnk" #set time after which script will start Start-Sleep 180 function GetElapsedTime([datetime]$starttime) { $runtime = $(get-date) - $starttime $retStr = [string]::format("{0} sec(s)", $runtime.TotalSeconds) $retStr } #to check wheather openhardwaremonitor is running or not $ProcessName = "openhardwaremonitor" if((get-process $ProcessName -ErrorAction SilentlyContinue) -eq $Null) { Start-Process -FilePath ".\OpenHardwareMonitor\OHM.exe" -WindowStyle Minimized} else { echo " openhardwaremonitor is already running " } #Check GPU load while($true) { $gputemp = Get-WmiObject -namespace root\openhardwaremonitor -class sensor | Where-Object {$_.SensorType -Match "temp" -and $_.Identifier -like "*gpu*"} ForEach($GPU In $gputemp) {if($GPU.value -lt $temptrig ) {$mytest = $GPU.value Write-Host $mytest"°C gpu not mininig...temperature seems low" #"$Date - Low result obtained $mytest" >> $Log $failtestcount = $failtestcount + 1 } else {$mytest = $GPU.value Write-Host $mytest"°C gpu is mininig" } } $elapsed = GetElapsedTime $script:startTime write-host "Mining Since: " $elapsed; #all nine tests have to get a low result restart if($failtestcount -gt $totoalgpuno * 3 ) { "$Date Miner Restart" >> $Log Write-Output " Restarting Miner" Stop-Process -name $minername -force Start-Process -FilePath $Minerpath $minerrestartno = $minerrestartno + 1 $failtestcount = 0 $script:startTime = Get-Date if($minerrestartno -gt 3) { Stop-Process -name $minername -force Start-Sleep 30 "$Date Computer Restart" >> $Log Restart-Computer -force } } else { Write-Host "Everthing Working Fine" } if($GPU.value -gt $tempmaxallow) { Stop-Process -name $minername -force Start-Sleep 300 Start-Process -FilePath $Minerpath $minerrestartno = $minerrestartno + 1 $failtestcount = 0 $script:startTime = Get-Date "$Date GPU Running Too Hot" >> $Log } Write-Host " " Write-Host "Starting New Test" Write-Host " " Start-Sleep 30 }
4. Change following in powershell script provided. ( all in beginning )
$temptrig = 35 ( set this threshold if GPU temperature goes below this miner will restart. This depends on region you live, for me 35 is perfect as ambient room temperature is between 10 – 25-degree celsius at my area. I think 35 will work for most of you, or you may tweak it as per need.
- $tempmaxallow = 80 ( maximum temperature on which gpu can miner. After crossing this threshold mining will be stopped for gpu cool down then restarts.
- $totoalgpuno = 7 ( total number of gpu connected)
- $minername = “ccminer*” ( name of miner. Open task manager and look for mining process, check image below to know how to find it, place * after name, * is wild card.)
- $Minerpath=”C:\Users\All Users\… \Startup\jkcrypto.lnk”
( if you are following steps 1 and 2 then no changes required )
5. If you want this monitoring script get loaded every time after powering on the mining rig then do the following. Move the file “script auto restart” to “C:\Users\All Users\Microsoft\Windows\Start Menu\Programs\Startup\”
6. Done, Part 1 ” restart miner automatically after failure “of this monitoring guide is complete. Will be posting other parts very soon.
I have made this mining monitoring tutorial guide as easy as possible. If you are still facing any issues don’t hesitate to ask via comments below. To appreciate my work you can give this article a share.
I write about Crypto mining, trading, referral programs. I have been in the cryptocurrency industry for the last 4 years.