If I run the following command in InfluxDB I get a decent response :
influx -database database_metrics -execute "SELECT last("slave_slave_io_running") FROM "mysql" WHERE ("time" > now() - 60m)"
But If I try to scrape the output from the terminal using a python script I get the following error:
[‘Visit https://enterprise.influxdata.com to register for updates, InfluxDB server management, and monitoring.’, ‘Connected to http://localhost:8086 version unknown’, ‘InfluxDB shell version: unknown’, ‘standard output is not a terminal’]
Finished
The code I wrote is as follows:
out = subprocess.Popen([‘influx’,‘-database’,‘database_metrics’,' -execute’,‘\“SELECT last(\“slave_slave_io_running\“) FROM \“mysql\” WHERE (\“time\” > now() - 60m)\“’],stdout =subprocess.PIPE,stderr=subprocess.STDOUT)
stdout,stderr = out.communicate()
#get the lines and remove the empty lines
lines = stdout.decode().split("\n")
lines = [x for x in lines if x]