def test_ui_alert_manager(local_salt_client): IP = utils.get_monitoring_ip('stacklight_monitor_address') result = local_salt_client.cmd( 'keystone:server', 'cmd.run', ['curl -s http://{}:15011/ | grep Alertmanager'.format(IP)], expr_form='pillar') assert len(result[result.keys()[0]]) != 0, \ 'AlertManager page is not reachable on {} from ctl nodes'.format(IP)
def test_ui_grafana(local_salt_client): IP = utils.get_monitoring_ip('stacklight_monitor_address') result = local_salt_client.cmd( 'keystone:server', 'cmd.run', ['curl http://{}:15013/login 2>&1 | grep Grafana'.format(IP)], expr_form='pillar') assert len(result[result.keys()[0]]) != 0, \ 'Grafana page is not reachable on {} from ctl nodes'.format(IP)
def test_ui_kibana(local_salt_client): IP = utils.get_monitoring_ip('stacklight_log_address') result = local_salt_client.cmd( 'keystone:server', 'cmd.run', ['curl http://{}:5601/app/kibana 2>&1 | \ grep loading'.format(IP)], expr_form='pillar') assert len(result[result.keys()[0]]) != 0, \ 'Kibana login page is not reachable on {} from ctl nodes'.format(IP)
def test_kibana_status(local_salt_client): proxies = {"http": None, "https": None} IP = utils.get_monitoring_ip('stacklight_log_address') resp = requests.get('http://{}:5601/api/status'.format(IP), proxies=proxies).content body = json.loads(resp) assert body['status']['overall']['state'] == "green", \ "Kibana status is not expected: {}".format( body['status']['overall']) for i in body['status']['statuses']: assert i['state'] == "green", \ "Kibana statuses are unexpected: {}".format(i)
def test_prometheus_alert_count(local_salt_client): IP = utils.get_monitoring_ip('cluster_public_host') # keystone:server can return 3 nodes instead of 1 # this will be fixed later # TODO nodes_info = local_salt_client.cmd( 'keystone:server', 'cmd.run', [ 'curl -s http://{}:15010/alerts | grep icon-chevron-down | ' 'grep -v "0 active"'.format(IP) ], expr_form='pillar') result = nodes_info[nodes_info.keys()[0]].replace('</td>', '').replace( '<td><i class="icon-chevron-down"></i> <b>', '').replace('</b>', '') assert result == '', 'AlertManager page has some alerts! {}'.format( json.dumps(result), indent=4)