Difference between revisions of "ExternalParametersProvider"

From NetXMS Wiki
Jump to navigation Jump to search
(Created page with "== Data provider == Data provider is an application or script, executed by NetXMS Agent on regular basis, completely unrelated to requests from server. Script output is cached...")
 
m (Text replacement - "^" to "{{deprecated}}")
 
(3 intermediate revisions by 2 users not shown)
Line 1: Line 1:
== Data provider ==
{{deprecated}}== Data provider ==
Data provider is an application or script, executed by NetXMS Agent on regular basis, completely unrelated to requests from server. Script output is cached by agent.
Data provider is an application or script, executed by NetXMS Agent on regular basis, completely unrelated to requests from server. Script output is cached by agent.
Main purpose it to providing data from long-running processes, or return multiple values at once (e.g. same parameter for multiple instances, which could be loaded from DB by a single query).
Main purpose is to providing data from long-running processes, or return multiple values at once (e.g. same parameter for multiple instances, which could be loaded from DB by a single query).


Script should print one or more "Parameter=Value" pairs to standard output. Multiple pairs should be separated by new line. If parameter takes argument, it should be included in "Parameter(...)".<br />Example (shell script):
Script should print one or more "Parameter=Value" pairs to standard output. Multiple pairs should be separated by new line. If parameter takes argument, it should be included in "Parameter(...)".<br />Example (shell script):
<syntaxhighlight lang="shell">
<syntaxhighlight lang="bash">
#!/bin/sh
#!/bin/sh


Line 14: Line 14:


== Agent configuration  ==
== Agent configuration  ==
<syntaxhighlight lang="plain">
<syntaxhighlight lang="ini">
ExternalParametersProvider=PATH_TO_PROVIDER_SCRIPT:POLL_TIME_IN_SECONDS
ExternalParametersProvider=PATH_TO_PROVIDER_SCRIPT:POLL_TIME_IN_SECONDS
</syntaxhighlight>
</syntaxhighlight>


Example (run /tmp/test.sh every 5 seconds):
Example (run /tmp/test.sh every 5 seconds):
<syntaxhighlight lang="plain">
<syntaxhighlight lang="ini">
ExternalParametersProvider=/tmp/test.sh:5
ExternalParametersProvider=/tmp/test.sh:5
</syntaxhighlight>
</syntaxhighlight>
Line 25: Line 25:
== Verify ==
== Verify ==
You can check that everything is working fine by listing supported parameters from the agent:
You can check that everything is working fine by listing supported parameters from the agent:
<syntaxhighlight lang="plain">
<syntaxhighlight lang="html4strict">
Alexs-MacBook-Air:~ alk$ /opt/netxms/bin/nxget -I localhost
Alexs-MacBook-Air:~ alk$ /opt/netxms/bin/nxget -I localhost
Agent.AcceptedConnections UINT "Number of connections accepted by agent"
Agent.AcceptedConnections UINT "Number of connections accepted by agent"
Line 34: Line 34:
ParameterWithArgs(AAA) STRING ""
ParameterWithArgs(AAA) STRING ""
ParameterWithArgs(BBB) STRING ""
ParameterWithArgs(BBB) STRING ""
</syntaxhighlight>
Get value for specific parameter:
<syntaxhighlight lang="html4strict">
Alexs-MacBook-Air:~ alk$ /opt/netxms/bin/nxget localhost 'ParameterWithArgs(AAA)'
Value3
</syntaxhighlight>
</syntaxhighlight>

Latest revision as of 18:13, 13 September 2022

This Wiki is deprecated and we are are currrently migrating remaining pages into product documentation (Admin Guide, NXSL Guide)

== Data provider ==

Data provider is an application or script, executed by NetXMS Agent on regular basis, completely unrelated to requests from server. Script output is cached by agent. Main purpose is to providing data from long-running processes, or return multiple values at once (e.g. same parameter for multiple instances, which could be loaded from DB by a single query).

Script should print one or more "Parameter=Value" pairs to standard output. Multiple pairs should be separated by new line. If parameter takes argument, it should be included in "Parameter(...)".
Example (shell script):

#!/bin/sh

echo 'Parameter1=Value1'
echo 'Parameter2=Value2'
echo 'ParameterWithArgs(AAA)=Value3'
echo 'ParameterWithArgs(BBB)=Value4'

Agent configuration

ExternalParametersProvider=PATH_TO_PROVIDER_SCRIPT:POLL_TIME_IN_SECONDS

Example (run /tmp/test.sh every 5 seconds):

ExternalParametersProvider=/tmp/test.sh:5

Verify

You can check that everything is working fine by listing supported parameters from the agent:

Alexs-MacBook-Air:~ alk$ /opt/netxms/bin/nxget -I localhost
Agent.AcceptedConnections UINT "Number of connections accepted by agent"
Agent.AcceptErrors UINT "Number of accept() call errors"
...
Parameter1 STRING ""
Parameter2 STRING ""
ParameterWithArgs(AAA) STRING ""
ParameterWithArgs(BBB) STRING ""

Get value for specific parameter:

Alexs-MacBook-Air:~ alk$ /opt/netxms/bin/nxget localhost 'ParameterWithArgs(AAA)'
Value3