7 unstable releases (3 breaking)

0.4.1 Jul 5, 2022
0.3.0 May 15, 2022
0.2.2 Sep 19, 2020
0.2.1 Jun 28, 2019
0.1.0 Apr 13, 2018

#945 in Cryptography

Download history 351/week @ 2024-07-22 373/week @ 2024-07-29 365/week @ 2024-08-05 515/week @ 2024-08-12 987/week @ 2024-08-19 781/week @ 2024-08-26 684/week @ 2024-09-02 875/week @ 2024-09-09 891/week @ 2024-09-16 1244/week @ 2024-09-23 1021/week @ 2024-09-30 811/week @ 2024-10-07 832/week @ 2024-10-14 1393/week @ 2024-10-21 1186/week @ 2024-10-28 740/week @ 2024-11-04

4,171 downloads per month
Used in zbx-webhook-proxy

MIT license

74KB
1.5K SLoC

Rust 1K SLoC // 0.0% comments Python 189 SLoC // 0.0% comments

zbx-sender

Synopsis

Modern Rust implementation of Zabbix Sender Client. Working with Zabbix 2.0.8 and 2.1.7+ versions.

Code Example

Easy to use:

extern crate zbx_sender;

use zbx_sender::{Response, Result, Sender};
use std::env;

fn send_one_value(command: &str) -> Result<Response> {
    let sender = Sender::new(command.to_owned(), 10051);
    sender.send(("host1", "key1", "value"))
}

fn main() {
    let command = match env::args().nth(1) {
        Some(cmd) => cmd,
        None => {
            let name = env::args().nth(0).unwrap();
            panic!("Usage: {} [command]", name)
        }
    };

    match send_one_value(&command) {
        Ok(response) => println!("{:?} is success {} ", response, response.success()),
        Err(e) => println!("Error {}", e),
    }
}

See examples/sender.rs

License

The MIT License (MIT)


lib.rs:

Zabbix Sender Protocol implementation to transmit metrics to Zabbix Server.

Provides sync (and optional async) methods to send key-value pairs to Zabbix Server and Zabbix Proxy. Can communicate unencrypted or via TLS with certificates or pre-shared key (PSK). Also provides a clap command line parser that can be used to configure a TLS connection to Zabbix for crates that use this library.

Crate Features

  • tracing - enable logging via the tracing crate.
  • async_tokio - enable the async method Sender.send_async() to send values asynchronously using tokio::net::TcpStream
  • tls_rustls - use the rustls crate to enable TLS certificate encryption with Zabbix Server. As of version 0.20, rustls does NOT support PSK encryption.
  • tls_openssl - use the openssl crate to enable TLS certificate encryption or PSK encryption with Zabbix Server.
  • tls_rustls_tokio - MUST be enabled when both async_tokio and tls_rustls are enabled, because Cargo does not support conditional feature enablement (i.e. https://github.com/rust-lang/cargo/issues/1839).
  • tls_openssl_tokio - MUST be enabled when both async_tokio and tls_openssl are enabled.
  • clap - Include the struct that implements clap::Args, which can be included in downstream users of this library to get command line argument parsing that mirrors Zabbix native TLS configuration.

Dependencies

~3–17MB
~233K SLoC