everpure.flasharray.purefa_metrics module – Collect OpenMetrics data from a Everpure FlashArray

Note

This module is part of the everpure.flasharray collection (version 1.46.0).

You might already have this collection installed if you are using the ansible package. It is not included in ansible-core. To check whether it is installed, run ansible-galaxy collection list.

To install it, use: ansible-galaxy collection install everpure.flasharray. You need further requirements to be able to use this module, see Requirements for details.

To use it in a playbook, specify: everpure.flasharray.purefa_metrics.

New in everpure.flasharray 1.46.0

Synopsis

  • Reads the OpenMetrics exporter built into Purity//FA 6.7.0 and later, and returns what it publishes as structured data.

  • The exporter is not part of the REST API and has no py-pure-client method, so this module reads it over HTTPS directly.

  • Returns every metric by default, or a chosen resource group, named metrics, or individual components of a metric.

  • Read-only. This module never reports a change and is safe in check mode.

Requirements

The below requirements are needed on the host that executes this module.

  • python >= 3.3

  • purestorage >= 1.19

  • py-pure-client >= 1.88.0

  • netaddr

  • requests

  • pycountry

  • urllib3

Parameters

Parameter

Comments

api_token

string

FlashArray API token for admin privileged user.

client_id

string

added in everpure.flasharray 1.43.0

ID of the API Client that issues the identity token.

Used with private_key_file.

disable_warnings

boolean

added in everpure.flasharray 1.29.0

Disable insecure certificate warnings in debug logs

Choices:

  • false ← (default)

  • true

fa_url

string

FlashArray management IPv4 address or Hostname.

id_token

string

added in everpure.flasharray 1.43.0

A pre-signed JWT to authenticate with, as an alternative to api_token.

The token is exchanged by the array for a short-lived access token.

Requires a matching API Client to be registered on the array (see everpure.flasharray.purefa_apiclient).

include_samples

boolean

Whether to return the individual samples of each metric.

Set to false to return only each metric’s help text, type and sample count, which is a cheap way to discover what an array publishes without carrying the values back.

Choices:

  • false

  • true ← (default)

issuer

string

added in everpure.flasharray 1.43.0

The API Client’s trusted identity issuer registered on the array.

Used with private_key_file.

key_id

string

added in everpure.flasharray 1.43.0

Key ID of the API Client that issues the identity token.

Used with private_key_file.

labels

dictionary

Return only the samples whose labels match every one of these label names and values.

This is how an individual component of a metric is selected - a component_name of CT0.TMP0 for one temperature sensor, or a component_type of temp_sensor for all of them.

Label names and values are those the exporter publishes, and are matched exactly.

metrics

list / elements=string

Names of the metrics to return, such as purefa_hw_component_temperature_celsius.

Omit to return every metric the chosen subset publishes.

The exporter has no server-side filtering, so the whole endpoint is read either way and this selects from the result.

Naming a metric the array does not publish fails the task, listing what is available. Which metrics exist varies with Purity version and array configuration.

private_key_file

string

added in everpure.flasharray 1.43.0

Path to the PEM RSA private key used to sign an identity token, as an alternative to api_token.

Requires client_id, key_id, issuer and username.

private_key_password

string

added in everpure.flasharray 1.43.0

Password protecting private_key_file, if encrypted.

raw

boolean

Additionally return the exporter’s response as unparsed OpenMetrics exposition text, under raw.

metrics and labels do not apply to it. It is the whole response for the chosen subset.

Choices:

  • false ← (default)

  • true

subset

string

Which of the exporter’s six endpoints to read.

all reads every metric the array publishes. The array warns that this endpoint is slower than the others, and it returns by far the most data.

array collects the purefa_info, purefa_alerts, purefa_array, purefa_hw, purefa_network and purefa_drive instruments.

directories collects purefa_info and purefa_directory. This endpoint can be slow to answer - see the note on polling intervals.

hosts collects purefa_info and purefa_host.

pods collects purefa_info and purefa_pod.

volumes collects purefa_info and purefa_volume.

purefa_info is therefore present whichever endpoint is read.

Choices:

  • "all" ← (default)

  • "array"

  • "volumes"

  • "hosts"

  • "pods"

  • "directories"

timeout

integer

Seconds to wait for the array to answer.

Default: 60

use_proxy

boolean

Honour the controller’s https_proxy environment like other Ansible URL modules. Set to false when the array must be reached directly.

Choices:

  • false

  • true ← (default)

username

string

added in everpure.flasharray 1.43.0

Username the issued token should be granted to.

Must be a valid user on the array. Used with private_key_file.

validate_certs

boolean

Whether to verify the array’s TLS certificate.

FlashArrays ship with a self-signed certificate, which does not validate, so this defaults to false to match the behaviour of the rest of this collection. Set it to true on an array that has been given a certificate signed by a trusted CA.

Choices:

  • false ← (default)

  • true

Notes

Note

  • Requires Purity//FA 6.7.0 or later, which is where the exporter was moved inside Purity. An earlier array serves the exporter’s HTML index page instead of metrics, which this module reports as an error.

  • The exporter authenticates with the API token as a bearer credential, so this module needs api_token or the PUREFA_API environment variable. It cannot use the id_token or private_key_file authentication modes that the rest of the collection accepts, because the exporter rejects everything but an API token.

  • The endpoint is rate limited. This module makes one request per task, but a tight loop over it can still be refused.

  • On how often to read it - the Prometheus configuration examples published with Purity//FA use a scrape interval of 60 seconds for every endpoint except directories, which they set to 30 minutes because it can take a long time to respond. A playbook polling this module repeatedly is doing the same job as a scrape, so the same intervals are a sensible guide, and timeout may need raising for subset=directories on an array with many managed directories.

  • This module requires the py-pure-client Python library.

  • Additional Python libraries may be required for specific modules.

  • You must set PUREFA_URL and PUREFA_API environment variables if fa_url and api_token arguments are not passed to the module directly.

  • Token-based authentication (id_token, or private_key_file with client_id, key_id, issuer and username) may be used as an alternative to api_token, and requires a matching API Client registered on the array via everpure.flasharray.purefa_apiclient.

Examples

- name: Collect every metric the array publishes
  everpure.flasharray.purefa_metrics:
    fa_url: 10.10.10.2
    api_token: e31060a7-21fc-e277-6240-25983c6c4592
  register: metrics

- name: Collect only the array-level metrics
  everpure.flasharray.purefa_metrics:
    subset: array
    fa_url: 10.10.10.2
    api_token: e31060a7-21fc-e277-6240-25983c6c4592

- name: Read one metric, every component of it
  everpure.flasharray.purefa_metrics:
    subset: array
    metrics:
      - purefa_hw_component_temperature_celsius
    fa_url: 10.10.10.2
    api_token: e31060a7-21fc-e277-6240-25983c6c4592
  register: temperatures

- name: Read one metric for a single component
  everpure.flasharray.purefa_metrics:
    subset: array
    metrics:
      - purefa_hw_component_temperature_celsius
    labels:
      component_name: CT0.TMP0
    fa_url: 10.10.10.2
    api_token: e31060a7-21fc-e277-6240-25983c6c4592

- name: Read the write bandwidth of one volume
  everpure.flasharray.purefa_metrics:
    subset: volumes
    metrics:
      - purefa_volume_performance_bandwidth_bytes
    labels:
      name: database01
      dimension: write_bytes_per_sec
    fa_url: 10.10.10.2
    api_token: e31060a7-21fc-e277-6240-25983c6c4592

- name: Discover what an array publishes, without the values
  everpure.flasharray.purefa_metrics:
    include_samples: false
    fa_url: 10.10.10.2
    api_token: e31060a7-21fc-e277-6240-25983c6c4592

- name: Pass the exposition text on to something that speaks OpenMetrics
  everpure.flasharray.purefa_metrics:
    raw: true
    include_samples: false
    fa_url: 10.10.10.2
    api_token: e31060a7-21fc-e277-6240-25983c6c4592
  register: exposition

- name: Fail when any installed hardware component is not ok
  everpure.flasharray.purefa_metrics:
    subset: array
    metrics:
      - purefa_hw_component_status
    fa_url: 10.10.10.2
    api_token: e31060a7-21fc-e277-6240-25983c6c4592
  register: hardware
  # A healthy array reports every empty bay and unused port as not_installed
  failed_when: >-
    hardware.purefa_metrics.purefa_hw_component_status.samples
    | rejectattr('labels.component_status', 'in', ['ok', 'not_installed'])
    | list | length > 0

Return Values

Common return values are documented here, the following are the fields unique to this module:

Key

Description

purefa_metrics

dictionary

The metrics read from the array, keyed by metric name.

Returned: always

Sample: {"purefa_hw_component_temperature_celsius": {"help": "FlashArray hardware component temperature", "sample_count": 2, "samples": [{"labels": {"component_name": "CT0.TMP0", "component_type": "temp_sensor"}, "value": 30.0}, {"labels": {"component_name": "CT1.TMP0", "component_type": "temp_sensor"}, "value": 31.0}], "type": "gauge"}}

help

string

The metric’s description, as the exporter publishes it.

Returned: success

Sample: "FlashArray hardware component temperature"

sample_count

integer

How many samples the metric has, before labels filtering.

Returned: success

Sample: 55

samples

list / elements=dictionary

One entry per labelled time series, omitted when include_samples=false.

A value the exporter reports as NaN, +Inf or -Inf is returned as none, because JSON has no representation for those.

Returned: success

labels

dictionary

The sample’s labels.

Returned: success

value

float

The sample’s value.

Returned: success

type

string

The OpenMetrics instrument type. Every metric the exporter currently publishes is a gauge.

Returned: success

Sample: "gauge"

raw

string

The exporter’s unparsed OpenMetrics exposition text, when raw=true.

Returned: when raw=true

Authors

  • Everpure Ansible Team (@sdodsley)