Skip to content

Adds multipathd_metrics.sh #236

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

mob-galtryn
Copy link

Pull Request for Prometheus Textfile Collector Script for Multipathd

Title: Add script multipathd_exporter.sh to collect multipathd metrics for Prometheus

Description:

This pull request introduces a new script, multipathd_exporter.sh, designed to collect and expose metrics from the multipathd show multipaths command in a format compatible with the Prometheus textfile collector. This script leverages jq to parse the JSON output of multipathd and extracts key information about multipath devices and their paths, output is then written to file using sponge.

Metrics Exposed:

The script currently exposes the following metrics:

  • node_multipath_paths_dm_st: A gauge representing the count of paths with an active Direct Mapped (DM) state within each multipath device's path groups. Labels include name (multipath device name), uuid, vend (vendor), prod (product), and state="active".
  • node_multipath_paths_chk_st: A gauge representing the count of paths with a ready check status (chk_st) within each multipath device's path groups. Labels include name, uuid, vend, prod, and state="ready".
  • node_multipath_paths_dev_st: A gauge representing the count of paths with a running device status (dev_st) within each multipath device's path groups. Labels include name, uuid, vend, prod, and state="running".
  • node_multipath_dm_st: A gauge representing the count of multipath devices with an active DM state. Labels include name, uuid, vend, prod, and state="active".
  • node_multipath_path_nr: A gauge representing the total number of paths associated with each multipath device. Labels include name, uuid, vend, and prod.
  • node_multipath_path_faults: A gauge representing the number of faults reported for each multipath device. Labels include name, uuid, vend, and prod.

Usage:

  1. Ensure that jq and moreutils are installed on the system where the script will run.
  2. Save the provided script as multipathd_exporter.sh (or a similar name).
  3. Make the script executable: chmod +x multipathd_exporter.sh.
  4. Configure the Prometheus node exporter to collect metrics from the textfile collector. This typically involves setting the --collector.textfile.directory flag to a directory where Prometheus can read the output of this script.
  5. Run the script periodically (e.g., via cron) and output its results to a file within the configured textfile collector directory using sponge to write out to file. For example:
    */5 * * * * /usr/local/bin/multipathd_metrics.sh | sponge /var/lib/prometheus/node-exporter/multipathd.prom

Benefits:

  • Provides valuable insights into the health and status of multipath devices.
  • Allows for monitoring the number of active, ready, and running paths.
  • Tracks the total number of paths and reported faults for each multipath device.
  • Integrates seamlessly with Prometheus for alerting and visualization.

Author: Nick Galtry

Signed-off-by: Nick Galtry <[email protected]>
Signed-off-by: Nick Galtry <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant