metrics-zabbix

Metrics zabbix adapter for reporting and monitor metrics with zabbix

License

License

Categories

Categories

Metrics Application Testing & Monitoring Monitoring
GroupId

GroupId

com.janramm
ArtifactId

ArtifactId

metrics-zabbix
Last Version

Last Version

0.0.1
Release Date

Release Date

Type

Type

jar
Description

Description

metrics-zabbix
Metrics zabbix adapter for reporting and monitor metrics with zabbix
Project URL

Project URL

https://github.com/janramm87/metrics-zabbix
Source Code Management

Source Code Management

https://github.com/janramm87/metrics-zabbix

Download metrics-zabbix

How to add to project

<!-- https://jarcasting.com/artifacts/com.janramm/metrics-zabbix/ -->
<dependency>
    <groupId>com.janramm</groupId>
    <artifactId>metrics-zabbix</artifactId>
    <version>0.0.1</version>
</dependency>
// https://jarcasting.com/artifacts/com.janramm/metrics-zabbix/
implementation 'com.janramm:metrics-zabbix:0.0.1'
// https://jarcasting.com/artifacts/com.janramm/metrics-zabbix/
implementation ("com.janramm:metrics-zabbix:0.0.1")
'com.janramm:metrics-zabbix:jar:0.0.1'
<dependency org="com.janramm" name="metrics-zabbix" rev="0.0.1">
  <artifact name="metrics-zabbix" type="jar" />
</dependency>
@Grapes(
@Grab(group='com.janramm', module='metrics-zabbix', version='0.0.1')
)
libraryDependencies += "com.janramm" % "metrics-zabbix" % "0.0.1"
[com.janramm/metrics-zabbix "0.0.1"]

Dependencies

compile (4)

Group / Artifact Type Version
com.quigley : zabbixj jar 1.0.1
com.codahale.metrics : metrics-core jar 3.0.1
org.slf4j : slf4j-api jar 1.7.2
org.slf4j : slf4j-log4j12 jar 1.7.2

Project Modules

There are no modules declared in this project.

metrics-zabbix

This project is a small addon for metrics in order to report measures to Zabbix.

Import with Maven:

...
<dependency>
  <groupId>com.janramm</groupId>
  <artifactId>metrics-zabbix</artifactId>
  <version>0.0.1-SNAPSHOT</version>
</dependency>
...

Example:

Our source contains a counter called test and our host (zabbix name) is macbook-jramm

In order to monitor that counter we have to integrate some source code and have to configure zabbix.

Source code:

ZabbixAgent agent = new ZabbixAgent();
agent.setEnableActive(true);
agent.setEnablePassive(false);
agent.setHostName("macbook-jramm");
agent.setServerAddress(InetAddress.getByName("zabbix.janramm.com"));
agent.setServerPort(10051);
final MetricRegistry metrics = new MetricRegistry();

ZabbixMetricsAgent zabbixMetricsAgent = new ZabbixMetricsAgent(metrics, agent);
zabbixMetricsAgent.start();

Counter counter = metrics.counter("test");
agent.start();

counter.inc();

Thread.sleep(1000);
counter.inc();

Thread.sleep(35000);

zabbixMetricsAgent.stop();
agent.stop();

Zabbix configuration:

  • create a host called macbook-jramm
  • create an item with the following configuration:
    • test.test (metricname.metric-key)
    • Zabbix agent (active)

MetricKeys

The supported metric-keys depends on the metric type

Counter

any metric-key specified will return the current count

Gauge

any metric-key specified will return the current count

Histogram

supported metric-keys:

MAX,
MIN,
MEDIAN,
MEAN,
STDDEV, 
P75TH,
P95TH,
P98TH,
P99TH,
P999TH,
COUNT
Meter

supported metric-keys:

MEAN_RATE,
ONE_MINUTE_RATE,
FIVE_MINUTE_RATE,
FIFTEEN_MINUTE_RATE,
COUNT
Timer

supported metric-keys:

MEAN_RATE,
ONE_MINUTE_RATE,
FIVE_MINUTE_RATE,
FIFTEEN_MINUTE_RATE,
COUNT
MAX,
MIN,
MEDIAN,
MEAN,
STDDEV,
P75TH,
P95TH,
P98TH,
P99TH,
P999TH

Versions

Version
0.0.1