influxdata / kapacitor

Open source framework for processing, monitoring, and alerting on time series data
MIT License
2.31k stars 492 forks source link

kapacitor - telegram error : dial tcp 149.154.167.220:443: i/o timeout #2516

Open priyankamondalairtel opened 3 years ago

priyankamondalairtel commented 3 years ago

Hi,

I am using kapacitor version: kapacitor-1.5.7-1.x86_64. and trying to send alert through telegram. PFB kapacitor config:

[telegram] enabled = true url = "https://api.telegram.org/bot" token = "1234:AAAA-BBBB" chat-id = "-**111" parse-mode = "Markdown" disable-web-page-preview = false disable-notification = false global = false**

also added telegram into TICKSCRIPT:

    .log('/tmp/telegram-disk.log')
    .telegram()
    .chatId('-111')
    .parseMode('Markdown')

but I am getting below error in log: ts=2021-03-31T15:53:07.757+05:30 lvl=error msg="failed to send event to Telegram" service=telegram task=chronograf-v1-e73925dd-30e1-4fa8-8879-966dd6b448d1 err="Post https://api.telegram.org/bot1234:AAAA-BBBB/sendMessage: dial tcp 149.154.167.220:443: i/o timeout"

where it may possible that i/o timeout error throws because of proxy issue. but here is this case I can run successfully through curl command from the same server.

curl https://api.telegram.org/bot1234:AAAA-BBBB/sendMessage -F chat_id=-**111 -F text="hello"** _{"ok":true,"result":{"message_id":36,"from":{"id":1763934750,"is_bot":true,"first_name":"Tools","username":"Tools_bot"},"chat":{"id":-111,"title":"Tools","type":"group","all_members_areadministrators":true},"date":1617186495,"text":"hello"}}

I am not sure what is the cause of this error, is it from server proxy (then it should throw error while running from server itself ) / else I need to modify any setting to kapacitor configuration. please help me here.

priyankamondalairtel commented 3 years ago

I think there is an error from kapacitor side, that it is not including CHAT_ID and text into it.

ts=2021-03-31T15:53:07.757+05:30 lvl=error msg="failed to send event to Telegram" service=telegram task=chronograf-v1-e73925dd-30e1-4fa8-8879-966dd6b448d1 err="Post https://api.telegram.org/bot1234:AAAA-BBBB/sendMessage: dial tcp 149.154.167.220:443: i/o timeout"

can anyone please update? It is little bit urgent for me.

docmerlin commented 3 years ago

@priyankamondalairtel we send the chat_id and text via json, can you try: (I don't have a telegram account)

try something like: You will need to modify this for auth etc:

 curl https://api.telegram.org/bot1234:AAAA-BBBB/sendMessage -H "Content-Type: application/json" -v -d '{"chat_id":"-111","text":"hello"}'