From 4a447d9b85c1584fa7d00f188b6e0946f5bb3ed8 Mon Sep 17 00:00:00 2001 From: d-linko Date: Mon, 19 Feb 2024 16:59:24 -0500 Subject: [PATCH 1/5] updated rpt handling to avoid max vect in ion --- amp-sql/postgres/Database_Scripts/Views/rpt_view.sql | 4 ++-- anms-core/anms/routes/ARIs/reports.py | 4 +++- ion/ion-4.1.1-anms-db.patch | 4 ++-- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/amp-sql/postgres/Database_Scripts/Views/rpt_view.sql b/amp-sql/postgres/Database_Scripts/Views/rpt_view.sql index 7cc7767..fcc5e6a 100644 --- a/amp-sql/postgres/Database_Scripts/Views/rpt_view.sql +++ b/amp-sql/postgres/Database_Scripts/Views/rpt_view.sql @@ -141,7 +141,7 @@ FROM (((SELECT ts, report_id, - str_value, + COALESCE('''' || str_value ||'''', NULL) as str_value, uint_value, int_value, obj_value, @@ -155,7 +155,7 @@ FROM ari_id FROM report_definition - INNER JOIN vw_tnvc_entries ON report_definition.tnvc_id = vw_tnvc_entries.tnvc_id order by report_id , order_num) AS sel1 + LEFT JOIN vw_tnvc_entries ON report_definition.tnvc_id = vw_tnvc_entries.tnvc_id order by report_id , order_num) AS sel1 INNER JOIN obj_actual_definition ON sel1.ari_id = obj_actual_definition.obj_actual_definition_id) INNER JOIN vw_obj_metadata ON vw_obj_metadata.obj_metadata_id = obj_actual_definition.obj_metadata_id) GROUP BY report_id,ts, diff --git a/anms-core/anms/routes/ARIs/reports.py b/anms-core/anms/routes/ARIs/reports.py index 7382432..1845782 100644 --- a/anms-core/anms/routes/ARIs/reports.py +++ b/anms-core/anms/routes/ARIs/reports.py @@ -29,6 +29,7 @@ from fastapi_pagination.ext.async_sqlalchemy import paginate from sqlalchemy import select, and_ from sqlalchemy.engine import Result +import re from anms.components.schemas import ARIs from anms.models.relational import get_async_session, get_session @@ -159,7 +160,8 @@ async def report_ac(agent_id: str, adm: str, report_name: str): for entry in entries: curr_values = [] - string_values = entry.string_values.split(',') if entry.string_values else [] + string_values = list(filter(None, re.split(r",|'(.*?)'", entry.string_values))) if entry.string_values else [] + # string_values = entry.string_values.split('\',\'') if entry.string_values else [] uint_values = entry.uint_values.split(',') if entry.uint_values else [] int_values = entry.int_values.split(',') if entry.int_values else [] real32_values = entry.real32_values.split(',') if entry.real32_values else [] diff --git a/ion/ion-4.1.1-anms-db.patch b/ion/ion-4.1.1-anms-db.patch index b707326..ac6efd3 100644 --- a/ion/ion-4.1.1-anms-db.patch +++ b/ion/ion-4.1.1-anms-db.patch @@ -281,12 +281,12 @@ diff -ur ion-open-source-4.1.1/nm/mgr/nm_mgr_rx.c ion-open-source-4.1.1_postgres @@ -348,7 +348,7 @@ { msg_rpt_t *rpt_msg = msg_rpt_deserialize(msg_data, &success); - rx_data_rpt(&meta, rpt_msg); -#ifdef HAVE_MYSQL +#if defined(HAVE_MYSQL) || defined(HAVE_POSTGRESQL) db_insert_msg_rpt_set(incoming_idx, rpt_msg, &db_status); #endif - msg_rpt_release(rpt_msg, 1); + rx_data_rpt(&meta, rpt_msg); + msg_rpt_release(rpt_msg, 1); @@ -358,7 +358,7 @@ { msg_tbl_t *tbl_msg = msg_tbl_deserialize(msg_data, &success); From 51c1c21ea975e18a4659e5f4d69e7042c38bb567 Mon Sep 17 00:00:00 2001 From: d-linko Date: Tue, 20 Feb 2024 10:28:33 -0500 Subject: [PATCH 2/5] fixed reloading reports table --- .../app/components/management/agents/reports.vue | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/anms-ui/public/app/components/management/agents/reports.vue b/anms-ui/public/app/components/management/agents/reports.vue index 0591738..21f2614 100644 --- a/anms-ui/public/app/components/management/agents/reports.vue +++ b/anms-ui/public/app/components/management/agents/reports.vue @@ -1,6 +1,7 @@