예제 #1
0
    def __init__(self):
        MainParser.__init__(self)

        self.add_argument('v',
                          'verbose',
                          flag=True,
                          action=enable_log,
                          default=logging.NOTSET,
                          help='enable verbose mode')
        self.add_argument('s',
                          'stream',
                          flag=True,
                          action=store_true,
                          default=False,
                          help='enable stream mode')

        subparser_mongo_input = ComponentSubParser('mongodb')
        subparser_mongo_input.add_argument('u',
                                           'uri',
                                           help='sepcify MongoDB uri')
        subparser_mongo_input.add_argument(
            'd', 'db', help='specify MongoDB database name')
        subparser_mongo_input.add_argument(
            'c', 'collection', help='specify MongoDB database collection')
        subparser_mongo_input.add_argument(
            'm',
            'model',
            help='specify data type that will be storen in the database',
            default='hwpc_report')

        subparser_mongo_output = ComponentSubParser('mongodb')
        subparser_mongo_output.add_argument('u',
                                            'uri',
                                            help='sepcify MongoDB uri')
        subparser_mongo_output.add_argument(
            'd', 'db', help='specify MongoDB database name')
        subparser_mongo_output.add_argument(
            'c', 'collection', help='specify MongoDB database collection')
        subparser_mongo_output.add_argument(
            'm',
            'model',
            help='specify data type that will be storen in the database',
            default='power_report')

        self.add_component_subparser(
            'output',
            subparser_mongo_output,
            help_str=
            'specify a database output : --db_output database_name ARG1 ARG2 ...'
        )
        self.add_component_subparser(
            'input',
            subparser_mongo_input,
            help_str=
            'specify a database input : --db_output database_name ARG1 ARG2 ... '
        )
예제 #2
0
    def __init__(self):
        MainParser.__init__(self)

        self.add_argument('v',
                          'verbose',
                          flag=True,
                          action=enable_log,
                          default=logging.NOTSET,
                          help='enable verbose mode')
        self.add_argument('s',
                          'stream',
                          flag=True,
                          action=store_true,
                          default=False,
                          help='enable stream mode')

        subparser_mongo_input = ComponentSubParser('mongodb')
        subparser_mongo_input.add_argument('u',
                                           'uri',
                                           help='sepcify MongoDB uri')
        subparser_mongo_input.add_argument(
            'd',
            'db',
            help='specify MongoDB database name',
        )
        subparser_mongo_input.add_argument(
            'c', 'collection', help='specify MongoDB database collection')
        subparser_mongo_input.add_argument('n',
                                           'name',
                                           help='specify puller name',
                                           default='puller_mongodb')
        subparser_mongo_input.add_argument(
            'm',
            'model',
            help='specify data type that will be storen in the database',
            default='HWPCReport')
        self.add_component_subparser(
            'input',
            subparser_mongo_input,
            help_str=
            'specify a database input : --db_output database_name ARG1 ARG2 ... '
        )

        subparser_socket_input = ComponentSubParser('socket')
        subparser_socket_input.add_argument(
            'p', 'port', help='specify port to bind the socket')
        subparser_socket_input.add_argument('n',
                                            'name',
                                            help='specify puller name',
                                            default='puller_socket')
        subparser_socket_input.add_argument(
            'm',
            'model',
            help='specify data type that will be sent through the socket',
            default='HWPCReport')
        self.add_component_subparser(
            'input',
            subparser_socket_input,
            help_str=
            'specify a database input : --db_output database_name ARG1 ARG2 ... '
        )

        subparser_csv_input = ComponentSubParser('csv')
        subparser_csv_input.add_argument(
            'f',
            'files',
            help='specify input csv files with this format : file1,file2,file3',
            action=extract_file_names,
            default=[],
            check=check_csv_files,
            check_msg='one or more csv files couldn\'t be read')
        subparser_csv_input.add_argument(
            'm',
            'model',
            help='specify data type that will be storen in the database',
            default='HWPCReport')
        subparser_csv_input.add_argument('n',
                                         'name',
                                         help='specify puller name',
                                         default='puller_csv')
        self.add_component_subparser(
            'input',
            subparser_csv_input,
            help_str=
            'specify a database input : --db_output database_name ARG1 ARG2 ... '
        )

        subparser_mongo_output = ComponentSubParser('mongodb')
        subparser_mongo_output.add_argument('u',
                                            'uri',
                                            help='sepcify MongoDB uri')
        subparser_mongo_output.add_argument(
            'd', 'db', help='specify MongoDB database name')
        subparser_mongo_output.add_argument(
            'c', 'collection', help='specify MongoDB database collection')

        subparser_mongo_output.add_argument(
            'm',
            'model',
            help='specify data type that will be storen in the database',
            default='PowerReport')
        subparser_mongo_output.add_argument('n',
                                            'name',
                                            help='specify puller name',
                                            default='pusher_mongodb')
        self.add_component_subparser(
            'output',
            subparser_mongo_output,
            help_str=
            'specify a database output : --db_output database_name ARG1 ARG2 ...'
        )

        subparser_csv_output = ComponentSubParser('csv')
        subparser_csv_output.add_argument(
            'd',
            'directory',
            help=
            'specify directory where where output  csv files will be writen')
        subparser_csv_output.add_argument(
            'm',
            'model',
            help='specify data type that will be storen in the database',
            default='PowerReport')
        subparser_csv_output.add_argument('n',
                                          'name',
                                          help='specify puller name',
                                          default='pusher_csv')
        self.add_component_subparser(
            'output',
            subparser_csv_output,
            help_str=
            'specify a database input : --db_output database_name ARG1 ARG2 ... '
        )

        subparser_influx_output = ComponentSubParser('influxdb')
        subparser_influx_output.add_argument('u',
                                             'uri',
                                             help='sepcify InfluxDB uri')
        subparser_influx_output.add_argument(
            'd', 'db', help='specify InfluxDB database name')
        subparser_influx_output.add_argument(
            'p', 'port', help='specify InfluxDB connection port', type=int)
        subparser_influx_output.add_argument(
            'm',
            'model',
            help='specify data type that will be storen in the database',
            default='PowerReport')
        subparser_influx_output.add_argument('n',
                                             'name',
                                             help='specify puller name',
                                             default='pusher_influxdb')
        self.add_component_subparser(
            'output',
            subparser_influx_output,
            help_str=
            'specify a database input : --db_output database_name ARG1 ARG2 ... '
        )

        subparser_opentsdb_output = ComponentSubParser('opentsdb')
        subparser_opentsdb_output.add_argument('u',
                                               'uri',
                                               help='sepcify openTSDB host')
        subparser_opentsdb_output.add_argument(
            'p', 'port', help='specify openTSDB connection port', type=int)
        subparser_opentsdb_output.add_argument('metric_name',
                                               help='specify metric name')

        subparser_opentsdb_output.add_argument(
            'm',
            'model',
            help='specify data type that will be storen in the database',
            default='PowerReport')
        subparser_opentsdb_output.add_argument('n',
                                               'name',
                                               help='specify puller name',
                                               default='pusher_opentsdb')
        self.add_component_subparser(
            'output',
            subparser_opentsdb_output,
            help_str=
            'specify a database input : --db_output database_name ARG1 ARG2 ... '
        )
예제 #3
0
    def __init__(self):
        MainParser.__init__(self)

        self.add_argument('v',
                          'verbose',
                          flag=True,
                          action=enable_log,
                          default=logging.NOTSET,
                          help='enable verbose mode')
        self.add_argument('s',
                          'stream',
                          flag=True,
                          action=store_true,
                          default=False,
                          help='enable stream mode')

        subparser_mongo_input = ComponentSubParser('mongodb')
        subparser_mongo_input.add_argument('u',
                                           'uri',
                                           help='specify MongoDB uri')
        subparser_mongo_input.add_argument(
            'd',
            'db',
            help='specify MongoDB database name',
        )
        subparser_mongo_input.add_argument(
            'c', 'collection', help='specify MongoDB database collection')
        subparser_mongo_input.add_argument('n',
                                           'name',
                                           help='specify puller name',
                                           default='puller_mongodb')
        subparser_mongo_input.add_argument(
            'm',
            'model',
            help='specify data type that will be storen in the database',
            default='HWPCReport')
        self.add_component_subparser(
            'input',
            subparser_mongo_input,
            help_str=
            'specify a database input : --db_output database_name ARG1 ARG2 ... '
        )

        subparser_socket_input = ComponentSubParser('socket')
        subparser_socket_input.add_argument(
            'p', 'port', help='specify port to bind the socket')
        subparser_socket_input.add_argument('n',
                                            'name',
                                            help='specify puller name',
                                            default='puller_socket')
        subparser_socket_input.add_argument(
            'm',
            'model',
            help='specify data type that will be sent through the socket',
            default='HWPCReport')
        self.add_component_subparser(
            'input',
            subparser_socket_input,
            help_str=
            'specify a database input : --db_output database_name ARG1 ARG2 ... '
        )

        subparser_daemon_input = ComponentSubParser('tcp')
        subparser_daemon_input.add_argument('p',
                                            'port',
                                            help='specify the port to connect')
        subparser_daemon_input.add_argument('n',
                                            'name',
                                            help='specify puller name',
                                            default="puller_tcp")
        subparser_daemon_input.add_argument(
            'u',
            'uri',
            help='specify the address of the puller',
            default='localhost')
        subparser_daemon_input.add_argument(
            'm',
            'model',
            help='specify data type that will be sent through the socket',
            default='HWPCReport')

        self.add_component_subparser(
            'input',
            subparser_daemon_input,
            help_str='specify a tcp input : -p 8000 -a localhost ... ')

        subparser_csv_input = ComponentSubParser('csv')
        subparser_csv_input.add_argument(
            'f',
            'files',
            help='specify input csv files with this format : file1,file2,file3',
            action=extract_file_names,
            default=[],
            check=check_csv_files,
            check_msg='one or more csv files couldn\'t be read')
        subparser_csv_input.add_argument(
            'm',
            'model',
            help='specify data type that will be storen in the database',
            default='HWPCReport')
        subparser_csv_input.add_argument('n',
                                         'name',
                                         help='specify puller name',
                                         default='puller_csv')
        self.add_component_subparser(
            'input',
            subparser_csv_input,
            help_str=
            'specify a database input : --db_output database_name ARG1 ARG2 ... '
        )

        subparser_mongo_output = ComponentSubParser('mongodb')
        subparser_mongo_output.add_argument('u',
                                            'uri',
                                            help='specify MongoDB uri')
        subparser_mongo_output.add_argument(
            'd', 'db', help='specify MongoDB database name')
        subparser_mongo_output.add_argument(
            'c', 'collection', help='specify MongoDB database collection')

        subparser_mongo_output.add_argument(
            'm',
            'model',
            help='specify data type that will be storen in the database',
            default='PowerReport')
        subparser_mongo_output.add_argument('n',
                                            'name',
                                            help='specify puller name',
                                            default='pusher_mongodb')
        self.add_component_subparser(
            'output',
            subparser_mongo_output,
            help_str=
            'specify a database output : --db_output database_name ARG1 ARG2 ...'
        )

        subparser_prom_output = ComponentSubParser('prom')
        subparser_prom_output.add_argument('a',
                                           'addr',
                                           help='specify server address')
        subparser_prom_output.add_argument('p',
                                           'port',
                                           help='specify server port',
                                           type=int)
        subparser_prom_output.add_argument('M',
                                           'metric_name',
                                           help='speify metric name')
        subparser_prom_output.add_argument('d',
                                           'metric_description',
                                           help='specify metric description',
                                           default='energy consumption')
        subparser_prom_output.add_argument(
            'A',
            'aggregation_period',
            help=
            'specify number of second for the value must be aggregated before compute statistics on them',
            default=15,
            type=int)

        subparser_prom_output.add_argument(
            'm',
            'model',
            help='specify data type that will be storen in the database',
            default='PowerReport')
        subparser_prom_output.add_argument('n',
                                           'name',
                                           help='specify puller name',
                                           default='pusher_prom')
        self.add_component_subparser(
            'output',
            subparser_prom_output,
            help_str=
            'specify a database output : --db_output database_name ARG1 ARG2 ...'
        )

        subparser_csv_output = ComponentSubParser('csv')
        subparser_csv_output.add_argument(
            'd',
            'directory',
            help=
            'specify directory where where output  csv files will be writen')
        subparser_csv_output.add_argument(
            'm',
            'model',
            help='specify data type that will be storen in the database',
            default='PowerReport')
        subparser_csv_output.add_argument('n',
                                          'name',
                                          help='specify puller name',
                                          default='pusher_csv')
        self.add_component_subparser(
            'output',
            subparser_csv_output,
            help_str=
            'specify a database input : --db_output database_name ARG1 ARG2 ... '
        )

        subparser_influx_output = ComponentSubParser('influxdb')
        subparser_influx_output.add_argument('u',
                                             'uri',
                                             help='specify InfluxDB uri')
        subparser_influx_output.add_argument(
            'd', 'db', help='specify InfluxDB database name')
        subparser_influx_output.add_argument(
            'p', 'port', help='specify InfluxDB connection port', type=int)
        subparser_influx_output.add_argument(
            'm',
            'model',
            help='specify data type that will be storen in the database',
            default='PowerReport')
        subparser_influx_output.add_argument('n',
                                             'name',
                                             help='specify puller name',
                                             default='pusher_influxdb')
        self.add_component_subparser(
            'output',
            subparser_influx_output,
            help_str=
            'specify a database input : --db_output database_name ARG1 ARG2 ... '
        )

        subparser_opentsdb_output = ComponentSubParser('opentsdb')
        subparser_opentsdb_output.add_argument('u',
                                               'uri',
                                               help='specify openTSDB host')
        subparser_opentsdb_output.add_argument(
            'p', 'port', help='specify openTSDB connection port', type=int)
        subparser_opentsdb_output.add_argument('metric_name',
                                               help='specify metric name')

        subparser_opentsdb_output.add_argument(
            'm',
            'model',
            help='specify data type that will be storen in the database',
            default='PowerReport')
        subparser_opentsdb_output.add_argument('n',
                                               'name',
                                               help='specify puller name',
                                               default='pusher_opentsdb')
        self.add_component_subparser(
            'output',
            subparser_opentsdb_output,
            help_str=
            'specify a database input : --db_output database_name ARG1 ARG2 ... '
        )

        subparser_tcp_output = ComponentSubParser('tcp')
        subparser_tcp_output.add_argument('p', 'port', help="the port to bind")
        subparser_tcp_output.add_argument('u',
                                          'uri',
                                          help="the address to bind",
                                          default="0.0.0.0")
        subparser_tcp_output.add_argument(
            'm',
            'model',
            help='specify data type that will be send in the stream',
            default='PowerReport')
        subparser_tcp_output.add_argument('n',
                                          'name',
                                          help='specify pusher name',
                                          default='pusher_tcp')
        self.add_component_subparser(
            'output',
            subparser_tcp_output,
            help_str='specify a tcp output : -p 8001 -m PowerReport ... ')