/*
** Zabbix
** Copyright (C) 2001-2017 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 "strpool.h"
#include "zbxserver.h"
#include "zbxalgo.h"
#include "dbcache.h"
#include "zbxregexp.h"
#include "cfg.h"
#include "zbxtasks.h"
#include "../zbxcrypto/tls_tcp_active.h"
#include "dbcache.h"
#define ZBX_DBCONFIG_IMPL
#include "dbconfig.h"
#include "dbsync.h"
static int sync_in_progress = 0;
#define LOCK_CACHE if (0 == sync_in_progress) zbx_mutex_lock(&config_lock)
#define UNLOCK_CACHE if (0 == sync_in_progress) zbx_mutex_unlock(&config_lock)
#define START_SYNC LOCK_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
/* 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);
static ZBX_DC_CONFIG *config = NULL;
static ZBX_MUTEX config_lock = ZBX_MUTEX_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)
/******************************************************************************
* *
* 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;
goto clean;
}
}
else if (0 == strcmp(arg2, "discovery") && 0 == strcmp(arg3, "interfaces"))
{
ret = SUCCEED;
goto clean;
}
}
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:
case ITEM_TYPE_EXTERNAL:
case ITEM_TYPE_DB_MONITOR:
case ITEM_TYPE_SSH:
case ITEM_TYPE_TELNET:
case ITEM_TYPE_CALCULATED:
if (0 == CONFIG_POLLER_FORKS)
break;
return ZBX_POLLER_TYPE_NORMAL;
case ITEM_TYPE_IPMI:
if (0 == CONFIG_IPMIPOLLER_FORKS)
break;
return ZBX_POLLER_TYPE_IPMI;
case ITEM_TYPE_JMX:
if (0 == CONFIG_JAVAPOLLER_FORKS)
break;
return ZBX_POLLER_TYPE_JAVA;
}
return ZBX_NO_POLLER;
}
/******************************************************************************
* *
* Function: is_counted_in_item_queue *
* *
* Purpose: determine whether the given item typ
没有合适的资源?快使用搜索试试~ 我知道了~
zabbix安装包- zabbix-3.4.2.tar.gz
5星 · 超过95%的资源 需积分: 29 165 下载量 166 浏览量
2017-11-08
10:36:50
上传
评论 4
收藏 16.32MB GZ 举报
温馨提示
共1883个文件
php:721个
c:332个
png:224个
zabbix安装包- zabbix-3.4.2.tar.gz zabbix安装包- zabbix-3.4.2.tar.gz
资源推荐
资源详情
资源评论
收起资源包目录
zabbix安装包- zabbix-3.4.2.tar.gz (1883个子文件)
configure.ac 47KB
Makefile.am 3KB
Makefile.am 3KB
Makefile.am 3KB
Makefile.am 2KB
Makefile.am 2KB
Makefile.am 2KB
Makefile.am 1KB
Makefile.am 1KB
Makefile.am 1KB
Makefile.am 738B
Makefile.am 632B
Makefile.am 547B
Makefile.am 478B
Makefile.am 445B
Makefile.am 437B
Makefile.am 424B
Makefile.am 424B
Makefile.am 417B
Makefile.am 413B
Makefile.am 407B
Makefile.am 400B
Makefile.am 397B
Makefile.am 392B
Makefile.am 373B
Makefile.am 353B
Makefile.am 352B
Makefile.am 352B
Makefile.am 340B
Makefile.am 335B
Makefile.am 310B
Makefile.am 283B
Makefile.am 278B
Makefile.am 260B
Makefile.am 247B
Makefile.am 240B
Makefile.am 229B
Makefile.am 224B
Makefile.am 214B
Makefile.am 208B
Makefile.am 208B
Makefile.am 190B
Makefile.am 179B
Makefile.am 178B
Makefile.am 178B
Makefile.am 177B
Makefile.am 161B
Makefile.am 160B
Makefile.am 160B
Makefile.am 159B
Makefile.am 158B
Makefile.am 157B
Makefile.am 157B
Makefile.am 156B
Makefile.am 156B
Makefile.am 153B
Makefile.am 152B
Makefile.am 149B
Makefile.am 145B
Makefile.am 145B
Makefile.am 143B
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 127B
Makefile.am 125B
Makefile.am 125B
Makefile.am 121B
Makefile.am 119B
AUTHORS 98B
dbconfig.c 400KB
tls.c 199KB
expression.c 196KB
host.c 191KB
vmware.c 181KB
str.c 167KB
dbschema.c 163KB
lld_item.c 139KB
proxy.c 135KB
valuecache.c 135KB
misc.c 132KB
dbcache.c 125KB
lld_trigger.c 117KB
dbsync.c 114KB
lld_host.c 104KB
logfiles.c 103KB
evalfunc.c 98KB
db.c 93KB
escalator.c 89KB
events.c 84KB
checks_simple_vmware.c 81KB
alert_manager.c 75KB
共 1883 条
- 1
- 2
- 3
- 4
- 5
- 6
- 19
资源评论
- zhongJeff2018-07-04thanks for sharing
- Her邓松彪2018-09-24亲测!有效!
- qq_432732772020-05-25不知道怎么用
- upc执着2017-11-24很不错,很有帮助
- freedomyang2018-10-08多谢 找了半天,就这里有
粟懿
- 粉丝: 3
- 资源: 22
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功