From 06b00b819226b339bc06c02208d5e578ad08ebdd Mon Sep 17 00:00:00 2001 From: Stefan Erl Date: Tue, 14 Aug 2018 14:41:21 +0200 Subject: [PATCH 1/2] enable time-based production rule messages --- agent/ingest.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/agent/ingest.c b/agent/ingest.c index c7ac15e..016afdf 100644 --- a/agent/ingest.c +++ b/agent/ingest.c @@ -283,6 +283,13 @@ void *rx_thread(int *running) { } break; + case MSG_TYPE_CTRL_PERIOD_PROD: + { + AMP_DEBUG_ALWAYS("NM Agent :","Received Periodic Production Ctrl Message.\n", NULL); + rx_handle_time_prod(&meta, cursor, size, &bytes); + } + break; + default: { AMP_DEBUG_WARN("rx_thread","Received unknown type: %d.\n", hdr->type); From d4012287647e2124166eab8fce0f176f47f093f2 Mon Sep 17 00:00:00 2001 From: Stefan Erl Date: Tue, 14 Aug 2018 14:42:48 +0200 Subject: [PATCH 2/2] build time-based production rules --- mgr/nm_mgr_netui.c | 33 ++++++++++++++++++++------------- mgr/nm_mgr_netui.h | 4 ++-- 2 files changed, 22 insertions(+), 15 deletions(-) diff --git a/mgr/nm_mgr_netui.c b/mgr/nm_mgr_netui.c index 77c20fe..d58a179 100644 --- a/mgr/nm_mgr_netui.c +++ b/mgr/nm_mgr_netui.c @@ -201,6 +201,7 @@ void netui_construct_ctrl_by_idx(agent_t* agent,cmdFormat* curCmd) void netui_construct_time_rule_by_idx(agent_t* agent,cmdFormat* curCmd) { + mid_t* id = NULL; time_t offset = 0; uint32_t period = 0; uint32_t evals = 0; @@ -224,20 +225,30 @@ void netui_construct_time_rule_by_idx(agent_t* agent,cmdFormat* curCmd) /* Step 1a: "tokenize" the string */ char** args=netui_parse_arguments(curCmd->arguments,&numArgs); - if(numArgs<4) + if(numArgs<5) { AMP_DEBUG_ERR("netui_construct_time_rule_by_idx","Not enough arguments %d",numArgs); return; } - offset=atoi(args[0]); - period=atoi(args[1]); - evals=atoi(args[2]); + oid_t oid_id = oid_construct(OID_TYPE_FULL, NULL, 0, args[0], strlen(args[0])); + printf("Parsed OID: %s\n", oid_pretty_print(oid_id)); - /* Step 1b: Split the MID array */ - unsigned int x = 3; + id = mid_construct(MID_TRL, NULL, NULL, oid_id); + + if (id == NULL) { + AMP_DEBUG_ERR("netui_construct_time_rule_by_idx","Could not create MID",NULL); + return; + } + + //printf("Parsed MID: %s\n", mid_pretty_print(id)); - for(x=3;x