Skip to content

slashpai/prom_check

Repository files navigation

prom_check

prom_check is created to do prometheus analysis by querying prometheus api

Installation

Installing in a ruby environment

Build and install it yourself as:

gem build
gem install prom_check-<VERSION>.gem

Using Docker

Build Image

docker build . -t prom_check:0.1.0
  • Using externally accessible url

    Example:

    docker run prom_check:0.1.0 prom_check labels -u http://demo.robustperception.io:9090
  • If need to pass localhost link of prometheus running on hostmachine

    Example:

    docker run --network=host prom_check:0.1.0 prom_check labels

    or

    docker run --network=host prom_check:0.1.0 prom_check labels -u http://localhost:9090

Other examples is applicable for docker as well or use help flag to get options available

Features

  • Get Labels
  • Review Labels (Labels, Label Name Lengths and Label Values)

Usage

Commands:
  prom_check help [COMMAND]  # Describe available commands or one specific command
  prom_check labels          # Get Labels
  prom_check review_labels   # Review Labels

Options:
  -l, [--log-level=LOG_LEVEL]  # loglevel, default info
  -u, [--prom-url=PROM_URL]    # prometheus_url, default http://localhost:9090

Get Labels

Get all labels from prometheus

Usage:
  prom_check labels

Options:
  -l, [--log-level=LOG_LEVEL]  # loglevel, default info
  -u, [--prom-url=PROM_URL]    # prometheus_url, default http://localhost:9090

Get Labels

Review Labels

Get all labels, analyze label name lengths, label value lengths and print analysis

Usage:
  prom_check review_labels

Options:
  -n, [--lv-display-count=N]
                               # Default: 100000
  -l, [--log-level=LOG_LEVEL]  # loglevel, default info
  -u, [--prom-url=PROM_URL]    # prometheus_url, default http://localhost:9090

Review Labels

Examples

Get Labels

  • Without debug mode

    prom_check labels -u http://demo.robustperception.io:9090
  • With debug mode

    Note: Nothing specific in debug mode for this command

    prom_check labels -u http://demo.robustperception.io:9090 -l debug

Review Labels

  • Without debug mode

    prom_check review_labels -u http://demo.robustperception.io:9090
  • With debug mode

    prom_check labels -u http://demo.robustperception.io:9090 -l debug
  • Display only top 20 label values by label value length (default if not passed the -n flag it will display all (max 100000))

    prom_check review_labels -n 20 -u http://demo.robustperception.io:9090

Development

After checking out the repo, run bundle install to install dependencies. You can also run bundle exec bin/prom_check for an interactive prompt that will allow you to experiment.

TODO

  • Print metric corresponding to large label values
  • Add more features
  • Add Tests

Contributing

  • Bug reports and pull requests are welcome

    • Fork the project on GitHub
    • Clone the project
    • Add changes (and tests if applicable)
    • Commit and push
    • Create a pull request