Exemple #1
0
    def __init__(self,
                 app_id,
                 monitor_plugin,
                 enable_visualizer,
                 datasource_type,
                 user,
                 password,
                 database_data,
                 timeout=60):
        Plugin.__init__(self, app_id, enable_visualizer, timeout)
        # Compute necessary variables
        kube.config.load_kube_config(api.k8s_conf_path)
        self.LOG = Log(LOG_NAME, LOG_FILE)
        self.visualizer_url = "URL not generated!"
        self.datasource = datasource_type
        self.monitor_plugin = monitor_plugin
        self.enable_visualization = enable_visualizer
        self.app_id = app_id
        self.grafana_user = user
        self.grafana_password = password
        if datasource_type == 'influxdb':
            self.datasource = InfluxDataSource(monitor_plugin, database_data,
                                               app_id)
        elif datasource_type == 'monasca':
            self.datasource = MonascaDataSource(app_id)
        else:
            raise Exception("ERROR: Datasource type unknown...!")

        self.visualizer_type = api.visualizer_type

        # Gets the visualizer ip if the value is not explicitic in the config file
        try:
            self.visualizer_ip = api.visualizer_ip
        except AttributeError:
            self.visualizer_ip = api.get_node_cluster(api.k8s_conf_path)
Exemple #2
0
 def __init__(self, app_id):
     Base.__init__(self, app_id, api.monasca_datasource_name,
                   api.monasca_datasource_type)
     # Compute necessary variables
     self.LOG = Log(LOG_NAME, LOG_FILE)
     self.datasource_access = api.monasca_datasource_access
     self.datasource_url = api.monasca_datasource_url
     self.datasource_basic_auth = api.monasca_datasource_basic_auth
     self.datasource_auth_type = api.monasca_datasource_auth_type
     self.datasource_token = api.monasca_datasource_token
     self.dashboard_path = './visualizer/utils/templates/dashboard-job-monasca.template'
     self.image = 'monasca/grafana'
Exemple #3
0
 def __init__(self, app_id):
     Base.__init__(self, app_id, api.monasca_datasource_name,
                   api.monasca_datasource_type)
     # Compute necessary variables
     self.LOG = Log(LOG_NAME, LOG_FILE)
     self.datasource_access = api.monasca_datasource_access
     self.datasource_url = api.monasca_datasource_url
     self.datasource_basic_auth = api.monasca_datasource_basic_auth
     self.datasource_auth_type = api.monasca_datasource_auth_type
     self.datasource_token = api.monasca_datasource_token
     self.dashboard_path = MONASCA_FILE_PATH
     self.image = 'monasca/grafana'
Exemple #4
0
 def __init__(self, monitor_plugin, database_data, app_id):
     Base.__init__(self, app_id, api.influxdb_datasource_name, api.influxdb_datasource_type)
     # Compute necessary variables
     self.LOG = Log(LOG_NAME, LOG_FILE)
     self.datasource_access = api.influxdb_datasource_access
     self.datasource_url = database_data['url']
     self.datasource_port = database_data['port']
     self.database_name = database_data['name']
     if(monitor_plugin == 'kubejobs'):
         self.dashboard_path = './visualizer/utils/templates/dashboard-job-influxdb-kubejobs.template'
     elif(monitor_plugin == 'external_api'):
         self.dashboard_path = './visualizer/utils/templates/dashboard-job-influxdb-vertical.template'
     self.image = 'grafana/grafana:5.4.2'
    def __init__(self, monitor_plugin, database_data, app_id):
        Base.__init__(self, app_id, api.influxdb_datasource_name,
                      api.influxdb_datasource_type)
        # Compute necessary variables
        self.LOG = Log(LOG_NAME, LOG_FILE)
        self.datasource_access = api.influxdb_datasource_access
        self.datasource_url = database_data['url']
        self.datasource_port = database_data['port']
        self.database_name = database_data['name']
        if (monitor_plugin == 'kubejobs'):
            self.dashboard_path = K8S_TEMPLATE_PATH

        elif (monitor_plugin == 'external_api'):
            self.dashboard_path = VERTICAL_TEMPLATE_PATH

        self.image = 'grafana/grafana:5.4.2'
Exemple #6
0
#    http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
# implied.
# See the License for the specific language governing permissions and
# limitations under the License.

from visualizer.service import api
from visualizer.utils.logger import Log
from visualizer import exceptions as ex
from visualizer.plugins.builder import VisualizerBuilder


API_LOG = Log("APIv10", "logs/APIv10.log")

visualized_apps = {}
builder = VisualizerBuilder()

def start_visualization(data, app_id):
    """Starts the visualization of a job
    
    Arguments:
        app_id {string} -- Id of the job
    
    Returns:
        None
    """

    if 'plugin' not in data or 'enable_visualizer' not in data or \