This project has been archived by its maintainers, and is no longer receiving any updates.
sensu-handler-rocketchat
This is a notification handler for Sensu written in Python. It should also work with Slack and any other Chat service which uses Slack compatible WebHooks.
Why this and not sensu-plugins-slack?
Because it was easier to rewrite this in Python than to figure out how to quote and escape JSON in ERB in a JSON config file ;-). The orignal sensu plugin identifies monitored hosts by their IP address, which is not helpful, when using cloud setups, where IPs may repeat.
Usage
Create a handler config for sensu:
{
"handlers": {
"rockethandler": {
"type": "pipe",
"filters": [ "state_change_only" ],
"command": "sensu-handler-rocketchat"
}
}
}
Refer to the sensu documentation for more info on how to write this.
Then create the config for this specific handler. The default config section is “rockethandler”, but this can be overridden on the commandline, to enable handling multiple channels or Rocketchat servers.
{
"rockethandler": {
"hook_url": "https://rocketchat.example.com/hooks/iPw6s7Ykseuhf88kkhf8s4fn0392cnfh83mcfnbsWCzxHTSK",
"nickname": "sensu",
"channel": "openstack-events",
"dashboard_url": "http://10.0.1.4:3000",
"pretext": ""
}
}
Parameters
hook_url: (required) Full URL to the WebHook (incoming integration) you want to use.
nickname: (optional) Nickname to use by the handler. Defaults to “RocketChat defined”.
channel: (optional) Channel name to deliver notification to. Defaults to “RocketChat defined”.
dashboard_url: (optional) URL to uchiwa or sensu dashboard (root URL). This is used to create a link in the title of every notification
pretext: (optional) Text to prepend to each notification. Can be used e.g. for highlights.
Changing config namespace
By default the handler will use the top-level namespace “rockethandler” in the sensu config. If you need to notify multiple channels depending on different events you can define multiple config under different namespaces.
These configs can then be referenced by using the -c namespace commandline argument
Example:
rockethandler config
{
"rockethandler": {
"hook_url": "https://rocketchat.example.com/hooks/iPw6s7Ykseuhf88kkhf8s4fn0392cnfh83mcfnbsWCzxHTSK",
"nickname": "sensu",
"channel": "all-events",
"dashboard_url": "http://10.0.1.4:3000",
"pretext": ""
},
"rockethandler_1": {
"hook_url": "https://rocketchat.example.com/hooks/iPw6s7Ykseuhf88kkhf8s4fn0392cnfh83mcfnbsWCzxHTSK",
"nickname": "sensu-emerg",
"channel": "emergency-events",
"dashboard_url": "http://10.0.1.4:3000",
"pretext": "@all"
},
"rockethandler_2": {
"hook_url": "https://rocketchat.example.com/hooks/iPw6s7Ykseuhf88kkhf8s4fn0392cnfh83mcfnbsWCzxHTSK",
"nickname": "sensu-resolve",
"channel": "all-events",
"dashboard_url": "http://10.0.1.4:3000",
"pretext": "**PROBLEM RESOLVED**"
}
}
sensu handler config
{
"handlers": {
"rocket_handler": {
"type": "pipe",
"filters": [ "state_change_only" ],
"command": "sensu-handler-rocketchat"
},
"rocket_handler": {
"type": "pipe",
"filters": [ "state_change_only", "emergency" ],
"command": "sensu-handler-rocketchat -c rockethandler_1"
},
"rocket_handler": {
"type": "pipe",
"filters": [ "state_change_only", "resolution" ],
"command": "sensu-handler-rocketchat -c rockethandler_2"
}
}
}
Metadata
Release files for sensu-handler-rocketchat 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| sensu-handler-rocketchat-0.1.0.tar.gz | 3.7 kB | Without provenance | Details for sensu-handler-rocketchat-0.1.0.tar.gz |
Release files / sensu-handler-rocketchat-0.1.0.tar.gz
| Download URL | sensu-handler-rocketchat-0.1.0.tar.gz |
|---|---|
| Size | 3.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
db1e3bd53757eb47c871d780c0efc7ad0635672078990fae09b56af21debaf4b
|
|
BLAKE2b-256 checksum How to use checksums |
7078bc1db0843d50f7519acd6bb25b0236e93eaf1d713d19a07af1537aecfd4f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Security for sensu-handler-rocketchat 0.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.