# Path: monitoring/config/local_settings.py
# MONITORING_SERVICES_GROUPS = [
#     {'name': _('OpenStack Services'), 'groupBy': 'service'},
#     {'name': _('Servers'), 'groupBy': 'hostname'}
# ]
# MONITORING_SERVICES = getattr(
#     settings,
#     'MONITORING_SERVICES_GROUPS',
#     MONITORING_SERVICES_GROUPS
# )
# MONITORING_SERVICE_VERSION = getattr(
#     settings, 'MONITORING_SERVICE_VERSION', '2_0'
# )
# MONITORING_SERVICE_TYPE = getattr(
#     settings, 'MONITORING_SERVICE_TYPE', 'monitoring'
# )
# MONITORING_ENDPOINT_TYPE = getattr(
#     # NOTE(trebskit) # will default to OPENSTACK_ENDPOINT_TYPE
#     settings, 'MONITORING_ENDPOINT_TYPE', None
# )
# GRAFANA_LINKS = []
# DASHBOARDS = getattr(settings, 'GRAFANA_LINKS', GRAFANA_LINKS)
# GRAFANA_URL = getattr(settings, 'GRAFANA_URL', None)
# SHOW_GRAFANA_HOME = getattr(settings, 'SHOW_GRAFANA_HOME', True)
# ENABLE_LOG_MANAGEMENT_BUTTON = getattr(settings, 'ENABLE_LOG_MANAGEMENT_BUTTON', True)
# ENABLE_EVENT_MANAGEMENT_BUTTON = getattr(settings, 'ENABLE_EVENT_MANAGEMENT_BUTTON', False)
# KIBANA_POLICY_RULE = getattr(settings, 'KIBANA_POLICY_RULE',
#                              'monitoring:kibana_access')
# KIBANA_POLICY_SCOPE = getattr(settings, 'KIBANA_POLICY_SCOPE',
#                               'monitoring')
# KIBANA_HOST = getattr(settings, 'KIBANA_HOST', 'http://192.168.10.6:5601/')
# OPENSTACK_SSL_NO_VERIFY = getattr(settings, 'OPENSTACK_SSL_NO_VERIFY', False)
# OPENSTACK_SSL_CACERT = getattr(settings, 'OPENSTACK_SSL_CACERT', None)
# POLICY_FILES = getattr(settings, 'POLICY_FILES', {})


from horizon import exceptions
from horizon.utils import memoized
from oslo_log import log as logging
from openstack_dashboard.api import base
from monascaclient import client as mon_client
from monitoring.config import local_settings as settings
# 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.





LOG = logging.getLogger(__name__)

INSECURE = getattr(settings, 'OPENSTACK_SSL_NO_VERIFY', False)
CACERT = getattr(settings, 'OPENSTACK_SSL_CACERT', None)

KEYSTONE_SERVICE = 'identity'
MONITORING_SERVICE = getattr(settings, 'MONITORING_SERVICE_TYPE', 'monitoring')

VERSIONS = base.APIVersionManager(
    MONITORING_SERVICE,
    preferred_version=getattr(settings,
                              'OPENSTACK_API_VERSIONS',
                              {}).get(MONITORING_SERVICE, 2.0)
)
VERSIONS.load_supported_version(2.0, {'client': mon_client, 'version': '2_0'})


def _get_endpoint(request):
    try:
        endpoint = base.url_for(request,

# Path: monitoring/config/local_settings.py
# MONITORING_SERVICES_GROUPS = [
#     {'name': _('OpenStack Services'), 'groupBy': 'service'},
#     {'name': _('Servers'), 'groupBy': 'hostname'}
# ]
# MONITORING_SERVICES = getattr(
#     settings,
#     'MONITORING_SERVICES_GROUPS',
#     MONITORING_SERVICES_GROUPS
# )
# MONITORING_SERVICE_VERSION = getattr(
#     settings, 'MONITORING_SERVICE_VERSION', '2_0'
# )
# MONITORING_SERVICE_TYPE = getattr(
#     settings, 'MONITORING_SERVICE_TYPE', 'monitoring'
# )
# MONITORING_ENDPOINT_TYPE = getattr(
#     # NOTE(trebskit) # will default to OPENSTACK_ENDPOINT_TYPE
#     settings, 'MONITORING_ENDPOINT_TYPE', None
# )
# GRAFANA_LINKS = []
# DASHBOARDS = getattr(settings, 'GRAFANA_LINKS', GRAFANA_LINKS)
# GRAFANA_URL = getattr(settings, 'GRAFANA_URL', None)
# SHOW_GRAFANA_HOME = getattr(settings, 'SHOW_GRAFANA_HOME', True)
# ENABLE_LOG_MANAGEMENT_BUTTON = getattr(settings, 'ENABLE_LOG_MANAGEMENT_BUTTON', True)
# ENABLE_EVENT_MANAGEMENT_BUTTON = getattr(settings, 'ENABLE_EVENT_MANAGEMENT_BUTTON', False)
# KIBANA_POLICY_RULE = getattr(settings, 'KIBANA_POLICY_RULE',
#                              'monitoring:kibana_access')
# KIBANA_POLICY_SCOPE = getattr(settings, 'KIBANA_POLICY_SCOPE',
#                               'monitoring')
# KIBANA_HOST = getattr(settings, 'KIBANA_HOST', 'http://192.168.10.6:5601/')
# OPENSTACK_SSL_NO_VERIFY = getattr(settings, 'OPENSTACK_SSL_NO_VERIFY', False)
# OPENSTACK_SSL_CACERT = getattr(settings, 'OPENSTACK_SSL_CACERT', None)
# POLICY_FILES = getattr(settings, 'POLICY_FILES', {})


# Path: monitoring/api/client.py
from horizon import exceptions
from horizon.utils import memoized
from oslo_log import log as logging
from openstack_dashboard.api import base
from monascaclient import client as mon_client
from monitoring.config import local_settings as settings

# 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.





LOG = logging.getLogger(__name__)

INSECURE = getattr(settings, 'OPENSTACK_SSL_NO_VERIFY', False)
CACERT = getattr(settings, 'OPENSTACK_SSL_CACERT', None)

KEYSTONE_SERVICE = 'identity'
MONITORING_SERVICE = getattr(settings, 'MONITORING_SERVICE_TYPE', 'monitoring')

VERSIONS = base.APIVersionManager(
    MONITORING_SERVICE,
    preferred_version=getattr(settings,
                              'OPENSTACK_API_VERSIONS',
                              {}).get(MONITORING_SERVICE, 2.0)
)
VERSIONS.load_supported_version(2.0, {'client': mon_client, 'version': '2_0'})


def _get_endpoint(request):
    try:
        endpoint = base.url_for(request,

                                service_type=settings.MONITORING_SERVICE_TYPE,