Hi all. Im kind of new to the topic but want to learn and understand how I can use influxDB for our needs and requirements.
We need historical data for Dashboards we want to build and decided to use influx. For this reason we are using a script that pulls the information from our source.
However I understood how I pull my data from my source and I got about 50 results.
They now look like this:
{
“name”: “UI/UX Mac mini”,
“os_version”: “13.3.1”,
“model”: “Mac mini (M1, 2020)”
}
However now I wanted to push them to influxDB.
I thought I would write a while loop like this:
=== Process Devices and Write to InfluxDB ===
echo "$resp_clean" | tr -d '\000-\031' | jq -r '.results[] |
{
name: .general.name,
os_version: (.operatingSystem.version // "unknown"),
model: (.hardware.model // "unknown")
}' | while IFS= read -r device; do
name=$(echo "$device" | jq -r '.name')
os_version=$(echo "$device" | jq -r '.os_version')
model=$(echo "$device" | jq -r '.model')
# Write data to InfluxDB
curl -XPOST "$INFLUX_URL/api/v2/write?org=$INFLUX_ORG&bucket=$INFLUX_BUCKET&precision=s" \
-H "Authorization: Token $INFLUX_TOKEN" \
--data-binary "device,source=jamf,model=$model os_version=$os_version,device_name=$name"
However it fails to inject the data to the Database.
Would somebody able to joint me to the problem here?