Coder Social home page Coder Social logo

devopsmakers / python-grafannotate Goto Github PK

View Code? Open in Web Editor NEW
18.0 3.0 6.0 66 KB

A CLI tool to add annotations to Grafana

License: MIT License

Python 100.00%
grafana grafana-dashboard annotations grafana-annotations events metrics python influxdb

python-grafannotate's Introduction

grafannotate

Build Status Coverage Status PyPI version

A CLI tool to send Grafana annotations to various destinations.

Installation

pip install grafannotate

Usage

grafannotate --help
Usage: grafannotate [OPTIONS]

  Send Grafana annotations to various endpoints

Options:
  -u, --uri TEXT          URI to send annotation to. Default:
                          "http://localhost:3000/api/annotations".
  -k, --api-key TEXT      Grafana API key to pass in Authorisation header
  -T, --title TEXT        Event title. Default: "event".
  -t, --tag TEXT          Event tags (can be used multiple times).
  -d, --description TEXT  Event description body. Optional.
  -s, --start INTEGER     Start timestamp (unix secs). Default: current
                          timestamp.
  -e, --end INTEGER       End timestamp (unix secs). Optional.
  --help                  Show this message and exit.

Examples

  • Send an annotation to Grafana API for current time
grafannotate --uri http://user:password@grafana:3000/api/annotations --tag my_tag --title "Event Title"
  • Send an annotation to Grafana API for a time region
grafannotate --uri http://user:password@grafana:3000/api/annotations --tag my_tag --title "Event Title" --start 1557222057 --end 1557222259
  • Send an annotation to Grafana API with an extended description
grafannotate --uri http://user:password@grafana:3000/api/annotations --tag my_tag --title "Event Title" --description "Some longer description<br />with newlines<br />and <a href=\"https://something.com/\">links</a>"
  • Pipe output to an annotation description
START_TIME=`date +%s`
command_with_output | grafannotate --uri http://user:password@grafana:3000/api/annotations --tag my_tag --title "Event Title" --start $START_TIME
  • Send an annotation to Grafana API using Authorization header
GRAFANA_API_TOKEN="some_generated_api_token"
grafannotate --uri http://grafana:3000/api/annotations --tag my_tag --title "Event Title" --api-key $GRAFANA_API_TOKEN

python-grafannotate's People

Contributors

js-timbirkett avatar pysysops avatar timbirk avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

python-grafannotate's Issues

Add examples of using in code

I've designed the code to allow for usage in other code (that's how the cli works).

Add an example of doing that. Change the code if it makes it easier to explain and use.

What about panels and dashboards?

This looks like a VERY nice API, but I would also like to be able to send the panelID and/or the dashboardID too?
Would you be open for adding two more parameters?

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.