Unitymetrics is a tool written in Go for collecting usage and performance metrics from a Dell EMC Unity array and translating them in InfluxDB's line protocol.
It can be useful to send metrics in a InfluxDB database with the help of Telegraf and then display metrics in grafana.
In the Unity API, metrics are define by a path. For example, if you want to collect the remaining memory available on the storage processors, you'll have to use the path sp.*.memory.summary.freeBytes
.
You can find a list of the metrics here.
If you look at the different path, you will figure that some of them contains *
or +
characters.
When there is a *
in the path, you can use the path as-is in your request, the *
will be automatically replaced with all the possibilities. For example, if you want to use the path sp.*.memory.summary.freeBytes
. The API will interpret it as if you were requesting the free memory for the SPA and the SPB. If you need this information only for one of the SPs, you can use the path sp.spa.memory.summary.freeBytes
When there is a +
in the path, you can replace it with the relevant item by yourself before requesting the API or by a *
for breaking the results by this item. For example, if you want to specifically retrieve the CPU utilization of the SPA, you have to modify the path kpi.sp.+.utilization
like this kpi.sp.spa.utilization
.
You can find prebuilt unitymetrics binaries on the releases page.
Download and install a binary locally like this:
% curl -L $URL_TO_BINARY | gunzip > /usr/local/bin/unitymetrics
% chmod +x /usr/local/bin/unitymetrics
To build unitymetrics from source, first install the Go toolchain.
Make sure to set the environment variable GOPATH.
You can then download the latest unitymetrics source code from github using:
% go get -u github.com/equelin/unitymetrics
Make sure $GOPATH/bin
is in your PATH
.
You can build unitymetrics using:
% cd $GOPATH/src/github.com/equelin/unitymetrics/
% make
See usage with:
./unitymetrics -h
./unitymetrics -unity unity01.example.com -user admin -password AwesomePassword -histkpipaths kpi.sp.*.utilization
./unitymetrics -unity unity01.example.com -user admin -password AwesomePassword -rtpaths sp.*.memory.summary.freeBytes -interval 10
./unitymetrics -unity unity01.example.com -user admin -password AwesomePassword -interval 10 -histkpipaths kpi.sp.*.utilization,kpi.lun.+.sp.+.rw.+.throughput,kpi.lun.*.sp.+.rw.+.throughput,kpi.lun.+.sp.+.responseTime,kpi.lun.*.sp.+.responseTime,kpi.lun.+.sp.+.queueLength,kpi.lun.*.sp.+.queueLength
./unitymetrics -unity unity01.example.com -user admin -password AwesomePassword -capacity
The exec
input plugin of Telegraf executes the commands
on every interval and parses metrics from their output in any one of the accepted Input Data Formats.
unitymetrics
output the metrics in InfluxDB's line protocol. Telegraf will parse them and send them to the InfluxDB database.
Don't forget to configure Telegraf to output data to InfluxDB !
Here is an example of a working telegraf's config file:
###############################################################################
# INPUT PLUGINS #
###############################################################################
[[inputs.exec]]
# Shell/commands array
# Full command line to executable with parameters, or a glob pattern to run all matching files.
commands = ["unitymetrics -user admin -password Mypassword -unity unity01.example.com -histkpipaths kpi.sp.*.utilization,kpi.lun.+.sp.+.rw.+.throughput,kpi.lun.*.sp.+.rw.+.throughput,kpi.lun.+.sp.+.responseTime,kpi.lun.*.sp.+.responseTime,kpi.lun.+.sp.+.queueLength,kpi.lun.*.sp.+.queueLength -capacity"]
# Timeout for each command to complete.
timeout = "60s"
# Data format to consume.
# NOTE json only reads numerical measurements, strings and booleans are ignored.
data_format = "influx"
interval = "60s"
If needed, you can specify more than one input plugin. It might be useful if you want to gather different statistics with different intervals or if you want to query different arrays.
###############################################################################
# INPUT PLUGINS #
###############################################################################
[[inputs.exec]]
# Shell/commands array
# Full command line to executable with parameters, or a glob pattern to run all matching files.
commands = ["unitymetrics -user admin -password Mypassword -unity unity01.example.com -histkpipaths kpi.sp.*.utilization,kpi.lun.+.sp.+.rw.+.throughput,kpi.lun.*.sp.+.rw.+.throughput,kpi.lun.+.sp.+.responseTime,kpi.lun.*.sp.+.responseTime,kpi.lun.+.sp.+.queueLength,kpi.lun.*.sp.+.queueLength -capacity"]
# Timeout for each command to complete.
timeout = "60s"
# Data format to consume.
# NOTE json only reads numerical measurements, strings and booleans are ignored.
data_format = "influx"
interval = "60s"
[[inputs.exec]]
# Shell/commands array
# Full command line to executable with parameters, or a glob pattern to run all matching files.
commands = ["unitymetrics -user admin -password Mypassword -unity unity01.example.com -interval 50 -rtpaths sp.*.memory.summary.freeBytes,sp.*.memory.summary.totalBytes,sp.*.memory.summary.totalUsedBytes,sp.*.cpu.uptime"]
# Timeout for each command to complete.
timeout = "60s"
# Data format to consume.
# NOTE json only reads numerical measurements, strings and booleans are ignored.
data_format = "influx"
interval = "60s"
[[inputs.exec]]
# Shell/commands array
# Full command line to executable with parameters, or a glob pattern to run all matching files.
commands = ["unitymetrics -user admin -password Mypassword -unity unity02.example.com -histkpipaths kpi.sp.*.utilization,kpi.lun.+.sp.+.rw.+.throughput,kpi.lun.*.sp.+.rw.+.throughput,kpi.lun.+.sp.+.responseTime,kpi.lun.*.sp.+.responseTime,kpi.lun.+.sp.+.queueLength,kpi.lun.*.sp.+.queueLength -capacity"]
# Timeout for each command to complete.
timeout = "60s"
# Data format to consume.
# NOTE json only reads numerical measurements, strings and booleans are ignored.
data_format = "influx"
interval = "60s"
Erwan Quélin
Copyright 2018 Erwan Quelin and the community.
Licensed under the MIT License.