1 /*
2 ** Zabbix
3 ** Copyright (C) 2001-2021 Zabbix SIA
4 **
5 ** This program is free software; you can redistribute it and/or modify
6 ** it under the terms of the GNU General Public License as published by
7 ** the Free Software Foundation; either version 2 of the License, or
8 ** (at your option) any later version.
9 **
10 ** This program is distributed in the hope that it will be useful,
11 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
12 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 ** GNU General Public License for more details.
14 **
15 ** You should have received a copy of the GNU General Public License
16 ** along with this program; if not, write to the Free Software
17 ** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
18 **/
19 
20 #include "common.h"
21 #include "proxy.h"
22 #include "checks_internal.h"
23 
24 /******************************************************************************
25  *                                                                            *
26  * Function: zbx_get_value_internal_ext                                       *
27  *                                                                            *
28  * Purpose: processes program type (proxy) specific internal checks           *
29  *                                                                            *
30  * Parameters: param1  - [IN] the first parameter                             *
31  *             request - [IN] the request                                     *
32  *             result  - [OUT] the result                                     *
33  *                                                                            *
34  * Return value: SUCCEED - data successfully retrieved and stored in result   *
35  *               NOTSUPPORTED - requested item is not supported               *
36  *               FAIL - not a proxy specific internal check                   *
37  *                                                                            *
38  * Comments: This function is used to process proxy specific internal checks  *
39  *           before generic internal checks are processed.                    *
40  *                                                                            *
41  ******************************************************************************/
zbx_get_value_internal_ext(const char * param1,const AGENT_REQUEST * request,AGENT_RESULT * result)42 int	zbx_get_value_internal_ext(const char *param1, const AGENT_REQUEST *request, AGENT_RESULT *result)
43 {
44 	if (0 == strcmp(param1, "proxy_history"))
45 	{
46 		if (1 != get_rparams_num(request))
47 		{
48 			SET_MSG_RESULT(result, zbx_strdup(NULL, "Invalid number of parameters."));
49 			return NOTSUPPORTED;
50 		}
51 
52 		SET_UI64_RESULT(result, proxy_get_history_count());
53 	}
54 	else
55 		return FAIL;
56 
57 	return SUCCEED;
58 }
59