NetXMS Support Forum

English Support => General Support => Topic started by: Imad on October 15, 2014, 07:42:07 PM

Title: Table DCI parameters
Post by: Imad on October 15, 2014, 07:42:07 PM
Hi,

I'm trying to write Table DCI under AIX agent, but i'm getting disorder when it's showed on Netxms server side while trying to add this table from DCIs:

below is how I'm getting the disorder of the DCIs table where it shows that available tables are shown under name, instance column and description instead of just being under Name:

and I'm not facing the same form for single parameter:
(//)
I defined NETXMS_SUBAGENT_TABLE and NETXMS_SUBAGENT_PARAM on AIX as below (if I try to use the same number of parameters for NETXMS_SUBAGENT_TABLE and NETXMS_SUBAGENT_PARAM , I got compilation error of parameters):


Quotestatic NETXMS_SUBAGENT_TABLE m_tables[] =
{
{ "Switch.TopReadTablesWork(*)", H_TOP_READ_TABLES_WORK, NULL } ,
{ "Switch.Test1", H_TABLE_TEST, NULL } ,
{ "Switch.Test2", H_TABLE_TEST, NULL } ,
{ "Switch.Test3", H_TABLE_TEST, NULL }
};

static NETXMS_SUBAGENT_PARAM m_parameters[] =
{

{ "Switch.SrcVersion", H_Version, NULL,DCI_DT_STRING, "Source long version" },
{ "Switch.Echo(*)", H_Echo, NULL,DCI_DT_STRING, "Echoes string back" },

Can anyone helps me out of the exact format and type of NETXMS_SUBAGENT_TABLE ???

Thanks in advance
Title: Re: Table DCI parameters
Post by: Alex Kirhenshtein on October 16, 2014, 01:16:22 AM
Hello.

NETXMS_SUBAGENT_TABLE is defined in include/nms_agent.h: http://git.netxms.org/public/netxms.git/blob/develop:/include/nms_agent.h?js=1#l406

Table example:

Filling up structure: http://git.netxms.org/public/netxms.git/blob/develop:/src/agent/subagents/aix/main.cpp?js=1#l266
Callback implementation: http://git.netxms.org/public/netxms.git/blob/develop:/src/agent/subagents/aix/disk.cpp?js=1#l108

Small tip: you can use "nxget" tool for debugging, it connects directly to the agent and query parameter / table (just make sure your IP is in Servers/MasterServers). To query for table, use "-T" switch: nxget -T 10.5.0.111 FileSystem.Volumes
Title: Re: Table DCI parameters
Post by: Imad on October 16, 2014, 04:09:58 PM
Thank you Alex,

Thanks a lot, i found the problem, in file nms_agent.h it was:

Quotetypedef struct
{
   TCHAR name[MAX_PARAM_NAME];
   LONG (* handler)(const TCHAR *, const TCHAR *, Table *);
   const TCHAR *arg;
} NETXMS_SUBAGENT_TABLE;

instead of being

Quotetypedef struct
{
   TCHAR name[MAX_PARAM_NAME];
   LONG (* handler)(const TCHAR *, const TCHAR *, Table *);
   const TCHAR *arg;
   TCHAR instanceColumns[MAX_COLUMN_NAME * MAX_INSTANCE_COLUMNS];
   TCHAR description[MAX_DB_STRING];
} NETXMS_SUBAGENT_TABLE;
Title: Re: Table DCI parameters
Post by: Alex Kirhenshtein on October 16, 2014, 06:14:52 PM
You are using extremely old version (I'd say 1.1.11), which was released in the 2012.