Skip to content

Commit

Permalink
Added new statistics charts & new admin panel
Browse files Browse the repository at this point in the history
  • Loading branch information
fancoder committed Aug 7, 2014
1 parent c2a9aae commit 92ec67f
Show file tree
Hide file tree
Showing 17 changed files with 1,474 additions and 194 deletions.
57 changes: 57 additions & 0 deletions README.md
Expand Up @@ -282,6 +282,63 @@ Explanation for each field:
"host": "127.0.0.1",
"port": 6379
}

/* Monitoring RPC services. Statistics will be displayed in Admin panel */
"monitoring": {
"daemon": {
"checkInterval": 60, //interval of sending rpcMethod request
"rpcMethod": "getblockcount" //RPC method name
},
"wallet": {
"checkInterval": 60,
"rpcMethod": "getbalance"
}

/* Collect pool statistics to display in frontend charts */
"charts": {
"pool": {
"hashrate": {
"enabled": true, //enable data collection and chart displaying in frontend
"updateInterval": 60, //how often to get current value
"stepInterval": 1800, //chart step interval calculated as average of all updated values
"maximumPeriod": 86400 //chart maximum periods (chart points number = maximumPeriod / stepInterval = 48)
},
"workers": {
"enabled": true,
"updateInterval": 60,
"stepInterval": 1800, //chart step interval calculated as maximum of all updated values
"maximumPeriod": 86400
},
"difficulty": {
"enabled": true,
"updateInterval": 1800,
"stepInterval": 10800,
"maximumPeriod": 604800
},
"price": { //USD price of one currency coin received from cryptonator.com/api
"enabled": true,
"updateInterval": 1800,
"stepInterval": 10800,
"maximumPeriod": 604800
},
"profit": { //Reward * Rate / Difficulty
"enabled": true,
"updateInterval": 1800,
"stepInterval": 10800,
"maximumPeriod": 604800
}
},
"user": { //chart data displayed in user stats block
"hashrate": {
"enabled": true,
"updateInterval": 180,
"stepInterval": 1800,
"maximumPeriod": 86400
},
"payments": { //payment chart uses all user payments data stored in DB
"enabled": true
}
}
```
#### 3) [Optional] Configure cryptonote-easy-miner for your pool
Expand Down
58 changes: 58 additions & 0 deletions config.json
@@ -1,6 +1,7 @@
{
"coin": "monero",
"symbol": "XMR",
"coinUnits": 1000000000000,

"logging": {
"files": {
Expand Down Expand Up @@ -113,5 +114,62 @@
"redis": {
"host": "127.0.0.1",
"port": 6379
},

"monitoring": {
"daemon": {
"checkInterval": 60,
"rpcMethod": "getblockcount"
},
"wallet": {
"checkInterval": 60,
"rpcMethod": "getbalance"
}
},

"charts": {
"pool": {
"hashrate": {
"enabled": true,
"updateInterval": 60,
"stepInterval": 1800,
"maximumPeriod": 86400
},
"workers": {
"enabled": true,
"updateInterval": 60,
"stepInterval": 1800,
"maximumPeriod": 86400
},
"difficulty": {
"enabled": true,
"updateInterval": 1800,
"stepInterval": 10800,
"maximumPeriod": 604800
},
"price": {
"enabled": true,
"updateInterval": 1800,
"stepInterval": 10800,
"maximumPeriod": 604800
},
"profit": {
"enabled": true,
"updateInterval": 1800,
"stepInterval": 10800,
"maximumPeriod": 604800
}
},
"user": {
"hashrate": {
"enabled": true,
"updateInterval": 180,
"stepInterval": 1800,
"maximumPeriod": 86400
},
"payments": {
"enabled": true
}
}
}
}
26 changes: 24 additions & 2 deletions init.js
Expand Up @@ -30,6 +30,10 @@ if (cluster.isWorker){
case 'cli':
require('./lib/cli.js');
break
case 'chartsDataCollector':
require('./lib/chartsDataCollector.js');
break

}
return;
}
Expand All @@ -40,7 +44,7 @@ require('./lib/exceptionWriter.js')(logSystem);

var singleModule = (function(){

var validModules = ['pool', 'api', 'unlocker', 'payments'];
var validModules = ['pool', 'api', 'unlocker', 'payments', 'chartsDataCollector'];

for (var i = 0; i < process.argv.length; i++){
if (process.argv[i].indexOf('-module=') === 0){
Expand Down Expand Up @@ -75,13 +79,17 @@ var singleModule = (function(){
case 'api':
spawnApi();
break;
case 'chartsDataCollector':
spawnChartsDataCollector();
break;
}
}
else{
spawnPoolWorkers();
spawnBlockUnlocker();
spawnPaymentProcessor();
spawnApi();
spawnChartsDataCollector();
}

spawnCli();
Expand Down Expand Up @@ -228,4 +236,18 @@ function spawnApi(){

function spawnCli(){

}
}

function spawnChartsDataCollector(){
if (!config.charts) return;

var worker = cluster.fork({
workerType: 'chartsDataCollector'
});
worker.on('exit', function(code, signal){
log('error', logSystem, 'chartsDataCollector died, spawning replacement...');
setTimeout(function(){
spawnChartsDataCollector();
}, 2000);
});
}

0 comments on commit 92ec67f

Please sign in to comment.