spring-zabbix-api-client

Zabbix 4 API Client with Spring

License

License

Categories

Categories

CLI User Interface
GroupId

GroupId

io.github.mlniang
ArtifactId

ArtifactId

spring-zabbix-api-client
Last Version

Last Version

0.1.1
Release Date

Release Date

Type

Type

jar
Description

Description

spring-zabbix-api-client
Zabbix 4 API Client with Spring
Project URL

Project URL

https://github.com/mlniang/spring-zabbix-api-client
Source Code Management

Source Code Management

https://github.com/mlniang/spring-zabbix-api-client

Download spring-zabbix-api-client

How to add to project

<!-- https://jarcasting.com/artifacts/io.github.mlniang/spring-zabbix-api-client/ -->
<dependency>
    <groupId>io.github.mlniang</groupId>
    <artifactId>spring-zabbix-api-client</artifactId>
    <version>0.1.1</version>
</dependency>
// https://jarcasting.com/artifacts/io.github.mlniang/spring-zabbix-api-client/
implementation 'io.github.mlniang:spring-zabbix-api-client:0.1.1'
// https://jarcasting.com/artifacts/io.github.mlniang/spring-zabbix-api-client/
implementation ("io.github.mlniang:spring-zabbix-api-client:0.1.1")
'io.github.mlniang:spring-zabbix-api-client:jar:0.1.1'
<dependency org="io.github.mlniang" name="spring-zabbix-api-client" rev="0.1.1">
  <artifact name="spring-zabbix-api-client" type="jar" />
</dependency>
@Grapes(
@Grab(group='io.github.mlniang', module='spring-zabbix-api-client', version='0.1.1')
)
libraryDependencies += "io.github.mlniang" % "spring-zabbix-api-client" % "0.1.1"
[io.github.mlniang/spring-zabbix-api-client "0.1.1"]

Dependencies

compile (4)

Group / Artifact Type Version
org.springframework.boot : spring-boot-starter-web jar 2.1.6.RELEASE
org.springframework.boot : spring-boot-configuration-processor Optional jar 2.1.6.RELEASE
org.projectlombok : lombok Optional jar 1.18.8
org.apache.maven.scm : maven-scm-provider-gitexe jar 1.11.2

runtime (1)

Group / Artifact Type Version
org.springframework.boot : spring-boot-devtools Optional jar 2.1.6.RELEASE

test (3)

Group / Artifact Type Version
org.springframework.boot : spring-boot-starter-test jar 2.1.6.RELEASE
org.junit.jupiter : junit-jupiter-api jar
org.junit.jupiter : junit-jupiter-engine jar

Project Modules

There are no modules declared in this project.

spring-zabbix-api-client

Helper Library for using Zabbix API from a Spring Boot application based on the Zabbix API version 4.0.

Build Status Maven Central License

Usage

Import using:

<dependency>
    <groupId>io.github.mlniang</groupId>
    <artifactId>spring-zabbix-api-client</artifactId>
    <version>0.1.1</version>
</dependency>

Set the property zabbix.api.url in your properties file as the URL of the Zabbix Server (without /api_jsonrpc.php).

The ZabbixApiService offers a general method you can use to make calls to the API. Example:

import io.github.mlniang.zabbix.client.exception.ZabbixApiException;
import io.github.mlniang.zabbix.client.request.CommonGetParams;
import io.github.mlniang.zabbix.client.response.JsonRPCResponse;
import io.github.mlniang.zabbix.client.service.ZabbixApiService;
import org.springframework.stereotype.Component;

@Component
public class TestClass {

   private final ZabbixApiService zabbixApiService;

   public TestClass(ZabbixApiService zabbixApiService) {
       this.zabbixApiService = zabbixApiService;
   }

   public JsonRPCResponse testCall() throws ZabbixApiException {
       CommonGetParams params = CommonGetParams.builder()
               .output("extended")
               .build();
       return zabbixApiService.call("host.get", params, "0424bd59b807674191e7d77572075f33");
   }
}

It contains also a shortcut method for authentication (zabbixApiService.authenticate("user", "password")).

The ZabbixHostService is just a helper class built for Zabbix Host method.

Next Steps

  • Build more helpers.
  • Propose caching user auth tokens ?

Versions

Version
0.1.1
0.1