我们正在使用Telegraf从 AWS 收集 CloudWatch 数据并将其输出到 InfluxDB。
我们需要在输入中添加动态标签, st if "instancId == 12345",添加标签"user = 3"
有没有办法做到这一点?
我正在使用kapacitor使用HTTP POST将警报发送到URL。写入的脚本在给定的URL上命中,但未将相关数据发送到任何给定的URL。
以下是我的TICK脚本。
stream
    |from()
        .measurement('cpu')
    |alert()
        .id('kapacitor/{{ index .Tags "host"}}')
        .message('{{ .ID }} is {{ .Level }} value:{{ index .Fields "value" }}')
        .info(lambda: TRUE)
        .post('http://localhost:1440/alert')
        .post('http://localhost/test.php')
Run Code Online (Sandbox Code Playgroud)
以下是第一个帖子脚本:
var express = require("express");
var app = express();
var moment = require("moment");
var dateTime = moment();
var bodyParser = require("body-parser");
var urlencodedParser = bodyParser.urlencoded({extended:false});
var jsonParser = bodyParser.json();
var port = 1440;
app.post('/alert', jsonParser ,function(request, response){
    console.log(request.body);
    response.send(); 
});
app.listen(port);
console.log('Express App.js listening to port '+port);
Run Code Online (Sandbox Code Playgroud)
以下是第二个帖子脚本:
<?php
    $content = json_encode($_REQUEST);
    echo …Run Code Online (Sandbox Code Playgroud) 我正在跑步prometheus和telegraf在同一台主机上。
我正在使用一些输入插件:
我已经配置到prometheus_client输出插件向普罗米修斯发送数据
这是我的配置:
    [[outputs.prometheus_client]]
      ## Address to listen on.
      listen = ":9126"
      ## Use HTTP Basic Authentication.
      # basic_username = "Foo"
      # basic_password = "Bar"
      ## If set, the IP Ranges which are allowed to access metrics.
      ##   ex: ip_range = ["192.168.0.0/24", "192.168.1.0/30"]
      # ip_range = []
      ## Path to publish the metrics on.
      path = "/metrics"
      ## Expiration interval for each metric. 0 == no expiration
      #expiration_interval = "0s"
      ## …Run Code Online (Sandbox Code Playgroud) Telegraf 1.9.0,Influxdb 1.7.4。我正在使用 filecount 输入插件来计算两个目录中的文件数量。这是 telegraf 的相关测试输出:
    $ telegraf --config /etc/telegraf/telegraf.conf --test
    2019-04-08T19:41:42Z I! Starting Telegraf 1.9.0
    > filecount,directory=/var/lib/pgsql/9.6/data/pg_logical/snapshots,host=db02 count=113i 1554752503000000000
    > filecount,directory=/var/lib/pgsql/9.6/data/pg_xlog,host=db02 count=569i 1554752503000000000
Run Code Online (Sandbox Code Playgroud)
当我使用 Chronograf 查找 influxdb 中的值时,根本没有 filecount 条目。我怎样才能找出问题所在?
如何使用InlineKeyboardButton{ parse_mode: \'Markdown\' }申请回复?
const Telegraf = require("telegraf");\nconst Extra = require("telegraf/extra");\nconst Markup = require("telegraf/markup");\n\nconst keyboard = Markup.inlineKeyboard([\n  Markup.urlButton("\xe2\x9d\xa4\xef\xb8\x8f", "http://telegraf.js.org"),\n  Markup.callbackButton("Delete", "delete")\n]);\n\nconst myReply = "Hello *mate*, __where are you ?__"\n\nbot.on("message", ctx =>\n  ctx.telegram.sendMessage(ctx.chat.id, myReply, Extra.markup(keyboard))\n);\nRun Code Online (Sandbox Code Playgroud)\n\n是否有任何选项可以使用 InlineKeyboardButton 为消息添加 markdown 样式?
\n我有以下telegraf配置
[agent]
  interval = "5s"
  round_interval = true
  metric_batch_size = 1000
  metric_buffer_limit = 10000
  collection_jitter = "0s"
  flush_interval = "5s"
  flush_jitter = "0s"
  precision = ""
  debug = false
  quiet = false
  logfile = ""
  hostname = "$HOSTNAME"
  omit_hostname = false
[[outputs.influxdb]]
  urls = ["http://influxdb:8086"]
  database = "telegraf"
  username = ""
  password = ""
  retention_policy = ""
  write_consistency = "any"
  timeout = "5s"
[[inputs.docker]]
  endpoint = "unix:///var/run/docker.sock"
  container_names = []
  timeout = "5s"
  perdevice = true
  total = …Run Code Online (Sandbox Code Playgroud) 我正在使用该telegraf软件包开发电报机器人。(版本 4.1.1)
一切正常,直到我开始使用来自 Telegraf 包的更多模块,如Extra和mark-up。
我开始收到此错误:
internal/modules/cjs/loader.js:800
    throw err;
    ^
Error: Cannot find module 'typegram/callback'
Require stack:
- C:\gitprojects\bot\node_modules\telegraf\lib\telegram-types.js
- C:\gitprojects\bot\node_modules\telegraf\lib\context.js
- C:\gitprojects\bot\node_modules\telegraf\lib\composer.js
- C:\gitprojects\bot\node_modules\telegraf\lib\telegraf.js
- C:\gitprojects\bot\node_modules\telegraf\lib\index.js
- C:\gitprojects\bot\index.js
?[90m    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:797:15)?[39m
?[90m    at Function.Module._load (internal/modules/cjs/loader.js:690:27)?[39m
?[90m    at Module.require (internal/modules/cjs/loader.js:852:19)?[39m
?[90m    at require (internal/modules/cjs/helpers.js:74:18)?[39m
    at Object.<anonymous> (C:\gitprojects\bot\node_modules\?[4mtelegraf?[24m\lib\telegram-types.js:16:14)
?[90m    at Module._compile (internal/modules/cjs/loader.js:959:30)?[39m
?[90m    at Object.Module._extensions..js (internal/modules/cjs/loader.js:995:10)?[39m
?[90m    at Module.load (internal/modules/cjs/loader.js:815:32)?[39m
?[90m    at Function.Module._load (internal/modules/cjs/loader.js:727:14)?[39m
?[90m    at Module.require (internal/modules/cjs/loader.js:852:19)?[39m {
  code: ?[32m'MODULE_NOT_FOUND'?[39m,
  requireStack: [
    ?[32m'C:\\gitprojects\\bot\\node_modules\\telegraf\\lib\\telegram-types.js'?[39m, …Run Code Online (Sandbox Code Playgroud) 我想用collectd部署influxDB。对于以前的版本,即 influxDB 1.8,它是受支持的。最新版本的 influxdb ie 2.0 是否支持collectd?
**嘿伙计们,我想在我的机器人中使用参数**
例如我发送 /ping hello 5
ctx.reply(You want me to ping hello 5 times)
在上面的代码中 /ping 是命令,而 hello 和 5 是参数,因此我可以在代码中访问它们
在
bot.command('ping')
我认为它不起作用,所以我需要帮助来处理参数
我有 6 个机器人,我想在同一台服务器上运行它们,但是当我运行第二个机器人时,它会抛出此错误:
address already in use :::8443
我知道我只能使用 4 个端口(80,88,443,8443)进行 webhook,但我有 6 个机器人。实际上,我正在尝试在同一端口上运行所有机器人。
有办法做吗?
我正在使用 telegraf 框架。我为每个机器人创建了一个目录,因为我认为这是做到这一点的方法。也许我错了。
这是每个目录中机器人的代码:
const Telegraf = require('telegraf');
const fs = require('fs');
let token = 'botID:botToken';
const bot = new Telegraf(token);
const tlsOptions = {
    key: fs.readFileSync('server-key.pem'),
    cert: fs.readFileSync('server-cert.pem'),
    ca: []
}
bot.on('message', (ctx) => ctx.reply('Hey'));
bot.telegram.setWebhook('https://myAddress.com:8443/test/botID');
bot.startWebhook('/test/botID', tlsOptions, 8443);
Run Code Online (Sandbox Code Playgroud) telegraf ×10
node.js ×4
influxdb ×3
telegram-bot ×3
javascript ×2
bots ×1
collectd ×1
influxdb-2 ×1
kapacitor ×1
monitoring ×1
npm ×1
prometheus ×1
telegram ×1