Skip to content

Instantly share code, notes, and snippets.

@clemenko
Last active May 7, 2025 18:22
Show Gist options
  • Save clemenko/0602ba26338b3f32e5c8c5acab40d7a1 to your computer and use it in GitHub Desktop.
Save clemenko/0602ba26338b3f32e5c8c5acab40d7a1 to your computer and use it in GitHub Desktop.

quick install of docker, prometheus, and grafana

This guide is a quick, and easy way to setup docker, prometheus, and grafana for getting the metrics from a Pure FlashArray.

install docker

Rocky

yum clean all; yum install -y vim yum-utils && yum-config-manager -y --add-repo https://download.docker.com/linux/centos/docker-ce.repo && yum install -y docker-ce docker-ce-cli containerd.io docker-compose-plugin && mkdir -p /etc/docker && systemctl start docker

ubuntu

curl -fsSL https://download.docker.com/linux/ubuntu/gpg -o /etc/apt/keyrings/docker.asc && chmod a+r /etc/apt/keyrings/docker.asc
echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/ubuntu $(. /etc/os-release && echo "${UBUNTU_CODENAME:-$VERSION_CODENAME}") stable" | tee /etc/apt/sources.list.d/docker.list > /dev/null
apt-get update && apt-get install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin -y

add compose

make directories and add files.

Compose was based on : https://github.com/docker/awesome-compose/blob/master/prometheus-grafana/compose.yaml

# make dirs
mkdir -p /opt/{grafana/{datasources,dashboards},prometheus}

# add docker compose
cat << EOF > /opt/compose.yaml
services:
  prometheus:
    image: prom/prometheus
    container_name: prometheus
    command:
      - '--config.file=/etc/prometheus/prometheus.yml'
    ports:
      - 9090:9090
    restart: unless-stopped
    volumes:
      - /opt/prometheus:/etc/prometheus
      - prom_data:/prometheus

  grafana:
    image: grafana/grafana
    container_name: grafana
    ports:
      - 3000:3000
    restart: unless-stopped
    environment:
      - GF_SECURITY_ADMIN_USER=admin
      - GF_SECURITY_ADMIN_PASSWORD=Pa22word
    volumes:
      - /opt/grafana/datasources:/etc/grafana/provisioning/datasources
      - /opt/grafana/dashboard.yaml:/etc/grafana/provisioning/dashboards/main.yaml
      - /opt/grafana/dashboards:/var/lib/grafana/dashboards

volumes:
  prom_data:
EOF

add grafana and prometheus configs

Pay attention to the IP and bearer_token for the array!

# graf dashboard yaml
cat << EOF > /opt/grafana/dashboard.yaml
apiVersion: 1

providers:
  - name: "Dashboard provider"
    orgId: 1
    type: file
    disableDeletion: true
    updateIntervalSeconds: 10
    allowUiUpdates: false
    options:
      path: /var/lib/grafana/dashboards
      foldersFromFilesStructure: true
EOF

# graf datasource
cat << EOF > /opt/grafana/datasources/datasource.yml
apiVersion: 1

datasources:
- name: Prometheus
  type: prometheus
  url: http://prometheus:9090 
  isDefault: true
  access: proxy
  editable: true
EOF

# get dashboard
curl -s https://raw.githubusercontent.com/PureStorage-OpenConnect/pure-fa-openmetrics-exporter/refs/heads/master/extra/grafana/grafana-purefa-flasharray-overview.json -o /opt/grafana/dashboards/puredash.json

# prom config
cat << EOF > /opt/prometheus/prometheus.yml
global:
  scrape_interval:     30s # Set the scrape interval to every 30 seconds. Default is every 1 minute.
  scrape_timeout:      30s # Set the scrape timeout to shorter than or equal to scrape_interval. Default is every 1 minute.
  # evaluation_interval: 60s # is set to the default every 1 minute.

# Alertmanager configuration (optional)
#alerting:
#  alertmanagers:
#  - static_configs:
#    - targets:
#       - alertmanager:9093

# Load rules once and periodically evaluate them according to the global 'evaluation_interval'. (optional)
#rule_files:
#  - "purefa_alerts_rules.yml"
#  - "purefa_pods_rules.yml"

scrape_configs:
  - job_name: 'purefa_array'
    scheme: https
    tls_config:
      insecure_skip_verify: true
    bearer_token : 3d84e613-c905-649a-2b7a-0bc8def997e9
    params:
      namespace: ['purefa']
    static_configs:
    - targets:
      - 192.168.1.11
      labels:
        location: us
        site: Edgewater
        instance: arrayname01
        env: production
EOF

lets fire it up

now run : cd /opt; docker compose up -d

check the urls

prom : http://192.168.1.174:9090/targets
graf : http://192.168.1.174:3000

more info

For more information on the alerts check out the github page.
https://github.com/PureStorage-OpenConnect/pure-fa-openmetrics-exporter/tree/master/extra/prometheus

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment