Is it possible to use the Web API for requesting an adhoc summary table for a Table DCI?
https://netxms.org/documentation/adminguide/rest-api.html#adhoc-summary-table
If yes, how?
If no, what is the best way to export multiple Table DCI values to a CSV file automatically (meaning, by script)?
Old web api path summaryTable/adHoc vs restapi summary-table/ad-hoc
curl -s -X POST --cookie "session_handle=__HASH__" --data @netxms.json "http://localhost:8080/netxms-websvc/summaryTable/adHoc"
netxms.json, same as rest-api:
{
"baseObject":"ContainerName",
"columns": [
{
"columnName":"Free form name that will be used in return table for this column",
"dciName":"Name of DCI, that will be used for filtering"
},
{
"columnName":"Name2",
"dciName":"DCIName2"
}
]
}
Thank you, I am working with the API already. I am asking about creating an ad-hoc summary table from a table DCI. I suspect this is not yet implemented.
We don't have a concept of DCI summary table from table DCIs.
One option is to have a number of single-value push DCIs, then in transformation script of your table DCI you can push values into these.
Or, via the API you can call /objects/{object-id}/execute-script endpoint and call a script that would return the data you need.
Are you sure about that there is no concept for DCI summary tables from table DCI? I am talking about this.
In the meantime I wrote a script to query each DCI one by one and join the results to one table (the same way the summary table for table DCI works), so you can consider my question as answered.
Well, not so sure now, will check how this works. But don't think it's currently exposed to the API
Table DCI summary tables work, I've tried in the new API, but it should be same in the old one under /summaryTable/adHoc
curl -s -X 'POST' 'http://127.0.0.1:8000/v1/dci-summary-tables/adhoc-query' -H 'Authorization: Bearer xxxxxxxxxxxxxxxxxxx' -H 'Content-Type: application/json' -d '{ "objectId": 2, "tableDefinition" : { "flags": 2, "dciName": "Network.Interfaces" } }'
P.S. flags are the following:
/
* Summary table flags
*/
#define SUMMARY_TABLE_MULTI_INSTANCE 0x0001
#define SUMMARY_TABLE_TABLE_DCI_SOURCE 0x0002
/
* Summary table column flags
*/
#define COLUMN_DEFINITION_REGEXP_MATCH 0x0001
#define COLUMN_DEFINITION_MULTIVALUED 0x0002
#define COLUMN_DEFINITION_BY_DESCRIPTION 0x0004
Oh nice, thank you. Maybe you can add this to the manual for future reference!