Search in sources :

Example 1 with IndyZabbixApi

use of org.commonjava.indy.metrics.zabbix.api.IndyZabbixApi in project indy by Commonjava.

the class IndyZabbixSender method zabbixApiInit.

private void zabbixApiInit() throws IndyMetricsException, IOException, IndyHttpException {
    if (!bCreateNotExistZabbixApi) {
        return;
    }
    if (this.zabbixHostUrl == null || "".equals(this.zabbixHostUrl)) {
        throw new IndyMetricsException("can not find Zabbix's Host");
    }
    zabbixApi = new IndyZabbixApi(this.zabbixHostUrl, indyHttpProvider.createClient(new URL(zabbixHostUrl).getHost()));
    zabbixApi.init();
    if (this.zabbixUserName == null || "".equals(this.zabbixUserName) || this.zabbixUserPwd == null || "".equals(this.zabbixUserPwd)) {
        throw new IndyMetricsException("can not find Zabbix's username or password");
    }
    boolean login = zabbixApi.login(this.zabbixUserName, this.zabbixUserPwd);
    logger.info("User:" + this.zabbixUserName + " login is " + login);
}
Also used : IndyZabbixApi(org.commonjava.indy.metrics.zabbix.api.IndyZabbixApi) URL(java.net.URL) IndyMetricsException(org.commonjava.indy.metrics.exception.IndyMetricsException)

Aggregations

URL (java.net.URL)1 IndyMetricsException (org.commonjava.indy.metrics.exception.IndyMetricsException)1 IndyZabbixApi (org.commonjava.indy.metrics.zabbix.api.IndyZabbixApi)1