|
38 | 38 | from powerapi.cli.parser import BadTypeException, BadContextException
|
39 | 39 | from powerapi.cli.parser import UnknowArgException
|
40 | 40 | from powerapi.report_model import HWPCModel, PowerModel
|
41 |
| -from powerapi.database import MongoDB, CsvDB |
| 41 | +from powerapi.database import MongoDB, CsvDB, InfluxDB |
42 | 42 | from powerapi.puller import PullerActor
|
43 | 43 | from powerapi.pusher import PusherActor
|
44 | 44 |
|
@@ -88,7 +88,12 @@ def __init__(self):
|
88 | 88 | subparser_csv_output.add_argument('m', 'model', help='specify data type that will be storen in the database', default='power_report')
|
89 | 89 | self.add_component_subparser('output', subparser_csv_output, help_str='specify a database input : --db_output database_name ARG1 ARG2 ... ')
|
90 | 90 |
|
91 |
| - |
| 91 | + subparser_influx_output = ComponentSubParser('influxdb') |
| 92 | + subparser_influx_output.add_argument('u', 'uri', help='sepcify InfluxDB uri') |
| 93 | + subparser_influx_output.add_argument('d', 'db', help='specify InfluxDB database name') |
| 94 | + subparser_influx_output.add_argument('p', 'port', help='specify InfluxDB connection port', type=int) |
| 95 | + subparser_influx_output.add_argument('m', 'model', help='specify data type that will be storen in the database', default='power_report') |
| 96 | + self.add_component_subparser('output', subparser_influx_output, help_str='specify a database input : --db_output database_name ARG1 ARG2 ... ') |
92 | 97 |
|
93 | 98 |
|
94 | 99 | def parse_argv(self):
|
@@ -124,7 +129,8 @@ def parse_argv(self):
|
124 | 129 |
|
125 | 130 | DB_FACTORY = {
|
126 | 131 | 'mongodb': lambda db_config: MongoDB(db_config['uri'], db_config['db'], db_config['collection']),
|
127 |
| - 'csv': lambda db_config: CsvDB(current_path=os.getcwd() if 'directory' not in db_config else db_config['directory'], files=[] if 'files' not in db_config else db_config['files']) |
| 132 | + 'csv': lambda db_config: CsvDB(current_path=os.getcwd() if 'directory' not in db_config else db_config['directory'], files=[] if 'files' not in db_config else db_config['files']), |
| 133 | + 'influxdb': lambda db_config: InfluxDB(db_config['uri'], db_config['port'], db_config['db']), |
128 | 134 | }
|
129 | 135 |
|
130 | 136 |
|
|
0 commit comments