| Crates.io | killjoy-notifier-slack |
| lib.rs | killjoy-notifier-slack |
| version | 0.2.3 |
| created_at | 2021-11-24 21:05:47.503516+00 |
| updated_at | 2023-07-07 19:32:06.734539+00 |
| description | Send slack messages about unit state changes on behalf of killjoy. |
| homepage | |
| repository | https://github.com/kennep/killjoy-notifier-slack |
| max_upload_size | |
| id | 487291 |
| size | 89,131 |
Generate slack notifications on behalf of killjoy.
killjoy is a systemd unit monitoring application. It discovers systemd units and tracks their states. When a unit changes to a state of interest, killjoy contacts notifiers. This application is a notifier which, upon being contacted by killjoy, will post a Slack message using a webhook.
The code for this notifier was based in part on https://github.com/Ichimonji10/killjoy-notifier-notification.
First, read the concepts section in the killjoy documentation.
When properly installed, this application will be auto-started whenever a D-Bus message is sent to it. When started, this application will consume all messages (presumably from killjoy) in its message queue, and then idle.
Rust developers may install this app from source. Note that libdbus must be
installed. (On Ubuntu, this is provided by the libdbus-1-dev package.)
git clone https://github.com/kennep/killjoy-notifier-slack.git
cd killjoy-notifier-notification
cargo build
Note: no systemd unit scripts or installation scripts are included. The scripts from e.g. https://github.com/Ichimonji10/killjoy-notifier-notification can be used as a starting point.
This notifier expects a configuration file called slack-notifier.json to
be installed in the same directory as the main killjoy configuration file.
Here is an example configuration file with all configuration keys populated:
{
"webhook_url": "https://hooks.slack.com/services/YOUR_UNIQUE_WEBOOOK_URL",
"username": "My user",
"channel": "Channel name",
"icon_emoji": ":robot_face:"
}
The webhook_url key is required, and contains your Slack webhook URL.
The username, channel and icon_emoji keys are optional. If present,
they specify the username to post as, the channel to post in and the emoji
to use.
If username or channel are not present, the defaults for the Slack
webhook URL is used. If icon_emoji is not present, then :robot_face: is
used as the emoji.
Define a notifier in killjoy's configuration file:
"slack": {
"bus_type": "session",
"bus_name": "com.wangpedersen.KilljoyNotifierSlack1"
}
Then, list it in a rule's list of notifiers.
When this application receives a message, it will generate a slack message.
See annotated git tags.
This application is licensed under the GPLv3 or any later version.