$node.ipAddr is unspec

Started by saksham.adyso, April 15, 2025, 03:36:50 PM

Previous topic - Next topic

saksham.adyso

I have made a filter script that writes a DiscoveredNode object to a text document, code: $node.ipAddr. But the "unspec" text is written to the file.
I made this script just to understand how the filter script works.
If I don't use a script, everything works. So there is no problem in the search. Why is the IP address of the object not written, but the text unspec?

Filipp Sudanov

Something like this was fixed recently, please try v5.2.1

saksham.adyso

I've updated to the latest version. Unfortunately now nothing is being written. I tried to do a clean install of NetXMS and the result is the same.

Filipp Sudanov

What is the name of the hook script that you are using?

saksham.adyso

I use a custom script where I write the state of a variable to a file. I don't use the built-in hook script.

Filipp Sudanov

From which place do you run your script?

saksham.adyso

Script is in script library and I select this script for discovery filter.

Filipp Sudanov

Yes, thanks for the info. In that script we have $node variable which contains object of DiscoveredNode class, please see here:
https://netxms.org/documentation/nxsl-latest/#class-discoverednode

We will improve the UI in a future version so that discovery filter script is editable right from Network Discovery page with hint on available variables in that editor.

saksham.adyso

I use exactly this $node variable in the script and write its ipAddr property to a file. In the old version the UNSPEC text was written to the file and in the latest version nothing was written. Same for the other variables of the $node object (DiscoveredNode).

Filipp Sudanov

Can you show full script that does writing to file?

saksham.adyso

function main()
{
LogFile = IO::OpenFile("C:\\nx\\netxms.txt", "a");
if (LogFile != null)
{
LogFile.writeLine($node.ipAddr);
LogFile.close();
}
}