zabbixApi4j-Host interface

2018-01-11  本文已影响38人  差不多先生_tl

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));
    }
}

上一篇下一篇

猜你喜欢

热点阅读