/*
** Zabbix
** Copyright (C) 2001-2019 Zabbix SIA
**
** This program is free software; you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation; either version 2 of the License, or
** (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program; if not, write to the Free Software
** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
**/
#include <stddef.h>
#include "common.h"
#include "log.h"
#include "threads.h"
#include "dbcache.h"
#include "ipc.h"
#include "mutexs.h"
#include "memalloc.h"
#include "zbxserver.h"
#include "zbxalgo.h"
#include "zbxregexp.h"
#include "cfg.h"
#include "zbxtasks.h"
#include "../zbxcrypto/tls_tcp_active.h"
#define ZBX_DBCONFIG_IMPL
#include "dbconfig.h"
#include "dbsync.h"
int sync_in_progress = 0;
#define START_SYNC WRLOCK_CACHE; sync_in_progress = 1
#define FINISH_SYNC sync_in_progress = 0; UNLOCK_CACHE
#define ZBX_LOC_NOWHERE 0
#define ZBX_LOC_QUEUE 1
#define ZBX_LOC_POLLER 2
#define ZBX_SNMP_OID_TYPE_NORMAL 0
#define ZBX_SNMP_OID_TYPE_DYNAMIC 1
#define ZBX_SNMP_OID_TYPE_MACRO 2
/* trigger is functional unless its expression contains disabled or not monitored items */
#define TRIGGER_FUNCTIONAL_TRUE 0
#define TRIGGER_FUNCTIONAL_FALSE 1
/* trigger contains time functions and is also scheduled by timer queue */
#define ZBX_TRIGGER_TIMER_UNKNOWN 0
#define ZBX_TRIGGER_TIMER_QUEUE 1
/* item priority in poller queue */
#define ZBX_QUEUE_PRIORITY_HIGH 0
#define ZBX_QUEUE_PRIORITY_NORMAL 1
#define ZBX_QUEUE_PRIORITY_LOW 2
/* shorthand macro for calling in_maintenance_without_data_collection() */
#define DCin_maintenance_without_data_collection(dc_host, dc_item) \
in_maintenance_without_data_collection(dc_host->maintenance_status, \
dc_host->maintenance_type, dc_item->type)
/******************************************************************************
* *
* Function: zbx_value_validator_func_t *
* *
* Purpose: validate macro value when expanding user macros *
* *
* Parameters: macro - [IN] the user macro *
* value - [IN] the macro value *
* error - [OUT] the error message *
* *
* Return value: SUCCEED - the value is valid *
* FAIL - otherwise *
* *
******************************************************************************/
typedef int (*zbx_value_validator_func_t)(const char *macro, const char *value, char **error);
ZBX_DC_CONFIG *config = NULL;
zbx_rwlock_t config_lock = ZBX_RWLOCK_NULL;
static zbx_mem_info_t *config_mem;
extern unsigned char program_type;
extern int CONFIG_TIMER_FORKS;
ZBX_MEM_FUNC_IMPL(__config, config_mem)
static void dc_maintenance_precache_nested_groups(void);
/******************************************************************************
* *
* Function: dc_strdup *
* *
* Purpose: copies string into configuration cache shared memory *
* *
******************************************************************************/
static char *dc_strdup(const char *source)
{
char *dst;
size_t len;
len = strlen(source) + 1;
dst = (char *)__config_mem_malloc_func(NULL, len);
memcpy(dst, source, len);
return dst;
}
/******************************************************************************
* *
* Function: is_item_processed_by_server *
* *
* Parameters: type - [IN] item type [ITEM_TYPE_* flag] *
* key - [IN] item key *
* *
* Return value: SUCCEED when an item should be processed by server *
* FAIL otherwise *
* *
* Comments: list of the items, always processed by server *
* ,------------------+--------------------------------------, *
* | type | key | *
* +------------------+--------------------------------------+ *
* | Zabbix internal | zabbix[host,,items] | *
* | Zabbix internal | zabbix[host,,items_unsupported] | *
* | Zabbix internal | zabbix[host,discovery,interfaces] | *
* | Zabbix internal | zabbix[host,,maintenance] | *
* | Zabbix internal | zabbix[proxy,<proxyname>,lastaccess] | *
* | Zabbix aggregate | * | *
* | Calculated | * | *
* '------------------+--------------------------------------' *
* *
******************************************************************************/
int is_item_processed_by_server(unsigned char type, const char *key)
{
int ret = FAIL;
switch (type)
{
case ITEM_TYPE_AGGREGATE:
case ITEM_TYPE_CALCULATED:
ret = SUCCEED;
break;
case ITEM_TYPE_INTERNAL:
if (0 == strncmp(key, "zabbix[", 7))
{
AGENT_REQUEST request;
char *arg1, *arg2, *arg3;
init_request(&request);
if (SUCCEED != parse_item_key(key, &request) || 3 != request.nparam)
goto clean;
arg1 = get_rparam(&request, 0);
arg2 = get_rparam(&request, 1);
arg3 = get_rparam(&request, 2);
if (0 == strcmp(arg1, "host"))
{
if ('\0' == *arg2)
{
if (0 == strcmp(arg3, "maintenance") || 0 == strcmp(arg3, "items") ||
0 == strcmp(arg3, "items_unsupported"))
{
ret = SUCCEED;
}
}
else if (0 == strcmp(arg2, "discovery") && 0 == strcmp(arg3, "interfaces"))
ret = SUCCEED;
}
else if (0 == strcmp(arg1, "proxy") && 0 == strcmp(arg3, "lastaccess"))
ret = SUCCEED;
clean:
free_request(&request);
}
break;
}
return ret;
}
static unsigned char poller_by_item(unsigned char type, const char *key)
{
switch (type)
{
case ITEM_TYPE_SIMPLE:
if (SUCCEED == cmp_key_id(key, SERVER_ICMPPING_KEY) ||
SUCCEED == cmp_key_id(key, SERVER_ICMPPINGSEC_KEY) ||
SUCCEED == cmp_key_id(key, SERVER_ICMPPINGLOSS_KEY))
{
if (0 == CONFIG_PINGER_FORKS)
break;
return ZBX_POLLER_TYPE_PINGER;
}
/* break; is not missing here */
case ITEM_TYPE_ZABBIX:
case ITEM_TYPE_SNMPv1:
case ITEM_TYPE_SNMPv2c:
case ITEM_TYPE_SNMPv3:
case ITEM_TYPE_INTERNAL:
case ITEM_TYPE_AGGREGATE
没有合适的资源?快使用搜索试试~ 我知道了~
zabbix-4.0.4.tar.gz
1星 需积分: 50 28 下载量 54 浏览量
2019-02-27
13:11:57
上传
评论
收藏 17.21MB GZ 举报
温馨提示
共1982个文件
php:791个
c:344个
png:224个
最新版本的zabbix-4.0.4.tar.gz---
资源推荐
资源详情
资源评论
收起资源包目录
zabbix-4.0.4.tar.gz (1982个子文件)
configure.ac 53KB
Makefile.am 4KB
Makefile.am 4KB
Makefile.am 4KB
Makefile.am 3KB
Makefile.am 2KB
Makefile.am 1KB
Makefile.am 1KB
Makefile.am 1KB
Makefile.am 733B
Makefile.am 688B
Makefile.am 602B
Makefile.am 552B
Makefile.am 478B
Makefile.am 445B
Makefile.am 437B
Makefile.am 424B
Makefile.am 424B
Makefile.am 413B
Makefile.am 407B
Makefile.am 400B
Makefile.am 397B
Makefile.am 397B
Makefile.am 394B
Makefile.am 394B
Makefile.am 393B
Makefile.am 392B
Makefile.am 392B
Makefile.am 378B
Makefile.am 373B
Makefile.am 353B
Makefile.am 352B
Makefile.am 340B
Makefile.am 310B
Makefile.am 294B
Makefile.am 283B
Makefile.am 278B
Makefile.am 264B
Makefile.am 240B
Makefile.am 229B
Makefile.am 224B
Makefile.am 214B
Makefile.am 208B
Makefile.am 208B
Makefile.am 190B
Makefile.am 183B
Makefile.am 179B
Makefile.am 178B
Makefile.am 178B
Makefile.am 178B
Makefile.am 177B
Makefile.am 170B
Makefile.am 168B
Makefile.am 161B
Makefile.am 160B
Makefile.am 160B
Makefile.am 159B
Makefile.am 157B
Makefile.am 157B
Makefile.am 156B
Makefile.am 156B
Makefile.am 155B
Makefile.am 153B
Makefile.am 152B
Makefile.am 149B
Makefile.am 145B
Makefile.am 145B
Makefile.am 142B
Makefile.am 141B
Makefile.am 141B
Makefile.am 140B
Makefile.am 137B
Makefile.am 137B
Makefile.am 134B
Makefile.am 134B
Makefile.am 133B
Makefile.am 133B
Makefile.am 133B
Makefile.am 133B
Makefile.am 127B
Makefile.am 125B
Makefile.am 125B
Makefile.am 121B
Makefile.am 119B
AUTHORS 98B
dbconfig.c 447KB
expression.c 216KB
vmware.c 216KB
tls.c 202KB
host.c 194KB
lld_item.c 187KB
str.c 178KB
dbschema.c 170KB
dbcache.c 156KB
misc.c 148KB
proxy.c 141KB
dbsync.c 141KB
logfiles.c 129KB
lld_trigger.c 118KB
valuecache.c 115KB
共 1982 条
- 1
- 2
- 3
- 4
- 5
- 6
- 20
资源评论
- ~见贤思齐~2020-04-28分太高,不厚道!
Landseer_
- 粉丝: 2
- 资源: 2
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功