Menu
Grafana Cloud

OpenStack integration for Grafana Cloud

OpenStack is an open-source cloud computing platform that facilitates the management of large pools of computing, storage, and networking resources in a data center. It provides scalable Infrastructure as a Service (IaaS) with multiple storage options, networking, IAM, monitoring, and more all built-in to the platform.

This integration supports Openstack 2023.2 Bobcat+.

This integration includes 9 useful alerts and 5 pre-built dashboards to help monitor and visualize OpenStack metrics and logs.

Grafana Alloy configuration

Before you begin

OpenStack prometheus exporter

This integration supports metrics and logs from an OpenStack cloud. It is configured to work with the OpenStack Prometheus Exporter, which must be installed and configured separately from Grafana Alloy. Follow instructions in exporter repo to configure the exporter, referring to /etc/openstack/clouds.yaml for the possible names of clouds to monitor.

Logging to a file (optional)

This integration collects logs from journald, assuming that logging to a file is not configured. If you wish to configure a log file for your OpenStack services:

  1. Create a <service>.log file.
  2. Edit the <service>.conf file to include log_file and level config options.
bash
log_file = /Path/to/log/dir/<service>.log
level =  WARNING
  • Other possible level options are DEBUG, INFO, and ERROR.
  1. Restart the service:
bash
systemctl restart <service-name>
  1. Repeat steps 1-3 for each service.

Install OpenStack integration for Grafana Cloud

  1. In your Grafana Cloud stack, click Connections in the left-hand menu.
  2. Find OpenStack and click its tile to open the integration.
  3. Review the prerequisites in the Configuration Details tab and set up Grafana Agent to send OpenStack metrics and logs to your Grafana Cloud instance.
  4. Click Install to add this integration’s pre-built dashboards and alerts to your Grafana Cloud instance, and you can start monitoring your OpenStack setup.

Configuration snippets for Grafana Alloy

Simple mode

These snippets are configured to scrape a single OpenStack cloud with Grafana Alloy running locally.

Copy and Paste the following snippets into your Grafana Alloy configuration file.

Integrations snippets

river
prometheus.exporter.openstack "integrations_openstack_exporter" {}
discovery.relabel "integrations_openstack_exporter" {
  targets = prometheus.exporter.openstack.integrations_openstack_exporter.targets
  rule {
    target_label = "job"
    replacement  = "integrations/openstack"
  }
  rule {
    target_label = "instance"
    replacement  = constants.hostname
  }
}
prometheus.scrape "integrations_openstack_exporter" {
  targets    = discovery.relabel.integrations_openstack_exporter.output
  forward_to = [prometheus.remote_write.metrics_service.receiver]
  job_name   = "integrations/openstack"
}

Logs snippets

all

river
loki.process "logs_integrations_openstack" {
  forward_to = [loki.process.logs_service.receiver]
  stage.multiline {
    firstline = "(?P<level>(DEBUG|INFO|WARNING|ERROR)) "
  }
  stage.regex {
    expression = "(?P<level>(DEBUG|INFO|WARNING|ERROR)) (?P<service>\w+)[\w|.]+ (\[.*] )(?P<message>.*)"
  }
  stage.labels {
    values = {
      level     = "",
      service   = "",
    }
  }
}
loki.relabel "logs_integrations_openstack" {
  forward_to = [loki.process.logs_integrations_openstack.receiver]

  rule {
    source_labels = ["__journal_systemd_unit"]
    target_label  = "unit"
  }
}
loki.source.journal "logs_integrations_openstack" {
  max_age = "12h"
  labels  = {
    job      = "integrations/openstack",
    instance = constants.hostname,
  }
  forward_to = [loki.process.logs_integrations_openstack.receiver]
}

Advanced mode

The following snippets provide examples to guide you through the configuration process.

To instruct Grafana Alloy to scrape your OpenStack cloud, copy and paste the snippets to your configuration file and follow subsequent instructions.

Advanced integrations snippets

river
prometheus.exporter.openstack "integrations_openstack_exporter" {}
discovery.relabel "integrations_openstack_exporter" {
  targets = prometheus.exporter.openstack.integrations_openstack_exporter.targets
  rule {
    target_label = "job"
    replacement  = "integrations/openstack"
  }
  rule {
    target_label = "instance"
    replacement  = constants.hostname
  }
}
prometheus.scrape "integrations_openstack_exporter" {
  targets    = discovery.relabel.integrations_openstack_exporter.output
  forward_to = [prometheus.remote_write.metrics_service.receiver]
  job_name   = "integrations/openstack"
}

This integration uses the prometheus.exporter.openstack component to collect metrics from an OpenStack cloud.

This exporter must be linked with a discovery.relabel component to apply the necessary relabelings. For each OpenStack cloud to be monitored you must create a pair of these components.

The snippets set the instance label to your Grafana Alloy server hostname using the constants.hostname variable. If you are running Grafana Alloy outside of your OpenStack host, change the variable to a value that uniquely identifies it.

You can then scrape them by including each discovery.relabel under targets within the prometheus.scrape component.

Advanced logs snippets

linux

river
loki.process "logs_integrations_openstack" {
  forward_to = [loki.process.logs_service.receiver]
  stage.multiline {
    firstline = "(?P<level>(DEBUG|INFO|WARNING|ERROR)) "
  }
  stage.regex {
    expression = "(?P<level>(DEBUG|INFO|WARNING|ERROR)) (?P<service>\w+)[\w|.]+ (\[.*] )(?P<message>.*)"
  }
  stage.labels {
    values = {
      level     = "",
      service   = "",
    }
  }
}
loki.relabel "logs_integrations_openstack" {
  forward_to = [loki.process.logs_integrations_openstack.receiver]

  rule {
    source_labels = ["__journal_systemd_unit"]
    target_label  = "unit"
  }
}
loki.source.journal "logs_integrations_openstack" {
  max_age = "12h"
  labels  = {
    job      = "integrations/openstack",
    instance = constants.hostname,
  }
  forward_to = [loki.process.logs_integrations_openstack.receiver]
}

This integration uses the loki.source.journal component to collect OpenStack service logs.

If you configure logging to a file for your OpenStack services, refer to the loki.source.file component documentation.

Grafana Agent configuration

Before you begin

OpenStack prometheus exporter

This integration supports metrics and logs from an OpenStack cloud. It is configured to work with the OpenStack Prometheus Exporter, which must be installed and configured separately from the Grafana Agent. Follow instructions in exporter repo to configure the exporter, referring to /etc/openstack/clouds.yaml for the possible names of clouds to monitor.

Logging to a file (optional)

This integration collects logs from journald, assuming that logging to a file is not configured. If you wish to configure a log file for your OpenStack services:

  1. Create a <service>.log file.
  2. Edit the <service>.conf file to include log_file and level config options.
bash
log_file = /Path/to/log/dir/<service>.log
level =  WARNING
  • Other possible level options are DEBUG, INFO, and ERROR.
  1. Restart the service:
bash
systemctl restart <service-name>
  1. Repeat steps 1-3 for each service.

Install OpenStack integration for Grafana Cloud

  1. In your Grafana Cloud stack, click Connections in the left-hand menu.
  2. Find OpenStack and click its tile to open the integration.
  3. Review the prerequisites in the Configuration Details tab and set up Grafana Agent to send OpenStack metrics and logs to your Grafana Cloud instance.
  4. Click Install to add this integration’s pre-built dashboards and alerts to your Grafana Cloud instance, and you can start monitoring your OpenStack setup.

Post-install configuration for the OpenStack integration

To show logs and metrics signals correlated in your dashboards, as a single pane of glass, ensure the following:

  • job and instance label values must match for metrics and logs scrape config in your agent configuration file.
  • job label must be set to integrations/openstack (already configured in the snippets).
  • instance label must be set to a value that uniquely identifies your OpenStack node. Please replace the default hostname value according to your environment - it must be set manually.

Configuration snippets for Grafana Agent

Below metrics.configs.scrape_configs, insert the following lines and change the URLs according to your environment:

yaml
    - job_name: integrations/openstack
      metrics_path: /metrics
      static_configs:
        - targets: ["<your-instance-name>:<your-instance-port>"]

Below logs.configs.scrape_configs, insert the following lines according to your environment.

yaml
    - job_name: integrations/openstack
      journal:
        max_age: 12h
        labels:
          job: integrations/openstack
          instance: <your-instance-name>
      relabel_configs:
        - source_labels: ["__journal_systemd_unit"]
          target_label: "unit"
      pipeline_stages:
        - multiline:
            firstline: '(?P<level>(DEBUG|INFO|WARNING|ERROR)) '
        - regex:
            expression: '(?P<level>(DEBUG|INFO|WARNING|ERROR)) (?P<service>\w+)[\w|.]+ (\[.*] )(?P<message>.*)'
        - labels:
            level:
            service:

Full example configuration for Grafana Agent

Refer to the following Grafana Agent configuration for a complete example that contains all the snippets used for the OpenStack integration. This example also includes metrics that are sent to monitor your Grafana Agent instance.

yaml
integrations:
  prometheus_remote_write:
  - basic_auth:
      password: <your_prom_pass>
      username: <your_prom_user>
    url: <your_prom_url>
  agent:
    enabled: true
    relabel_configs:
    - action: replace
      source_labels:
      - agent_hostname
      target_label: instance
    - action: replace
      target_label: job
      replacement: "integrations/agent-check"
    metric_relabel_configs:
    - action: keep
      regex: (prometheus_target_sync_length_seconds_sum|prometheus_target_scrapes_.*|prometheus_target_interval.*|prometheus_sd_discovered_targets|agent_build.*|agent_wal_samples_appended_total|process_start_time_seconds)
      source_labels:
      - __name__
  # Add here any snippet that belongs to the `integrations` section.
  # For a correct indentation, paste snippets copied from Grafana Cloud at the beginning of the line.
logs:
  configs:
  - clients:
    - basic_auth:
        password: <your_loki_pass>
        username: <your_loki_user>
      url: <your_loki_url>
    name: integrations
    positions:
      filename: /tmp/positions.yaml
    scrape_configs:
      # Add here any snippet that belongs to the `logs.configs.scrape_configs` section.
      # For a correct indentation, paste snippets copied from Grafana Cloud at the beginning of the line.
    - job_name: integrations/openstack
      journal:
        max_age: 12h
        labels:
          job: integrations/openstack
          instance: <your-instance-name>
      relabel_configs:
        - source_labels: ["__journal_systemd_unit"]
          target_label: "unit"
      pipeline_stages:
        - multiline:
            firstline: '(?P<level>(DEBUG|INFO|WARNING|ERROR)) '
        - regex:
            expression: '(?P<level>(DEBUG|INFO|WARNING|ERROR)) (?P<service>\w+)[\w|.]+ (\[.*] )(?P<message>.*)'
        - labels:
            level:
            service:
metrics:
  configs:
  - name: integrations
    remote_write:
    - basic_auth:
        password: <your_prom_pass>
        username: <your_prom_user>
      url: <your_prom_url>
    scrape_configs:
      # Add here any snippet that belongs to the `metrics.configs.scrape_configs` section.
      # For a correct indentation, paste snippets copied from Grafana Cloud at the beginning of the line.
    - job_name: integrations/openstack
      metrics_path: /metrics
      static_configs:
        - targets: ["<your-instance-name>:<your-instance-port>"]
  global:
    scrape_interval: 60s
  wal_directory: /tmp/grafana-agent-wal

Dashboards

The OpenStack integration installs the following dashboards in your Grafana Cloud instance to help monitor your system.

  • OpenStack Cinder
  • OpenStack Neutron
  • OpenStack Nova
  • OpenStack logs
  • OpenStack overview

OpenStack overview (services)

OpenStack overview (services)

OpenStack Nova

OpenStack Nova

OpenStack Neutron (networks)

OpenStack Neutron (networks)

Alerts

The OpenStack integration includes the following useful alerts:

AlertDescription
OpenStackPlacementHighMemoryUsageWarningWarning: The cloud is using a significant percentage of its allocated memory.
OpenStackPlacementHighMemoryUsageCriticalCritical: The cloud is using a large percentage of its allocated memory, consider allocating more resources.
OpenStackNovaHighVMMemoryUsageWarning: VMs are using a high percentage of their allocated memory.
OpenStackNovaHighVMVCPUUsageWarning: VMs are using a high percentage of their allocated virtual CPUs.
OpenStackNeutronHighDisconnectedPortRateCritical: A high rate of ports have no IP addresses assigned to them.
OpenStackNeutronHighInactiveRouterRateCritical: A high rate of routers are currently inactive.
OpenStackCinderHighBackupMemoryUsageWarning: Cinder backups are using a large amount of their maximum memory.
OpenStackCinderHighVolumeMemoryUsageWarning: Cinder volumes are using a large amount of their maximum memory.
OpenStackCinderHighPoolCapacityUsageWarning: Cinder pools are using a large amount of their maximum capacity.

Metrics

The most important metrics provided by the OpenStack integration, which are used on the pre-built dashboards and Prometheus alerts, are as follows:

  • openstack_cinder_agent_state
  • openstack_cinder_limits_backup_max_gb
  • openstack_cinder_limits_backup_used_gb
  • openstack_cinder_limits_volume_max_gb
  • openstack_cinder_limits_volume_used_gb
  • openstack_cinder_pool_capacity_free_gb
  • openstack_cinder_pool_capacity_total_gb
  • openstack_cinder_snapshots
  • openstack_cinder_volume_status_counter
  • openstack_cinder_volumes
  • openstack_glance_image_bytes
  • openstack_glance_images
  • openstack_identity_domains
  • openstack_identity_project_info
  • openstack_identity_projects
  • openstack_identity_regions
  • openstack_identity_up
  • openstack_identity_users
  • openstack_neutron_agent_state
  • openstack_neutron_floating_ips
  • openstack_neutron_floating_ips_associated_not_active
  • openstack_neutron_network_ip_availabilities_total
  • openstack_neutron_network_ip_availabilities_used
  • openstack_neutron_networks
  • openstack_neutron_port
  • openstack_neutron_ports
  • openstack_neutron_ports_lb_not_active
  • openstack_neutron_ports_no_ips
  • openstack_neutron_router
  • openstack_neutron_routers
  • openstack_neutron_routers_not_active
  • openstack_neutron_security_groups
  • openstack_neutron_subnets
  • openstack_nova_agent_state
  • openstack_nova_limits_instances_max
  • openstack_nova_limits_instances_used
  • openstack_nova_limits_memory_max
  • openstack_nova_limits_memory_used
  • openstack_nova_limits_vcpus_max
  • openstack_nova_limits_vcpus_used
  • openstack_nova_total_vms
  • openstack_placement_resource_total
  • openstack_placement_resource_usage
  • openstack_placement_up
  • up

Changelog

md
# 1.0.0 - March 2024

- Initial release

Cost

By connecting your OpenStack instance to Grafana Cloud, you might incur charges. To view information on the number of active series that your Grafana Cloud account uses for metrics included in each Cloud tier, see Active series and dpm usage and Cloud tier pricing.