Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/zabbix/zabbix.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJanis Freibergs <janis.freibergs@zabbix.com>2021-11-25 15:33:30 +0300
committerJanis Freibergs <janis.freibergs@zabbix.com>2021-11-25 15:35:23 +0300
commit8f8f663f43104a48edd4959c069885f05e0807ca (patch)
treea325a5371ea573c0fd2f7f2ab8ebbb6f504e34e5
parent86dd93671922df992b9745aa9eeb45ecb2dffc1b (diff)
parent0e264bc700cbead2de96ea21713f74480099f345 (diff)
.......... [ZBXNEXT-6999] updated to latest from origin; resolved conflicts
- create/src/schema.tmpl - src/libs/zbxdbupgrade/dbupgrade_5050.c - ui/include/defines.inc.php
-rw-r--r--create/src/schema.tmpl22
-rw-r--r--include/db.h1
-rw-r--r--src/libs/zbxdbupgrade/dbupgrade_5050.c384
-rw-r--r--src/libs/zbxserver/expression.c5
-rw-r--r--src/zabbix_server/escalator/escalator.c14
-rw-r--r--ui/app/partials/services.sla.list.php6
-rw-r--r--ui/include/classes/helpers/CSlaHelper.php2
-rw-r--r--ui/include/defines.inc.php2
8 files changed, 396 insertions, 40 deletions
diff --git a/create/src/schema.tmpl b/create/src/schema.tmpl
index afb4688a90c..782f37e9fe2 100644
--- a/create/src/schema.tmpl
+++ b/create/src/schema.tmpl
@@ -1905,17 +1905,17 @@ UNIQUE |1 |name
TABLE|sla_schedule|sla_scheduleid|ZBX_DATA
FIELD |sla_scheduleid |t_id | |NOT NULL |0
FIELD |slaid |t_id | |NOT NULL |0 |1|sla|slaid
-FIELD |from |t_integer |'0' |NOT NULL |0
-FIELD |to |t_integer |'0' |NOT NULL |0
+FIELD |period_from |t_integer |'0' |NOT NULL |0
+FIELD |period_to |t_integer |'0' |NOT NULL |0
INDEX |1 |slaid
-TABLE|sla_downtime|sla_downtimeid|ZBX_DATA
-FIELD |sla_downtimeid |t_id | |NOT NULL |0
-FIELD |slaid |t_id | |NOT NULL |0 |1|sla|slaid
-FIELD |from |t_integer |'0' |NOT NULL |0
-FIELD |to |t_integer |'0' |NOT NULL |0
-FIELD |name |t_varchar(255) |'' |NOT NULL |0
-INDEX |1 |slaid
+TABLE|sla_excluded_downtime|sla_excluded_downtimeid|ZBX_DATA
+FIELD |sla_excluded_downtimeid|t_id | |NOT NULL |0
+FIELD |slaid |t_id | |NOT NULL |0 |1|sla|slaid
+FIELD |name |t_varchar(255) |'' |NOT NULL |0
+FIELD |period_from |t_integer |'0' |NOT NULL |0
+FIELD |period_to |t_integer |'0' |NOT NULL |0
+INDEX |1 |slaid
TABLE|sla_service_tag|sla_service_tagid|0
FIELD |sla_service_tagid |t_id | |NOT NULL |0
@@ -1929,6 +1929,4 @@ TABLE|dbversion|dbversionid|
FIELD |dbversionid |t_id | |NOT NULL |0
FIELD |mandatory |t_integer |'0' |NOT NULL |
FIELD |optional |t_integer |'0' |NOT NULL |
-ROW |1 |5050128 |5050128
-
-
+ROW |1 |5050130 |5050130
diff --git a/include/db.h b/include/db.h
index 4d88eabebdd..3cc94ac50a1 100644
--- a/include/db.h
+++ b/include/db.h
@@ -342,6 +342,7 @@ typedef struct
{
zbx_uint64_t serviceid;
char *name;
+ char *description;
zbx_vector_uint64_t eventids;
zbx_vector_ptr_t events;
zbx_vector_tags_t service_tags;
diff --git a/src/libs/zbxdbupgrade/dbupgrade_5050.c b/src/libs/zbxdbupgrade/dbupgrade_5050.c
index f2eea80a5cc..6e7d2e83011 100644
--- a/src/libs/zbxdbupgrade/dbupgrade_5050.c
+++ b/src/libs/zbxdbupgrade/dbupgrade_5050.c
@@ -22,6 +22,7 @@
#include "dbupgrade.h"
#include "dbupgrade_macros.h"
#include "log.h"
+#include "../zbxalgo/vectorimpl.h"
extern unsigned char program_type;
@@ -1248,8 +1249,8 @@ static int DBpatch_5050117(void)
{
{"sla_scheduleid", NULL, NULL, NULL, 0, ZBX_TYPE_ID, ZBX_NOTNULL, 0},
{"slaid", NULL, NULL, NULL, 0, ZBX_TYPE_ID, ZBX_NOTNULL, 0},
- {"from", "0", NULL, NULL, 0, ZBX_TYPE_INT, ZBX_NOTNULL, 0},
- {"to", "0", NULL, NULL, 0, ZBX_TYPE_INT, ZBX_NOTNULL, 0},
+ {"period_from", "0", NULL, NULL, 0, ZBX_TYPE_INT, ZBX_NOTNULL, 0},
+ {"period_to", "0", NULL, NULL, 0, ZBX_TYPE_INT, ZBX_NOTNULL, 0},
{0}
},
NULL
@@ -1273,13 +1274,13 @@ static int DBpatch_5050119(void)
static int DBpatch_5050120(void)
{
const ZBX_TABLE table =
- {"sla_downtime", "sla_downtimeid", 0,
+ {"sla_excluded_downtime", "sla_excluded_downtimeid", 0,
{
- {"sla_downtimeid", NULL, NULL, NULL, 0, ZBX_TYPE_ID, ZBX_NOTNULL, 0},
+ {"sla_excluded_downtimeid", NULL, NULL, NULL, 0, ZBX_TYPE_ID, ZBX_NOTNULL, 0},
{"slaid", NULL, NULL, NULL, 0, ZBX_TYPE_ID, ZBX_NOTNULL, 0},
- {"from", "0", NULL, NULL, 0, ZBX_TYPE_INT, ZBX_NOTNULL, 0},
- {"to", "0", NULL, NULL, 0, ZBX_TYPE_INT, ZBX_NOTNULL, 0},
{"name", "", NULL, NULL, 255, ZBX_TYPE_CHAR, ZBX_NOTNULL, 0},
+ {"period_from", "0", NULL, NULL, 0, ZBX_TYPE_INT, ZBX_NOTNULL, 0},
+ {"period_to", "0", NULL, NULL, 0, ZBX_TYPE_INT, ZBX_NOTNULL, 0},
{0}
},
NULL
@@ -1290,47 +1291,394 @@ static int DBpatch_5050120(void)
static int DBpatch_5050121(void)
{
- return DBcreate_index("sla_downtime", "sla_downtime_1", "slaid", 0);
+ return DBcreate_index("sla_excluded_downtime", "sla_excluded_downtime_1", "slaid", 0);
}
static int DBpatch_5050122(void)
{
const ZBX_FIELD field = {"slaid", NULL, "sla", "slaid", 0, ZBX_TYPE_ID, ZBX_NOTNULL, ZBX_FK_CASCADE_DELETE};
- return DBadd_foreign_key("sla_downtime", 1, &field);
+ return DBadd_foreign_key("sla_excluded_downtime", 1, &field);
}
static int DBpatch_5050123(void)
{
- return DBdrop_table("services_times");
+ const ZBX_FIELD field = {"description", "", NULL, NULL, 0, ZBX_TYPE_SHORTTEXT, ZBX_NOTNULL, 0};
+
+ return DBadd_field("services", &field);
}
static int DBpatch_5050124(void)
{
- return DBdrop_field("services", "showsla");
+ const ZBX_FIELD field = {"uuid", "", NULL, NULL, 32, ZBX_TYPE_CHAR, ZBX_NOTNULL, 0};
+
+ return DBadd_field("services", &field);
+}
+
+typedef struct
+{
+ int type;
+ int from;
+ int to;
+ char *note;
+}
+services_times_t;
+
+ZBX_PTR_VECTOR_DECL(services_times, services_times_t)
+ZBX_PTR_VECTOR_IMPL(services_times, services_times_t)
+
+typedef struct
+{
+ int showsla;
+ double goodsla;
+ zbx_vector_services_times_t services_times;
+ zbx_vector_uint64_t serviceids;
+}
+sla_t;
+
+ZBX_PTR_VECTOR_DECL(sla, sla_t *)
+ZBX_PTR_VECTOR_IMPL(sla, sla_t *)
+
+static int compare_services_time(const void *d1, const void *d2)
+{
+ const services_times_t *a, *b;
+ int ret;
+
+ a = (services_times_t *)d1;
+ b = (services_times_t *)d2;
+
+ ZBX_RETURN_IF_NOT_EQUAL(a->type, b->type);
+ ZBX_RETURN_IF_NOT_EQUAL(a->from, b->from);
+ ZBX_RETURN_IF_NOT_EQUAL(a->to, b->to);
+
+ if (0 != (ret = strcmp(a->note, b->note)))
+ return ret;
+
+ return 0;
+}
+
+static int compare_sla(const void *d1, const void *d2)
+{
+ const sla_t *a, *b;
+ int i, ret;
+
+ a = *(sla_t **)d1;
+ b = *(sla_t **)d2;
+
+ ZBX_RETURN_IF_NOT_EQUAL(a->showsla, b->showsla);
+ ZBX_RETURN_IF_NOT_EQUAL(a->goodsla, b->goodsla);
+ ZBX_RETURN_IF_NOT_EQUAL(a->services_times.values_num, b->services_times.values_num);
+
+ for (i = 0; i < a->services_times.values_num; i++)
+ {
+ if (0 != (ret = compare_services_time(&a->services_times.values[i], &b->services_times.values[i])))
+ return ret;
+ }
+
+ return 0;
+}
+
+static void services_time_clean(services_times_t services_time)
+{
+ zbx_free(services_time.note);
+}
+
+static void sla_clean(sla_t *sla)
+{
+ zbx_vector_services_times_clear_ext(&sla->services_times, services_time_clean);
+ zbx_vector_services_times_destroy(&sla->services_times);
+ zbx_vector_uint64_destroy(&sla->serviceids);
+ zbx_free(sla);
+}
+
+#define ZBX_SLA_PERIOD_WEEKLY 1
+
+#define SERVICE_TIME_TYPE_UPTIME 0
+#define SERVICE_TIME_TYPE_DOWNTIME 1
+
+#define SLA_TAG_NAME "SLA"
+
+static void db_insert_sla(const zbx_vector_sla_t *uniq_slas, const char *default_timezone)
+{
+ zbx_db_insert_t db_insert_sla, db_insert_sla_schedule, db_insert_sla_excluded_downtime,
+ db_insert_sla_service_tag, db_insert_service_tag;
+ int i, j;
+ zbx_uint64_t slaid;
+
+ zbx_db_insert_prepare(&db_insert_sla, "sla", "slaid", "name", "status", "slo", "period", "timezone", NULL);
+
+ zbx_db_insert_prepare(&db_insert_sla_service_tag, "sla_service_tag", "sla_service_tagid", "slaid", "tag",
+ "value", NULL);
+
+ zbx_db_insert_prepare(&db_insert_service_tag, "service_tag", "servicetagid", "serviceid", "tag", "value",
+ NULL);
+
+ zbx_db_insert_prepare(&db_insert_sla_schedule, "sla_schedule", "sla_scheduleid", "slaid", "period_from",
+ "period_to", NULL);
+ zbx_db_insert_prepare(&db_insert_sla_excluded_downtime, "sla_excluded_downtime", "sla_excluded_downtimeid",
+ "slaid", "period_from", "period_to", "name", NULL);
+
+ for (i = 0, slaid = 0; i < uniq_slas->values_num; i++)
+ {
+ char buffer[MAX_STRING_LEN];
+ const sla_t *sla = uniq_slas->values[i];
+
+ zbx_snprintf(buffer, sizeof(buffer), "%s:" ZBX_FS_UI64, SLA_TAG_NAME, ++slaid);
+
+ zbx_db_insert_add_values(&db_insert_sla, slaid, buffer, sla->showsla, sla->goodsla,
+ ZBX_SLA_PERIOD_WEEKLY, default_timezone);
+
+ zbx_snprintf(buffer, sizeof(buffer), ZBX_FS_UI64, slaid);
+ zbx_db_insert_add_values(&db_insert_sla_service_tag, slaid, slaid, SLA_TAG_NAME, buffer);
+
+ for (j = 0; j < sla->serviceids.values_num; j++)
+ {
+ zbx_db_insert_add_values(&db_insert_service_tag, __UINT64_C(0), sla->serviceids.values[j],
+ SLA_TAG_NAME, buffer);
+ }
+
+ for (j = 0; j < sla->services_times.values_num; j++)
+ {
+ services_times_t *services_time = &sla->services_times.values[j];
+
+ if (SERVICE_TIME_TYPE_UPTIME == services_time->type)
+ {
+ zbx_db_insert_add_values(&db_insert_sla_schedule, __UINT64_C(0), slaid,
+ services_time->from, services_time->to);
+ continue;
+ }
+
+ zbx_db_insert_add_values(&db_insert_sla_excluded_downtime, __UINT64_C(0), slaid,
+ services_time->from, services_time->to, services_time->note);
+ }
+ }
+
+ zbx_db_insert_execute(&db_insert_sla);
+ zbx_db_insert_clean(&db_insert_sla);
+
+ zbx_db_insert_execute(&db_insert_sla_service_tag);
+ zbx_db_insert_clean(&db_insert_sla_service_tag);
+
+ zbx_db_insert_autoincrement(&db_insert_service_tag, "servicetagid");
+ zbx_db_insert_execute(&db_insert_service_tag);
+ zbx_db_insert_clean(&db_insert_service_tag);
+
+ zbx_db_insert_autoincrement(&db_insert_sla_schedule, "sla_scheduleid");
+ zbx_db_insert_execute(&db_insert_sla_schedule);
+ zbx_db_insert_clean(&db_insert_sla_schedule);
+
+ zbx_db_insert_autoincrement(&db_insert_sla_excluded_downtime, "sla_excluded_downtimeid");
+ zbx_db_insert_execute(&db_insert_sla_excluded_downtime);
+ zbx_db_insert_clean(&db_insert_sla_excluded_downtime);
+}
+
+static void services_times_convert_downtime(zbx_vector_services_times_t *services_times)
+{
+ int i;
+ zbx_vector_services_times_t services_times_converted;
+
+ zbx_vector_services_times_create(&services_times_converted);
+
+ for (i = 0; i < services_times->values_num; i++)
+ {
+ services_times_t *service_time = &services_times->values[i];
+
+ if (SERVICE_TIME_TYPE_DOWNTIME != service_time->type)
+ continue;
+
+ if (0 != service_time->from)
+ {
+ services_times_t service_time_new;
+
+ service_time_new.type = SERVICE_TIME_TYPE_UPTIME;
+ service_time_new.from = 0;
+ service_time_new.to = service_time->from;
+ service_time_new.note = zbx_strdup(NULL, "");
+
+ zbx_vector_services_times_append(&services_times_converted, service_time_new);
+ }
+
+ if (SEC_PER_WEEK != service_time->to)
+ {
+ services_times_t service_time_new;
+
+ service_time_new.type = SERVICE_TIME_TYPE_UPTIME;
+ service_time_new.from = service_time->to;
+ service_time_new.to = SEC_PER_WEEK;
+ service_time_new.note = zbx_strdup(NULL, "");
+
+ zbx_vector_services_times_append(&services_times_converted, service_time_new);
+ }
+
+ services_time_clean(*service_time);
+ zbx_vector_services_times_remove(services_times, i);
+ i--;
+ }
+
+ if (0 != services_times_converted.values_num)
+ {
+ zbx_vector_services_times_append_array(services_times, services_times_converted.values,
+ services_times_converted.values_num);
+ }
+
+ zbx_vector_services_times_destroy(&services_times_converted);
}
static int DBpatch_5050125(void)
{
- return DBdrop_field("services", "goodsla");
+ DB_RESULT result;
+ DB_ROW row;
+ zbx_uint64_t last_serviceid = 0;
+ zbx_vector_sla_t slas, uniq_slas;
+ int i, j;
+ char *default_timezone;
+
+ zbx_vector_sla_create(&slas);
+ zbx_vector_sla_create(&uniq_slas);
+
+ result = DBselect(
+ "select s.serviceid,s.showsla,s.goodsla,t.type,t.ts_from,t.ts_to,t.note"
+ " from services s"
+ " left join services_times t on s.serviceid=t.serviceid"
+ " order by s.serviceid");
+
+ while (NULL != (row = DBfetch(result)))
+ {
+ zbx_uint64_t serviceid;
+ sla_t *sla;
+
+ ZBX_STR2UINT64(serviceid, row[0]);
+
+ if (last_serviceid != serviceid)
+ {
+ sla = zbx_malloc(NULL, sizeof(sla_t));
+
+ zbx_vector_services_times_create(&sla->services_times);
+ zbx_vector_uint64_create(&sla->serviceids);
+
+ sla->showsla = atoi(row[1]);
+ sla->goodsla = atof(row[2]);
+
+ zbx_vector_uint64_append(&sla->serviceids, serviceid);
+
+ zbx_vector_sla_append(&slas, sla);
+ last_serviceid = serviceid;
+ }
+
+ if (NULL != row[3])
+ {
+ services_times_t service_time;
+
+ service_time.type = atoi(row[3]);
+ service_time.from = atoi(row[4]);
+ service_time.to = atoi(row[5]);
+ service_time.note = zbx_strdup(NULL, row[6]);
+
+ zbx_vector_services_times_append(&sla->services_times, service_time);
+ }
+ }
+ DBfree_result(result);
+
+ for (i = 0; i < slas.values_num; i++)
+ {
+ services_times_convert_downtime(&slas.values[i]->services_times);
+ zbx_vector_services_times_sort(&slas.values[i]->services_times, compare_services_time);
+ }
+
+ for (i = 0; i < slas.values_num; i++)
+ {
+ if (FAIL == (j = zbx_vector_sla_search(&uniq_slas, slas.values[i], compare_sla)))
+ {
+ zbx_vector_sla_append(&uniq_slas, slas.values[i]);
+ zbx_vector_sla_remove_noorder(&slas, i);
+ i--;
+ continue;
+ }
+
+ zbx_vector_uint64_append(&uniq_slas.values[j]->serviceids, slas.values[i]->serviceids.values[0]);
+ }
+
+ for (i = 0; i < slas.values_num; i++)
+ zbx_vector_uint64_sort(&uniq_slas.values[i]->serviceids, ZBX_DEFAULT_UINT64_COMPARE_FUNC);
+
+ result = DBselect("select default_timezone from config");
+ if (NULL != (row = DBfetch(result)))
+ {
+ if (0 == strcmp(row[0], "system"))
+ default_timezone = zbx_strdup(NULL, "UTC");
+ else
+ default_timezone = zbx_strdup(NULL, row[0]);
+ }
+ else
+ {
+ THIS_SHOULD_NEVER_HAPPEN;
+ default_timezone = zbx_strdup(NULL, "UTC");
+ }
+ DBfree_result(result);
+
+ db_insert_sla(&uniq_slas, default_timezone);
+
+ zbx_vector_sla_clear_ext(&slas, sla_clean);
+ zbx_vector_sla_clear_ext(&uniq_slas, sla_clean);
+ zbx_vector_sla_destroy(&slas);
+ zbx_vector_sla_destroy(&uniq_slas);
+
+ zbx_free(default_timezone);
+
+ return SUCCEED;
}
static int DBpatch_5050126(void)
{
- const ZBX_FIELD field = {"description", "", NULL, NULL, 0, ZBX_TYPE_SHORTTEXT, ZBX_NOTNULL, 0};
-
- return DBadd_field("services", &field);
+ return DBdrop_table("services_times");
}
static int DBpatch_5050127(void)
{
- const ZBX_FIELD field = {"uuid", "", NULL, NULL, 32, ZBX_TYPE_CHAR, ZBX_NOTNULL, 0};
-
- return DBadd_field("services", &field);
+ return DBdrop_field("services", "showsla");
}
static int DBpatch_5050128(void)
{
+ return DBdrop_field("services", "goodsla");
+}
+
+static int DBpatch_5050129(void)
+{
+ int ret = SUCCEED;
+ char *uuid, *sql = NULL;
+ size_t sql_alloc = 0, sql_offset = 0;
+ DB_ROW row;
+ DB_RESULT result;
+
+ DBbegin_multiple_update(&sql, &sql_alloc, &sql_offset);
+
+ result = DBselect("select serviceid,name from services");
+
+ while (NULL != (row = DBfetch(result)))
+ {
+ uuid = zbx_gen_uuid4(row[1]);
+ zbx_snprintf_alloc(&sql, &sql_alloc, &sql_offset, "update services set uuid='%s' where serviceid=%s;\n",
+ uuid, row[0]);
+ zbx_free(uuid);
+
+ if (SUCCEED != (ret = DBexecute_overflowed_sql(&sql, &sql_alloc, &sql_offset)))
+ goto out;
+ }
+
+ DBend_multiple_update(&sql, &sql_alloc, &sql_offset);
+
+ if (16 < sql_offset && ZBX_DB_OK > DBexecute("%s", sql))
+ ret = FAIL;
+out:
+ DBfree_result(result);
+ zbx_free(sql);
+
+ return ret;
+}
+
+static int DBpatch_5050130(void)
+{
if (ZBX_DB_OK > DBexecute("update role_rule set name='ui.services.services' where name='ui.monitoring.services'"))
return FAIL;
@@ -1460,5 +1808,7 @@ DBPATCH_ADD(5050125, 0, 1)
DBPATCH_ADD(5050126, 0, 1)
DBPATCH_ADD(5050127, 0, 1)
DBPATCH_ADD(5050128, 0, 1)
+DBPATCH_ADD(5050129, 0, 1)
+DBPATCH_ADD(5050130, 0, 1)
DBPATCH_END()
diff --git a/src/libs/zbxserver/expression.c b/src/libs/zbxserver/expression.c
index 915f8a1a553..fa21a65500d 100644
--- a/src/libs/zbxserver/expression.c
+++ b/src/libs/zbxserver/expression.c
@@ -1597,6 +1597,7 @@ static int get_autoreg_value_by_event(const DB_EVENT *event, char **replace_to,
#define MVAR_SERVICE "{SERVICE."
#define MVAR_SERVICE_NAME MVAR_SERVICE "NAME}"
+#define MVAR_SERVICE_DESCRIPTION MVAR_SERVICE "DESCRIPTION}"
#define MVAR_SERVICE_ROOTCAUSE MVAR_SERVICE "ROOTCAUSE}"
#define MVAR_SERVICE_TAGS MVAR_SERVICE "TAGS}"
#define MVAR_SERVICE_TAGSJSON MVAR_SERVICE "TAGSJSON}"
@@ -4181,6 +4182,10 @@ static int substitute_simple_macros_impl(const zbx_uint64_t *actionid, const DB_
{
replace_to = zbx_strdup(replace_to, service->name);
}
+ else if (0 == strcmp(m, MVAR_SERVICE_DESCRIPTION))
+ {
+ replace_to = zbx_strdup(replace_to, service->description);
+ }
else if (0 == strcmp(m, MVAR_SERVICE_ROOTCAUSE))
{
get_rootcause(service, &replace_to);
diff --git a/src/zabbix_server/escalator/escalator.c b/src/zabbix_server/escalator/escalator.c
index 4cbce93a06d..6cc06a72c87 100644
--- a/src/zabbix_server/escalator/escalator.c
+++ b/src/zabbix_server/escalator/escalator.c
@@ -2739,7 +2739,7 @@ static void db_get_services(const zbx_vector_ptr_t *escalations, zbx_vector_serv
serviceids.values_num);
result = DBselect(
- "select s.serviceid,s.name,st.tag,st.value"
+ "select s.serviceid,s.name,s.description,st.tag,st.value"
" from services s left join service_tag st on s.serviceid=st.serviceid"
" where%s order by s.serviceid",
sql);
@@ -2758,8 +2758,8 @@ static void db_get_services(const zbx_vector_ptr_t *escalations, zbx_vector_serv
last_service = services->values[services->values_num - 1];
- tag->tag = zbx_strdup(NULL, row[2]);
- tag->value = zbx_strdup(NULL, row[3]);
+ tag->tag = zbx_strdup(NULL, row[3]);
+ tag->value = zbx_strdup(NULL, row[4]);
zbx_vector_tags_append(&last_service->service_tags, tag);
continue;
@@ -2768,16 +2768,17 @@ static void db_get_services(const zbx_vector_ptr_t *escalations, zbx_vector_serv
service = (DB_SERVICE*)zbx_malloc(NULL, sizeof(DB_SERVICE));
service->serviceid = serviceid;
service->name = zbx_strdup(NULL, row[1]);
+ service->description = zbx_strdup(NULL, row[2]);
zbx_vector_uint64_create(&service->eventids);
zbx_vector_ptr_create(&service->events);
zbx_vector_tags_create(&service->service_tags);
- if (FAIL == DBis_null(row[2]))
+ if (FAIL == DBis_null(row[3]))
{
zbx_tag_t *tag = zbx_malloc(NULL, sizeof(zbx_tag_t));
- tag->tag = zbx_strdup(NULL, row[2]);
- tag->value = zbx_strdup(NULL, row[3]);
+ tag->tag = zbx_strdup(NULL, row[3]);
+ tag->value = zbx_strdup(NULL, row[4]);
zbx_vector_tags_append(&service->service_tags, tag);
}
@@ -2889,6 +2890,7 @@ static void get_db_service_alarms(zbx_vector_ptr_t *escalations, zbx_vector_serv
static void service_clean(DB_SERVICE *service)
{
zbx_free(service->name);
+ zbx_free(service->description);
zbx_vector_ptr_destroy(&service->events);
zbx_vector_uint64_destroy(&service->eventids);
zbx_vector_tags_clear_ext(&service->service_tags, zbx_free_tag);
diff --git a/ui/app/partials/services.sla.list.php b/ui/app/partials/services.sla.list.php
index 1ebf07ef0dc..da12bae1a32 100644
--- a/ui/app/partials/services.sla.list.php
+++ b/ui/app/partials/services.sla.list.php
@@ -40,7 +40,7 @@ $header = [
];
if ($data['can_edit']) {
- array_unshift($header,
+ array_unshift($header,
(new CCheckBox('all_ids'))->onClick("checkAll('sla-list', 'all_ids', 'ids');")
);
}
@@ -56,7 +56,7 @@ foreach ($data['records'] as $recordid => $record) {
];
if ($data['can_edit']) {
- array_unshift($row,
+ array_unshift($row,
new CCheckBox('ids['.$recordid.']', $recordid),
);
}
@@ -94,4 +94,4 @@ $form->addItem([
->removeAttribute('id')
]
], 'slas')
-])->show(); \ No newline at end of file
+])->show();
diff --git a/ui/include/classes/helpers/CSlaHelper.php b/ui/include/classes/helpers/CSlaHelper.php
index 9dddf48b525..51fe620c78f 100644
--- a/ui/include/classes/helpers/CSlaHelper.php
+++ b/ui/include/classes/helpers/CSlaHelper.php
@@ -39,7 +39,7 @@ class CSlaHelper {
public static function periodToStr(int $period): ?string {
static $period_strings;
-
+
if ($period_strings === null) {
$period_strings = [
self::PERIOD_DAILY => _('Daily'),
diff --git a/ui/include/defines.inc.php b/ui/include/defines.inc.php
index 0058a028869..d85d92e82fa 100644
--- a/ui/include/defines.inc.php
+++ b/ui/include/defines.inc.php
@@ -22,7 +22,7 @@ define('ZABBIX_VERSION', '6.0.0alpha7');
define('ZABBIX_API_VERSION', '6.0.0');
define('ZABBIX_EXPORT_VERSION', '6.0');
-define('ZABBIX_DB_VERSION', 5050128);
+define('ZABBIX_DB_VERSION', 5050130);
define('DB_VERSION_SUPPORTED', 0);
define('DB_VERSION_LOWER_THAN_MINIMUM', 1);