To manipulate the received metric you could use the valuation function, when that is defined, the value goes through it.
You'd have to use events though to generate auxiliary data. When you enable those events they run whenever some data is received from that node, you then have the option to do whatever you want. I would probably define the "fake" metrics somewhere and just pass your calculated data through processSerialData() as if this was real incoming data.
The key function to process your data would be the serverExecute() function.
Here's a template for generating fake min/max metrics for a node, you'd have to populate the '...' section with your own code, see other events for such examples:
exports.events = {
MinMax: {
label:'Min/Max Generated Metrics',
icon:'fa-heartbeat', //tons of awesome icons at https://fontawesome.com/
descr:'Generates minimum/maximum load metrics based on incoming data from multiple metrics',
serverExecute:function(node) {
db.findOne({ _id : node._id }, function (err, nodeNow) {
if (nodeNow)
{
//get the previous min/max values for comparison, if any exist
var oldMin=undefined;
var oldMax=undefined;
if (nodeNow.metrics && nodeNow.metrics['MIN'])
oldMin = nodeNow.metrics['MIN'].valueNumeric;
if (nodeNow.metrics && nodeNow.metrics['MAX'])
oldMax = nodeNow.metrics['MAX'].valueNumeric;
//find all existing values, then determine new min/max values
//... implementation specific .. query db for other metrics, other nodes/node groups etc.
// & determine if oldMin/oldMax need to be updated
//generake new fake MIN and MAX metrics
var fakeSerialMsg = '['+nodeNow._id+']';
//if (newMin != oldMin)
fakeSerialMsg += ' MIN:'+newMin;
//if (newMax != oldMax)
fakeSerialMsg += ' MAX:'+newMax;
//pass to data processor
processSerialData(fakeSerialMsg, true);
}
});
}
},
}
and an example for the MAX metric:
Max : {
name:'MAX',
regexp:/MAX\:(-?\d{1,3})/i,
duplicateInterval:3600,
value:'',
unit:'°',
pin:0,
graph:0,
graphOptions: {
legendLbl:'',
lines: { lineWidth:1 },
yaxis: { min:-100, max:200, autoscaleBottom:false, autoscaleTop:true }
},
},