I will describe one of the ways how to monitor the “farm” and remotely restart if it hangs, the video card or the mining program “fell off”, the Internet disappeared, the router hung.
Advantages of the GSM socket:
- Automatic farm reboot, even if it is “hard” stuck.
- You will be informed about the reboot of the farm. Even if you currently have no Internet on your mobile. You receive an ordinary SMS.
- Google Drive - always works in the "cloud", without your participation, verified more than 5 years.
- Issue price ~ 800 UAH. + 1 UAH per year. (for any tariff from Kyivstar)
Disadvantages of other monitoring systems:
- Software WATCHDOG - who would not say, but ... freezes!
- USB WATCHDOG - does not send an alert, it does not reboot if for some reason the "miner" is closed.
- Wi-Fi smart sockets will not automatically reboot the system. It is necessary to go to them and manually disable and enable. Provided that the Internet does not “fall off” and the router does not freeze.
The whole idea of monitoring works if you mine on a pool and the pool gives statistics on the performance of your “farm”.
- Sign up for Google.com or use a ready-made gmail account .com. Is free!
- We are registering on clickatell.com - this is to send SMS to your outlet. Is free!
- We buy a GSM-outlet. Well proven "GSM-socket SOKOL". Enough 1st version of SOKOL-GS1. Or another available GSM socket that works via SMS commands.
The meaning of the work of monitoring:
The script works around the clock in Google Drive and polls your pool every minute. As soon as the script receives your speed equal to zero H / sec, it will immediately send SMS to the outlet for resetting the farm. Everything works without your participation.
All SMS Free!
Setting up the script for Google Drive
For example, cryptocurrency KARBO (karbovanets), with the algorithm CryptoNight and the pool krb.sberex.com
Go to
drive.google.com and create a new Google Apps Script:
Register this code:
Script codefunction response(n) { // var wallet = 'KcdYnF6rxxKEw7pvFWqNCh3yhpFD6sfvtCuTakxpWZSQCs3sTrvBLfK4TLMxZnRd'; try { // var html = UrlFetchApp.fetch('http://home.sberex.com:7006/stats_address?address=' + wallet, {muteHttpExceptions:true}); } catch (e) { if (n < 2) response(++n); else send_sms('sberex.com++3+'); return false; } try { return JSON.parse(html.getContentText()); } catch (e) { // Logger.log(response); send_sms('error+sberex.com:+'+html.getResponseCode()); return false; } } function sberex() { var JSONresponse = response(0); if (!JSONresponse) return; var dateLastShare = Utilities.formatDate(new Date(JSONresponse.stats.lastShare*1000), Session.getScriptTimeZone(), "HH:mm"); var hashrate = JSONresponse.stats.hashrate; var cacheHashrate = CacheService.getScriptCache().get('hesh'); if (hashrate && cacheHashrate == 'undefined') { send_sms('YES_KRB+' + dateLastShare); CacheService.getScriptCache().put('time', 0); } if (!hashrate && cacheHashrate != 'undefined') { send_sms_mining_off(); send_sms('NOT_KRB+' + dateLastShare); // send_sms_mining('Vkl'); } if (!hashrate && cacheHashrate == 'undefined') { var cacheTime = CacheService.getScriptCache().get('time'); if (cacheTime) ++cacheTime; else cacheTime = 0; if (cacheTime != 0 && cacheTime % 10 == 0) send_sms('NOT_KRB+%3E' + cacheTime + 'min+' + dateLastShare); CacheService.getScriptCache().put('time', cacheTime); } CacheService.getScriptCache().put('hesh', hashrate); } function sberex_day() { var JSONresponse = response(0); if (!JSONresponse) return; var payments = JSONresponse.charts.payments; var hashrate = JSONresponse.charts.hashrate; var day = Utilities.formatDate(new Date(), Session.getScriptTimeZone(), "dd") - 1; var pay = 0, hash = 0; for (var i = 0; i < payments.length; i++) { if (Utilities.formatDate(new Date(payments[i][0]*1000), Session.getScriptTimeZone(), "dd") == day) pay += payments[i][1] / 1000000000000; } for (var i = 0; i < hashrate.length; i++) { hash += hashrate[i][1]; } hash = (hash / hashrate.length).toFixed(0); send_sms(pay + '+KRB+++' + day + '+(~+' + hash + '+H/sec)'); } function send_sms(m) { // ( .) UrlFetchApp.fetch('https://platform.clickatell.com/messages/http/send?apiKey=iY3rdSUbRj6b4E356g==&to=380981075040&content=' + m); } function send_sms_mining_off() { // . try { var html = UrlFetchApp.fetch('https://platform.clickatell.com/messages/http/send?apiKey=iY3rdSUbRj6b4E36g==&to=380661075040&content=%231111LOAD0'); var mesID = JSON.parse(html.getContentText()).messages[0].apiMessageId; if (mesID) CacheService.getScriptCache().put('mesID', mesID, 21600); else send_sms('+++++'); } catch (e) { send_sms_mining_off(); } } function doGet(e) { // , . var status = e.parameter.status; var mesID = CacheService.getScriptCache().get('mesID'); if (e.parameter.status == 'RECEIVED_BY_RECIPIENT' && mesID == e.parameter.messageId) UrlFetchApp.fetch('https://platform.clickatell.com/messages/http/send?apiKey=iY3rdSUbRj6b4E36g==&to=380661075040&content=%231111LOAD1'); }
In the code, respectively, change your data, this is the wallet, phone number and address of the pool.
Attention! The address of the pool is not the one you see in the browser, but you need to find it. To do this, on the statistics page, press
ctrl + shift + i and in the appeared window select
Network .
We find the part of the request that requests statistics on the server. Each pool has its own, but the answers always come in a standard JSON format. For Carbovanets, it is the same for every pool. Here is the answer and "parses" the script on Google Drive, every minute.
After you have changed the data in the code to your values, you need to activate it and deploy it as a web application. To do this, select any function from the script and run it:
Click "Grant Permission" and select an account:
Click "Allow":
Now expand as “Web application”, click on the “Publish” menu:
Configure as shown in the screenshot below:
Copy the current URL of the web application, later it will come in handy.
Now we will add a Trigger, which will be triggered every minute, and once a day with a report (optional). Choose such functions and customize the screenshot:
At this, the script setting is over, let's proceed to SMS.
SMS gateway setting
We register on clickatell.com. Go to your personal account and add two phones. For reporting your phone and the one that is in the outlet. The resource Satelliteite allows you to send completely free sms to your three numbers that you register with them in unlimited quantities. Now we will configure the API for sending SMS, go
here and configure the API, you will be assigned an API key.
This completes the “farm” monitoring setup. Insert the SIM card into the GSM outlet, turn on the farm. You can test the work of the outlet by running the function in the
send_sms_mining_off () script. The socket should turn off and after a few seconds turn on, while sending an alert to your phone.
PS For the third month already, there was not a single case that I had to manually restart, or start the farm!