Coder Social home page Coder Social logo

graf's Introduction

graf

Build Status

Graf was a grafana client, it support batch to create graphs by template.

Install

go get -u github.com/qianlnk/graf
go install github.com/qianlnk/graf/cmd/graf
echo > $GOPATH/bin/config.json

Config

get apiKey from your grafana window. and baseUrl is your.grafana.com

vi $GOPATH/bin/config.json

{
	"apiKey":"",
	"baseUrl":"",
	"user":"",
	"password":""
}

Use

graf -h

Template

make your Template panel at grafana, then you can export it:

graf export -t "dashboard title" -p <the Template panel id you have made> -n <Template name>

or edit the Template json file:

{
    "aliasColors": {},
    "bars": false,
    "datasource": "market",
    "editable": true,
    "fill": 1,
    "grid": {
        "threshold1": "",
        "threshold1Color": "rgba(216, 200, 27, 0.27)",
        "threshold2": "",
        "threshold2Color": "rgba(234, 112, 112, 0.22)"
    },
    "id": 0,
    "isNew": true,
    "legend": {
        "avg": false,
        "current": false,
        "max": false,
        "min": false,
        "show": true,
        "total": false,
        "values": false
    },
    "lines": true,
    "linewidth": 2,
    "nullPointMode": "connected",
    "percentage": false,
    "pointradius": 5,
    "points": false,
    "renderer": "flot",
    "seriesOverrides": [],
    "span": 12,
    "stack": false,
    "steppedLine": false,
    "title": "default",
    "tooltip": {
        "shared": true,
        "value_type": "cumulative"
    },
    "type": "graph",
    "xaxis": {
        "show": true
    },
    "yaxes": [
        {
            "format": "none",
            "logBase": 1,
            "show": true
        },
        {
            "format": "short",
            "logBase": 1
        }
    ]
}

Create dashboard

a json file need, like

{
	"title":"default",
	"timezone":"utc",
	"templateType":"lacal",
	"inheritTitle":"",
	"inheritPanelid":0,
	"templateFile":"templates/default.json",
	"rows":[
		{
			"title":"New Row",
			"panels":[
				{
					"title":"default",
					"dsType":"infuxdb",
					"sqls":[
						"",
						""
					]
				}
			]
		}
	]
}

then run cmd:

graf -f <name>.json

graf's People

Watchers

qianlnk 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.