Show us the datasource settings
Are influx and grafana running on the same computer?
How did you install influx and grafana?
What application are you running where you show the database contents?
Yes, they running on the same computer
I install influxdb and grafana by this:
I use NR for app (or you mean something else?)
What do you mean by:where you show the database contents?
A couple of posts back you showed the database contents. How did you access the database to show that data? Normally one would use the influx
command to check the contents of the database.
I note that in the tutorial linked he has the user name grafana, but you have specified admin, did you create a user (in influx) called admin or did you follow the tutorial?
What does this command show
sudo systemctl status influxdb
[Edit]
A further thing to try to help diagnose the problem, run in a terminal,
sudo tail -f /var/log/syslog
and leave it running (hit enter a couple of times and it will put some blank lines in). Then go to the grafana window and try and save again. See if anything is added to syslog. If yes then copy/paste it here please (preferably copy/paste if you can rather than a screen shot). Use the </>
button when pasting it here.
I access the database to show that data, with this:
influx
show databases
>use TEMPERATURES
>show MEASUREMENTS
>SELECT * FROM temp
Yes, i created a user (in influx) called admin.
The command sudo systemctl status influxdb show :
pi@raspberrypi:~ $ sudo systemctl status influxdb
● influxdb.service - InfluxDB is an open-source, distributed, time series databa
Loaded: loaded (/lib/systemd/system/influxdb.service; enabled; vendor preset:
Active: active (running) since Sat 2020-08-22 21:29:55 EEST; 22h ago
Docs: https://docs.influxdata.com/influxdb/
Main PID: 548 (influxd)
Tasks: 15 (limit: 4915)
CGroup: /system.slice/influxdb.service
└─548 /usr/bin/influxd -config /etc/influxdb/influxdb.conf
Aug 23 17:57:20 raspberrypi influxd[548]: ts=2020-08-23T14:57:20.751873Z lvl=inf
Aug 23 17:57:20 raspberrypi influxd[548]: [httpd] 192.168.1.8 - - [23/Aug/2020:1
Aug 23 17:59:29 raspberrypi influxd[548]: ts=2020-08-23T14:59:29.968134Z lvl=inf
Aug 23 17:59:29 raspberrypi influxd[548]: ts=2020-08-23T14:59:29.968379Z lvl=inf
Aug 23 18:29:29 raspberrypi influxd[548]: ts=2020-08-23T15:29:29.968159Z lvl=inf
Aug 23 18:29:29 raspberrypi influxd[548]: ts=2020-08-23T15:29:29.968419Z lvl=inf
Aug 23 18:59:29 raspberrypi influxd[548]: ts=2020-08-23T15:59:29.968208Z lvl=inf
Aug 23 18:59:29 raspberrypi influxd[548]: ts=2020-08-23T15:59:29.968464Z lvl=inf
Aug 23 19:29:29 raspberrypi influxd[548]: ts=2020-08-23T16:29:29.968204Z lvl=inf
Aug 23 19:29:29 raspberrypi influxd[548]: ts=2020-08-23T16:29:29.968455Z lvl=inf
lines 1-19/19 (END)
After run:
sudo tail -f /var/log/syslog
This is added to syslog:
Aug 23 19:42:46 raspberrypi grafana-server[1642]: t=2020-08-23T19:42:46+0300 lvl=eror msg="Failed to update last_seen_at" logger=context userId=1 orgId=1 uname=admin error="attempt to write a readonly database"
Aug 23 19:42:46 raspberrypi grafana-server[1642]: t=2020-08-23T19:42:46+0300 lvl=eror msg="Failed to update datasource" logger=context userId=1 orgId=1 uname=admin error="attempt to write a readonly database" remote_addr=[::1]
Aug 23 19:42:46 raspberrypi grafana-server[1642]: t=2020-08-23T19:42:46+0300 lvl=eror msg="Failed to rotate token" logger=context userId=1 orgId=1 uname=admin error="attempt to write a readonly database"
Aug 23 19:42:46 raspberrypi grafana-server[1642]: t=2020-08-23T19:42:46+0300 lvl=eror msg="Request Completed" logger=context userId=1 orgId=1 uname=admin method=PUT path=/api/datasources/1 status=500 remote_addr=[::1] time_ms=4 size=41 referer=http://localhost:3000/datasources/edit/1/
Aug 23 19:45:10 raspberrypi grafana-server[1642]: t=2020-08-23T19:45:10+0300 lvl=eror msg="failed to run garbage collect" logger=remotecache.database error="attempt to write a readonly database"
Aug 23 19:45:10 raspberrypi grafana-server[1642]: t=2020-08-23T19:45:10+0300 lvl=eror msg="failed to lock and execute cleanup of expired auth token" logger=auth error="attempt to write a readonly database"
Aug 23 19:45:10 raspberrypi grafana-server[1642]: t=2020-08-23T19:45:10+0300 lvl=eror msg="Problem reading image dir" logger=cleanup error="open /var/lib/grafana/png: permission denied"
Aug 23 19:45:10 raspberrypi grafana-server[1642]: t=2020-08-23T19:45:10+0300 lvl=eror msg="Failed to delete expired snapshots" logger=cleanup error="attempt to write a readonly database"
Aug 23 19:45:10 raspberrypi grafana-server[1642]: t=2020-08-23T19:45:10+0300 lvl=eror msg="failed to lock and execute cleanup of old login attempts" logger=cleanup error="attempt to write a readonly database"
Did you notice this?
I believe that is referring to the grafana config database, I don't know why it would be read only. I am not at my computer at the moment, have a Google for that error message with grafana see if anything appears.
So i don't created user correctly?
The error is from grafana, it is not an influxdb issue.
But Martin has stated:
The reason it won't connect, I believe, is because Grafana can't write to its configuration database (which is sqlite), so it isn't even getting as far as trying to connect to the influx db.
@martin10 what does this show?
ls -l /var/lib/grafana
Mine shows
-rw-r----- 1 grafana grafana 507904 Jun 29 22:01 grafana.db
drwxr-x--- 2 grafana grafana 4096 Mar 12 2019 plugins
drwx------ 2 grafana grafana 4096 Mar 12 2019 png
drwxr-x--- 6 grafana grafana 4096 Mar 4 2017 sessions
though mine isn't a standard install so that may not be relevant. grafana.db is the config database I believe.
Also what about
ps -aux|grep grafana
That will tell us which user is running grafana
And finally
sudo systemctl status grafana-service
pi@raspberrypi:~ $ ls -l /var/lib/grafana
total 488
-rw-r----- 1 pi grafana 487424 Aug 18 16:05 grafana.db
drwxr-x--- 2 pi grafana 4096 Aug 16 14:11 plugins
drwx------ 2 pi grafana 4096 Aug 16 14:11 png
pi@raspberrypi:~ $ ps -aux|grep grafana
grafana 1231 0.4 1.0 926912 40364 ? Ssl 14:39 0:02 /usr/sbin/grafana-server --config=/etc/grafana/grafana.ini --pidfile=/var/run/grafana/grafana-server.pid --packaging=deb cfg:default.paths.logs=/var/log/grafana cfg:default.paths.data=/var/lib/grafana cfg:default.paths.plugins=/var/lib/grafana/plugins cfg:default.paths.provisioning=/etc/grafana/provisioning
pi 1891 0.0 0.0 7348 524 pts/1 S+ 14:50 0:00 grep --color=auto grafana
pi@raspberrypi:~ $ sudo systemctl status grafana-service
Unit grafana-service.service could not be found.
pi@raspberrypi:~ $ sudo systemctl status grafana-server
● grafana-server.service - Grafana instance
Loaded: loaded (/usr/lib/systemd/system/grafana-server.service; disabled; vendor preset: enable
Active: active (running) since Mon 2020-08-24 14:39:48 EEST; 26min ago
Docs: http://docs.grafana.org
Main PID: 1231 (grafana-server)
Tasks: 11 (limit: 4915)
CGroup: /system.slice/grafana-server.service
└─1231 /usr/sbin/grafana-server --config=/etc/grafana/grafana.ini --pidfile=/var/run/gr
Aug 24 14:45:31 raspberrypi grafana-server[1231]: t=2020-08-24T14:45:31+0300 lvl=eror msg="Failed
Aug 24 14:45:31 raspberrypi grafana-server[1231]: t=2020-08-24T14:45:31+0300 lvl=eror msg="Request
Aug 24 14:49:50 raspberrypi grafana-server[1231]: t=2020-08-24T14:49:50+0300 lvl=eror msg="failed
Aug 24 14:49:50 raspberrypi grafana-server[1231]: t=2020-08-24T14:49:50+0300 lvl=eror msg="Problem
Aug 24 14:49:50 raspberrypi grafana-server[1231]: t=2020-08-24T14:49:50+0300 lvl=eror msg="Failed
Aug 24 14:49:50 raspberrypi grafana-server[1231]: t=2020-08-24T14:49:50+0300 lvl=eror msg="failed
Aug 24 14:59:50 raspberrypi grafana-server[1231]: t=2020-08-24T14:59:50+0300 lvl=eror msg="failed
Aug 24 14:59:50 raspberrypi grafana-server[1231]: t=2020-08-24T14:59:50+0300 lvl=eror msg="Problem
Aug 24 14:59:50 raspberrypi grafana-server[1231]: t=2020-08-24T14:59:50+0300 lvl=eror msg="Failed
Aug 24 14:59:50 raspberrypi grafana-server[1231]: t=2020-08-24T14:59:50+0300 lvl=eror msg="failed
lines 1-19/19 (END)
How did you manage to get those files owned by pi instead of grafana? Perhaps you tried various methods of installing, for example, so you somehow got to that situation. They should all be owned by grafana. The solution is to fix the ownership
sudo chown -R grafana:grafana /var/lib/grafana
Then try again. Probably worth restarting grafana, or rebooting, after changing the ownership.
Show us the query you have entered.
Is defauld
really the name or should it be default
?