Zabbix Error Analysis

Source: Internet
Author: User

Zabbix Error Analysis
The error message for zabbix error analysis is as follows:

3128: 20150429: 114455.871 history data from active proxy on "115.29.182.109" failed: proxy "jinrong" not found

Find source code

[Root @ monitor src] # grep "history data from active proxy" *-r | more
Zabbix_server/trapper. c: zabbix_log (LOG_LEVEL_WARNING, "history data from active proxy on \" % s \ "failed: % s ",

The result is trapper. c.

Analyze trapper. c
/****************************************************************************** *                                                                            * * Function: recv_proxyhistory                                                * *                                                                            * * Purpose: processes the received values from active proxies                 * *                                                                            * ******************************************************************************/static void     recv_proxyhistory(zbx_sock_t *sock, struct zbx_json_parse *jp){        const char      *__function_name = "recv_proxyhistory";        zbx_uint64_t    proxy_hostid;        char            host[HOST_HOST_LEN_MAX], *error = NULL;        int             ret;        zabbix_log(LOG_LEVEL_DEBUG, "In %s()", __function_name);        if (SUCCEED != (ret = get_active_proxy_id(jp, &proxy_hostid, host, &error)))        {                zabbix_log(LOG_LEVEL_WARNING, "history data from active proxy on \"%s\" failed: %s",                                get_ip_by_socket(sock), error);                goto out;        }        update_proxy_lastaccess(proxy_hostid);        ret = process_hist_data(sock, jp, proxy_hostid, error, sizeof(error));out:        zbx_send_response(sock, ret, error, CONFIG_TIMEOUT);        zbx_free(error);        zabbix_log(LOG_LEVEL_DEBUG, "End of %s()", __function_name);}

That is to say, if the get_active_proxy_id (jp, & proxy_hostid, host, & error) function is executed incorrectly, the above error is reported.
The problem is converted to the execution of get_active_proxy_id.
Continue to search for the source code file of the function get_active_proxy_id,

[root@monitor src]# grep get_active_proxy_id * -rBinary file libs/zbxdbhigh/libzbxdbhigh.a matchesBinary file libs/zbxdbhigh/libzbxdbhigh_a-proxy.o matcheslibs/zbxdbhigh/proxy.c: * Function: get_active_proxy_id *libs/zbxdbhigh/proxy.c:int get_active_proxy_id(struct zbx_json_parse *jp, zbx_uint64_t *hostid, char *host, char **error)Binary file zabbix_server/trapper/proxyhosts.o matcheszabbix_server/trapper/proxydiscovery.c: if (SUCCEED != (ret = get_active_proxy_id(jp, &proxy_hostid, host, &error)))zabbix_server/trapper/trapper.c: if (SUCCEED != (ret = get_active_proxy_id(jp, &proxy_hostid, host, &error)))zabbix_server/trapper/trapper.c: if (SUCCEED != (ret = get_active_proxy_id(jp, &proxy_hostid, host, &error)))Binary file zabbix_server/trapper/trapper.o matchesBinary file zabbix_server/trapper/proxydiscovery.o matchesBinary file zabbix_server/trapper/proxyconfig.o matcheszabbix_server/trapper/proxyautoreg.c: if (SUCCEED != (ret = get_active_proxy_id(jp, &proxy_hostid, host, &error)))zabbix_server/trapper/proxyconfig.c: if (SUCCEED != get_active_proxy_id(jp, &proxy_hostid, host, &error))Binary file zabbix_server/trapper/proxyautoreg.o matchesBinary file zabbix_server/trapper/libzbxtrapper.a matcheszabbix_server/trapper/proxyhosts.c: if (SUCCEED != (ret = get_active_proxy_id(jp, &proxy_hostid, host, &error)))Binary file zabbix_server/zabbix_server matches

We can see that it is defined in the libs/zbxdbhigh/proxy. c file

/****************************************************************************** * * * Function: get_active_proxy_id * * * * Purpose: extract a proxy name from JSON and find the proxy ID in database. * * The proxy must be configured in active mode. * * * * Parameters: jp - [IN] JSON with the proxy name * * hostid - [OUT] proxy host ID found in database * * host - [IN] buffer with minimum size * * 'HOST_HOST_LEN_MAX' * * error - [OUT] error message * * * * Return value: SUCCEED - proxy ID was found in database * * FAIL - an error occurred (e.g. an unknown proxy or the * * proxy is configured in passive mode * * * * Author: Alexander Vladishev * * * ******************************************************************************/int get_active_proxy_id(struct zbx_json_parse *jp, zbx_uint64_t *hostid, char *host, char **error){ DB_RESULT result; DB_ROW row; char *host_esc; int ret = FAIL, status; if (SUCCEED == zbx_json_value_by_name(jp, ZBX_PROTO_TAG_HOST, host, HOST_HOST_LEN_MAX)) { if (FAIL == zbx_check_hostname(host)) { *error = zbx_dsprintf(*error, "invalid proxy name \"%s\"", host); return ret; } host_esc = DBdyn_escape_string(host); result = DBselect( "select hostid,status" " from hosts" " where host='%s'" " and status in (%d,%d)" ZBX_SQL_NODE, host_esc, HOST_STATUS_PROXY_ACTIVE, HOST_STATUS_PROXY_PASSIVE, DBand_node_local("hostid")); zbx_free(host_esc); if (NULL != (row = DBfetch(result)) && FAIL == DBis_null(row[0])) { if (SUCCEED == is_uint31(row[1], &status)) { if (HOST_STATUS_PROXY_ACTIVE == status) { ZBX_STR2UINT64(*hostid, row[0]); ret = SUCCEED; } else { *error = zbx_dsprintf(*error, "proxy \"%s\" is configured in passive mode", host); } } else THIS_SHOULD_NEVER_HAPPEN; } else *error = zbx_dsprintf(*error, "proxy \"%s\" not found", host); DBfree_result(result); } else *error = zbx_strdup(*error, "missing name of proxy"); return ret;}

Analyze the source code. If the hosts table cannot be found, proxy \ "% s \" not found will be reported.

Hosts table structure

MySQL [zabbix]> desc hosts;
+——————–+———————+——+—–+———+——-+
| Field | Type | Null | Key | Default | Extra |
+——————–+———————+——+—–+———+——-+
| hostid | bigint(20) unsigned | NO | PRI | NULL | |
| proxy_hostid | bigint(20) unsigned | YES | MUL | NULL | |
| host | varchar(64) | NO | MUL | | |
| status | int(11) | NO | MUL | 0 | |
| disable_until | int(11) | NO | | 0 | |
| error | varchar(128) | NO | | | |
| available | int(11) | NO | | 0 | |
| errors_from | int(11) | NO | | 0 | |
| lastaccess | int(11)

Analysis

Observe the hosts table data and find that the status is the host state. HOST_STATUS_PROXY_ACTIVE and HOST_STATUS_PROXY_PASSIVE are active and passive proxies. Combined with zabbix theory, the active proxy only needs to be configured, if you do not need to configure an ip address or dns name, you will automatically establish a connection with the server. If no configuration is found in the hosts table when the connection is established, the proxy not found error will be reported. It seems that the proxy configuration has been deleted before, but the proxy on the machine is still running, which may cause this situation. However, no such alarm was reported in 2.2.3. Or the code of the new push in 2.2.9.

Processing

After adding the original jinrong proxy configuration in the dm configuration, zabbix server does not report this error. Processing is completed.

Postscript

The source code still needs to be viewed. After all, it is "no secret in front of the source code ". It is not necessary to fully understand.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.