Difference between revisions of "Script Example: Read Table From Agent"
Jump to navigation
Jump to search
(Created page with "This script can be put into Script Library and run from server's debug console. It accepts node object name or ID as first parameter, table name as second parameter, and print...") |
m (Text replacement - "^" to "{{deprecated}}") |
||
(2 intermediate revisions by one other user not shown) | |||
Line 1: | Line 1: | ||
{{deprecated}} | |||
{| style="border-spacing: 20px; border: 20px solid red;" | |||
| | |||
'''WARNING''': This page is no longer updated. Please visit '''[https://www.netxms.org/documentation/nxsl-latest/#_examples_2 NetXMS Script examples]''' for current version of the documentation. | |||
|} | |||
This script can be put into Script Library and run from server's debug console. It accepts node object name or ID as first parameter, table name as second parameter, and prints content of given table to console. | This script can be put into Script Library and run from server's debug console. It accepts node object name or ID as first parameter, table name as second parameter, and prints content of given table to console. | ||
Latest revision as of 16:13, 13 September 2022
This Wiki is deprecated and we are are currrently migrating remaining pages into product documentation (Admin Guide, NXSL Guide) |
WARNING: This page is no longer updated. Please visit NetXMS Script examples for current version of the documentation. |
This script can be put into Script Library and run from server's debug console. It accepts node object name or ID as first parameter, table name as second parameter, and prints content of given table to console.
// Find node object
node = FindObject($1);
if (node == null)
{
println "ERROR: Node not found";
return;
}
// REad table data from agent
table = AgentReadTable(node, $2);
if (table == null)
{
println "ERROR: Cannot read table from agent";
return;
}
// Print column names
for(i = 0; i < table->columnCount; i++)
print "| " . left(table->getColumnName(i), 20);
println "|";
for(i = 0; i < table->columnCount; i++)
print "+" . left("-", 21, "-");
println "+";
// Print data
for(i = 0; i < table->rowCount; i++)
{
for(j = 0; j < table->columnCount; j++)
{
print "| " . left(table->get(i, j), 20);
}
println "|";
}