how to interact with NGA InfluxDB in CONTROL

Find and share HowTos to various installations / configurations!
6 posts • Page 1 of 1
tmalone
Posts:192
Joined: Mon Nov 22, 2010 11:21 pm

how to interact with NGA InfluxDB in CONTROL

Post by tmalone »

how can I sent native InfluxDB SQL commands through NGA from within the CONTROL scripting?

The db family of functions in the CONTROL language seems to be limited to ADO or ODBC front end. Is there a path between CONTROL and the NGA backends?

Todd Malone

kilianvp
Posts:443
Joined: Fri Jan 16, 2015 10:29 am

Re: how to interact with NGA InfluxDB in CONTROL

Post by kilianvp »

Yes with #uses "CrtlNgaFrontend" and dpQueryNGA

tmalone
Posts:192
Joined: Mon Nov 22, 2010 11:21 pm

Re: how to interact with NGA InfluxDB in CONTROL

Post by tmalone »

wow, similar to the old Oracle stuff. I never thought to look for new functions.

After reviewing some other posts of Master @kilianvp, I found a way to use a REST interface that with some extra scripting you can make work on remote UIs too.

sUsrPwd = base64Encode("username:password");
m = makeMapping("headers", makeMapping("Authorization", "Basic "+sUsrPwd));
ret = netGet(http://localhost:8086/query?pretty=true&q=SELECT \name\", _ack_state FROM winccoa.ALERT.ALERT WHERE time > now() - 1h", sRet, m);

Todd Malone

tmalone
Posts:192
Joined: Mon Nov 22, 2010 11:21 pm

Re: how to interact with NGA InfluxDB in CONTROL

Post by tmalone »

in a follow up to the dpQueryNGA(), this function allows only same sort of calls as dpQuery. For example SELECT '_original.._value' ...

The dpQueryNGA() does not allow you do do more complex SQL with the database. The InfluxDB is a very powerful database with many "data mining" possibilities.

Todd

gschijndel
Posts:376
Joined: Tue Jan 15, 2019 3:12 pm

Re: how to interact with NGA InfluxDB in CONTROL

Post by gschijndel »

The 'dpQueryNGA'/'dpQueryRDB' should be used automatically if the use direct queries have been enabled, so I do not see a point to call them explicitly.

Unfortunately there seems to be not a NGA equivalent of 'runRealSQLQuery'.

tmalone
Posts:192
Joined: Mon Nov 22, 2010 11:21 pm

Re: how to interact with NGA InfluxDB in CONTROL

Post by tmalone »

while it is true that "direct queries" would default to that call, but it is not good for a common client to have that turned on for everything as it will also force it for trends, etc. Calling it explicitly allows the system to remain in the default mode for datamanager interactions.

6 posts • Page 1 of 1