# zabbix-sdk **Repository Path**: bif/zabbix-sdk ## Basic Information - **Project Name**: zabbix-sdk - **Description**: zabbix java sdk support 4.0 TLS and above - **Primary Language**: Java - **License**: AGPL-3.0 - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 2 - **Created**: 2021-04-06 - **Last Updated**: 2021-05-07 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # zabbix-sdk #### 介绍 zabbix-sdk是针对zabbix4.0 LTS版本设计的一套通用java api 目前官方提供的相关API,更多的兼容低版本,使用的功能和技术未能够及时更新,故实现此API,帮助那些希望快速集成zabbix的java爱好者。 目前已经完成部分: 1. zabbix标准api封装。 2. 全部high level api 封装(create/delete/get/update) - auth - action - apiinfo - application - configuration - correlation - dashboard - discovered - discovery - event - graph - history - host - iconmap - image - item - maintenance - map - mediatype - problem - proxy - screen - script - service - task - template - trend - trigger - user - valuemap - webscenario #### 软件架构 软件架构说明 本项目引用的外部及第三方库包括: - Feign(https://github.com/OpenFeign/feign) #### 安装教程 mvn仓库安装(https://search.maven.org/artifact/cn.wusifx/zabbix-sdk) ``` cn.wusifx zabbix-sdk 4.0.1 ``` #### 使用说明 ``` public class App { public static void main(String[] args) { Zabbix zabbix = new Zabbix(); zabbix.init("https://www.zabbix.com/zabbix"); BaseResponse baseResponse = zabbix.call(new AuthRequestBuilder(1L).setUserName("username").setPassword("password").builder()); System.out.println(baseResponse.getResult()); BaseResponse authResponse = zabbix.call(new AuthRequestBuilder(1L).setUserName("username").setPassword("password").builder()); String auth = authResponse.getResult(); BaseResponse alertResponse = zabbix.call(new AlertGetRequestBuilder(1L, auth).builder()); System.out.println(alertResponse.getResult()); BaseResponse unAuthResponse = zabbix.call(new UnAuthRequestBuilder(1L, auth).builder()); System.out.println(unAuthResponse.getResult()); String auth2 = zabbix.auth("username", "password");//login BaseResponse>> userGroupResponse = zabbix.call(new UserGroupCreateRequestBuilder(zabbix.getAuth())//create user group .setName("testGroup") .builder()); String userGroupId = userGroupResponse.getResult().get("usrgrpids").get(0);//get user group id zabbix.call(new UserCreateRequestBuilder(zabbix.getAuth())//create user and link to group by group id .setAlias("alias").setPasswd("p@ssw0rd") .setUsrgrps(new ArrayList() {{ add(new HashMap() {{ put("usrgrpid", userGroupId); }}); }}).builder()); zabbix.unAuth(auth2);//zabbix.unAuth();//logout } } ``` #### 后续计划(roadmap) 1. 兼容zabbix 5.0 及之后的 LTS 版本支持 2. 针对常用场景完善高级别抽象API #### 参与贡献 1. Fork 本仓库 2. 新建 Feat_xxx 分支 3. 提交代码 4. 新建 Pull Request #### 联系作者 wechat: ok_it_is_me