Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Telegram notification support #714

Merged
merged 8 commits into from Dec 12, 2016
Merged

Telegram notification support #714

merged 8 commits into from Dec 12, 2016

Conversation

islander
Copy link
Contributor

Implement sending notification to Telegram chats

@jamtur01
Copy link
Member

Looks like some test failures in there.

(ns ^{:doc "Send events to Telegram"}
riemann.telegram
(:require [clj-http.client :as client]
[clojure.string :refer [join]]))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You need to add clojure.string/escape here, that's why the test is failing.

refer clojure.string/escape
@pradeepchhetri-nd
Copy link

@islander
Copy link
Contributor Author

@pradeepchhetri-nd thank, i'll take a look later.

So, I just need to add [telegram :refer [telegram]] in :require section of riemann/config.clj and :telegram :telegram to :test-selectors of project.clj?

P.S. Sorry for my mistakes and stupid questions, I'm new to clojure and riemann development =)

@jamtur01
Copy link
Member

@islander Yes.

@jamtur01
Copy link
Member

jamtur01 commented Sep 6, 2016

LGTM - excluding the configurable formatting.

@pradeepchhetri-nd
Copy link

pradeepchhetri-nd commented Sep 6, 2016

@jamtur01 @islander I will try this on my setup today and let you know how the testing goes. Thanks.

@jamtur01
Copy link
Member

jamtur01 commented Sep 6, 2016

@pradeepchhetri I am not overly keen on the sleep....

@pradeepchhetri
Copy link
Member

@jamtur01 @islander I think we can do something better than sleep Will get back to you soon.

@islander
Copy link
Contributor Author

islander commented Sep 6, 2016

@jamtur01 by external formating you mean switching between HTML and Markdown? I'll try to add this soon. And what other options we have to replace sleep?

@islander
Copy link
Contributor Author

islander commented Sep 7, 2016

According to formatting: sometimes I send, for example, syslog message in event description, so telegram markdown parser could interpret all special symbols in message ([,],*,_ and so on) and formatting become weird. So, should I make escaping inside format-message function, or it should be done outside of it (in client, or somewhere in riemann streams)? It's the reason i switched to HTML parse_mode (easier to escape :))

example of such message:

Description: WARNING[817][C-00036738]: app_dial.c:2437 in dial_exec_full: Unable to create channel of type 'SIP' (cause 20 - Subscriber absent)

becomes something like this:

Description: WARNING817C-00036738: app dial.c:2437 in dial exec_full: Unable to create channel of type 'SIP' (cause 20 - Subscriber absent)

@pradeepchhetri
Copy link
Member

@islander I send a pull request to your fork's telegram branch. I tested the plugin and works perfectly fine.

@islander
Copy link
Contributor Author

I've added parse_mode option.

@pyr
Copy link
Contributor

pyr commented Dec 12, 2016

thanks @islander

@pyr pyr merged commit cf9c4f0 into riemann:master Dec 12, 2016
@islander islander deleted the telegram branch January 27, 2018 03:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants