Giter Site home page Giter Site logo

check-meta's Introduction

check-meta

Description

Check that the host metadata is the expected value.

Installation

$ sudo mkr plugin install tukaelu/check-meta

Usage

Usage:
  check-meta [OPTIONS]

Application Options:
  -n, --namespace=NAMESPACE            Uses the metadata for the specified namespace
  -k, --key=KEY                        The value matching the specified key is used for comparison
  -e, --expected=EXPECTED-VALUE        Compares with the specified expected value
      --regex                          Compare with regular expression if specified (Enable only for string type value)
      --gt                             Compare as 'actual > expected' (Enable only for number type value)
      --lt                             Compare as 'actual < expected' (Enable only for number type value)
      --ge                             Compare as 'actual >= expected' (Enable only for number type value)
      --le                             Compare as 'actual <= expected' (Enable only for number type value)
  -N, --compare-namespace=NAMESPACE    Uses the metadata for the specified namespace to compare
  -K, --compare-key=KEY                Uses the metadata value that matches the specified key as the expected value

Help Options:
  -h, --help       Show this help message

Supported expected value types are...

  • string
  • float64 (JSON number)
  • bool

Configuration

[plugin.checks.meta-namespace-key]
command = ["/path/to/check-meta", "--namespace", "namespace", "--key", "key", "--expected", "expected"]

[plugin.checks.meta-namespace-key-short]
command = ["/path/to/check-meta", "-n", "namespace", "-k", "key", "-e", "expected"]

Examples

# GET /api/v0/hosts/<hostId>/metadata/namespace
# {
#   "key1": "value1",
#   "key2": 1000,
#   "key3": true,
#   "key4": "value1",
# }

## OK (match)
[plugin.checks.meta_string]
command = ["/path/to/check-meta", "-n", "namespace", "-k", "key1", "-e", "value1"]

## OK (regex match)
[plugin.checks.meta_string_regex]
command = ["/path/to/check-meta", "-n", "namespace", "-k", "key1", "-e", "value[0-1]{1}", "--regex"]

## OK (number lower than expected)
[plugin.checks.meta_greater_than]
command = ["/path/to/check-meta", "-n", "namespace", "-k", "key2", "-e", "2000", "--lt"]

## OK (boolean match)
[plugin.checks.meta_greater_than]
command = ["/path/to/check-meta", "-n", "namespace", "-k", "key3", "-e", "true"]

## OK (compare with metadata)
[plugin.checks.meta_compare_metadata]
command = ["/path/to/check-meta", "-n", "namespace", "-k", "key1", "-K", "key4"]

## CRITICAL (does not match)
[plugin.checks.meta_string]
command = ["/path/to/check-meta", "-n", "namespace", "-k", "key2", "-e", 1001]

For more information

  • Execute check-meta -h and you can get command line options.

Misc.

check-meta's People

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.