I am trying to collect Bitbucket API data as a json file and push the data to InfluxDB. I am doing this via Jenkins scripted pipeline.
I am not sure how to convert my json data to points as the data will be dynamic. The script executes without any error but I am unable to see my data in InfluxDB
How can I specify which measurement to use.
Code is as below
import groovy.json.*
def result
influxSRV='x.x.x.x:8086'
influxDb='dbname'
measurement = 'ms'
node('master'){
stage('collect'){
sh "curl -XGET -u 'xx:yy' https://x.y.z > output.json"
result = readJSON file: 'output.json'
sh "curl -iX POST \'http://${influxSRV}/write?db=${influxDb}&precision=ms\' --data-binary \'${measurement},${result}\'"
}
}
Unfortunately, I cannot use telegraf. Is it possible to insert multiple values to a field using one post query.
I need only two fields from the JSON generated. I want the DB to look like:
commit user
xx yy
zz cc
aa bb