Exemple #1
0
 def list(self):
     self.parser.add_argument('--unit-type',
                              help='Type of unit valid value\
                                                  is docker',
                              required=True)
     self.parser.add_argument('--search-type',
                              help='search type',
                              required=False)
     self.parser.add_argument('--search-string',
                              help='search string',
                              required=False)
     args = self.parser.parse_args()
     unit_type = vars(args)['unit_type']
     search_type = vars(args)['search_type']
     search_string = vars(args)['search_string']
     data = {
         'unit_type': unit_type,
         'search_type': search_type,
         'search_string': search_string
     }
     galaxia_api_endpoint = os.getenv("galaxia_api_endpoint")
     target_url = client.concatenate_url(galaxia_api_endpoint,
                                         self.catalogue_uri)
     resp = client.http_request('GET', target_url, self.headers, data)
     if unit_type == 'container':
         format_print.format_dict(resp.json(), "keys")
     if unit_type == 'dashboard':
         format_print.format_dict(resp.json(), "keys")
     if unit_type == 'exporter':
         header = ["EXPORTER_NAME", "EXPORTER_ID"]
         format_print.format_dict(resp.json(), header)
     if unit_type == 'node':
         header = ["Instance_Name", "Host_Name"]
         format_print.format_dict(resp.json(), header)
Exemple #2
0
 def list(self):
     self.parser.add_argument('--unit-type', help='Type of unit valid value\
                                                  is docker', required=True)
     self.parser.add_argument('--search-type', help='search type', required=False)
     self.parser.add_argument('--search-string', help='search string', required=False)
     args = self.parser.parse_args()
     unit_type = vars(args)['unit_type']
     search_type = vars(args)['search_type']
     search_string = vars(args)['search_string']
     data = {'unit_type': unit_type, 'search_type': search_type, 'search_string': search_string}
     galaxia_api_endpoint = os.getenv("galaxia_api_endpoint")
     target_url = client.concatenate_url(galaxia_api_endpoint,
                                         self.catalogue_uri)
     resp = client.http_request('GET', target_url, self.headers, data)
     if unit_type == 'container':
         #header = ["Container", "Host", "ImageName", "ID"]
         format_print.format_dict(resp.json(), "keys")
     if unit_type == 'dashboard':
         header = ["Name", "Dashboard_url"]
         format_print.format_dict(resp.json(), header)
     if unit_type == 'exporter':
         header = ["EXPORTER_NAME", "EXPORTER_ID"]
         format_print.format_dict(resp.json(), header)
     if unit_type == 'node':
         header = ["Instance_Name", "Host_Name"]
         format_print.format_dict(resp.json(), header)
    def update(self):
        self.parser.add_argument('--name', help='Name of the dashboard',
                                 required=True)
        self.parser.add_argument('--metrics-list', help='List of \
                                metrics to be displayed on the dashboard',
                                 required=True)
        self.parser.add_argument('--names-list', help='Names list of \
                                units to plot in dashboard')
        self.parser.add_argument('--search-string', help='Search String')
        self.parser.add_argument('--search-type', help='Search String')
        self.parser.add_argument('--unit-type', help='Type of unit,\
                                                     valid value is docker')
        self.parser.add_argument('--exclude', help='Search excluding search string', required=False)
        args = self.parser.parse_args()
        if not (args.names_list or (args.search_string and args.search_type)):
            self.parser.error('add --names-list or (--search-string and\
                              --search-type)')

        json_data = client.create_request_data(**vars(args))
        galaxia_api_endpoint = os.getenv("galaxia_api_endpoint")
        target_url = client.concatenate_url(galaxia_api_endpoint, self.url)
        try:
            resp = client.http_request('POST', target_url, self.headers,
                                       json_data)
            print resp.text
        except Exception as ex:
            pass
Exemple #4
0
 def list(self):
     self.parser.add_argument('--unit-type',
                              help='Type of unit valid value\
                                                  is docker',
                              required=True)
     self.parser.add_argument('--search-type',
                              help='search type',
                              required=False)
     self.parser.add_argument('--search-string',
                              help='search string',
                              required=False)
     self.parser.add_argument('--meter-name',
                              help='Name of the meter',
                              required=True)
     args = self.parser.parse_args()
     unit_type = vars(args)['unit_type']
     search_type = vars(args)['search_type']
     search_string = vars(args)['search_string']
     meter_name = vars(args)['meter_name']
     data = {
         'unit_type': unit_type,
         'search_type': search_type,
         'search_string': search_string,
         'meter_name': meter_name
     }
     galaxia_api_endpoint = os.getenv("galaxia_api_endpoint")
     target_url = client.concatenate_url(galaxia_api_endpoint,
                                         self.status_uri)
     resp = client.http_request('GET', target_url, self.headers, data)
     #        format_print.format_dict(resp.json(), "keys") TODO  We need a better printing done here for nested json
     print resp.json()
Exemple #5
0
 def agent(self):
     self.parser.add_argument('--unit-type',
                              help='Type of unit valid value\
                                                  is docker',
                              required=True)
     self.parser.add_argument('--host', help='host', required=True)
     self.parser.add_argument('--port', help='port', required=True)
     self.parser.add_argument('--instance-key',
                              help='Name of the meter',
                              required=False)
     self.parser.add_argument('--job-name',
                              help='Name of the meter',
                              required=True)
     args = self.parser.parse_args()
     unit_type = vars(args)['unit_type']
     host = vars(args)['host']
     port = vars(args)['port']
     job_name = vars(args)['job_name']
     instance_key = vars(args)['instance_key']
     data = {
         'unit_type': unit_type,
         'host': host,
         'port': port,
         'job_name': job_name,
         'instance_key': instance_key
     }
     galaxia_api_endpoint = os.getenv("galaxia_api_endpoint")
     target_url = client.concatenate_url(galaxia_api_endpoint,
                                         self.status_uri)
     resp = client.http_request('POST', target_url, self.headers,
                                json.dumps(data))
     format_print.format_dict(resp.json(), "keys")
Exemple #6
0
 def list(self):
     self.parser.add_argument('--unit-type',
                              help='Type of unit valid value\
                                                  is docker',
                              required=True)
     self.parser.add_argument('--search-type',
                              help='search type',
                              required=False)
     self.parser.add_argument('--search-string',
                              help='search string',
                              required=False)
     self.parser.add_argument('--time-interval',
                              help='Time Interval',
                              required=False)
     args = self.parser.parse_args()
     unit_type = vars(args)['unit_type']
     search_type = vars(args)['search_type']
     search_string = vars(args)['search_string']
     time_interval = vars(args)['time_interval']
     data = {
         'unit_type': unit_type,
         'search_type': search_type,
         'search_string': search_string,
         'time_interval': time_interval
     }
     galaxia_api_endpoint = os.getenv("galaxia_api_endpoint")
     target_url = client.concatenate_url(galaxia_api_endpoint,
                                         self.status_uri)
     resp = client.http_request('GET', target_url, self.headers, data)
     if unit_type == 'container':
         #header = ["Container", "Host", "ImageName", "ID"]
         format_print.format_dict(resp.json(), "keys")
Exemple #7
0
    def update(self):
        self.parser.add_argument('--name',
                                 help='Name of the dashboard',
                                 required=True)
        self.parser.add_argument('--metrics-list',
                                 help='List of \
                                metrics to be displayed on the dashboard',
                                 required=True)
        self.parser.add_argument('--names-list',
                                 help='Names list of \
                                units to plot in dashboard')
        self.parser.add_argument('--search-string', help='Search String')
        self.parser.add_argument('--search-type', help='Search String')
        self.parser.add_argument('--unit-type',
                                 help='Type of unit,\
                                                     valid value is docker')
        self.parser.add_argument('--exclude',
                                 help='Search excluding search string',
                                 required=False)
        args = self.parser.parse_args()
        if not (args.names_list or (args.search_string and args.search_type)):
            self.parser.error('add --names-list or (--search-string and\
                              --search-type)')

        json_data = client.create_request_data(**vars(args))
        galaxia_api_endpoint = os.getenv("galaxia_api_endpoint")
        target_url = client.concatenate_url(galaxia_api_endpoint, self.url)
        try:
            resp = client.http_request('POST', target_url, self.headers,
                                       json_data)
            print resp.text
        except Exception as ex:
            pass
Exemple #8
0
 def sample(self):
     resp = None
     self.parser.add_argument('--type',
                              help="Type of unit valid values are\
                             containers, nodes",
                              choices=['container'],
                              required=True)
     self.parser.add_argument('--search-string',
                              help='Search String',
                              required=False)
     self.parser.add_argument('--search-type',
                              help='Search String',
                              required=False)
     self.parser.add_argument('--meter-name',
                              help='Name of the meter',
                              required=True)
     args = self.parser.parse_args()
     data = {
         "type": vars(args)['type'],
         "search_string": vars(args)['search_string'],
         "search_type": vars(args)['search_type'],
         "meter_name": vars(args)['meter_name']
     }
     galaxia_api_endpoint = os.getenv("galaxia_api_endpoint")
     target_url = client.concatenate_url(galaxia_api_endpoint,
                                         self.sample_uri)
     try:
         resp = client.http_request('GET', target_url, self.headers, data)
         headers = ["NAME", "VALUE"]
         print "Current " + vars(args)['meter_name']
         #print "Current "+unit_type
         format_print.format_dict(resp.json(), headers)
     except Exception as ex:
         pass
Exemple #9
0
    def create(self):
        self.parser.add_argument('--source-system',
                                 help='Source system',
                                 required=True)
        self.parser.add_argument('--target-system',
                                 help='Target system',
                                 required=True)
        self.parser.add_argument('--metrics-list',
                                 help='List of metrics to\
                                                        export',
                                 required=True)
        self.parser.add_argument('--time-interval',
                                 help='Time interval\
                                        in which to push metrics to target\
                                                         system',
                                 required=True)
        self.parser.add_argument('--unit-type',
                                 help='Type of unit valid value\
                                                     is docker',
                                 required=True)
        self.parser.add_argument('--exporter-name',
                                 help='Unique Name for\
                                                    exporter',
                                 required=True)

        args = self.parser.parse_args()
        json_data = client.create_request_data(**vars(args))
        galaxia_api_endpoint = os.getenv("galaxia_api_endpoint")
        target_url = client.concatenate_url(galaxia_api_endpoint,
                                            self.exporter_uri)
        resp = client.http_request('POST', target_url, self.headers, json_data)
        print resp.text
 def delete(self):
     self.parser.add_argument('--name', help='Name of the dashboard',
                              required=True)
     args = self.parser.parse_args()
     json_data = client.create_request_data(**vars(args))
     galaxia_api_endpoint = os.getenv("galaxia_api_endpoint")
     target_url = client.concatenate_url(galaxia_api_endpoint, self.url)
     try:
         resp = client.http_request('DELETE', target_url, self.headers,
                                    json_data)
         print resp.text
     except Exception as ex:
         pass
Exemple #11
0
 def delete(self):
     self.parser.add_argument('--name', help='Name of the dashboard',
                              required=True)
     args = self.parser.parse_args()
     json_data = client.create_request_data(**vars(args))
     galaxia_api_endpoint = os.getenv("galaxia_api_endpoint")
     target_url = client.concatenate_url(galaxia_api_endpoint, self.url)
     try:
         resp = client.http_request('DELETE', target_url, self.headers,
                                    json_data)
         print resp.text
     except Exception as ex:
         pass
 def list(self):
     resp = None
     self.parser.add_argument('--type', help="Type of unit valid values are\
                             containers, nodes", required=True)
     args = self.parser.parse_args()
     unit_type = vars(args)['type']
     data = {"sub_type": unit_type}
     galaxia_api_endpoint = os.getenv("galaxia_api_endpoint")
     target_url = client.concatenate_url(galaxia_api_endpoint, self.metrics_uri)
     try:
         resp = client.http_request('GET', target_url, self.headers, data)
         headers = ["NAME", "DESCRIPTION"]
         print "List of supported metrics for "+unit_type
         format_print.format_dict(resp.json(), headers)
     except Exception as ex:
         pass
Exemple #13
0
 def list(self):
     resp = None
     self.parser.add_argument('--type', help="Type of unit valid values are\
                             containers, nodes", choices=['container'], required=True)
     args = self.parser.parse_args()
     unit_type = vars(args)['type']
     data = {"type": unit_type}
     galaxia_api_endpoint = os.getenv("galaxia_api_endpoint")
     target_url = client.concatenate_url(galaxia_api_endpoint, self.metrics_uri)
     try:
         resp = client.http_request('GET', target_url, self.headers, data)
         headers = ["NAME", "DESCRIPTION"]
         print "List of supported metrics for "+unit_type
         format_print.format_dict(resp.json(), headers)
     except Exception as ex:
         pass
    def list(self):
        self.parser.add_argument('--unit-type', help='Type of unit valid value\
                                                     is docker', required=True)
        self.parser.add_argument('--search-type', help='search type', required=False)
        self.parser.add_argument('--search-string', help='search string', required=False)
        self.parser.add_argument('--meter-name', help='Name of the meter', required=True)
        args = self.parser.parse_args()
        unit_type = vars(args)['unit_type']
        search_type = vars(args)['search_type']
        search_string = vars(args)['search_string']
        meter_name = vars(args)['meter_name']
        data = {'unit_type': unit_type, 'search_type': search_type, 'search_string': search_string, 'meter_name': meter_name}
        galaxia_api_endpoint = os.getenv("galaxia_api_endpoint")
        target_url = client.concatenate_url(galaxia_api_endpoint,
                                            self.status_uri)
        resp = client.http_request('GET', target_url, self.headers, data)
#        format_print.format_dict(resp.json(), "keys") TODO  We need a better printing done here for nested json
        print resp.json()
 def agent(self):
     self.parser.add_argument('--unit-type', help='Type of unit valid value\
                                                  is docker', required=True)
     self.parser.add_argument('--host', help='host', required=True)
     self.parser.add_argument('--port', help='port', required=True)
     self.parser.add_argument('--instance-key', help='Name of the meter', required=False)
     self.parser.add_argument('--job-name', help='Name of the meter', required=True)
     args = self.parser.parse_args()
     unit_type = vars(args)['unit_type']
     host = vars(args)['host']
     port = vars(args)['port']
     job_name = vars(args)['job_name']
     instance_key =  vars(args)['instance_key']
     data = {'unit_type': unit_type, 'host': host, 'port': port, 'job_name': job_name, 'instance_key': instance_key }
     galaxia_api_endpoint = os.getenv("galaxia_api_endpoint")
     target_url = client.concatenate_url(galaxia_api_endpoint,
                                         self.status_uri)
     resp = client.http_request('POST', target_url, self.headers, json.dumps(data))
     format_print.format_dict(resp.json(), "keys")
 def list(self):
     self.parser.add_argument('--unit-type', help='Type of unit valid value\
                                                  is docker', required=True)
     self.parser.add_argument('--search-type', help='search type', required=False)
     self.parser.add_argument('--search-string', help='search string', required=False)
     self.parser.add_argument('--time-interval', help='Time Interval', required=False)
     args = self.parser.parse_args()
     unit_type = vars(args)['unit_type']
     search_type = vars(args)['search_type']
     search_string = vars(args)['search_string']
     time_interval = vars(args)['time_interval']
     data = {'unit_type': unit_type, 'search_type': search_type, 'search_string': search_string, 'time_interval': time_interval}
     galaxia_api_endpoint = os.getenv("galaxia_api_endpoint")
     target_url = client.concatenate_url(galaxia_api_endpoint,
                                         self.status_uri)
     resp = client.http_request('GET', target_url, self.headers, data)
     if unit_type == 'container':
         #header = ["Container", "Host", "ImageName", "ID"]
         format_print.format_dict(resp.json(), "keys")
 def sample(self):
     resp = None
     self.parser.add_argument('--type', help="Type of unit valid values are\
                             containers, nodes", required=True)
     self.parser.add_argument('--search-string', help='Search String', required=False)
     self.parser.add_argument('--search-type', help='Search String', required=False)
     self.parser.add_argument('--meter-name', help='Name of the meter', required=True)
     args = self.parser.parse_args()
     data = {"type": vars(args)['type'], "search_string": vars(args)['search_string'],
             "search_type": vars(args)['search_type'] , "meter_name": vars(args)['meter_name']}
     galaxia_api_endpoint = os.getenv("galaxia_api_endpoint")
     target_url = client.concatenate_url(galaxia_api_endpoint, self.sample_uri)
     try:
         resp = client.http_request('GET', target_url, self.headers, data)
         headers = ["NAME", "VALUE"]
         print "Current "+ vars(args)['meter_name']
         #print "Current "+unit_type
         format_print.format_dict(resp.json(), headers)
     except Exception as ex:
         pass
    def create(self):
        self.parser.add_argument('--source-system', help='Source system',
                                 required=True)
        self.parser.add_argument('--target-system', help='Target system',
                                 required=True)
        self.parser.add_argument('--metrics-list', help='List of metrics to\
                                                        export', required=True)
        self.parser.add_argument('--time-interval', help='Time interval\
                                        in which to push metrics to target\
                                                         system', required=True)
        self.parser.add_argument('--unit-type', help='Type of unit valid value\
                                                     is docker', required=True)
        self.parser.add_argument('--exporter-name', help='Unique Name for\
                                                    exporter', required=True)

        args = self.parser.parse_args()
        json_data = client.create_request_data(**vars(args))
        galaxia_api_endpoint = os.getenv("galaxia_api_endpoint")
        target_url = client.concatenate_url(galaxia_api_endpoint,
                                            self.exporter_uri)
        resp = client.http_request('POST', target_url, self.headers,
                                   json_data)
        print resp.text