Skip to content

tverlaan/exometer_zabbix

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

29 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Exometer Zabbix Reporter

Hex.pm Version CI Status

A Zabbix reporter backend for exometer_core. This repo also contains an Elixir behaviour for reporters to have less boilerplate in the actual reporter.

Installation

The package can be installed as:

  1. Add exometer_zabbix to your list of dependencies in mix.exs:
def deps do
  [
    {:exometer_zabbix, "~> 1.0"} # see Hex version at the top
  ]
end
  1. Configure exometer_zabbix
config :exometer_core,
  report: [
    reporters: [
      'Elixir.Exometer.Report.Zabbix': [
        host: "127.0.0.1", # zabbix host
        hostname: "my-hostname-in-zabbix" # hostname of the machine in zabbix
      ]
    ]
  ]

Usage

The zabbix hostname is taken from the configuration. Each metric will be sent as if it belongs to that host.

Metrics in exometer are noted by a list of atoms. Each metric has one or more datapoints. Zabbix keys are generated using the metric name and each individual datapoint. Eg. [:erlang, :memory] with datapoints [:atom, :total] becomes erlang.memory.atom and erlang.memory.total.

Add items to zabbix with type trapper. More info here.

Configuration example

config :exometer_core,
  predefined: [
    { [:erlang, :memory], {:function, :erlang, :memory, [], :proplist, [:atom, :binary, :ets, :processes, :total]}, [] },
    { [:erlang, :statistics], {:function, :erlang, :statistics, [:'$dp'], :value, [:run_queue]}, [] },
    { [:erlang, :system_info], {:function, :erlang, :system_info, [:'$dp'], :value, [:port_count, :process_count, :thread_pool_size]}, [] },
  ],
  report: [
    reporters: [
      'Elixir.Exometer.Report.Zabbix': [
        host: "127.0.0.1",
        port: 10051,
        timestamping: true,
        batch_window_size: 1000,
        hostname: "my-hostname-in-zabbix"
      ]
    ],
    subscribers: [
      {Exometer.Report.Zabbix, [:erlang, :memory], [:atom, :binary, :ets, :processes, :total], 5000, true, []},
      {Exometer.Report.Zabbix, [:erlang, :statistics], :run_queue, 5000, true, []},
      {Exometer.Report.Zabbix, [:erlang, :system_info], [:port_count, :process_count, :thread_pool_size], 5000, true, []}
    ]
  ]