Cacti to influxdb2

Hello

I have a cacti v1.2.17 which retrieves snmp data on different equipment
So I don’t want to redo polling on this equipment via telegraf.
So I say use CereusTransporter via the target: influxdb://user:password@IP_INFLUXDB:8086/Cacti to send to InfluxDB v2.5.1
My problem is that using via user/password doesn’t work, you have to use a token.

How can I add a user / password to access influxdb.

To test locally I do this test:
curl -G http://localhost:8086/query -u user:password --data-urlencode “q=SHOW DATABASES”
{“code”:“unauthorized”,“message”:“Unauthorized”}

Thank you in advance for your answers
Cordially
Franpom

Hi @Franpom,
So you should be able to make use of the V1 API for this: InfluxDB 1.x compatibility API | InfluxDB OSS 2.5 Documentation

curl --get "http://localhost:8086/query" \
  --user "INFLUX_USERNAME":"INFLUX_PASSWORD_OR_TOKEN" \
  --data-urlencode "db=mydb" \
  --data-urlencode "q=SELECT * FROM cpu_usage"

you can use simuler for the write method

hello @Jay_Clifford
it does not work

influx user list -t Mc0y-e-mtD8HCHB7C50mxaxlp3FoHHosAihejMLxj0gSBNg87cl_jx9F8_db1XqZx9ugQZqNKopnwMapbOHGxQ==
ID Name
0a5268a352579000 admin

The user admin and token is OK
But :
curl --get “http://localhost:8086/query” --user “admin”:“Mc0y-e-mtD8HCHB7C50mxaxlp3FoHHosAihejMLxj0gSBNg87cl_jx9F8_db1XqZx9ugQZqNKopnwMapbOHGxQ==” --data-urlencode “q=SHOW DATABASES”
{“code”:“unauthorized”,“message”:“Unauthorized”}

So instead you could define explicit username and password to your bucket via the v1 mapping tool of the CLI. Here is an example based on my setup:

 influx v1 auth create --org  influxdata --username influxdbv1 --password influxdbv1 --read-bucket 39c32dd653331ef4 --write-bucket 39c32dd653331ef4

then the curl request

 curl --get "http://raspberrypi:8086/query"   --data-urlencode "u=influxdbv1” \
  --data-urlencode "p=influxdbv1   --data-urlencode "db=rawdata” \
  --data-urlencode "q=SELECT * FROM power_meter”

Hello,
Thanks for this solution, it works great with curl.
On the other hand with the plugin cacti CereusTransporter it does not work.
I think it’s due to the format of the url which is:
influxdb://user:password@IP_INFLUXDB:8086/Cacti where Cacti is the bucket.
Anyway, I keep looking for a solution.

1 Like