Skip to content

Metric Collection

Avi Mehenwal edited this page Oct 28, 2019 · 20 revisions

-@avi

official documentation

https://docs.openstack.org//train/contributor/.html

docker exec -ti $(docker ps | grep osm_mon.1. | awk '{print $1}') bash

osm_mon container dies and then respawns quickly! Is it normal?

watch --difference --beep 'docker ps | grep osm_mon.1.'

Is compatible with our installation?

https://docs.openstack.org//queens/contributor/.html

The services are not enabled by default, so they must be enabled in local.conf

https://docs.openstack.org/aodh/pike/install/install-ubuntu.html

Alarming service, code-named adoh

panco

https://docs.openstack.org/panko/latest/install/development.html#configuring-

Restart service service --status-all

Keystone is Identity management and authentication service for openstack

set openstack client

https://docs.oracle.com/cd/E78305_01/E78304/html/openstack-envars.html

export OS_PROJECT_DOMAIN_ID=default
export OS_USER_DOMAIN_ID=default
export OS_PROJECT_NAME=admin
export OS_TENANT_NAME=admin
export OS_USERNAME=admin
export OS_PASSWORD=backflipad
export OS_AUTH_URL=http://fgcn-backflip9.cs.uni-paderborn.de/identity
export OS_IDENTITY_API_VERSION=3
openstack token issue

Install cilometer

apt-get install -agent-compute
apt-get install -agent-ipmi

Restart keystone

systemctl restart apache2.service
systemctl status apache2.service
netstat -nltp | egrep apache2

openstack commands

. openstack-environment.vars.sh 

openstack user create --domain default --password-prompt 
openstack role add --project service --user  admin
openstack service create --name  --description "" metering

openstack user create --domain default --password-prompt 
openstack service create --name  --description "Metric Service" metric
openstack role add --project service --user  admin

openstack endpoint create --region RegionOne metric public http://131.234.29.220:8041
openstack endpoint create --region RegionOne metric internal http://131.234.29.220:8041
openstack endpoint create --region RegionOne metric admin http://131.234.29.220:8041

# Verification
openstack role assignment list --names
openstack service list
openstack endpoint list -c Interface -c URL -c 'Service Name' -c 'Service Type'

commands

 metric list
 resource list -t instance -c id -c user_id -c flavor_id
 measures show --resource-id dcaf2c23-1da7-4ca0-853c-541574323aed cpu
 measures show --resource-id 06e76595-4155-4bbc-a7ec-8ea99117f019 --start 2017-07-14T20:35 disk.usage

SWIFT-hash backflip

openstack user passwords for and backflip

Test if openstack is running

sudo systemctl status "@*"
sudo systemctl restart "@n-*"

  • Your will have installed keystone, glance, nova, placement, cinder, neutron, and horizon. Floating IPs will be available, guests have access to the external world.
openstack --version
openstack versions show

apt-get install mongodb-server mongodb-clients python-pymongo
sudo journalctl --unit @*

[ERROR] /opt/stack//lib/glance:335 g-api did not start

./unstack.sh
./clean.sh
# kill all processes from user 'stack'
killall -u stack
./stack.sh

openstack service list --os-username=admin

local.conf

[[local|localrc]]
ADMIN_PASSWORD=backflipad
DATABASE_PASSWORD=$ADMIN_PASSWORD
RABBIT_PASSWORD=$ADMIN_PASSWORD
SERVICE_PASSWORD=$ADMIN_PASSWORD
HOST_IP=131.234.29.231
CEILOMETER_BACKEND=
CLOUDKITTY_COLLECTOR=

enable_service c-bak
enable_service swift

# 
enable_plugin  https://github.com/openstack/ master
enable_service -api,-metricd

# 
enable_plugin  https://git.openstack.org/openstack/.git master

# horizon
enable_service horizon

# cloudkitty
enable_plugin cloudkitty https://git.openstack.org/openstack/cloudkitty.git master
enable_service ck-api ck-proc

# Enable the   plugin
enable_plugin aodh https://git.openstack.org/openstack/aodh

placement-api did not start

This happen because of several runs of ./stack.sh and didn't clean the environment after using it. To overcome this problem we need to clean /etc/apache2/site-enable and /etc/apache2/site-available folders and run ./unstack.sh. After that we can run ./stack.sh

Similar issues on stackoverflow

  1. https://stackoverflow.com/questions/56353943/how-to-use--api-on-openstack-rocky

Useful Links

Approach 2, native prometheus

docker service update --force osm_prometheus
docker service logs osm_prometheus

global:
  scrape_interval:     15s # Set the scrape interval to every 15 seconds. Default is every 1 minute.
  evaluation_interval: 15s # Evaluate rules every 15 seconds. The default is every 1 minute.
  # scrape_timeout is set to the global default (10s).

# Alertmanager configuration
alerting:
  alertmanagers:
  - static_configs:
    - targets:
      # - alertmanager:9093

# Load rules once and periodically evaluate them according to the global 'evaluation_interval'.
rule_files:
  # - "first_rules.yml"
  # - "second_rules.yml"

# A scrape configuration containing exactly one endpoint to scrape:
# Here it's Prometheus itself.
scrape_configs:
  # The job name is added as a label `job=<job_name>` to any timeseries scraped from this config.
  - job_name: 'prometheus'

    # metrics_path defaults to '/metrics'
    # scheme defaults to 'http'.

    static_configs:
    - targets: ['mon:8000']

    #Scrape OpenStack instances
  - job_name: 'openstack'
    openstack_sd_configs:
      - identity_endpoint: http://131.234.29.220/identity
        username: admin
        project_name: admin
        password: backflip
        role: instance
        region: RegionOne
        domain_name: Default
    relabel_configs:
      # Keep only active instances
      - source_labels: [__meta_openstack_instance_status]
        action: keep
        regex: ACTIVE
  

Useful Links

openstack errors

$ sudo apt-get remove --purge mysql-server mysql-client mysql-common -y
$ sudo apt-get autoremove -y
$ sudo apt-get autoclean
sudo rm -rf /var/lib/mysql/mysql

sudo apt-get install mysql-server