I'm currently trying to create a database of 3 values from a server to easily check every minute and be able to easily query and display using a tool like Grafana.
Basically the data is
server01,value01,value02,date_time
server02,value01,value02,date_time
server03,value01,value02,date_time
server04,value01,value02,date_time
This script would run every minute or so, and then data displayed in Grafana. Currently I have the MySQL DB setup like this:
+-------------+-------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+-------------+-------------+------+-----+---------+-------+
| server_name | varchar(20) | NO | PRI | | |
| file_count | float | YES | | NULL | |
| file_size | float | YES | | NULL | |
| curtime | datetime | YES | | NULL | |
+-------------+-------------+------+-----+---------+-------+
The problem is, every time the script runs, it inserts the records as new, so I have duplicate server names, which makes data display possible.
If I make the individual server names the columns, can data be inserted so value01 and value02 can be inserted per column, or does insert only work by row?