Skip to content

Instantly share code, notes, and snippets.

@dlangille
Last active August 29, 2022 00:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dlangille/d08f74da7fa883624fa1a76fe35b63df to your computer and use it in GitHub Desktop.
Save dlangille/d08f74da7fa883624fa1a76fe35b63df to your computer and use it in GitHub Desktop.
Importing data from Greeneye Monitor (GEM)
$ mysql -u root -p
mysql> create user gemuser identified by 'gempass'
mysql> create database gem;
mysql> grant usage on gem.* to gemuser@localhost identified by 'gempass';
mysql> grant all privileges on gem.* to gemuser@localhost;
$ cat config.txt
mysql_out = true
mysql_host = localhost
mysql_user = gemuser
mysql_passwd = gempass
[mysql01 dan ~/gem] % ~/gem/btmon3.py --mysql-config 23:05:53
2022/08/28 23:05:55 btmon: 4.0.0
2022/08/28 23:05:55 python: 3.9.13 (main, Jul 16 2022, 12:14:30)
[Clang 13.0.0 (git@github.com:llvm/llvm-project.git llvmorg-13.0.0-0-gd7b669b3a
2022/08/28 23:05:55 platform: freebsd13
2022/08/28 23:05:55 device type: ecm1240
2022/08/28 23:05:55 device list: ['fc']
2022/08/28 23:05:55 packet format: ecm1240bin
2022/08/28 23:05:55 schema: counters
MySQL Error: MySQLdb module could not be imported.
[mysql01 dan ~/gem] % 23:05:55
databases/py-mysqlclient is neeeded
After installation, I got:
[mysql01 dan ~/gem] % ~/gem/btmon3.py --mysql-config --config-file=config.txt 0:02:11
2022/08/29 00:02:14 btmon: 4.0.0
2022/08/29 00:02:14 python: 3.9.13 (main, Jul 16 2022, 12:14:30)
[Clang 13.0.0 (git@github.com:llvm/llvm-project.git llvmorg-13.0.0-0-gd7b669b3a
2022/08/29 00:02:14 platform: freebsd13
2022/08/29 00:02:14 device type: ecm1240
2022/08/29 00:02:14 device list: ['fc']
2022/08/29 00:02:14 packet format: ecm1240bin
2022/08/29 00:02:14 schema: counters
2022/08/29 00:02:14 MYSQL: host: localhost
2022/08/29 00:02:14 MYSQL: username: gemuser
2022/08/29 00:02:14 MYSQL: database: gem
2022/08/29 00:02:14 MYSQL: table: gem.ecm1240bin_counters
2022/08/29 00:02:14 MYSQL: creating database gem
2022/08/29 00:02:14 MYSQL: creating table gem.ecm1240bin_counters
[mysql01 dan ~/gem] % 0:02:15
[mysql01 dan ~/gem] % mysql -u root -p gem 0:03:23
Enter password:
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 198066
Server version: 5.7.38 Source distribution
Copyright (c) 2000, 2022, Oracle and/or its affiliates.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql> show tables;
+---------------------+
| Tables_in_gem |
+---------------------+
| ecm1240bin_counters |
+---------------------+
1 row in set (0.00 sec)
mysql> show columns from ecm1240bin_counters;
+--------------+-------------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+--------------+-------------+------+-----+---------+----------------+
| id | bigint(20) | NO | PRI | NULL | auto_increment |
| time_created | bigint(20) | YES | | NULL | |
| serial | varchar(10) | YES | | NULL | |
| secs | int(11) | YES | | NULL | |
| volts | float | YES | | NULL | |
| ch1_a | float | YES | | NULL | |
| ch2_a | float | YES | | NULL | |
| ch1_aws | bigint(20) | YES | | NULL | |
| ch2_aws | bigint(20) | YES | | NULL | |
| ch1_pws | bigint(20) | YES | | NULL | |
| ch2_pws | bigint(20) | YES | | NULL | |
| aux1_ws | bigint(20) | YES | | NULL | |
| aux2_ws | bigint(20) | YES | | NULL | |
| aux3_ws | bigint(20) | YES | | NULL | |
| aux4_ws | bigint(20) | YES | | NULL | |
| aux5_ws | bigint(20) | YES | | NULL | |
| aux5_volts | float | YES | | NULL | |
+--------------+-------------+------+-----+---------+----------------+
17 rows in set (0.00 sec)
mysql>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment