I am confused with the approach i need to write a python/any script that this needs to be dealt with the below situation.
I generate a text file from the server with column name, time-stamp, server name and column value
cpunumber 1437501780 l09fr01 40.0
cpunice 1437501780 l09fr01 0.0
cpusystem 1437501780 l09fr01 0.0
cpuwait 1437501780 l09fr01 0.0
cpuuser 1437501780 l09fr01 1.0
cpudile 1437501780 l09fr01 0.0
The table that i need to insert these values is given below. Load id is something i would populate uniquely within the program. What is the best way to parse the above information and load it in the table?
CREATE TABLE `test`.`cpu_util_all` (
`loadid` INT NOT NULL,
`servername` VARCHAR(45) NOT NULL,
`date_time` DATETIME NOT NULL,
`cpu_number` DECIMAL(10,2) NULL,
`cpu_user` DECIMAL(10,2) NULL,
`cpu_nice` DECIMAL(10,2) NULL,
`cpu_system` DECIMAL(10,2) NULL,
`cpu_wait` DECIMAL(10,2) NULL,
`cpu_idle` DECIMAL(10,2) NULL,
PRIMARY KEY (`loadid`, `servername`, `date_time`,`cpu_user`));