diff --git a/modules/openstack_project/files/elastic-recheck/elastic-recheck.html b/modules/openstack_project/files/elastic-recheck/elastic-recheck.html new file mode 100644 index 0000000000..d8f31b603d --- /dev/null +++ b/modules/openstack_project/files/elastic-recheck/elastic-recheck.html @@ -0,0 +1,70 @@ + + + Elastic Recheck + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+ + + + diff --git a/modules/openstack_project/files/elastic-recheck/elastic-recheck.js b/modules/openstack_project/files/elastic-recheck/elastic-recheck.js new file mode 100644 index 0000000000..f2d72d96c5 --- /dev/null +++ b/modules/openstack_project/files/elastic-recheck/elastic-recheck.js @@ -0,0 +1,60 @@ +// Copyright 2013 OpenStack Foundation +// +// Licensed under the Apache License, Version 2.0 (the "License"); you may +// not use this file except in compliance with the License. You may obtain +// a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +// License for the specific language governing permissions and limitations +// under the License. + +function update() { + $.getJSON('http://status.openstack.org/elastic-recheck/graph.json', function(data) { + var seen = []; + $.each(data, function(i, bug) { + var id = 'bug-'+bug['number']; + seen.push(id); + var div = $('#'+id); + + if (!div.length) { + div = $('
', {'id': id, 'class': 'bug-container'}); + div.appendTo($('#main-container')); + $('

', {text: 'Bug ' + bug['number']}).appendTo(div); + $('
', {'class': 'graph'}).appendTo(div); + $('', { + href: 'http://logstash.openstack.org/#'+bug['logstash_query'], + text: 'Logstash' + }).appendTo($('', { + 'class': 'extlink' + }).appendTo(div)); + $('', { + href: 'https://bugs.launchpad.net/bugs/'+bug['number'], + text: 'Launchpad' + }).appendTo($('', { + 'class': 'extlink' + }).appendTo(div)); + } + div = div.find(".graph"); + + $.plot(div, bug['data'], + {xaxis: { + mode: "time" + }} + ); + + }); + $.each($('.bug-container'), function(i, container) { + if (seen.indexOf(container.id) == -1) { + container.remove(); + } + }); + }); +} + +$(function() { + update(); +}); diff --git a/modules/openstack_project/manifests/static.pp b/modules/openstack_project/manifests/static.pp index a01c899bea..7243403829 100644 --- a/modules/openstack_project/manifests/static.pp +++ b/modules/openstack_project/manifests/static.pp @@ -271,6 +271,90 @@ class openstack_project::static ( require => [File['/srv/static/status'], Vcsrepo['/opt/jquery-graphite']], } + vcsrepo { '/opt/flot': + ensure => latest, + provider => git, + revision => 'master', + source => 'https://github.com/flot/flot.git', + } + + exec { 'install_flot' : + command => 'yui-compressor -o \'.js$:.min.js\' /opt/flot/jquery.flot*.js; mv /opt/flot/jquery.flot*.min.js /srv/static/status', + path => '/bin:/usr/bin', + refreshonly => true, + subscribe => Vcsrepo['/opt/flot'], + require => [File['/srv/static/status'], + Vcsrepo['/opt/flot']], + } + + ########################################################### + # Status - elastic-recheck + + group { 'recheck': + ensure => 'present', + } + + user { 'recheck': + ensure => present, + home => '/home/recheck', + shell => '/bin/bash', + gid => 'recheck', + require => Group['recheck'], + } + + file { '/home/recheck': + ensure => directory, + mode => '0700', + owner => 'recheck', + group => 'recheck', + require => User['recheck'], + } + + vcsrepo { '/opt/elastic-recheck': + ensure => latest, + provider => git, + revision => 'master', + source => 'https://git.openstack.org/openstack-infra/elastic-recheck', + } + + include pip + exec { 'install_elastic-recheck' : + command => 'python setup.py install', + cwd => '/opt/elastic-recheck', + path => '/bin:/usr/bin', + refreshonly => true, + subscribe => Vcsrepo['/opt/elastic-recheck'], + require => Class['pip'], + } + + file { '/srv/static/status/elastic-recheck': + ensure => directory, + owner => 'recheck', + group => 'recheck', + require => User['recheck'], + } + + file { '/srv/static/status/elastic-recheck/index.html': + ensure => present, + source => 'puppet:///modules/openstack_project/elastic-recheck/elastic-recheck.html', + require => File['/srv/static/status/elastic-recheck'], + } + + file { '/srv/static/status/elastic-recheck/elastic-recheck.js': + ensure => present, + source => 'puppet:///modules/openstack_project/elastic-recheck/elastic-recheck.js', + require => File['/srv/static/status/elastic-recheck'], + } + + cron { 'elastic-recheck': + user => 'recheck', + minute => '*/15', + hour => '*', + command => 'elastic-recheck-graph /opt/elastic-recheck/queries.yaml -o /srv/static/status/elastic-recheck/graph-new.json && mv /srv/static/status/elastic-recheck/graph-new.json /srv/static/status/elastic-recheck/graph.json', + environment => 'PATH=/usr/bin:/bin:/usr/sbin:/sbin', + require => [Vcsrepo['/opt/elastic-recheck'], + User['recheck']], + } ########################################################### # Status - zuul