Upgrade Grafana to 2.1
It downloads nightly build and uses the Puppet module of "bfraser" to install and configure Grafana. It also adds two new parameters in the UI that are the username and the password of the Grafana admin user. Blueprint: upgrade-influxdb-grafana Change-Id: Ibb6fc7bb523800d6a14ed659d2fa02b726742984
This commit is contained in:
parent
1fbf797868
commit
1ce76eac0e
31
README.md
31
README.md
|
@ -77,9 +77,10 @@ User Guide
|
|||
5. Scroll down the page, select the "InfluxDB-Grafana Server plugin" checkbox
|
||||
and fill-in the required fields.
|
||||
- The name of the node where the plugin is deployed.
|
||||
- The password for the root user.
|
||||
- The password for the InfluxDB root user.
|
||||
- The name of the database where you want to store your metrics.
|
||||
- The username and the password for this specific database.
|
||||
- The name and the password for the Grafana admin user.
|
||||
|
||||
You can select up to 3 physical disks that will be mounted as a single logical
|
||||
volume to store the InfluxDB data. If you specify no disk, the data will
|
||||
|
@ -101,36 +102,31 @@ Testing
|
|||
Once installed, you can check that InfluxDB is working using `curl`:
|
||||
|
||||
```
|
||||
curl -G 'http://<HOST>:8086/db/lma/series?u=lma&p=<yourpassword>' --data-urlencode "q=list series"
|
||||
curl -G 'http://<HOST>:8086/' \
|
||||
--data-urlencode "u=<root user of InfluxDB>" \
|
||||
--data-urlencode "p=<password of root user>" \
|
||||
--data-urlencode "q=show databases"
|
||||
```
|
||||
|
||||
Where `HOST` is the IP address or the name of the node that runs the server and
|
||||
`yourpassword` is the password provided in the Fuel UI for the user of InfluxDB.
|
||||
credentials are those provided in the Fuel UI for the InfluxDB root user.
|
||||
|
||||
The curl command should return a valid JSON object similar to:
|
||||
The curl command should return something similar to:
|
||||
|
||||
```
|
||||
[{"name":"list_series_result","columns":["time","sequence_number","name"],"points":[...]}]
|
||||
{"results":[{"series":[{"name":"databases","columns":["name"],"values":[["lma"]]}]}]}
|
||||
```
|
||||
|
||||
### Grafana
|
||||
|
||||
To check that Grafana is running, you need to make sure that *nginx* is listening
|
||||
on port 80. The user interface is available at:
|
||||
|
||||
```
|
||||
http://$HOST/
|
||||
```
|
||||
|
||||
**Note**: if you deploy this plugin on a node that is also running the
|
||||
[Elasticsearch-Kibana plugin](https://github.com/stackforge/fuel-plugin-elasticsearch-kibana)
|
||||
then *nginx* will use the port 8000 instead of 80. So in that case the user interface
|
||||
is available at:
|
||||
Grafana is available at:
|
||||
|
||||
```
|
||||
http://$HOST:8000/
|
||||
```
|
||||
|
||||
You can login by using the username and password that you provided in the Fuel UI.
|
||||
|
||||
Known issues
|
||||
------------
|
||||
|
||||
|
@ -141,7 +137,8 @@ Release Notes
|
|||
|
||||
**0.8.0**
|
||||
|
||||
*
|
||||
* Upgrade Grafana to 2.1
|
||||
* Upgrade InfluxDB to 0.9
|
||||
|
||||
**0.7.0**
|
||||
|
||||
|
|
|
@ -13,18 +13,9 @@
|
|||
# under the License.
|
||||
#
|
||||
$influxdb_grafana = hiera('influxdb_grafana')
|
||||
$elasticsearch_kibana = hiera('elasticsearch_kibana', undef)
|
||||
$user_node_name = hiera('user_node_name')
|
||||
|
||||
if $influxdb_grafana['node_name'] == $user_node_name {
|
||||
if $elasticsearch_kibana {
|
||||
$http_port = $elasticsearch_kibana['node_name'] ? {
|
||||
$user_node_name => 8000,
|
||||
default => 80,
|
||||
}
|
||||
} else {
|
||||
$http_port = 80
|
||||
}
|
||||
|
||||
class {'::firewall':}
|
||||
|
||||
|
@ -58,7 +49,7 @@ if $influxdb_grafana['node_name'] == $user_node_name {
|
|||
}
|
||||
|
||||
firewall { '201 grafana':
|
||||
port => $http_port,
|
||||
port => 8000,
|
||||
proto => 'tcp',
|
||||
action => 'accept',
|
||||
}
|
||||
|
|
|
@ -13,27 +13,11 @@
|
|||
# under the License.
|
||||
#
|
||||
$influxdb_grafana = hiera('influxdb_grafana')
|
||||
$elasticsearch_kibana = hiera('elasticsearch_kibana', undef)
|
||||
$user_node_name = hiera('user_node_name')
|
||||
|
||||
if $influxdb_grafana['node_name'] == $user_node_name {
|
||||
|
||||
# We want to be able to deploy this plugin with Elasticsearch-Kibana. So
|
||||
# we check if EK plugin is deployed and if it is the case we set the listen
|
||||
# port to 8000 instead of 80.
|
||||
if $elasticsearch_kibana {
|
||||
$listen_port = $elasticsearch_kibana['node_name'] ? {
|
||||
$user_node_name => 8000,
|
||||
default => 80,
|
||||
}
|
||||
} else {
|
||||
$listen_port = 80
|
||||
}
|
||||
|
||||
class {'lma_monitoring_analytics::grafana':
|
||||
listen_port => $listen_port,
|
||||
influxdb_dbname => $influxdb_grafana['influxdb_dbname'],
|
||||
influxdb_username => $influxdb_grafana['influxdb_username'],
|
||||
influxdb_userpass => $influxdb_grafana['influxdb_userpass'],
|
||||
admin_username => $influxdb_grafana['grafana_username'],
|
||||
admin_password => $influxdb_grafana['grafana_userpass'],
|
||||
}
|
||||
}
|
||||
|
|
|
@ -15,102 +15,24 @@
|
|||
# == Class: lma_monitoring_analytics::grafana
|
||||
|
||||
class lma_monitoring_analytics::grafana (
|
||||
$listen_port = $lma_monitoring_analytics::params::listen_port,
|
||||
$influxdb_dbname = undef,
|
||||
$influxdb_username = undef,
|
||||
$influxdb_userpass = undef,
|
||||
$admin_username = undef,
|
||||
$admin_password = undef,
|
||||
$http_port = $lma_monitoring_analytics::params::listen_port,
|
||||
) inherits lma_monitoring_analytics::params {
|
||||
|
||||
$grafana_dir = $lma_monitoring_analytics::params::grafana_dir
|
||||
$grafana_conf = $lma_monitoring_analytics::params::grafana_conf
|
||||
$influxdb_host = $lma_monitoring_analytics::params::influxdb_host
|
||||
$grafana_dbname = $lma_monitoring_analytics::params::grafana_dbname
|
||||
$grafana_home_dashboard = $lma_monitoring_analytics::params::grafana_home_dashboard
|
||||
|
||||
# Deploy sources
|
||||
file { $grafana_dir:
|
||||
source => 'puppet:///modules/lma_monitoring_analytics/grafana/sources',
|
||||
recurse => true,
|
||||
}
|
||||
|
||||
# Replace config.js
|
||||
file { $grafana_conf:
|
||||
ensure => file,
|
||||
content => template('lma_monitoring_analytics/grafana/config.js.erb'),
|
||||
require => File[$grafana_dir],
|
||||
}
|
||||
|
||||
# Install the dashboards
|
||||
$dashboard_defaults = {
|
||||
ensure => present,
|
||||
storage_url => "http://localhost:8086/db/${grafana_dbname}",
|
||||
storage_user => $influxdb_username,
|
||||
storage_password => $influxdb_userpass,
|
||||
}
|
||||
$dashboards = {
|
||||
'Main' => {
|
||||
content => template('lma_monitoring_analytics/grafana_dashboards/Main.json'),
|
||||
class { '::grafana':
|
||||
install_method => 'repo',
|
||||
manage_package_repo => false,
|
||||
cfg => {
|
||||
server => {
|
||||
http_port => $http_port,
|
||||
},
|
||||
security => {
|
||||
admin_user => $admin_username,
|
||||
admin_password => $admin_password,
|
||||
},
|
||||
analytics => {
|
||||
reporting_enabled => false,
|
||||
},
|
||||
},
|
||||
'Apache' => {
|
||||
content => template('lma_monitoring_analytics/grafana_dashboards/Apache.json'),
|
||||
},
|
||||
'Ceph' => {
|
||||
content => template('lma_monitoring_analytics/grafana_dashboards/Ceph.json'),
|
||||
},
|
||||
'Ceph OSD' => {
|
||||
content => template('lma_monitoring_analytics/grafana_dashboards/Ceph_OSD.json'),
|
||||
},
|
||||
'Cinder' => {
|
||||
content => template('lma_monitoring_analytics/grafana_dashboards/Cinder.json'),
|
||||
},
|
||||
'Glance' => {
|
||||
content => template('lma_monitoring_analytics/grafana_dashboards/Glance.json'),
|
||||
},
|
||||
'HAProxy' => {
|
||||
content => template('lma_monitoring_analytics/grafana_dashboards/HAProxy.json'),
|
||||
},
|
||||
'Keystone' => {
|
||||
content => template('lma_monitoring_analytics/grafana_dashboards/Keystone.json'),
|
||||
},
|
||||
'LMA self-monitoring' => {
|
||||
content => template('lma_monitoring_analytics/grafana_dashboards/LMA.json'),
|
||||
},
|
||||
'Memcached' => {
|
||||
content => template('lma_monitoring_analytics/grafana_dashboards/Memcached.json'),
|
||||
},
|
||||
'MySQL' => {
|
||||
content => template('lma_monitoring_analytics/grafana_dashboards/MySQL.json'),
|
||||
},
|
||||
'Neutron' => {
|
||||
content => template('lma_monitoring_analytics/grafana_dashboards/Neutron.json'),
|
||||
},
|
||||
'Nova' => {
|
||||
content => template('lma_monitoring_analytics/grafana_dashboards/Nova.json'),
|
||||
},
|
||||
'RabbitMQ' => {
|
||||
content => template('lma_monitoring_analytics/grafana_dashboards/RabbitMQ.json'),
|
||||
},
|
||||
'Heat' => {
|
||||
content => template('lma_monitoring_analytics/grafana_dashboards/Heat.json'),
|
||||
},
|
||||
'System' => {
|
||||
content => template('lma_monitoring_analytics/grafana_dashboards/System.json'),
|
||||
},
|
||||
}
|
||||
create_resources(grafana_dashboard, $dashboards, $dashboard_defaults)
|
||||
|
||||
# And now install nginx
|
||||
class { 'nginx':
|
||||
manage_repo => false,
|
||||
nginx_vhosts => {
|
||||
'grafana.local' => {
|
||||
'www_root' => $grafana_dir
|
||||
}
|
||||
},
|
||||
nginx_vhosts_defaults => {
|
||||
'listen_port' => $listen_port,
|
||||
'listen_options' => 'default_server'
|
||||
},
|
||||
require => File[$grafana_conf],
|
||||
}
|
||||
}
|
||||
|
|
|
@ -15,12 +15,8 @@
|
|||
# == Class lma_monitoring_analytics::params
|
||||
|
||||
class lma_monitoring_analytics::params {
|
||||
$listen_port = 80
|
||||
$listen_port = 8000
|
||||
$influxdb_host = undef
|
||||
$influxdb_script = '/usr/local/bin/configure_influxdb.sh'
|
||||
$influxdb_dir = '/opt/influxdb'
|
||||
$grafana_dbname = 'grafana'
|
||||
$grafana_dir = '/opt/grafana'
|
||||
$grafana_conf = "${grafana_dir}/config.js"
|
||||
$grafana_home_dashboard = '/dashboard/db/main'
|
||||
}
|
||||
|
|
|
@ -1,52 +0,0 @@
|
|||
// Sample configuration for the LMA dashboard
|
||||
// Copy this file to your Grafana source directory
|
||||
define(['settings'], function(Settings) {
|
||||
|
||||
return new Settings({
|
||||
datasources: {
|
||||
influxdb: {
|
||||
type: 'influxdb',
|
||||
<% if @influxdb_host -%>
|
||||
url: "http://<%= @influxdb_host %>:8086/db/<%= @influxdb_dbname %>",
|
||||
<% else -%>
|
||||
url: "http://" + window.location.hostname + ":8086/db/<%= @influxdb_dbname %>",
|
||||
<% end -%>
|
||||
username: "<%= @influxdb_username %>",
|
||||
password: "<%= @influxdb_userpass %>",
|
||||
},
|
||||
grafana: {
|
||||
type: 'influxdb',
|
||||
<% if @influxdb_host -%>
|
||||
url: "http://<%= @influxdb_host %>:8086/db/<%= @grafana_dbname %>",
|
||||
<% else -%>
|
||||
url: "http://" + window.location.hostname + ":8086/db/<%= @grafana_dbname %>",
|
||||
<% end -%>
|
||||
username: "<%= @influxdb_username %>",
|
||||
password: "<%= @influxdb_userpass %>",
|
||||
grafanaDB: true
|
||||
},
|
||||
},
|
||||
|
||||
search: {
|
||||
max_results: 100
|
||||
},
|
||||
|
||||
default_route: '<%= @grafana_home_dashboard %>',
|
||||
|
||||
unsaved_changes_warning: true,
|
||||
|
||||
playlist_timespan: "1m",
|
||||
|
||||
admin: {
|
||||
password: ''
|
||||
},
|
||||
|
||||
window_title_prefix: 'LMA - ',
|
||||
|
||||
plugins: {
|
||||
panels: [],
|
||||
dependencies: [],
|
||||
}
|
||||
|
||||
});
|
||||
});
|
|
@ -1,5 +1,6 @@
|
|||
attributes:
|
||||
|
||||
# === INFLUXDB ===
|
||||
node_name:
|
||||
value: 'influxdb'
|
||||
label: 'Node name'
|
||||
|
@ -50,6 +51,26 @@ attributes:
|
|||
source: '^[\S]{4,}$'
|
||||
error: "You must provide a password with at least 4 characters"
|
||||
|
||||
grafana_username:
|
||||
value: 'lma'
|
||||
label: 'User name'
|
||||
description: 'The name of the Grafana admin user'
|
||||
weight: 63
|
||||
type: "text"
|
||||
regex:
|
||||
source: '\S'
|
||||
error: "You must provide a username"
|
||||
|
||||
grafana_userpass:
|
||||
value: ''
|
||||
label: 'User password'
|
||||
description: 'The password of the Grafana admin user'
|
||||
weight: 66
|
||||
type: "password"
|
||||
regex:
|
||||
source: '^[\S]{4,}$'
|
||||
error: "You must provide a password with at least 4 characters"
|
||||
|
||||
# Parameter hidden in the UI on purpose
|
||||
data_dir:
|
||||
value: '/opt/influxdb'
|
||||
|
|
|
@ -6,8 +6,9 @@ MODULES="${ROOT}"/deployment_scripts/puppet/modules
|
|||
RPM_REPO="${ROOT}"/repositories/centos/
|
||||
DEB_REPO="${ROOT}"/repositories/ubuntu/
|
||||
|
||||
# Puppet manifests required for grafana
|
||||
NGINX_TARBALL_URL="https://forgeapi.puppetlabs.com/v3/files/jfryman-nginx-0.2.2.tar.gz"
|
||||
# Puppet manifests for Grafana
|
||||
# NOTE: We are downloading master until branch 2.1.x is available.
|
||||
GRAFANA_TARBALL_URL="https://github.com/bfraser/puppet-grafana/archive/master.tar.gz"
|
||||
|
||||
# Puppet manifests from fuel-lib
|
||||
# This is the commit id for the current stable/6.1 branch
|
||||
|
@ -35,13 +36,18 @@ function download {
|
|||
download deb https://s3.amazonaws.com/influxdb/influxdb_0.9.2_amd64.deb
|
||||
download rpm https://s3.amazonaws.com/influxdb/influxdb-0.9.2-1.x86_64.rpm
|
||||
|
||||
# As Grafana 2.1.x is required for InfluxDB, we download nightly build until
|
||||
# official release is available.
|
||||
download deb https://grafanarel.s3.amazonaws.com/builds/grafana_latest_amd64.deb
|
||||
download rpm https://grafanarel.s3.amazonaws.com/builds/grafana-latest-1.x86_64.rpm
|
||||
|
||||
# Install puppet manifests
|
||||
# Clean-up first
|
||||
rm -rf "${MODULES:?}"/{nginx,stdlib,concat,inifile,disk_management,lvm}
|
||||
mkdir -p "${MODULES}"/nginx
|
||||
rm -rf "${MODULES:?}"/{grafana,stdlib,concat,inifile,disk_management,lvm}
|
||||
mkdir -p "${MODULES}"/grafana
|
||||
|
||||
# Include nginx.
|
||||
wget -qO- "${NGINX_TARBALL_URL}" | tar -C "${MODULES}/nginx" --strip-components=1 -xz
|
||||
# Include Grafana.
|
||||
wget -qO- "${GRAFANA_TARBALL_URL}" | tar -C "${MODULES}/grafana" --strip-components=1 -xz
|
||||
|
||||
# Include dependent manifests from fuel-library
|
||||
wget -qO- "${FUEL_LIB_TARBALL_URL}" | \
|
||||
|
@ -52,9 +58,3 @@ wget -qO- "${FUEL_LIB_TARBALL_URL}" | \
|
|||
wget -qO- "${MODULE_DISK_MANAGEMENT}" | \
|
||||
tar -C "${MODULES}" --strip-components=4 -xzvf - \
|
||||
fuel-plugin-elasticsearch-kibana-master/deployment_scripts/puppet/modules/disk_management
|
||||
|
||||
# We need to embed grafana sources into the lma_monitoring_analytics module.
|
||||
GRAFANA_TARBALL_URL="http://grafanarel.s3.amazonaws.com/grafana-1.9.1.tar.gz"
|
||||
GRAFANA_FOLDER="${MODULES}/lma_monitoring_analytics/files/grafana/sources"
|
||||
mkdir -p "${GRAFANA_FOLDER}"
|
||||
wget -qO- "${GRAFANA_TARBALL_URL}" | tar -C "${GRAFANA_FOLDER}" --strip-components=1 -xz
|
||||
|
|
Loading…
Reference in New Issue