Using flux as collector outside influxdb

I have this use case:

  • server X and Y with databases
  • remote server Z with influxdb
  • need to query databases with sql and send query result to influx.
    This problem with “old” influxdb was difficult to solve because with telegraf you cannot do (as far as I know) queries to sql server or postgres.
    But now if flux really supports query to most important sql dbs and if I can put flux on database servers (I would like to use it to an alternatve to telegraf) I can solve my use case.
    Can you help me or suggest better ways?

Hello @mgiammarco,
Yes you can use source functions in a task.

Hi @Anaisdg but tasks run in Influxdb server and influxdb does not have access to remote sql server db on customers premise.

Hello @mgiammarco,
How can you access the remote sql server then? What options do you have?
I can also recommend the execd processor plugin. It makes telegraf extensible in any language.

Thank you @Anaisdg for your help.
But I try to explain better: I suppose a typical use case that you have several servers with telegraf installed that send data to a remote influxdb.
If I have to collect the result of an sql query I must write code. People complains about it: if they have to write code they so will not use telegraf and so they will not use influxdb.
Now you announce a big news: flux language can query sql dbs!
But then flux language cannot run inside telegraf so usefulness is severely limited.
The “big news” become a “not so interesting news”.

@mgiammarco What data are you looking to obtain from the SQL server?

1 Like

@samdillard I “don’t know” because is data from custom applications that describes temperatures and other things that are saved on sql (and we cannot modify custom application) but we need to query it and copy on InfluxDB to manage it better. It is NOT sql server status data.

@mgiaammarco you can try this with Telegraf maybe: telegraf/plugins/inputs/postgresql_extensible at master · influxdata/telegraf · GitHub

Other than that, you have two options:

  1. Write the data to InfluxDB instead of / in addition to SQL
  2. Give InfluxDB access to the SQL server.

There is only so much InfluxDB can do to solve this problem.