I'm using v4.5.0
I have a query in agent configuration file which I'm polling in a DCI. It always gives <<ERROR>> output value. However, from the agent log below, I found that the query is indeed returning the intended output.
2025.03.25 12:35:53.413 *D* [comm.cs.1 ] Message dump:
** 000000 | 00 41 50 00 00 00 00 28 00 00 00 E0 00 00 00 01 | .AP....(........
** 000010 | 00 00 00 55 07 00 00 00 00 00 00 09 71 75 65 72 | ...U........quer
** 000020 | 79 34 28 31 29 00 00 00 | y4(1)...
** code=0x0041 (CMD_GET_PARAMETER) version=5 flags=0x0000 id=224 size=40 numFields=1
** 000000: [ 85] UTF8-STRING "query4(1)"
2025.03.25 12:35:53.413 *D* [comm.cs.1 ] Received message CMD_GET_PARAMETER (224)
2025.03.25 12:35:53.413 *D* [comm.cs.1 ] Requesting metric "query4(1)"
2025.03.25 12:35:55.015 *D* [db.query ] Long running query: "MY SELECT QUERY" [5602 ms]
2025.03.25 12:35:55.015 *D* [comm.cs.1 ] GetMetricValue("query4(1)"): 0 (SUCCESS) value = "88.78"
2025.03.25 12:35:55.015 *D* [dbquery ] H_DirectQueryConfigurable: Executing query "MY SELECT QUERY" in database "kmrcldb"
2025.03.25 12:35:55.015 *D* [comm.cs.1 ] Sending message CMD_REQUEST_COMPLETED (ID 222; size 56; uncompressed)
2025.03.25 12:35:55.015 *D* [comm.cs.1 ] Outgoing message dump:
** 000000 | 00 1D 50 00 00 00 00 38 00 00 00 DE 00 00 00 02 | ..P....8........
** 000010 | 00 00 00 1C 00 00 00 00 00 00 00 00 00 00 00 00 | ................
** 000020 | 00 00 00 15 07 00 00 00 00 00 00 05 38 38 2E 37 | ............88.7
** 000030 | 38 00 00 00 00 00 00 00 | 8.......
** code=0x001D (CMD_REQUEST_COMPLETED) version=5 flags=0x0000 id=222 size=56 numFields=2
** 000000: [ 28] INT32 0
** 000010: [ 21] UTF8-STRING "88.78"
What if you try to read value of that metric using nxget?
It is giving correct output
C:\NetXMS\bin>nxget 10.14.50.30 query4(1)
90.7
This means that something is configured incorrectly in the DCI.
Is Origin set correctly? Anything in transformation script?
Origin : NetXMS Agent
Metric : query4(1)
There's no transformation.
I think it has got something to do with query running time. If I simplify the select query then I do get output in the GUI.
The Query does not run from the DCI Parameter Selection form too. But it runs and gives output from nxget.
Solution was to increase the Agent.CommandTimeout value ::)
In overall it's not recommended to increase Agent.CommandTimeout too much (like > then 5 seconds) because in situations when agents are slow to respond server will spend too much time waiting.
If your query takes too long, you can use External metric provider - in this case command is executed in the backgound and agent caches values. https://netxms.org/documentation/adminguide/agent-management.html#externalmetricprovider