Sending data from bash script to Influxdb 2.6

Hi,
We use below script to send data to Influxdb1.8. I am trying to send data to new influxdb2.6 using the same script. But I am getting some error. Can anyone please help me?

#!/bin/bash
set -x
datee=date +%s
rm -rvf /tmp/final
for i in hostid1-m hostid2-m hostid3-m hostid4-m; (replaced hostnames)
do
hostnamee=echo $i | cut -d - -f 1,2,3
#pass=grep $hostnamee /etc/rpower.conf | awk '{print $5}'
pass=grep $hostnamee /opt/pass-test | awk '{print $5}'
ipmitool -H $i -U admin -P $pass -I lanplus sensor | nl -s “|” > /tmp/$i
awk -F| ‘{print $2 }’ /tmp/$i | tr -s ’ ’ ‘_’ | sed ‘s/.$//’ | nl -s “|” > /tmp/$i-preprocessed
join -t| /tmp/$i /tmp/$i-preprocessed > /tmp/$i-processed
awk -F| ‘{print "ipmiMetrics,hostname=’$hostnamee’,component=“$12”,status=“$5” value="$3 ‘$datee’ }’ /tmp/$i-processed | sed ‘s/= /=/g’ | grep -v “value=0x0” | grep -v “value=na” >> /tmp/final
done

curl -vvv -s -i -XPOST ‘http://hostaddress.com:8086/write?db=ipmi&precision=s’ --data-binary @/tmp/final
~
~
error:
Connected to hostaddress.com (ip addr) port 8086 (#0)

POST /write?db=ipmi&precision=s HTTP/1.1
User-Agent: curl/7.29.0
Host: hostaddress.com:8086
Accept: /
Content-Length: 14269
Content-Type: application/x-www-form-urlencoded
Expect: 100-continue

< HTTP/1.1 401 Unauthorized
HTTP/1.1 401 Unauthorized
< Content-Type: application/json; charset=utf-8
Content-Type: application/json; charset=utf-8
< X-Influxdb-Build: OSS
X-Influxdb-Build: OSS
< X-Influxdb-Version: v2.6.1
X-Influxdb-Version: v2.6.1
< X-Platform-Error-Code: unauthorized
X-Platform-Error-Code: unauthorized
< Date: Fri, 21 Apr 2023 04:27:48 GMT
Date: Fri, 21 Apr 2023 04:27:48 GMT
< Content-Length: 55
Content-Length: 55
< Connection: close
Connection: close

<

  • Closing connection 0
    {“code”:“unauthorized”,“message”:“unauthorized access”}

I have created the bucket with the name “ipmi”