Skip to content
Snippets Groups Projects
Commit cbbbd4e0 authored by Jacob Vosmaer (GitLab)'s avatar Jacob Vosmaer (GitLab)
Browse files

Merge branch 'feature/grafana-improvements' into 'master'

Grafana improvements

See merge request !242
parents ac5bc14b d74a2b29
No related branches found
No related tags found
1 merge request!242Grafana improvements
Pipeline #
Loading
Loading
@@ -234,7 +234,7 @@ grafana/gdk-pg-created:
touch $@
 
grafana/gdk-data-source-created:
printf ',s/^#grafana/grafana/\nwq\n' | ed -s Procfile
grep '^grafana:' Procfile || (printf ',s/^#grafana/grafana/\nwq\n' | ed -s Procfile)
support/bootstrap-grafana
touch $@
 
Loading
Loading
Loading
Loading
@@ -22,6 +22,12 @@ Next, go to http://localhost:3000/admin/application\_settings , look for
the 'Metrics' section, and select 'Enable InfluxDB metrics'. InfluxDB is
using the default host and port (localhost:8089).
 
After that, you have to restart `gdk run` to start sending metrics to
InfluxDB.
You can access Grafana at http://localhost:9999 using the credentials
`admin` / `admin`.
## Caveats
 
InfluxDB uses several UDP and TCP ports in the 8080-8090 range. We set
Loading
Loading
export GOPATH := $(shell pwd)
GRAFANA_PARENT := src/github.com/grafana
GRAFANA_SOURCE := ${GRAFANA_PARENT}/grafana
GRAFANA_VERSION := 3.1.1
GRAFANA_TAR_SHA256 = 77bff57f02e507fb998d6d2492798801db4cb10c82c1378e32bd1dde963dba3d
GRAFANA_VERSION := 4.1.1
GRAFANA_TAR_SHA256 = 34ecd6c7d3e30b7b0eecf78f57383ad3b4754f5da9da77f031ca4b5866fe9893
 
all: public vendor conf bin/grafana-server grafana-dashboards
 
Loading
Loading
#!/usr/bin/env ruby
require 'socket'
require 'net/http'
require 'json'
 
def main
host = '127.0.0.1'
Loading
Loading
@@ -11,21 +12,8 @@ def main
 
abort "#$0: could not connect to Grafana at #{host}:#{port}" unless wait_socket(host, port)
 
http = Net::HTTP.new(host, port)
request = Net::HTTP::Post.new('/api/datasources')
request.basic_auth('admin', 'admin')
request.add_field('Content-Type', 'application/json')
request.body = <<EOS
{
"name": "InfluxDB",
"type": "influxdb",
"url": "http://localhost:8086",
"access": "direct",
"database": "gitlab",
"isDefault": true
}
EOS
puts http.request(request).body
create_data_source(host, port, name: 'InfluxDB', database: 'gitlab', isDefault: true)
create_data_source(host, port, name: 'InfluxDB Internal', database: '_internal')
ensure
[grafana_pid, db_pid].each do |pid|
Process.kill('TERM', pid)
Loading
Loading
@@ -33,6 +21,21 @@ ensure
end
end
 
def create_data_source(host, port, options)
options = {
type: 'influxdb',
url: 'http://localhost:8086',
access: 'direct'
}.merge(options)
http = Net::HTTP.new(host, port)
request = Net::HTTP::Post.new('/api/datasources')
request.basic_auth('admin', 'admin')
request.add_field('Content-Type', 'application/json')
request.body = JSON.dump(options)
puts http.request(request).body
end
def wait_socket(host, port)
30.times do
begin
Loading
Loading
@@ -49,4 +52,4 @@ if !ARGV.empty?
abort "Usage: #$0"
end
 
main
\ No newline at end of file
main
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment