Menu

Show posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Show posts Menu

Messages - johnnyva

#16
Server environments:
- Instance 1 = v3.8.166 on Ubuntu Bionic (AgentExecuteActionWithOutput doesn't work)
- Instance 2 = v3.4.313 on Ubuntu Xenial (AgentExecuteActionWithOutput works)

When executing nxsl script against Instance 1 environment, and running the following command, I get no output.  This has been a thing for a while (going off my poor memory, I'm sure it used to work, but I don't think it has since 3.6ish? but I could be wrong and maybe it's never worked...)

println(AgentExecuteActionWithOutput($node, "echo test"));

This should print out "test".
When running this against our Instance 2 environment, I get the expected result (i.e. it prints out "test").

This could be a agent config or setting somewhere but struggling to find it.

Both servers have almost the same nxagentd.conf execpt for the MasterServers settings.

Both have the following nxagentd.conf


# Log File
LogFile=/var/log/nxagentd

# IP white list, can contain multiple records separated by comma.
# CIDR notation supported for subnets.
MasterServers=<redacted>,127.0.0.0/8

SubAgent = filemgr.nsm

[filemgr]
RootFolder = /


And when running the nxagentd -C on the working server instance, it does not contain any extra agent settings that might have been applied by agent policies.

Any ideas?
#17
Hey sNsReal,

You could probably use the newly available creationTime attribute on the NetObj class (added sometime in v3) which is epoch of when the object was created.

So on the container that you want nodes to autobind to, you could enable "Automatically bind nodes selected by filter to this container", and disable the unbind option.
And your filtering script would be something like this:


HOURS_IN_SECONDS = 3600;
if($node->creationTime != 0 && (time() - $node->creationTime) < HOURS_IN_SECONDS) return true;


This will bind nodes that have been created within the last hour.  So long as the node performs a config poll within that time, then it should bind.
If it does not return true, then it will implicitly return null, and null means that it won't bind or unbind the node being processed.
If the object was created prior to the CreationTime being added to NetXMS, then CreationTime will be 0.