Coder Social home page Coder Social logo

instanametricscli's Introduction

Metric Calculator

Simple CLI for querying metrics with the Instana API. Written for Python 3.x

Installation Instructions

You will need Python 3.x in your path. You will also need to install the pip module requests

pip3 install `requests`

Format

The main runtime is queryinstana.py which accepts the following commands :-

 queryinstana.py [Attribute|count] from|ascsv [Plugin] where [Dynamic Focus Query]

Attribute can be any field name returned in the API, but generally label will be used for this example count returns the number of records for the value of Attribute

from|ascsv|count

From denotes a line delimited return of the value of Attribute (useful in a bash For/Each scenario) ascsv denotes a csv delimited return of the value of Attribute

[Dynamic focus Query]

Add a query to refine your search criteria

Getting started

You will need to make two modifications to the instanaquery.py to get started :-

APItoken = "Your API Token" - Generated in the Instana UI

Instance = "demoeu-instana" - The name of your Instance (Please note you do not need the .instana.io, just the environment/tenant name)

Sample

  1. A simple query for Kubernetes Namespaces :-

python3 queryinstana.py label from KubernetesCluster where 'entity.selfType:kubernetesCluster'

Will return all labels (names) for each K8s cluster you have deployed.

Advanced

Putting this all together, its easy to iterate and parse in a bash script.

sampleusage.sh creates an output CSV of Clusters,Namespaces, Pods and Deployments.

Feel free to modify and clear up.I might try an interactive CLI browser at some point too. Thx,

instanametricscli's People

Contributors

justynroberts avatar

Watchers

 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.