[英]Retrieving metrics through librado using NodeJS
早上好!
我在尝试从librato
获取单个数字以在html页面中使用时遇到了麻烦。
我只想获取指标AWS.Billing.EstimatedCharges.total
的最后一个值,即花费该值并将其全部放到HTML页面中的客户端名称(简单,但对我而言不行)
我正在尝试使用此API https://github.com/goodeggs/librato-node而且我仍然不知道如何解决此问题。
ps:我无法使用嵌入图表。
var http = require('http');
http.createServer(function (req, res) { }).listen(1337, "127.0.0.1");
console.log('Server running at 127.0.0.1:1337/');
var librato = require('librato-node');
api = librato.configure({email: 'myemail', token: 'mytoken'});
librato.start(); process.once('SIGINT', function() { librato.stop();
// stop optionally takes a callback });
// Don't forget to specify an error handler, otherwise errors will be thrown
librato.on('error', function(err) { console.error(err); });
尝试npm install librato-metrics
,这里有很多猜测,因此请报告} 8 *)
const client = require('librato-metrics').createClient(
{
email: process.env.LIBRATO_METRICS_EMAIL,
token: process.env.LIBRATO_METRICS_TOKEN
}
const payload = {
count: 1,
resolution: 60
};
client.get('/metrics/AWS.Billing.EstimatedCharges.total', payload,
function(err, response) {
if (err) {
console.error(err, payload);
} else {
console.log(response);
}
});
```
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.