Merge "Create grafana.o.o under -infra"

This commit is contained in:
Jenkins 2015-07-30 19:54:17 +00:00 committed by Gerrit Code Review
commit 6d5a3800a6
6 changed files with 173 additions and 0 deletions

46
doc/source/grafana.rst Normal file
View File

@ -0,0 +1,46 @@
:title: Grafana
.. _grafana:
Grafana
#######
Grafana is an open source, feature rich metrics dashboard and graph editor for
Graphite, InfluxDB & OpenTSDB. Openstack runs Graphite which stores all the
metrics related to Nodepool, Zuul and Jenkins (to name a few).
At a Glance
===========
:Hosts:
* http://grafana.openstack.org
:Puppet:
* https://github.com/bfraser/puppet-grafana
* :file:`modules/openstack_project/manifests/grafana.pp`
:Projects:
* http://grafana.org
:Bugs:
* https://storyboard.openstack.org/#!/project/748
Overview
========
Apache is configured as a reverse proxy and there is a MySQL database
backend.
Sysadmin
========
After bringing up a Grafana node with puppet, log in and configure Grafana by
hand:
#. Log in as the admin user.
#. Under 'Data Sources', add a new entry with following:
- name: OpenStack
- type: Graphite
- default: checked
- url: http://graphite.openstack.org
- access: direct

View File

@ -8,6 +8,7 @@ Major Systems
cacti
gerrit
grafana
jenkins
zuul
jjb

View File

@ -116,6 +116,24 @@ node 'review-dev.openstack.org' {
}
}
# Node-OS: trusty
node 'grafana.openstack.org' {
class { 'openstack_project::server':
iptables_public_tcp_ports => [80],
sysadmins => hiera('sysadmins', []),
}
class { 'openstack_project::grafana':
admin_password => hiera('grafana_admin_password', 'XXX'),
admin_user => hiera('grafana_admin_user', 'username'),
mysql_host => hiera('grafana_mysql_host', 'localhost'),
mysql_name => hiera('grafana_mysql_name', 'XXX'),
mysql_password => hiera('grafana_mysql_password', 'XXX'),
mysql_root_password => hiera('grafana_mysql_root_password', 'XXX'),
mysql_user => hiera('grafana_mysql_user', 'username'),
secret_key => hiera('grafana_secret_key', 'XXX'),
}
}
# Node-OS: precise
node 'jenkins.openstack.org' {
$group = "jenkins"

View File

@ -35,6 +35,7 @@
# - our intent was not to limit it's use and it should be Apache
# licensed
SOURCE_MODULES["https://git.openstack.org/openstack-infra/puppet-vcsrepo"]="0.0.8"
SOURCE_MODULES["https://github.com/bfraser/puppet-grafana"]="c51f03df3b41755bf3968c978d80b3fc94138652"
SOURCE_MODULES["https://github.com/biemond/biemond-wildfly"]="v0.2.4"
SOURCE_MODULES["https://github.com/maestrodev/puppet-wget"]="v1.6.0"
SOURCE_MODULES["https://github.com/nanliu/puppet-git"]="0.1.0"

View File

@ -0,0 +1,91 @@
# == Class: openstack_project::grafana
#
# === Parameters
# [*cfg*]
# Manages the Grafana configuration file. The upstream puppet-grafana module
# documentaion: https://github.com/bfraser/puppet-grafana#cfg
#
class openstack_project::grafana (
$mysql_password,
$mysql_root_password,
$admin_password = '',
$admin_user = 'admin',
$grafana_cfg = {},
$mysql_host = '127.0.0.1',
$mysql_name = 'grafana',
$mysql_user = 'grafana',
$secret_key = '',
$vhost_name = $::fqdn,
) {
include apache
$grafana_cfg_defaults = {
# NOTE(pabelanger): app_mode must be the first key!
'app_mode' => 'production',
'analytics' => {
'reporting_enabled' => false,
},
'auth.anonymous' => {
enabled => true,
},
'database' => {
type => 'mysql',
host => "${mysql_host}:3306",
name => $mysql_name,
user => $mysql_user,
password => $mysql_password,
},
'security' => {
admin_password => $admin_password,
admin_user => $admin_user,
secret_key => $secret_key,
},
'server' => {
http_addr => '127.0.0.1',
http_port => 8080,
},
'users' => {
allow_sign_up => false,
},
}
$grafana_cfg_merged = merge($grafana_cfg_defaults, $grafana_cfg)
class { 'mysql::server':
config_hash => {
'bind_address' => $mysql_host,
'default_engine' => 'InnoDB',
'root_password' => $mysql_root_password,
}
}
mysql::db { $mysql_name:
grant => ['all'],
host => $mysql_host,
password => $mysql_password,
user => $mysql_user,
require => Class['mysql::server'],
}
class { '::grafana':
cfg => $grafana_cfg_merged,
require => Mysql::Db[$mysql_name],
}
apache::vhost { $vhost_name:
docroot => 'MEANINGLESS ARGUMENT',
port => 80,
priority => '50',
template => 'openstack_project/grafana.vhost.erb',
}
a2mod { 'rewrite':
ensure => present,
}
a2mod { 'proxy':
ensure => present,
}
a2mod { 'proxy_http':
ensure => present,
}
}

View File

@ -0,0 +1,16 @@
# ************************************
# Managed by Puppet
# ************************************
NameVirtualHost <%= @vhost_name %>:<%= @port %>
<VirtualHost <%= @vhost_name %>:<%= @port %>>
ServerName <%= @srvname %>
ProxyPass / http://127.0.0.1:8080/ retry=0 nocanon
ProxyPassReverse / http://127.0.0.1:8080/
ErrorLog /var/log/apache2/<%= @name %>_error.log
LogLevel warn
CustomLog /var/log/apache2/<%= @name %>_access.log combined
ServerSignature Off
</VirtualHost>