Difference between revisions of "ExternalParametersProvider"
Jump to navigation
Jump to search
m (→Verify) |
(Syntax highlighter fixed) |
||
Line 4: | Line 4: | ||
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=" | <syntaxhighlight lang="bash"> | ||
#!/bin/sh | #!/bin/sh | ||
Line 14: | Line 14: | ||
== Agent configuration == | == Agent configuration == | ||
<syntaxhighlight lang=" | <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=" | <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=" | <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 37: | Line 37: | ||
Get value for specific parameter: | Get value for specific parameter: | ||
<syntaxhighlight lang=" | <syntaxhighlight lang="html4strict"> | ||
Alexs-MacBook-Air:~ alk$ /opt/netxms/bin/nxget localhost 'ParameterWithArgs(AAA)' | Alexs-MacBook-Air:~ alk$ /opt/netxms/bin/nxget localhost 'ParameterWithArgs(AAA)' | ||
Value3 | Value3 | ||
</syntaxhighlight> | </syntaxhighlight> |
Revision as of 20:03, 19 March 2015
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 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).
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