-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
921d298
commit 85cf2ed
Showing
35 changed files
with
9,398 additions
and
467 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
.DS_Store | ||
.sass-cache | ||
.bundle | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,7 @@ | ||
source "http://rubygems.org" | ||
gem "sinatra" | ||
gem "haml" | ||
gem "compass" | ||
|
||
group :test do | ||
gem "rspec" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
require './healthchecker' | ||
|
||
Healthchecker.run! |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,14 @@ | ||
--- | ||
projects: | ||
colaboracoes: | ||
id: colaboracoes | ||
name: Colaborações | ||
url: http://colaboracoes.globo.com/healthcheck | ||
|
||
participacoes: | ||
id: participacoes | ||
name: Participações | ||
url: http://participacoes.globo.com/healthcheck | ||
|
||
colaboracoes2: | ||
id: colaboracoes2 | ||
name: Colaborações2 | ||
url: http://colaboracoes.globo.com/healthcheck | ||
|
||
participacoes2: | ||
id: participacoes2 | ||
name: Participações2 | ||
url: http://participacoes.globo.com/healthcheck | ||
globo: | ||
name: Globo | ||
url: http://www.globo.com/ | ||
bing: | ||
name: Bing | ||
url: http://br.bing.com/ | ||
xang: | ||
name: Xang | ||
url: | ||
- http://xang.com/ | ||
- http://xeng.com/ | ||
- http://xing.com/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
project_path = Sinatra::Application.root | ||
environment = :development | ||
|
||
# This is common configuration | ||
sass_dir = File.join 'views', 'stylesheets' | ||
images_dir = File.join 'static', 'images' | ||
http_path = "/" | ||
http_images_path = "/images" | ||
http_stylesheets_path = "/stylesheets" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,40 +1,52 @@ | ||
#!/usr/bin/env ruby | ||
require "rubygems" | ||
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__))) | ||
require "bundler/setup" | ||
|
||
require 'sinatra' | ||
require 'lib/connection' | ||
require 'yaml' | ||
require 'haml' | ||
require 'json' | ||
require 'compass' | ||
|
||
class Healthchecker < Sinatra::Base | ||
|
||
before do | ||
@config = YAML::load_file('config.yml') | ||
end | ||
configure do | ||
set :public_folder, File.dirname(__FILE__) + '/static' | ||
set :haml, {:format => :html5, :escape_html => true} | ||
set :sass, {:style => :compact, :debug_info => false} | ||
Compass.add_project_configuration(File.join(Sinatra::Application.root, 'config', 'compass.rb')) | ||
end | ||
|
||
get '/' do | ||
haml :index | ||
end | ||
get '/stylesheets/:name.css' do | ||
content_type 'text/css', :charset => 'utf-8' | ||
sass :"stylesheets/#{params[:name]}", Compass.sass_engine_options | ||
end | ||
|
||
get "/config" do | ||
@config.to_json | ||
end | ||
before do | ||
@config = YAML::load_file('config.yml') | ||
end | ||
|
||
get '/' do | ||
haml :index | ||
end | ||
|
||
get "/project/:project_name" do | ||
project_key = params[:project_name] | ||
project_config = @config['projects'][project_key] | ||
project_links = project_config['url'] | ||
project_links = [project_links] unless project_links.is_a? Array | ||
get "/project/:project_name.json" do | ||
content_type :json | ||
|
||
errors = project_links.inject([]) do |errors_list, link| | ||
status = Connection.new(link).status_code | ||
errors_list << {server: link, error: status} if status != '200' | ||
errors_list | ||
end | ||
project_key = params[:project_name] | ||
project_config = @config['projects'][project_key] | ||
project_links = project_config['url'] | ||
project_links = [project_links] unless project_links.is_a? Array | ||
|
||
errors = project_links.inject([]) do |errors_list, link| | ||
status = Connection.new(link).status_code | ||
errors_list << {server: link, error: status} if status != '200' | ||
errors_list | ||
end | ||
|
||
result = errors.empty? ? "ok" : "down" | ||
resposta = {project_name: project_key, status: result, errors: errors} | ||
resposta.to_json | ||
end | ||
result = errors.empty? ? "ok" : "down" | ||
resposta = {project_name: project_key, status: result, errors: errors} | ||
resposta.to_json | ||
end | ||
end |
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Oops, something went wrong.