美文网首页
zabbixApi4j-Host interface

zabbixApi4j-Host interface

作者: 差不多先生_tl | 来源:发表于2018-01-11 14:01 被阅读38次

    Host interface

    hostinterface.create: 创建新的主机接口
    hostinterface.delete: 删除主机接口
    hostinterface.exists: 检查主机接口是否存在
    hostinterface.get: 检索主机接口
    hostinterface.massadd: 向主机添加主机接口
    hostinterface.massremove: 从主机移除主机接口
    hostinterface.replaceostinterfaces: 主机替换主机接口
    hostinterface.update: 更新主机接口

    image.png
    HostInterfaceGetTest
    package cn.com.yeexun.testzabbix.zabbix4j.example.hostinterface;
    
    import static org.junit.Assert.assertNotNull;
    
    import java.util.ArrayList;
    
    import org.junit.Test;
    
    import cn.com.yeexun.testzabbix.zabbix4j.common.ZabbixApiTestBase;
    
    import com.google.gson.Gson;
    import com.zabbix4j.hostinteface.HostInterfaceGetRequest;
    import com.zabbix4j.hostinteface.HostInterfaceGetResponse;
    
    /**
     * Created by Suguru Yajima on 2014/05/08.
     */
    public class HostInterfaceGetTest extends ZabbixApiTestBase {
    
        public HostInterfaceGetTest() {
            super();
        }
    
        @Test
        public void testGet1() throws Exception {
    
            HostInterfaceGetRequest request = new HostInterfaceGetRequest();
            HostInterfaceGetRequest.Params params = request.getParams();
            ArrayList<Integer> hostids = new ArrayList<Integer>();
            hostids.add(10109);
            params.setHostids(hostids);
    
            HostInterfaceGetResponse response = zabbixApi.hostInterface().get(request);
    
            assertNotNull(response);
    
            Gson gson = getGson();
            logger.debug(gson.toJson(response));
        }
    }
    
    

    相关文章

      网友评论

          本文标题:zabbixApi4j-Host interface

          本文链接:https://www.haomeiwen.com/subject/upgznxtx.html