mirror of
https://github.com/grafana/grafana.git
synced 2024-12-01 21:19:28 -06:00
433070a135
Allows exporting all dashboards to a --dir or filtering dashboards by title. If no --dir is specified, a single dashboard must be found and it will be sent to stdout which can be piped to a file. Fixes #1498
68 lines
1.2 KiB
Go
68 lines
1.2 KiB
Go
package main
|
|
|
|
import (
|
|
"os"
|
|
"os/signal"
|
|
"runtime"
|
|
"strconv"
|
|
|
|
"github.com/grafana/grafana/pkg/cmd"
|
|
"github.com/grafana/grafana/pkg/log"
|
|
"github.com/grafana/grafana/pkg/setting"
|
|
|
|
"github.com/codegangsta/cli"
|
|
)
|
|
|
|
var version = "master"
|
|
var commit = "NA"
|
|
var buildstamp string
|
|
|
|
func init() {
|
|
runtime.GOMAXPROCS(runtime.NumCPU())
|
|
}
|
|
|
|
func main() {
|
|
buildstampInt64, _ := strconv.ParseInt(buildstamp, 10, 64)
|
|
|
|
setting.BuildVersion = version
|
|
setting.BuildCommit = commit
|
|
setting.BuildStamp = buildstampInt64
|
|
|
|
go func() {
|
|
c := make(chan os.Signal, 1)
|
|
signal.Notify(c, os.Interrupt)
|
|
<-c
|
|
os.Exit(0)
|
|
}()
|
|
|
|
app := cli.NewApp()
|
|
app.Name = "Grafana Backend"
|
|
app.Usage = "grafana web"
|
|
app.Version = version
|
|
app.Commands = []cli.Command{
|
|
cmd.ListOrgs,
|
|
cmd.CreateOrg,
|
|
cmd.DeleteOrg,
|
|
cmd.ExportDashboard,
|
|
cmd.ImportDashboard,
|
|
cmd.ListDataSources,
|
|
cmd.CreateDataSource,
|
|
cmd.DescribeDataSource,
|
|
cmd.DeleteDataSource,
|
|
cmd.Web}
|
|
app.Flags = append(app.Flags, []cli.Flag{
|
|
cli.StringFlag{
|
|
Name: "config",
|
|
Usage: "path to grafana.ini config file",
|
|
},
|
|
cli.StringFlag{
|
|
Name: "pidfile",
|
|
Usage: "path to pidfile",
|
|
},
|
|
}...)
|
|
|
|
app.Run(os.Args)
|
|
|
|
log.Close()
|
|
}
|