fleaz / CptHook

Receive webhooks from different applications and post them to IRC channels
MIT License
17 stars 8 forks source link

Module support also on the sender side #18

Closed fleaz closed 5 years ago

fleaz commented 5 years ago

Currently CptHook is a gateway for {Gitlab,Prometheus,...} --> IRC

When we take the modules approach and add them also to the sender side, we could turn CptHook into something like {Gitlab,prometheus,...} --> {IRC,Slack,Telegram,...}

Imho this would greatly increase the userbase for CptHook because most teams don't use IRC anymore and instead migrated to something like Slack or Hipchat.

I currently see two major things which should be designed carefully beforehand:

Especially the first point would greatly impact the amount of work we need to put into CptHook.

Would love to hear some more opinions on this topic :)

fooker commented 5 years ago

I like the idea of having multiple outputs.

IMHO the only way to gain all features from all notification transports is to have a transport-specific message per event. This means a lot of work, but I think it is worth the effort.

For the first point, we can do something like naming the transports and specify which transports to use on each hook module.

fleaz commented 5 years ago

IMHO the only way to gain all features from all notification transports is to have a transport-specific message per event.

I also thought about this, but the problem I see here is, that the messages are generated by the incoming module. So the incoming module needs to be aware of every outgoing module to generate enough different messages. This results in the fact that you have to modify every incoming module when you add a new outgoing module. Or did I get something wrong?

Thats why I thought about something more general as a CptHook internal representation and than the outgoing modules generate their specific version with all special features of this Service.

mweinelt commented 5 years ago

Format messages two ways:

When sending a message render both and send it, let the notification module choose which one it wants.

I'm most concerned with the way we select which input goes to which output. I'm thinking Prometheus Alertmanager complexity here, and that is no fun at all.

fooker commented 5 years ago

This results in the fact that you have to modify every incoming module when you add a new outgoing module. Or did I get something wrong?

Or we could do it the other way around: Every module has to support all transports. But then, some transports maybe can share some messages. Which gets close to the approach described by @mweinelt.

Maybe we have to come up with a list of transports we want to support and build a list of features these transports have. If we can find clusters in this, we can use these as message types.

fleaz commented 5 years ago

Suggestion:

modules: prometheus: enabled: true channel: "#prometeusChannel" hostname_filter: "(\w*)\.company.com:\d{4}" output: ["irc"] gitlab: enabled: true default: "#defaultChannel" output: ["slack"] simple: enabled: True default_channel: "#defaultChannel"

outputs: irc: host: "irc.hackint.eu" port: 6667 ssl: enabled: true nickname: "webhook-bot" slack: nickname: "webhook-bot" api-key: "asdjklasjdkl" telegram: nickname: "webhook-bot" api-key: "asdjklasjdkl"


This way `prometheus` would be send to **irc**, `gitlab` would be send to  **slack** and `simple` would be send to both because it would get **default_outputs** due to the lack of of defined outputs.

Any comments on this? Would this config schema fit every usecase or did I mis something?
mweinelt commented 5 years ago

Regarding outputs, maybe let me output to multiple IRC outputs, or multiple Slack outputs.

outputs:
    freenode:
        module: irc
        host: chat.freenode.net
        port: 6697
        ssl:
            enabled: true
        nickname: somebot
    hackint:
        module: irc
        host: irc.hackint.org
        port: 6697
        ssl:
            enabled: 6697
            cafile: /path/to/rootca.pem
        nickname: somebot
mweinelt commented 5 years ago

Let's replace modules with inputs.

fleaz commented 5 years ago

Regarding outputs, maybe let me output to multiple IRC outputs, or multiple Slack outputs.

I think this would also be usefull on the input side? So we can e.g. have 2 different Gitlabs which we route to different outputs? Or is this overkill?

fleaz commented 5 years ago

Update:

After discussing a lot about this issue in person and IRC we decided to drop the idea of multiple different outputs for now. Reasons are that CptHook was initially designed to work with IRC and every other messeging platform (slack,hipchat, you name it) behaves very differently and therefore a lot of complexity would be introduced just to support anything that is not IRC.

Closing this now.