Giter Club home page Giter Club logo

elixir_zabbix_sender's Introduction

ZabbixSender

Zabbix Sender Protocol client. Compatible with Zabbix 4.0

This library implements a simple TCP client as well as helper functions for encoding and decoding protocol messages.

Installation

The package can be installed by adding zabbix_sender to your list of dependencies in mix.exs:

def deps do
  [
    {:zabbix_sender, "~> 1.0.0"}
  ]
end

Usage

Use functions from ZabbixSender.Protocol for building requests and decoding responses. Use ZabbixSender.Serializer for writting and reading binary messages. ZabbixSender.send\3 will open connection, send request receive a response and then close the connection as the server won't allow it remain open.

Example

value = ZabbixSender.Protocol.value("localhost", "some_key", 12.3, :os.system_time(:second))
request = ZabbixSender.Protocol.encode_request([value], :os.system_time(:second))
|> ZabbixSender.Serializer.serialize()

with {:ok, response} <- ZabbixSender.send(request, "localhost", 10051),
  {:ok, deserialized} <- ZabbixSender.Serializer.deserialize(response),
  {:ok, decoded} <- ZabbixSender.Protocol.decode_response(deserialized)
do
  if decoded.failed == 0 do
    Logger.info("#{decoded.processed} values processed")
  else
    Logger.warn("#{decoded.processed} values processed out of #{decoded.total}")
  end
end

Known issues

Currently TLS encryption (both PSK and RSA) is not supported and there are no plans for it. A PR would be welcome though.

Documentation

Docs can be found at https://hexdocs.pm/zabbix_sender.

License

ZabbixSender source code is released under MIT License. Check LICENSE file for more information.

elixir_zabbix_sender's People

Contributors

lukaszsamson avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.