Grafana and SQLite or InfluxDB on AXC F 2152
On the AXC F 2152, I installed Grafana and I access it via the IP address and port 53000. Then, within the SQLite connection, I enter the path to the *.db file, but I get the error "error checking db: no file exists at the file path". File path is: /opt/plcnext/logs/datalogger/DataLoggerSetValues.db
Also, I saw that it doesn't exist on PLCNext Store InfluxDB as an option for 2152. Is it possible and how to connect Grafana with InfluxDB or the *.db file that is created when creating a Datalogger session. The goal is to display logged data on Grafana either from a *.db file or from the InfluxDB database.
Comments
This might be because the Grafana app is sandboxed on the PLCnext Control device.
Have you checked with the developers of the Grafana app, using the "Contact" button on the app page in the PLCnext Store?
Yes, I tried, but I got a reply that they don't support Grafana Cloud Free and OSS versions.
As the description on the plcnext store states the following:
In addition, the host system folder "/opt/plcnext/logs/grafana" is connected with the app folder "/var/log/grafana/grafana".
and this is not part of the *.ini file for Grafana, but obviously ENV variables, I am interested in how this path can be changed to be "/opt/plcnext/logs/datalogger"?
Only in the case when the *.db file is located at the location "/opt/plcnext/logs/grafana" then the connection is possible, and I need the connection to be possible for the files at the location "/opt/plcnext/logs/datalogger".
I think you asked the official Grafana for help, but the dont provide help for free versions. So we sandboxed the grafana application to be runable on the controller. We do this on plcnext with podman, its very familiar with docker.
If you have the app installed you can navigate to the file and edit it :"/opt/plcnext/appshome/data/60002172000510/docker-compose.yml". Within these file you can find the mounting paths. After you have done your changes, you can restart the controller.
Hi,
I've done it totally different. I downloaded the grafana app and run it without a sandboxed version. It can read the internal database now.
wget https://dl.grafana.com/oss/release/grafana-10.4.2.linux-armv7.tar.gz
tar -zxvf grafana-10.4.2.linux-armv7.tar.gz
cd grafana-v10.4.2
to start by hand, need to leave terminal open:
./bin/grafana-server
Hi,
How to start it automatically after restart?
Hello Everyone,
if you installed Grafana from the PLCnext store, you have the folder "/opt/plcnext/logs/grafana" linked to the container folder "/var/log/grafana/grafana".
You need now to tell the data logger service to save the .db files into that linked folder "/opt/plcnext/logs/grafana". To do this, you need to access the the file system of your PLC and navigate to the service folder of the data logger "/opt/plcnext/projects/PCWE/Services/DataLogger/". There you will find a .config file with the name of the logging service you configured in your PLCnext Engineer project.
Use a text editor to open the .config file and search for the destination field "dst". Modify the file so that the service places the logging files in the linked folder. that means: dst="/opt/plcnext/logs/grafana/<name_of_your_logger_file>.db"
NOTICE: the system may protest that the file is in use or that the user may not have enough rights to make the changes. Please set the PLC to stop before executing any changes to the .config file and try again. It is also necessary to reboot the PLC once the file has been modified.
Once your PLC has been restarted, you can go to grafana and configure your SQLite data source by specifying the path to the linked folder inside the container (/var/log/grafana/grafana/<name_of_your_logger_file>.db). Indicate also that the file should be "read only" in the Path Options field. i.e. mode=ro.
That should be all. Now you can play around with how you will display the logged data in grafana. Remember to consider the time difference of the database vs the displayed time window in case you dont see your data on the first try.
What is the time differnce in the displayed data? Is data streaming also possible?