Source
static int service_update_match_action(const zbx_service_update_t *update, const zbx_service_action_t *action)
/*
** Copyright (C) 2001-2025 Zabbix SIA
**
** This program is free software: you can redistribute it and/or modify it under the terms of
** the GNU Affero General Public License as published by the Free Software Foundation, version 3.
**
** 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 Affero General Public License for more details.
**
** You should have received a copy of the GNU Affero General Public License along with this program.
** If not, see <https://www.gnu.org/licenses/>.
**/
/******************************************************************************
* *
* Purpose: matches service update by service id *
* *
******************************************************************************/
static int condition_match_service(const zbx_service_action_condition_t *condition,
const zbx_service_update_t *update)
{
zbx_uint64_t serviceid;
if (SUCCEED != zbx_is_uint64(condition->value, &serviceid))
return FAIL;
return zbx_uint64match_condition(serviceid, update->service->serviceid, condition->op);
}
/******************************************************************************
* *
* Purpose: matches service update by service name *
* *
******************************************************************************/
static int condition_match_service_name(const zbx_service_action_condition_t *condition,
const zbx_service_update_t *update)
{
return zbx_strmatch_condition(update->service->name, condition->value, condition->op);
}
/******************************************************************************
* *
* Purpose: matches tag/tag+value using specified operator *
* *
* Parameters: tags - [IN] tags to match *
* name - [IN] target tag name *
* value - [IN] target tag value (NULL if only tag name is being *
* matched *
* op - [IN] matching operator (ZBX_CONDITION_OPERATOR_*) *
* *
* Return value: SUCCEED - tags match *
* FAIL - otherwise *
* *
* Comments: When matching tag+value the operator is using only to match *
* value - the tag name will be always matched as 'equal'. *
* *
******************************************************************************/