Skip to content

neiromc/zbx-sender

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

38 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Zbx Sender Library

This is a simple lightweight java library for sending data to Zabbix Trapper.
JAR Library: ./out/artifacts/zabbix_server/gmZabbixServerSender-X.X.X.jar

Official zabbix sender documentation:

https://www.zabbix.org/wiki/Docs/protocols/zabbix_sender/2.0
https://www.zabbix.org/wiki/Docs/protocols/zabbix_sender/1.8/java_example

Supported all actual versions of Zabbix Server (1.8 and later).

Examples

One item send:

ZabbixServer zs = new ZabbixServer("192.168.0.1, 10051, 5000);
ZabbixObject zo = new ZabbixObject("host1", "key1", "val1");
try {
    zs.connect();
    // send method will return answer from Zabbix Server as String
    System.out.println(zs.send(zo));
} catch (IOException e) {
    e.printStackTrace();
} finally {
    if (zs.isConnected())
        try {
            zs.close();
        } catch (IOException e) {
            e.printStackTrace();
        }
}

Bulk send:

ZabbixServer zs = new ZabbixServer("192.168.0.1, 10051, 5000);
ArrayList metrics = new ArrayList<>();
metrics.add(new ZabbixObject("host1", "key1_1", "val1"));
metrics.add(new ZabbixObject("host1", "key1_2", "val2"));
metrics.add(new ZabbixObject("host2", "key2",   "val3"));
metrics.add(new ZabbixObject("host3", "key3",   "val4"));
try {
    zs.connect();
    // send method will return answer from Zabbix Server as String
    System.out.println(zs.send(metrics));
} catch (IOException e) {
    e.printStackTrace();
} finally {
    if (zs.isConnected())
        try {
            zs.close();
        } catch (IOException e) {
            e.printStackTrace();
        }
}

License

The MIT License (MIT)

About

Java Library for send data to Zabbix Trapper

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages