Beispiel #1
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")
Beispiel #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)
     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")
Beispiel #3
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
Beispiel #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)
     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)
Beispiel #5
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 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
Beispiel #7
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 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