{"id":20775556,"url":"https://github.com/fleaz/cpthook","last_synced_at":"2025-04-30T15:49:07.124Z","repository":{"id":33982248,"uuid":"125285150","full_name":"fleaz/CptHook","owner":"fleaz","description":"Receive webhooks from different applications and post them to IRC channels","archived":false,"fork":false,"pushed_at":"2024-08-14T21:59:56.000Z","size":304,"stargazers_count":17,"open_issues_count":10,"forks_count":9,"subscribers_count":3,"default_branch":"main","last_synced_at":"2024-09-19T16:48:22.791Z","etag":null,"topics":["gitlab","hacktoberfest","icinga2","irc","webhook-notifications","webhooks"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/fleaz.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-03-14T23:09:28.000Z","updated_at":"2024-05-24T16:25:58.000Z","dependencies_parsed_at":"2024-06-19T01:29:58.492Z","dependency_job_id":"72940903-a177-476f-94f1-5672fe7d3b2d","html_url":"https://github.com/fleaz/CptHook","commit_stats":null,"previous_names":["f-breidenstein/cpthook"],"tags_count":13,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fleaz%2FCptHook","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fleaz%2FCptHook/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fleaz%2FCptHook/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fleaz%2FCptHook/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/fleaz","download_url":"https://codeload.github.com/fleaz/CptHook/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":225039243,"owners_count":17411422,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["gitlab","hacktoberfest","icinga2","irc","webhook-notifications","webhooks"],"created_at":"2024-11-17T12:37:37.024Z","updated_at":"2024-11-17T12:37:37.497Z","avatar_url":"https://github.com/fleaz.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# CptHook\n[![Build Status](https://travis-ci.org/fleaz/CptHook.svg?branch=main)](https://travis-ci.org/fleaz/CptHook)\n[![Go Report Card](https://goreportcard.com/badge/github.com/fleaz/CptHook)](https://goreportcard.com/report/github.com/fleaz/CptHook)\nMIT[![License: ](https://img.shields.io/badge/License-MIT-blue.svg)](https://github.com/fleaz/CptHook/blob/main/LICENSE)\n\nCptHook provides a single endpoint where you can point all your webhook notifications to and get the nicely formatted in an IRC channel of your choice.\n\nTake a look at the [input](https://github.com/fleaz/CptHook/tree/main/input) folder to find out which services are\nalready supported by CptHook.\n\n**If you have questions or problems come chat with us in #CptHook on HackInt** -\u003e [WebChat](https://webirc.hackint.org/#irc://irc.hackint.org/#CptHook)\n\n## Installation\n\n\n### Manual\n\n**Requirements**\n * Go \u003e= 1.11\n\n```\n# go get -u github.com/fleaz/CptHook\n# cp $GOPATH/bin/CptHook /usr/local/bin/CptHook\n# vim /etc/cpthook.yml\n# CptHook\n```\n\n### Docker container\n\n```\nvim cpthook.yml\ndocker run --rm -it -v $(pwd)/cpthook.yml:/etc/cpthook.yml -p 8086:8086 ghcr.io/fleaz/cpthook:stable\n```\n\n### Prebuild binaries\nVisit the GitHub [release page](https://github.com/fleaz/CptHook/releases/latest) to download them.\n\n## IRC authentication\nSASL support is available to authenticate to the server.\nThe following methods are supported:\n - `SASL-Plain` uses plaintext username and password authentication\n - `SASL-External` can be used with external authentication mechanism like CertFP\n\nTo use CertFP, a client certificate (`certfile`) and key (`keyfile`) must be specified in the `irc.ssl.client_cert`\nsection and the `SASL-External` authentication method must be used.\n\n\n## Configuration\n\n### General\n\nThese settings are available for all modules\n\n```\n- endpoint\nDefines the URI where the module is reachable.\n\n- type\nThe input module you want to initialize in this block.\n\n- default_channel\nDefines a fallback channel where messages should go if none of the defined filters has matched. Only used in modules which have some kind of routing for events, e.g. the Gitlab module.\n```\n\n### Prometheus\nReceives webhooks from Alertmanager.\n\n```\n- hostname_filter\nThis regex is used to shorten the hostname of instance name in an alert. This\nregex must contain exactly one capture group which will be used as the\nhostname if the regex matches.\n```\n\n### Gitlab\nReceives webhooks from Gitlab. *Currently not all event types are implemented!* When a webhook is received this\nmodule will first check if there is an explicit mapping in the configuration especially for this project. If yes,\nthis channel will be used. If not, the module will look if there exists for the group. If yes, this channel will be\nused. If not, the `default_channel` will be used.\n```\n- groups\nThis dictionary maps Gitlab groups to IRC-channels.\n\n- explicit\nThis dictionary maps full project paths (groupname/projectname) to IRC-channels.\n```\n\n### Simple\nReceives arbitrary messages as text via a HTTP `POST` request and forwards this message line by line to a channel.\nThe channel can be specified per request by the `channel` query parameter, otherwise the `default_channel` from the config will\nbe used.\n\n### Icinga2\nReceives webhooks from Icinga2. Add [icinga2-notifications-webhook](https://git.s7t.de/ManiacTwister/icinga2-notifications-webhook) to your\nIcinga2 installation to send the required webhooks.\n\nWhen a webhook is received this module will first check if there is an explicit\nmapping in the configuration especially for this host. If yes, this channel will be used. If not, the module will\nlook if there exists for the hostgroup. If yes, this channel will be used. If not, the `default_channel` channel will be used.\n\n```\n- hostgroups\nThis dictionary maps Icinga2 hostgroups to IRC-channels.\n\n- explicit\nThis dictionary maps hostnames to IRC-channels.\n```\n\n## Build a new module\nWhen you want to create a new module, e.g. for the service 'Foo', follow these steps to get started:\n  - Add a section 'foo' to `cpthook_example.yml`. Everything below `cpthook.foo` will be provided to your module. \n  - Add a case to the `main.createModuleObject` function\n  - Create `foo.go` and `foo_test.go` files in the `input` folder\n  - Implement the `Module` interface according to `input/helper.go`\n  - Bonus task: Be a good programmer and write a test :)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffleaz%2Fcpthook","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffleaz%2Fcpthook","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffleaz%2Fcpthook/lists"}