2 unstable releases
0.3.0 | Jul 29, 2022 |
---|---|
0.2.0 | Jul 18, 2022 |
#6 in #zabbix
36KB
662 lines
zbx-webhook-proxy
Accepts requests on a configurable set of URLs then forwards the GET query parameters or POSTed JSON body to Zabbix Server (as a JSON value), with optional JMESPath transformation.
Use with Zabbix 4.0 or later and Trapper Items of type log
, then configure further processing of the JSON body in Zabbix using Dependent Items and JSON preprocessing.
Built With
- warp - A super-easy, composable, web server framework for warp speeds
- zbx-sender - Modern Rust implementation of Zabbix Sender Client
- trust-dns-resolver - Used for reverse DNS resolution not supported by
std::net
- clap - Parse command line arguments by defining a struct
- fern - “Simple, efficent logging”; manages console logs and optional access log file
- serde-json - for
json!()
happiness
Version History
See changes in CHANGELOG.md
Building
Prerequisites
Rust 2021 edition
Installation
cargo build --release
- Copy
target/release/zbx-webhook-proxy
to any executable location and configure startup
TODO
- Startup scripts and SystemD unit files
make install
Configuration
config.toml
file
See example_config.toml
for full usage
Minimal configuration
zabbix_server = "zabbix.example.com"
[[route]]
path = "/hook"
item_host = "Monitored Host"
item_key = "event.json"
Command Line
All command-line flags are optional but can be specified to override the configuration file or defaults
Flags with no default value
MUST be specified on the command line or in the configuration file
-z/--zabbix-server
: Address of Zabbix Server or Proxy
Flags with a default value
-c/--config
: Path toconfig.toml
(default/etc/zbx-webhook-proxy.toml
)-p/--zabbix-port
: Zabbix trapper port (default: 10051)-l/--listen
: Proxy HTTP listening port (default: 3030)
Flags that enable additional features
--access-log
: Path to a log file that will contain requests in Apache Common log format
Flags that enable features only available from the command line
--test-mode
: Accept webhooks and print values that would be sent to Zabbix Server without actually sending-v/--verbose
: Increase logging to the console for troubleshooting purposes
Versioning
I use SemVer for versioning. For the versions available, see the tags on this repository.
Authors
License
This project is licensed under the Modified BSD License - see the LICENSE file for details
Dependencies
~21–33MB
~503K SLoC