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.
bleedingedgeITguru says
Very cool. Keep them coming. Looking forward to the email alerts. If you can do SMS alerts it would be even better.
ANUJ SAINI says
Will be posing email alerts within few hours.
For SMS alerts check this https://ifttt.com/applets/210655p-send-an-sms-when-an-email-is-received-with-a-specific-subject
PhiL.D says
you can try also send alerts via telegram
ANUJ SAINI says
ok will check that
Cody Gambit says
hi
I dont understd where and how i can create/copy this script ?(
ANUJ SAINI says
Follow the steps,
“Download script package from here – Part1 and extract it in ” C: ” drive. So all script files will be @ “C:MinerMonitor”
I will be making video guide for this very soon
Imulsion says
Can’t wait for the missing parts! 🙂
ANUJ SAINI says
All 4 are done.
Updating links now
Steve Hyde says
Thanks matey, thats a great tool, I’ve been playing around with it a little bit as I wanted it to also stop and restart MSI Afterburner as well… Obviously that wasn’t straight forward as I’ve never written powershell before, but I’ve got it running now. Just the one batch file directly calling the powershell script, as long as the batch file has the same name as the script it works fine.
@ECHO OFF
PowerShell.exe -NoProfile -Command “& {Start-Process PowerShell.exe -ArgumentList ‘-NoProfile -ExecutionPolicy Bypass -File “”%~dpn0.ps1″”‘ -Verb RunAs}”
PAUSE
Then added these lines to the powershell script
Stop-Process -name MSI*
Start-Sleep 5
Start-Process -FilePath “C:Program Files (x86)MSI AfterburnerMSIAfterburner.exe”
I’m sure it could be more eloquent… :p
ANUJ SAINI says
Thanks for sharing.
Many of readers can’t configure this script so i might create youtube video for this
Peter Horsky says
Thanks for this guide! I have one question – do you always change the script when you change coin/miner?
ANUJ SAINI says
No need to edit code.
Just add new miner shortcut to startup and name it “jkcrypto”.
I might create GUI based software for these script in future, but right now very busy in other works
Peter Horsky says
What I meant is that the script is checking process ccminer*, but for example for GOA coin we use hsrminer_neoscrypt… So the process name is different.
ANUJ SAINI says
What can we do to automate here is to use “OR ” and mention all available miners in the script.
If script find any in running processes than will act accordingly.
TheDesiKukkadShow says
Hey anuj bro i tried same but couldnt suceed i also have hsr miner problem can u please help me out though team viewer i messaged u fb also please help me out in much problem
ANUJ SAINI says
Sorry my bad.Will update post within few minutes.Maximum Nvidia miner are ccminer but not all. you have to change $minername = “ccminer*” with $minername = “hsr*”.
Julien Moody says
https://uploads.disquscdn.com/images/3ad6b3a4f921f2d4f5b5df7bf254491da6b200c61dc22b255e79ee1b1fc56442.jpg
Hi, sorry for my english, but I have this error with the script… I don’t find Why 🙁
ANUJ SAINI says
Can’t see error in the image.
Copy paste error message here.
Many users are facing problem while setting up this script.
I will create youtube video for this, possibly within a week
Julien Moody says
I have this :
openhardwaremonitor is already running
Get-WmiObject : Le fournisseur ne prend pas en charge l’opération tentée
Au caractère C:MinerMonitorjkcrypto-minermon.ps1:58 : 12
+ $gputemp = Get-WmiObject -namespace rootopenhardwaremonitor -class s …
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation : (:) [Get-WmiObject], ManagementException
+ FullyQualifiedErrorId : GetWMIManagementException,Microsoft.PowerShell.Commands.GetWmiObjectCommand
Mining Since: 180,5203705 sec(s)
Everthing Working Fine
Starting New Test
Get-WmiObject : Le fournisseur ne prend pas en charge l’opération tentée
Au caractère C:MinerMonitorjkcrypto-minermon.ps1:58 : 12
+ $gputemp = Get-WmiObject -namespace rootopenhardwaremonitor -class s …
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation : (:) [Get-WmiObject], ManagementException
+ FullyQualifiedErrorId : GetWMIManagementException,Microsoft.PowerShell.Commands.GetWmiObjectCommand
Mining Since: 210,6252952 sec(s)
Everthing Working Fine
Starting New Test
QuestionEverything says
Je crois qu’ill ne parle pas francais. English version if it makes it easier. I’m getting a similar message. I’m guessing it’s a permission issue when trying to call hardware monitor for GPU temps. Are you being prompted for admin rights for hardware monitor? If you are and the hardware monitor windows is open, close it. Seems to resolve the issue.
Get-WmiObject : Provider is not capable of the attempted operation
At C:MinerMonitorjkcrypto-minermon.ps1:58 char:12
+ $gputemp = Get-WmiObject -namespace rootopenhardwaremonitor -class s …
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (:) [Get-WmiObject], ManagementException
+ FullyQualifiedErrorId : GetWMIManagementException,Microsoft.PowerShell.Commands.GetWmiObjectCommand
ANUJ SAINI says
Make changes to openhardwaremonitor as shown in the picture. https://uploads.disquscdn.com/images/d2ab24026b8af73812d876d652137c6cf2b0639b773d7e0866c7c870200e0d95.jpg
Julien Moody says
These are already like that
ANUJ SAINI says
The script is working fine on my machine X64 bit Windows OS, consider i am not coder by profession. I will try to replicate this script on new machine and check for error
Julien Moody says
I’m investingating too, I will put the solution here if i found it
Julien Moody says
Isn’t possible to use -List or -Quey for this line ?
$gputemp = Get-WmiObject -Namespace ROOTOpenHardwareMonitor -Class Sensor
looks like it depends on windows 10 version if i understand :
https://github.com/openhardwaremonitor/openhardwaremonitor/issues/864
ANUJ SAINI says
Can’t help you in coding, don’t know much.
Few hours back setup this script on my friends computer via team viewer and it work perfectly on his Windows 10 rig.
QuestionEverything says
Yes, same here. Already set like the picture.
Julien Moody says
I found the solution !
Just replace OHM 0.8.0 by this one :
http://openhardwaremonitor.org/files/openhardwaremonitor-v0.8.0.3-alpha.zip
Julien Moody says
I found the solution for me !
Just replace OHM 0.8.0 by this one and set like your picture.
http://openhardwaremonitor.org/files/openhardwaremonitor-v0.8.0.3-alpha.zip
Tom says
Hi,
Thanks for sharing your experience and knowledge about mining. I really appreciate this.
Perhaps this is not the right place to ask you this:
I’m doing research and at starting point of getting a miner rig myself. Currently using my 1070 for mining while doing research. I would like to ask you if you could make a post about your rig. What motherboard, CPU, RAM, PSU’s and(!) what raisers you used. I thought 6 GPU / ‘normal’ motherboard was the max.
Thanks!!
ANUJ SAINI says
This post is requested many times , hopefully will post very soon.
This is my rig configuration
Motherboard : ASUS Z270 A , http://geni.us/SATc
GPU : Zotac AMP Extreme 1080 TI , http://geni.us/cFEy
CPU : Intel Celeron G3900 , http://geni.us/szdlE9S
RAM : 8 GB DDR4 Corsair Vengeance , http://geni.us/b1Z2NSQ
Hard Disk : 120 GB SSD , http://geni.us/ISfaIxB
PSU : 1600 Watt EVGA , http://geni.us/jzAwWj9 , 1000 Watt Corsair RMX 1000 , http://geni.us/rrYwn2
Riser Cables : http://bit.ly/2hsWbpQ
PSU Extension Cable : http://bit.ly/2i2Azhi
Cycle Relay Timer : DH48s-s , http://geni.us/1H7A0
Some other parts also needed like mouse,keyboard, rig frame, etc
Tom says
Thanks!
Looking forward to your post.
I’ve special interest in the risers you’ve selected and why. I’ve seen/read a lot of different power-related issues on those.
ANUJ SAINI says
These are the best one right now http://bit.ly/2rAKfqa.
If you can buy them at your local store then do buy otherwise buy from aliexpress but delivery time would be around 15 days.
Version 7 risers are also good
Matt White says
Curious why you use a Cycle Relay Timer?? Is it to just restart your rig after a certain amount of continuous mining?? Thanks
ANUJ SAINI says
Cycle Relaty time for exhaust fan – It run for 5 minutes after every 15 minutes.
You can restart your rig using simple windows batch script
MIchael Lander says
Its been running for an hour without issues. Thank you so much for your guide.
luis ate says
why it didn’t work @ win10 64bit
the script just start but only blank not working
Glenn S Tadeo says
Hi Anuj! What application should i run after doing all the stuff in your guide. Basically it doesnt detect when my GPU is not running or set at Temp Low setting. I tried setting it from 45 and 60deg C.
ANUJ SAINI says
Openhardware monitor but it is already added in zip file so should launch automatically. make sure you have followed step 3
Derek says
Can this script be altered for restart of GPU if hash rate falls below a set rate?
Anuj Saini says
Yes
Derek says
Can you share the code? This would make life so much easier, as I have been searching for a watchdog option for NBminer for days. Thanks for this by the way. Great work!! Also are you for hire to design custom work?
Derek says
In this script, it would be nice to add if hash rate falls below x MH/s for x amount of time then reboot miner software or if miner has not gotten a share in x amount of time then reboot miner software.
Anuj Saini says
sorry for very late reply.
https://jkcrypto.com/wp-content/uploads/2017/12/MinerMonitor.zip
No, I am busy in other stuff