slack-grafana-image-renderer-picker

module
v0.0.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 11, 2020 License: MIT

README

Slack Grafana Image Renderer Picker

Pick graph with cli tool from Grafana Image Renderer and post graph image to Slack.

Dependencies

Deployment

Configuration

Basic

You need register an Slack Application for Slash Command and files:write permission token.

cli can be configured as follows:

❯ ./gfslack -h
NAME:
   gfslack - upload grafana graph image to slack

USAGE:
   gfslack [global options] command [command options] [arguments...]

VERSION:
   0.0.1

AUTHOR:
   ak1ra24 <ak1ra24net@gmail.com>

COMMANDS:
   help, h  Shows a list of commands or help for one command

GLOBAL OPTIONS:
   --config value, -c value  Specify the Config file. (default: "config.yaml")
   --name value              Specify the dashboard name.
   --time value, -d value    Specify from time e.g.) 1h
   --tz value                Specify timezone (default: "JST")
   --help, -h                show help (default: false)
   --version, -v             print the version (default: false)

Configuration file be specified as follows:

slack:
    token: "xoxb-test"
    channel: "#test"
grafana:
    endpoint: "http://localhost:3000"
    apikey: "grafana-apikey"
    use_client_auth: true
    client_auth_p12: "/ssl/key.p12"
dashboards:
   -  name: cpu
      dashboardName: alerts-linux-nodes
      orgId: 1
      panelId: 2
   -  name: disk
      dashboardName: alerts-linux-nodes
      orgId: 1
      panelId: 3

dashboards specify a graph panel to be upload with cli. You can get the parameters of the graph panel by selecting the panel in Grafana and clicking on the share button.

name specifies the alias of a graph. So you can get a graph in Slack like /graph cpu.

Use Auth Proxy Authentication with Client Certificate

This application needs PKCS12 File (.p12) and password, and you need to enable use_client_auth and specify p12 file path on client_auth_p12 at config.yaml.

Run with environment: CONFIG_FILE=config.yaml CLIENT_AUTH_PASSWORD=p12_password

Use API Key

Run with environment: CONFIG_FILE=config.yaml GRAFANA_API_KEY=apikey

Usage

gfslack -c config.yaml --name cpu -d 1h

Example <from_time_range>: 15m 3h 1d 1M

Directories

Path Synopsis
cmd
pkg

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL