lib/db_utils.pm

influxdb_push_data

influxdb_push_data($url, $db, $org, $token, $data [, quiet => 1] [, proceed_on_failure => 1])

Builds an influx-db query and write it to the given database specified with url, org and db for the Influx DB organization and database name. token is used for user authentication. quiet is a boolean flag to hide output results, default true. proceed_on_failure is a boolean flag to continue and not die when return_code not ok, default false. data is a hash containing the table name in Influx DB, the tags and the values to plot.

Return code: 1, when ok and data uploaded to remote db undef or die, when push failed

Example of data: $data = { table => 'my_db_table_name', tags => { BUILD => '42', KERNEL => '4.12.14-lp151.28.20-default'}, values => { io_reads' => 1337, io_writes => 1338 } }

influxdb_read_data

Builds an Influx DB query and read data from specified database with url_base, db and org for the Influx DB name. token contains the access token. query contains SELECT query for given DB.

returns json with results of SELECT query.

push_image_data_to_db

Pushes data to specified with url and db for the Postgres DB name using curl.