diff -ur zabbix-1.8.3.old/include/dbcache.h zabbix-1.8.3/include/dbcache.h --- zabbix-1.8.3.old/include/dbcache.h 2010-08-16 10:19:31.000000000 +0200 +++ zabbix-1.8.3/include/dbcache.h 2010-11-05 11:16:23.000000000 +0100 @@ -71,6 +71,7 @@ char *ipmi_ip; unsigned short ipmi_port; signed char ipmi_authtype; + unsigned int ipmi_hacks; unsigned char ipmi_privilege; char ipmi_username[HOST_IPMI_USERNAME_LEN_MAX]; char ipmi_password[HOST_IPMI_PASSWORD_LEN_MAX]; diff -ur zabbix-1.8.3.old/src/libs/zbxdbcache/dbconfig.c zabbix-1.8.3/src/libs/zbxdbcache/dbconfig.c --- zabbix-1.8.3.old/src/libs/zbxdbcache/dbconfig.c 2010-08-16 10:19:31.000000000 +0200 +++ zabbix-1.8.3/src/libs/zbxdbcache/dbconfig.c 2010-11-04 17:15:27.000000000 +0100 @@ -182,6 +182,7 @@ const char *ipmi_password; /* interned; ipmi_password[HOST_IPMI_PASSWORD_LEN_MAX]; */ unsigned short ipmi_port; signed char ipmi_authtype; + unsigned int ipmi_hacks; unsigned char ipmi_privilege; }; @@ -277,12 +278,12 @@ else { const ZBX_DC_FLEXITEM *flexitem; - + flexitem = zbx_hashset_search(&config->flexitems, &item->itemid); nextcheck = calculate_item_nextcheck(item->itemid, item->type, item->delay, flexitem ? flexitem->delay_flex : NULL, now, NULL); } - + return nextcheck; } @@ -665,7 +666,7 @@ if (ITEM_TYPE_TRAPPER == item->type && SUCCEED != DBis_null(row[17]) && '\0' != *row[17]) { trapitem = DCfind_id(&config->trapitems, itemid, sizeof(ZBX_DC_TRAPITEM), &found); - + trapitem->itemid = itemid; DCstrpool_replace(found, &trapitem->trapper_hosts, row[17]); } @@ -1025,6 +1026,7 @@ DCstrpool_replace(found, &ipmihost->ipmi_ip, row[8]); ipmihost->ipmi_port = (unsigned short)atoi(row[9]); ipmihost->ipmi_authtype = (signed char)atoi(row[10]); + ipmihost->ipmi_hacks = (unsigned int)atoi(row[27]); ipmihost->ipmi_privilege = (unsigned char)atoi(row[11]); DCstrpool_replace(found, &ipmihost->ipmi_username, row[12]); DCstrpool_replace(found, &ipmihost->ipmi_password, row[13]); @@ -1061,7 +1063,7 @@ zbx_strpool_release(ipmihost->ipmi_ip); zbx_strpool_release(ipmihost->ipmi_username); zbx_strpool_release(ipmihost->ipmi_password); - + zbx_hashset_remove(&config->ipmihosts, &hostid); } @@ -1076,7 +1078,7 @@ zbx_strpool_release(host->host); zbx_strpool_release(host->ip); zbx_strpool_release(host->dns); - + zbx_hashset_remove(&config->hosts, &hostid); } } @@ -1143,7 +1145,7 @@ "ipmi_password,maintenance_status,maintenance_type,maintenance_from," "errors_from,available,disable_until,snmp_errors_from,snmp_available," "snmp_disable_until,ipmi_errors_from,ipmi_available,ipmi_disable_until," - "status" + "status, ipmi_hacks" " from hosts" " where status in (%d,%d,%d)" DB_NODE, @@ -1490,6 +1492,7 @@ dst_host->ipmi_ip = NULL; dst_host->ipmi_port = ipmihost->ipmi_port; dst_host->ipmi_authtype = ipmihost->ipmi_authtype; + dst_host->ipmi_hacks = ipmihost->ipmi_hacks; dst_host->ipmi_privilege = ipmihost->ipmi_privilege; strscpy(dst_host->ipmi_username, ipmihost->ipmi_username); strscpy(dst_host->ipmi_password, ipmihost->ipmi_password); diff -ur zabbix-1.8.3.old/src/libs/zbxdbhigh/dbschema.c zabbix-1.8.3/src/libs/zbxdbhigh/dbschema.c --- zabbix-1.8.3.old/src/libs/zbxdbhigh/dbschema.c 2010-08-16 10:20:08.000000000 +0200 +++ zabbix-1.8.3/src/libs/zbxdbhigh/dbschema.c 2010-11-04 17:04:34.000000000 +0100 @@ -1,4 +1,4 @@ -/* +/* ** ZABBIX ** Copyright (C) 2000-2005 SIA Zabbix ** @@ -626,6 +626,7 @@ {"snmp_errors_from", ZBX_TYPE_INT, ZBX_NOTNULL, NULL}, {"ipmi_error", ZBX_TYPE_CHAR, ZBX_NOTNULL | ZBX_SYNC, NULL}, {"snmp_error", ZBX_TYPE_CHAR, ZBX_NOTNULL | ZBX_SYNC, NULL}, + {"ipmi_hacks", ZBX_TYPE_INT, ZBX_NOTNULL | ZBX_SYNC | ZBX_PROXY, NULL}, {0} } }, @@ -1745,6 +1746,7 @@ snmp_errors_from integer DEFAULT '0' NOT NULL,\ ipmi_error varchar(128) DEFAULT '' NOT NULL,\ snmp_error varchar(128) DEFAULT '' NOT NULL,\ + ipmi_hacks integer DEFAULT '0' NOT NULL,\ PRIMARY KEY (hostid)\ ) ENGINE=InnoDB;\ CREATE INDEX hosts_1 on hosts (host);\ @@ -2823,6 +2825,7 @@ snmp_errors_from integer DEFAULT '0' NOT NULL,\ ipmi_error varchar(128) DEFAULT '' NOT NULL,\ snmp_error varchar(128) DEFAULT '' NOT NULL,\ + ipmi_hacks integer DEFAULT '0' NOT NULL,\ PRIMARY KEY (hostid)\ ) with OIDS;\ CREATE INDEX hosts_1 on hosts (host);\ @@ -5439,6 +5442,7 @@ snmp_errors_from integer DEFAULT '0' NOT NULL,\ ipmi_error varchar(128) DEFAULT '' NOT NULL,\ snmp_error varchar(128) DEFAULT '' NOT NULL,\ + ipmi_hacks integer DEFAULT '0' NOT NULL,\ PRIMARY KEY (hostid)\ );\ CREATE INDEX hosts_1 on hosts (host);\ diff -ur zabbix-1.8.3.old/src/zabbix_server/operations.c zabbix-1.8.3/src/zabbix_server/operations.c --- zabbix-1.8.3.old/src/zabbix_server/operations.c 2010-08-16 10:19:31.000000000 +0200 +++ zabbix-1.8.3/src/zabbix_server/operations.c 2010-11-04 17:07:49.000000000 +0100 @@ -83,7 +83,7 @@ host_esc = DBdyn_escape_string(host_name); result = DBselect( "select hostid,host,useip,ip,dns,port,useipmi,ipmi_ip,ipmi_port,ipmi_authtype," - "ipmi_privilege,ipmi_username,ipmi_password" + "ipmi_privilege,ipmi_username,ipmi_password,ipmi_hacks" " from hosts" " where status in (%d)" " and host='%s'" @@ -119,6 +119,7 @@ item.host.ipmi_privilege = atoi(row[10]); zbx_strlcpy(item.host.ipmi_username, row[11], sizeof(item.host.ipmi_username)); zbx_strlcpy(item.host.ipmi_password, row[12], sizeof(item.host.ipmi_password)); + item.host.ipmi_hacks = atoi(row[13]); } if (SUCCEED == (ret = parse_ipmi_command(p, item.ipmi_sensor, &val))) @@ -585,7 +586,7 @@ zbx_free(host_esc); } else /* EVENT_OBJECT_DHOST, EVENT_OBJECT_DSERVICE */ - { + { alarm(CONFIG_TIMEOUT); zbx_gethost_by_ip(row[1], host, sizeof(host)); alarm(0); @@ -619,10 +620,10 @@ /* by ip */ make_hostname(row[1]); /* replace not-allowed symbols */ host_unique = DBget_unique_hostname_by_sample(row[1]); - } - + } + host_unique_esc = DBdyn_escape_string(host_unique); - + DBexecute("insert into hosts (hostid,proxy_hostid,host,useip,ip,dns,port)" " values (" ZBX_FS_UI64 "," ZBX_FS_UI64 ",'%s',1,'%s','%s',%d)", hostid, @@ -632,7 +633,7 @@ ip_esc, host_esc, port); - + zbx_free(host_unique); zbx_free(host_unique_esc); } diff -ur zabbix-1.8.3.old/src/zabbix_server/poller/checks_ipmi.c zabbix-1.8.3/src/zabbix_server/poller/checks_ipmi.c --- zabbix-1.8.3.old/src/zabbix_server/poller/checks_ipmi.c 2010-08-16 10:19:31.000000000 +0200 +++ zabbix-1.8.3/src/zabbix_server/poller/checks_ipmi.c 2010-11-04 16:53:42.000000000 +0100 @@ -45,6 +45,7 @@ char *ip; int port; int authtype; + unsigned int hacks; int privilege; char *username; char *password; @@ -63,8 +64,8 @@ static os_handler_t *os_hnd; static zbx_ipmi_host_t *get_ipmi_host(const char *ip, const int port, - int authtype, int privilege, const char *username, - const char *password) + int authtype, unsigned int hacks, int privilege, + const char *username, const char *password) { const char *__function_name = "get_ipmi_host"; zbx_ipmi_host_t *h = NULL; @@ -76,8 +77,8 @@ for (i = 0; i < host_count; i ++) { if (0 == strcmp(ip, hosts[i].ip) && port == hosts[i].port && authtype == hosts[i].authtype - && privilege == hosts[i].privilege && 0 == strcmp(username, hosts[i].username) - && 0 == strcmp(password, hosts[i].password)) + && hacks == hosts[i].hacks && privilege == hosts[i].privilege + && 0 == strcmp(username, hosts[i].username) && 0 == strcmp(password, hosts[i].password)) { h = &hosts[i]; break; @@ -89,8 +90,8 @@ return h; } -static zbx_ipmi_host_t *allocate_ipmi_host(const char *ip, int port, int authtype, int privilege, - const char *username, const char *password) +static zbx_ipmi_host_t *allocate_ipmi_host(const char *ip, int port, int authtype, unsigned int hacks, + int privilege, const char *username, const char *password) { const char *__function_name = "allocate_ipmi_host"; size_t sz; @@ -114,6 +115,7 @@ h->ip = strdup(ip); h->port = port; h->authtype = authtype; + h->hacks = hacks; h->privilege = privilege; h->username = strdup(username); h->password = strdup(password); @@ -951,7 +953,7 @@ return SUCCEED; } -static zbx_ipmi_host_t *init_ipmi_host(const char *ip, int port, int authtype, int privilege, const char *username, const char *password) +static zbx_ipmi_host_t *init_ipmi_host(const char *ip, int port, int authtype, unsigned int hacks, int privilege, const char *username, const char *password) { const char *__function_name = "init_ipmi_host"; zbx_ipmi_host_t *h; @@ -963,7 +965,7 @@ zabbix_log(LOG_LEVEL_DEBUG, "In %s() host:'[%s]:%d'", __function_name, ip, port); - h = get_ipmi_host(ip, port, authtype, privilege, username, password); + h = get_ipmi_host(ip, port, authtype, hacks, privilege, username, password); if (NULL != h) { @@ -975,7 +977,7 @@ } } else - h = allocate_ipmi_host(ip, port, authtype, privilege, username, password); + h = allocate_ipmi_host(ip, port, authtype, hacks, privilege, username, password); h->ret = SUCCEED; h->done = 0; @@ -995,6 +997,8 @@ goto out; } + h->con->hacks = h->hacks; + if (0 != (ret = h->con->start_con(h->con))) { h->err = zbx_dsprintf(h->err, "Cannot connect to IPMI host [%s]:%d." @@ -1050,7 +1054,7 @@ } h = init_ipmi_host(item->host.ipmi_ip, item->host.ipmi_port, item->host.ipmi_authtype, - item->host.ipmi_privilege, item->host.ipmi_username, item->host.ipmi_password); + item->host.ipmi_hacks, item->host.ipmi_privilege, item->host.ipmi_username, item->host.ipmi_password); if (0 == h->domain_up) { @@ -1154,7 +1158,7 @@ } h = init_ipmi_host(item->host.useip ? item->host.ip : item->host.dns, item->host.ipmi_port, - item->host.ipmi_authtype, item->host.ipmi_privilege, item->host.ipmi_username, item->host.ipmi_password); + item->host.ipmi_authtype, item->host.ipmi_hacks, item->host.ipmi_privilege, item->host.ipmi_username, item->host.ipmi_password); if (0 == h->domain_up) { if (NULL != h->err) diff -ur zabbix-1.8.3.old/src/zabbix_server/trapper/nodecommand.c zabbix-1.8.3/src/zabbix_server/trapper/nodecommand.c --- zabbix-1.8.3.old/src/zabbix_server/trapper/nodecommand.c 2010-08-16 10:19:31.000000000 +0200 +++ zabbix-1.8.3/src/zabbix_server/trapper/nodecommand.c 2010-11-04 17:08:45.000000000 +0100 @@ -124,7 +124,7 @@ { db_result = DBselect( "select hostid,host,useip,ip,dns,port,useipmi,ipmi_ip,ipmi_port,ipmi_authtype," - "ipmi_privilege,ipmi_username,ipmi_password" + "ipmi_privilege,ipmi_username,ipmi_password,ipmi_hacks" " from hosts" " where hostid=" ZBX_FS_UI64 DB_NODE, @@ -150,6 +150,7 @@ item.host.ipmi_privilege = atoi(db_row[10]); zbx_strlcpy(item.host.ipmi_username, db_row[11], sizeof(item.host.ipmi_username)); zbx_strlcpy(item.host.ipmi_password, db_row[12], sizeof(item.host.ipmi_password)); + item.host.ipmi_hacks = atoi(db_row[13]); } if (SUCCEED == (ret = parse_ipmi_command(p, item.ipmi_sensor, &val)))