This project is a small addon for metrics in order to report measures to Zabbix.
...
<dependency>
<groupId>com.janramm</groupId>
<artifactId>metrics-zabbix</artifactId>
<version>0.0.1-SNAPSHOT</version>
</dependency>
...
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.
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();
- create a host called macbook-jramm
- create an item with the following configuration:
- test.test (metricname.metric-key)
- Zabbix agent (active)
The supported metric-keys depends on the metric type
any metric-key specified will return the current count
any metric-key specified will return the current count
supported metric-keys:
MAX,
MIN,
MEDIAN,
MEAN,
STDDEV,
P75TH,
P95TH,
P98TH,
P99TH,
P999TH,
COUNT
supported metric-keys:
MEAN_RATE,
ONE_MINUTE_RATE,
FIVE_MINUTE_RATE,
FIFTEEN_MINUTE_RATE,
COUNT
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