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 |
|---|---|
FlashArray API token for admin privileged user. |
|
ID of the API Client that issues the identity token. Used with private_key_file. |
|
Disable insecure certificate warnings in debug logs Choices:
|
|
FlashArray management IPv4 address or Hostname. |
|
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). |
|
Whether to return the individual samples of each metric. Set to Choices:
|
|
The API Client’s trusted identity issuer registered on the array. Used with private_key_file. |
|
Key ID of the API Client that issues the identity token. Used with private_key_file. |
|
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 Label names and values are those the exporter publishes, and are matched exactly. |
|
Names of the metrics to return, such as 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. |
|
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. |
|
Password protecting private_key_file, if encrypted. |
|
Additionally return the exporter’s response as unparsed OpenMetrics exposition text, under metrics and labels do not apply to it. It is the whole response for the chosen subset. Choices:
|
|
Which of the exporter’s six endpoints to read.
Choices:
|
|
Seconds to wait for the array to answer. Default: |
|
Honour the controller’s Choices:
|
|
Username the issued token should be granted to. Must be a valid user on the array. Used with private_key_file. |
|
Whether to verify the array’s TLS certificate. FlashArrays ship with a self-signed certificate, which does not validate, so this defaults to Choices:
|
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_APIenvironment 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 forsubset=directorieson an array with many managed directories.This module requires the
py-pure-clientPython library.Additional Python libraries may be required for specific modules.
You must set
PUREFA_URLandPUREFA_APIenvironment 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 |
|---|---|
The metrics read from the array, keyed by metric name. Returned: always Sample: |
|
The metric’s description, as the exporter publishes it. Returned: success Sample: |
|
How many samples the metric has, before labels filtering. Returned: success Sample: |
|
One entry per labelled time series, omitted when include_samples=false. A value the exporter reports as Returned: success |
|
The sample’s labels. Returned: success |
|
The sample’s value. Returned: success |
|
The OpenMetrics instrument type. Every metric the exporter currently publishes is a gauge. Returned: success Sample: |
|
The exporter’s unparsed OpenMetrics exposition text, when raw=true. Returned: when raw=true |