The current database model does not allow you to utilize the user_tags as items for a query. We are working on a new NiS model that will open up for this. However, you can do this with qos and origin.
Here's a sample script for the NAS (it has NiS integration built into it). You could ofcourse also use the NSA but you would require a connection string. The script will list out the matching origins and print the number of data rows for the last week.
Carstein
---8<-------8<-------8<-------8<-------8<-------8<-------8<----
origin="change-me"
-- Open the NimBUS Information Store (NiS)
database.open("provider=nis;driver=none;database=none")
rs = database.query("SELECT * FROM S_QOS_DATA WHERE qos='QOS_PROC_QUEUE_LEN' and origin='"..origin.."'")
if rs ~= nil and #rs>0 then
for i,r in ipairs(rs) do
printf("source: %s, target: %s, table_id: %d, table: %s",r.source,r.target,r.table_id,r.r_table)
data = database.query ("SELECT * FROM "..r.r_table.." WHERE table_id="..r.table_id.." AND sampletime > DATEADD(week,-1,GETDATE())")
printf(" rows of data: %d",#data)
-- write the data to a file or something
end
end
database.close()