Saving graphs

Information for the graph definitions are stored in the MySQL database, along with the data that is to be graphed.

I hadn’t gone looking for it before, but after seeing this thread the other day I got some pointers.

You can see from the text below that the config (including the graph name) is held in a table called graph in the database called emoncms.

I’m not suggesting this as a permanent fix, but if you need to get access to your graphs and can’t because there’s a special character in one of them then you can rename the graph by updating this table.

David


pi@emonpi:/etc/emonhub $ sudo mysql
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 477
Server version: 10.3.27-MariaDB-0+deb10u1 Raspbian 10

Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

MariaDB [(none)]> show databases;
+--------------------+
| Database           |
+--------------------+
| emoncms            |
| information_schema |
| mysql              |
| performance_schema |
+--------------------+
4 rows in set (0.003 sec)

MariaDB [(none)]> use emoncms
    Database changed
MariaDB [emoncms]> show tables;
+-------------------+
| Tables_in_emoncms |
+-------------------+
| app_config        |
| dashboard         |
| demandshaper      |
| device            |
| feeds             |
| graph             |
| input             |
| multigraph        |
| postprocess       |
| rememberme        |
| schedule          |
| setup             |
| sync              |
| users             |
+-------------------+
14 rows in set (0.001 sec)

MariaDB [emoncms]> show fields from graph;
+---------+---------+------+-----+---------+----------------+
| Field   | Type    | Null | Key | Default | Extra          |
+---------+---------+------+-----+---------+----------------+
| id      | int(11) | NO   | PRI | NULL    | auto_increment |
| userid  | int(11) | YES  |     | NULL    |                |
| groupid | int(11) | YES  |     | 0       |                |
| data    | text    | YES  |     | NULL    |                |
+---------+---------+------+-----+---------+----------------+
4 rows in set (0.007 sec)

MariaDB [emoncms]> select * from graph;
+----+--------+---------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| id | userid | groupid | data                                                                                                                                                                                                                                                                                                                                                                               |
+----+--------+---------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|  7 |      1 |       0 | {"name":"Test graph","start":1618759800000,"end":1619365500000,"interval":900,"mode":"interval","fixinterval":false,"floatingtime":1,"yaxismin":"auto","yaxismax":"auto","yaxismin2":"auto","yaxismax2":"auto","showmissing":false,"showtag":true,"showlegend":true,"showcsv":0,"csvtimeformat":"datestr","csvnullvalues":"show","csvheaders":"showNameTag","feedlist":[],"id":""} |
+----+--------+---------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
1 row in set (0.001 sec)
2 Likes