NetXMS Support Forum

English Support => General Support => Topic started by: saksham.adyso on April 15, 2025, 03:36:50 PM

Title: $node.ipAddr is unspec
Post by: saksham.adyso on April 15, 2025, 03:36:50 PM
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?
Title: Re: $node.ipAddr is unspec
Post by: Filipp Sudanov on April 15, 2025, 04:10:08 PM
Something like this was fixed recently, please try v5.2.1
Title: Re: $node.ipAddr is unspec
Post by: saksham.adyso on April 23, 2025, 10:30:28 AM
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.
Title: Re: $node.ipAddr is unspec
Post by: Filipp Sudanov on April 23, 2025, 10:37:50 AM
What is the name of the hook script that you are using?
Title: Re: $node.ipAddr is unspec
Post by: saksham.adyso on April 25, 2025, 09:09:32 AM
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.
Title: Re: $node.ipAddr is unspec
Post by: Filipp Sudanov on April 25, 2025, 09:29:09 AM
From which place do you run your script?
Title: Re: $node.ipAddr is unspec
Post by: saksham.adyso on April 25, 2025, 12:48:05 PM
Script is in script library and I select this script for discovery filter.
Title: Re: $node.ipAddr is unspec
Post by: Filipp Sudanov on April 28, 2025, 12:26:52 PM
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.
Title: Re: $node.ipAddr is unspec
Post by: saksham.adyso on April 30, 2025, 08:43:01 AM
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).
Title: Re: $node.ipAddr is unspec
Post by: Filipp Sudanov on April 30, 2025, 11:33:16 PM
Can you show full script that does writing to file?
Title: Re: $node.ipAddr is unspec
Post by: saksham.adyso on May 12, 2025, 03:15:49 PM
function main()
{
LogFile = IO::OpenFile("C:\\nx\\netxms.txt", "a");
if (LogFile != null)
{
LogFile.writeLine($node.ipAddr);
LogFile.close();
}
}