Initial setup via Ansible.
Change-Id: I8f24134a1c3410acb8bc12fa07023b8eb32be93f
This commit is contained in:
parent
572cb2ada8
commit
a9ae72ebda
5
.gitignore
vendored
5
.gitignore
vendored
@ -1,12 +1,7 @@
|
||||
.vagrant
|
||||
Berksfile.lock
|
||||
.project
|
||||
hlinux/templates/output-virtualbox-iso
|
||||
hlinux/templates/packer_cache
|
||||
.pydevproject
|
||||
.idea
|
||||
.settings
|
||||
*.deb
|
||||
*.pyc
|
||||
utils/cluster/data_bags/vertica/ssh_key.json
|
||||
utils/cluster/data_bags/vertica/backup_credentials.json
|
||||
|
23
Berksfile
23
Berksfile
@ -1,23 +0,0 @@
|
||||
require 'rubygems'
|
||||
|
||||
if Gem::Specification::find_by_name('berkshelf').version.to_s[0] == '3'
|
||||
source 'https://api.berkshelf.com'
|
||||
end
|
||||
|
||||
cookbook 'mini-mon', path: './cookbooks/mini-mon'
|
||||
cookbook 'devstack', path: './cookbooks/devstack'
|
||||
cookbook 'ds-build', path: './cookbooks/ds-build'
|
||||
cookbook 'monasca_api', git: 'https://github.com/stackforge/cookbook-monasca-api'
|
||||
cookbook 'kafka', git: 'https://github.com/hpcloud-mon/cookbooks-kafka'
|
||||
cookbook 'monasca_agent', git: 'https://github.com/stackforge/cookbook-monasca-agent'
|
||||
cookbook 'monasca_notification', git: 'https://github.com/stackforge/cookbook-monasca-notification'
|
||||
cookbook 'monasca_persister', git: 'https://github.com/stackforge/cookbook-monasca-persister.git'
|
||||
cookbook 'monasca_schema', git: 'https://github.com/stackforge/cookbook-monasca-schema.git'
|
||||
cookbook 'monasca_thresh', git: 'https://github.com/stackforge/cookbook-monasca-thresh.git'
|
||||
cookbook 'storm', git: 'https://github.com/tkuhlman/storm'
|
||||
cookbook 'zookeeper', git: 'https://github.com/hpcloud-mon/cookbooks-zookeeper'
|
||||
|
||||
# Community cookbooks
|
||||
cookbook 'apt', '= 2.4.0'
|
||||
cookbook 'influxdb', git: 'https://github.com/SimpleFinance/chef-influxdb', tag: "2.1.1"
|
||||
cookbook 'percona', git: 'https://github.com/phlipper/chef-percona', tag: "0.15.5"
|
90
README.md
90
README.md
@ -8,20 +8,13 @@
|
||||
- [Install VirtualBox and Vagrant](#install-virtualbox-and-vagrant)
|
||||
- [MacOS](#macos)
|
||||
- [Linux (Ubuntu)](#linux-ubuntu)
|
||||
- [Set Up Berkshelf](#set-up-berkshelf)
|
||||
- [MacOS](#macos-1)
|
||||
- [Linux (Ubuntu)](#linux-ubuntu-1)
|
||||
- [Using mini-mon](#using-mini-mon)
|
||||
- [Starting mini-mon](#starting-mini-mon)
|
||||
- [Mini-mon access information](#mini-mon-access-information)
|
||||
- [Internal Endpoints](#internal-endpoints)
|
||||
- [Updating](#updating)
|
||||
- [Improving Provisioning Speed](#improving-provisioning-speed)
|
||||
- [Local cache](#local-cache)
|
||||
- [Linux (Ubuntu)](#linux-ubuntu-2)
|
||||
- [MacOS](#macos-2)
|
||||
- [vagrant-cachier](#vagrant-cachier)
|
||||
- [Cookbook Development](#cookbook-development)
|
||||
- [Ansible Development](#ansible-development)
|
||||
- [Running behind a Web Proxy](#running-behind-a-web-proxy)
|
||||
- [Alternate Vagrant Configurations](#alternate-vagrant-configurations)
|
||||
|
||||
@ -42,37 +35,23 @@ git clone https://github.com/stackforge/monasca-vagrant
|
||||
Note: Vagrant version 1.5.0 or higher is required.
|
||||
|
||||
#### MacOS
|
||||
The following steps assume you have [Homebrew](http://brew.sh/) installed. Otherwise, install [VirtualBox](http://www.virtualbox.org) and [Vagrant](http://www.vagrantup.com) manually from their websites, then continue with Set Up Berkshelf below.
|
||||
The following steps assume you have [Homebrew](http://brew.sh/) installed. Otherwise, install [VirtualBox](http://www.virtualbox.org) and [Vagrant](http://www.vagrantup.com) and [Ansible](http://www.ansible.com) as suggested on their websites.
|
||||
|
||||
```
|
||||
brew tap phinze/cask
|
||||
brew install brew-cask
|
||||
brew cask install virtualbox
|
||||
brew cask install vagrant
|
||||
brew install ansible
|
||||
ansible-galaxy install -r ansible_roles -p ./roles
|
||||
```
|
||||
|
||||
#### Linux (Ubuntu)
|
||||
```
|
||||
# You need the ruby (>1.9), ruby-dev and build-essential packages installed for these commands to complete
|
||||
|
||||
# Specifically for Ubuntu 12.04, you may need to install ruby 1.9 first
|
||||
sudo apt-get install ruby1.9.3
|
||||
sudo update-alternatives --set ruby /usr/bin/ruby1.9.1
|
||||
|
||||
sudo apt-get install virtualbox
|
||||
#Download and install latest vagrant from http://www.vagrantup.com/downloads.html
|
||||
```
|
||||
|
||||
### Set Up Berkshelf
|
||||
#### MacOS
|
||||
```
|
||||
vagrant plugin install vagrant-berkshelf --plugin-version '= 2.0.1'
|
||||
gem install berkshelf
|
||||
```
|
||||
#### Linux (Ubuntu)
|
||||
```
|
||||
sudo vagrant plugin install vagrant-berkshelf --plugin-version '= 2.0.1'
|
||||
sudo gem install berkshelf
|
||||
sudo pip install ansible
|
||||
ansible-galaxy install -r ansible_roles -p ./roles
|
||||
```
|
||||
|
||||
# Using mini-mon
|
||||
@ -80,6 +59,12 @@ sudo gem install berkshelf
|
||||
- After installing to start just run `vagrant up`. The first run will download required vagrant boxes.
|
||||
- Run `vagrant help` for more info on standard vagrant commands.
|
||||
|
||||
## Smoke test
|
||||
A smoke test exists in the test directory. From within the mini-mon vm this directory is exposed to /vagrant/tests and
|
||||
so `/vagrant/tests/smoke.py` can be run when in a mini-mon terminal.
|
||||
|
||||
Alternatively a very simple playbook is available for running the test, `ansible-playbook ./smoke.yml`
|
||||
|
||||
## Mini-mon access information
|
||||
- Your host OS home dir is synced to `/vagrant_home` on the VM.
|
||||
- The root dir of the monasca-vagrant repo on your host OS is synced to `/vagrant` on the VM.
|
||||
@ -94,57 +79,34 @@ sudo gem install berkshelf
|
||||
- The keystone credentials used are mini-mon/password in the mini-mon project. The keystone services in 192.168.10.5 on standard ports.
|
||||
|
||||
## Updating
|
||||
When someone updates the config, this process should allow you to bring up an updated VM.
|
||||
When someone updates the config, this process should allow you to bring up an updated VM, though not every step is needed at all times.
|
||||
|
||||
- `git pull`
|
||||
- `berks update`
|
||||
- `ansible-galaxy install -r ansible_roles -p ./roles -f`
|
||||
- `vagrant box update`
|
||||
- `vagrant destroy <vm>` Where `<vm>` is the name of the VM being updated, for example 'vertica'
|
||||
- `vagrant up`
|
||||
|
||||
## Improving Provisioning Speed
|
||||
|
||||
The slowest part of the provisioning process is the downloading of deb packages.
|
||||
|
||||
### Local cache
|
||||
|
||||
To speed this up a local apt-cacher-ng can be used.
|
||||
|
||||
#### Linux (Ubuntu)
|
||||
```
|
||||
sudo apt-get install apt-cacher-ng
|
||||
```
|
||||
#### MacOS
|
||||
```
|
||||
brew install apt-cacher-ng
|
||||
```
|
||||
Run `apt-cacher-ng -c /usr/local/etc/apt-cacher-ng/` or optionally follow the instructions from brew to start up the cache automatically.
|
||||
That is all that is needed. From now on, the cache will be used.
|
||||
|
||||
A report from the cache is found at http://localhost:3142/acng-report.html
|
||||
|
||||
### vagrant-cachier
|
||||
|
||||
Instead of using apt-cacher-ng you can also use the Vagrant plugin
|
||||
`vagrant-cachier` available at https://github.com/fgrehm/vagrant-cachier. To
|
||||
use it with this Vagrant box you simply have to install the plugin.
|
||||
The slowest part of the provisioning process is the downloading of packages.
|
||||
The Vagrant plugin `vagrant-cachier` available at https://github.com/fgrehm/vagrant-cachier
|
||||
should help by caching repeated dependencies. To use with Vagrant simply install the plugin.
|
||||
|
||||
```
|
||||
sudo vagrant plugin install vagrant-cachier
|
||||
```
|
||||
|
||||
## Cookbook Development
|
||||
## Ansible Development
|
||||
|
||||
To develop cookbook changes with Vagrant:
|
||||
|
||||
- Edit Berksfile, changing the appropriate cookbook line to a local path. For example:
|
||||
```
|
||||
cookbook 'zookeeper', path: '/Users/kuhlmant/src/mon/cookbooks/zookeeper'
|
||||
```
|
||||
- Edit your local cookbook as needed
|
||||
- Run `berks update <cookbook_name>`
|
||||
- If the Vagrant VM is already up, run `vagrant provision`. Otherwise, run `vagrant up`
|
||||
- When finish testing commit and upload your cookbook as normal but don't forget to bump the cookbook version in the metadata.rb.
|
||||
To edit the Ansible roles I suggest downloading the full git source of the role and putting it in
|
||||
your ansible path. Then though you can rerun `vagrant provision` to test your changes, often it is
|
||||
easier to run ansible directly. For this to work smoothly add these vagrant specific settings to
|
||||
your local ansible configuration
|
||||
|
||||
hostfile = .vagrant/provisioners/ansible/inventory/vagrant_ansible_inventory
|
||||
private_key_file = ~/.vagrant.d/insecure_private_key
|
||||
remote_user = vagrant
|
||||
|
||||
## Running behind a Web Proxy
|
||||
If you are behind a proxy you can install the `vagrant-proxyconf` pluging to have Vagrant honor standard proxy-related environment variables and set the
|
||||
|
19
Vagrantfile
vendored
19
Vagrantfile
vendored
@ -3,14 +3,7 @@
|
||||
|
||||
VAGRANTFILE_API_VERSION = "2" # Vagrantfile API/syntax version. Don't touch unless you know what you're doing!
|
||||
|
||||
unless Vagrant.has_plugin?("vagrant-berkshelf")
|
||||
raise "The needed plugin vagrant-berkshelf is not available.
|
||||
Install it by calling 'vagrant plugin install vagrant-berkshelf'."
|
||||
end
|
||||
|
||||
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
|
||||
# Settings for all vms
|
||||
config.berkshelf.enabled = true
|
||||
|
||||
if Vagrant.has_plugin?("vagrant-cachier")
|
||||
config.cache.scope = :box
|
||||
@ -43,25 +36,27 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
|
||||
end
|
||||
ds.vm.provision :chef_solo do |chef|
|
||||
chef.roles_path = "roles"
|
||||
chef.cookbooks_path = "cookbooks"
|
||||
chef.data_bags_path = "data_bags"
|
||||
chef.add_role "Devstack"
|
||||
chef.arguments = '--force-formatter'
|
||||
end
|
||||
ds.vm.provision "ansible" do |ansible|
|
||||
ansible.playbook = "devstack.yml"
|
||||
end
|
||||
end
|
||||
|
||||
# One vm running all the services
|
||||
config.vm.define "mini-mon" do |mm|
|
||||
mm.vm.hostname = 'mini-mon'
|
||||
mm.vm.box = "kuhlmant/precise64_chef11"
|
||||
mm.vm.box = "ubuntu/trusty64"
|
||||
mm.vm.network :private_network, ip: "192.168.10.4"
|
||||
mm.vm.provider "virtualbox" do |vb|
|
||||
vb.memory = 6144
|
||||
vb.cpus = 4
|
||||
end
|
||||
mm.vm.provision :chef_solo do |chef|
|
||||
chef.roles_path = "roles"
|
||||
chef.data_bags_path = "data_bags"
|
||||
chef.add_role "Mini-Mon"
|
||||
mm.vm.provision "ansible" do |ansible|
|
||||
ansible.playbook = "mini-mon.yml"
|
||||
end
|
||||
end
|
||||
|
||||
|
12
ansible_roles
Normal file
12
ansible_roles
Normal file
@ -0,0 +1,12 @@
|
||||
tkuhlman.kafka
|
||||
tkuhlman.monasca-agent
|
||||
tkuhlman.monasca-api
|
||||
tkuhlman.monasca-notification
|
||||
tkuhlman.monasca-persister
|
||||
tkuhlman.monasca-schema
|
||||
tkuhlman.monasca-thresh
|
||||
tkuhlman.percona
|
||||
tkuhlman.storm
|
||||
tkuhlman.zookeeper
|
||||
|
||||
stympy.influxdb
|
@ -24,7 +24,9 @@ template "/root/.rabbitmq.cnf" do
|
||||
)
|
||||
end
|
||||
|
||||
include_recipe "mini-mon::mysql_client"
|
||||
package 'python-mysqldb' do
|
||||
action :install
|
||||
end
|
||||
template "/root/.my.cnf" do
|
||||
action :create
|
||||
source "my.cnf.erb"
|
||||
|
@ -1,10 +1,13 @@
|
||||
# Installs the mon-ui panel
|
||||
|
||||
package 'python-pip' do
|
||||
action :install
|
||||
end
|
||||
|
||||
# Grab the necessary packages
|
||||
include_recipe "python"
|
||||
['monasca-ui','python-monascaclient'].each do |pkg|
|
||||
python_pip pkg do
|
||||
action :install
|
||||
execute "pip install #{pkg}" do
|
||||
action :run
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -1,12 +0,0 @@
|
||||
mini_mon cookbook
|
||||
=========================
|
||||
Various helper recipes for the mini-mon setup.
|
||||
|
||||
Requirements
|
||||
------------
|
||||
apt cookbook
|
||||
|
||||
Recipes
|
||||
---------
|
||||
- default - configures base apt repostories needed for mini-mon as well as option apt cache
|
||||
- postfix - extremely simple postfix install
|
@ -1,8 +0,0 @@
|
||||
name "mini-mon"
|
||||
maintainer "Mon Team"
|
||||
maintainer_email "hpcs-mon@hp.com"
|
||||
license "All rights reserved"
|
||||
description "Base setup for all vagrant boxes"
|
||||
long_description IO.read(File.join(File.dirname(__FILE__), 'README.md'))
|
||||
version "0.1.3"
|
||||
depends "apt"
|
@ -1,49 +0,0 @@
|
||||
# Common setup for all vagrant boxes
|
||||
|
||||
# Look for a local apt cache, the base repo must be there before the apt cache but it should ideally be before the others
|
||||
rb = ruby_block "Check for local apt cache" do
|
||||
action :nothing
|
||||
block do
|
||||
if system("wget -T 1 -t 1 http://#{node[:network][:default_gateway]}:#{node[:apt][:cacher_port]}/acng-report.html -O /dev/null > /dev/null 2>&1")
|
||||
node.default[:apt][:cacher_ipaddress] = node[:network][:default_gateway]
|
||||
node.default[:apt][:cacher_interface] = 'eth0'
|
||||
Chef::Log.info('Enabling local apt-cache-ng')
|
||||
else
|
||||
node.default[:apt][:cacher_ipaddress] = nil
|
||||
Chef::Log.info('Disabling local apt-cache-ng')
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
rb.run_action(:create) # Run during compile time so that apt::cacher-client has the correct variables set
|
||||
|
||||
# Add in the cacher-client, it will do something or nothing depending on the value of node[:apt][:cacher_ipaddress]
|
||||
include_recipe('apt::cacher-client')
|
||||
|
||||
# Install package dependencies
|
||||
package 'apt-transport-https' do
|
||||
action :install
|
||||
end
|
||||
|
||||
apt_repository 'dev' do
|
||||
uri 'https://region-a.geo-1.objects.hpcloudsvc.com/v1/46995959297574/mini-mon/public_repo'
|
||||
arch 'amd64'
|
||||
distribution 'precise'
|
||||
components ['release']
|
||||
key 'https://region-a.geo-1.objects.hpcloudsvc.com/v1/46995959297574/mini-mon/public_repo/mon.gpg'
|
||||
end
|
||||
|
||||
# In some instances when behind a proxy pip times out, increase the timeout
|
||||
directory "/root/.pip" do
|
||||
action :create
|
||||
owner "root"
|
||||
group "root"
|
||||
mode "0755"
|
||||
end
|
||||
file '/root/.pip/pip.conf' do
|
||||
action :create
|
||||
owner "root"
|
||||
group "root"
|
||||
mode "0644"
|
||||
content "[global]\ntimeout = 180\n"
|
||||
end
|
@ -1,3 +0,0 @@
|
||||
package 'python-mysqldb' do
|
||||
action :install
|
||||
end
|
@ -1,3 +0,0 @@
|
||||
package 'postfix' do
|
||||
action :install
|
||||
end
|
@ -1,9 +0,0 @@
|
||||
{
|
||||
"id" : "monasca_agent",
|
||||
"keystone_url": "http://192.168.10.5:35357/v3",
|
||||
"username": "monasca-agent",
|
||||
"password": "password",
|
||||
"project_name": "mini-mon",
|
||||
"monasca_api_url" : "http://192.168.10.4:8080/v2.0",
|
||||
"service": "monitoring"
|
||||
}
|
@ -1,27 +0,0 @@
|
||||
{
|
||||
"id": "credentials",
|
||||
"middleware": {
|
||||
"serverVip": "192.168.10.5",
|
||||
"adminAuthMethod": "password",
|
||||
"adminUser": "admin",
|
||||
"adminPassword": "password",
|
||||
"adminToken": "ADMIN"
|
||||
},
|
||||
"mysql": {
|
||||
"hostname": "localhost",
|
||||
"username": "monapi",
|
||||
"password": "password",
|
||||
"schema": "mon"
|
||||
},
|
||||
"influxdb": {
|
||||
"hostname": "localhost",
|
||||
"username": "mon_api",
|
||||
"password": "password"
|
||||
},
|
||||
"vertica": {
|
||||
"hostname": "localhost",
|
||||
"username": "mon_api",
|
||||
"password": "password",
|
||||
"schema": "mon"
|
||||
}
|
||||
}
|
@ -1,21 +0,0 @@
|
||||
{
|
||||
"id" : "monasca_api",
|
||||
"api_region": "useast",
|
||||
"database-configuration": {
|
||||
"database-type": "influxdb"
|
||||
},
|
||||
"influxdb" : {
|
||||
"dbname" : "mon",
|
||||
"hostname" : "localhost"
|
||||
},
|
||||
"zookeeper" : {
|
||||
"hostname" : "localhost"
|
||||
},
|
||||
"mysql": {
|
||||
"hostname":"localhost",
|
||||
"schema": "mon"
|
||||
},
|
||||
"kafka": {
|
||||
"hostname": "192.168.10.4"
|
||||
}
|
||||
}
|
@ -1,24 +0,0 @@
|
||||
{
|
||||
"id" : "hosts",
|
||||
"kafka": {
|
||||
"url": "192.168.10.4",
|
||||
"alarm_topic": "alarm-state-transitions",
|
||||
"notification_topic": "alarm-notifications"
|
||||
},
|
||||
"mysql": {
|
||||
"url": "192.168.10.4",
|
||||
"user": "notification",
|
||||
"password": "password",
|
||||
"database": "mon"
|
||||
},
|
||||
"smtp": {
|
||||
"url": "localhost",
|
||||
"user": "",
|
||||
"password": "",
|
||||
"timeout": 60,
|
||||
"from_addr": "hpcs.mon@hp.com"
|
||||
},
|
||||
"zookeeper": {
|
||||
"url": "localhost"
|
||||
}
|
||||
}
|
@ -1,11 +0,0 @@
|
||||
{
|
||||
"id" : "credentials",
|
||||
"influxdb": {
|
||||
"user": "mon_persister",
|
||||
"password": "password"
|
||||
},
|
||||
"vertica" : {
|
||||
"user" : "dbadmin",
|
||||
"password" : "password"
|
||||
}
|
||||
}
|
@ -1,38 +0,0 @@
|
||||
{
|
||||
"id": "monasca_persister",
|
||||
"alarm_history": {
|
||||
"topic": "alarm-state-transitions",
|
||||
"num_threads": "1",
|
||||
"batch_size": "100",
|
||||
"maxBatchTime": "15"
|
||||
},
|
||||
"influxdb": {
|
||||
"dbname": "mon",
|
||||
"hostname": "localhost"
|
||||
},
|
||||
"metrics": {
|
||||
"topic": "metrics",
|
||||
"num_threads": "2",
|
||||
"batch_size": "100",
|
||||
"maxBatchTime": "10"
|
||||
},
|
||||
"kafka": {
|
||||
"group_id": "1",
|
||||
"consumer_id": 1
|
||||
},
|
||||
"alarmHistoryConfiguration": {
|
||||
},
|
||||
"database_configuration": {
|
||||
"database_type": "influxdb"
|
||||
},
|
||||
"vertica_metric_repository_config": {
|
||||
"max_cache_size": "2000000"
|
||||
},
|
||||
"vertica": {
|
||||
"dbname": "mon",
|
||||
"hostname": "localhost"
|
||||
},
|
||||
"zookeeper": {
|
||||
"hostname": "localhost"
|
||||
}
|
||||
}
|
@ -1,22 +0,0 @@
|
||||
{
|
||||
"id" : "monasca_thresh",
|
||||
"kafka": {
|
||||
"metric": {
|
||||
"group": "thresh-metric",
|
||||
"topic": "metrics"
|
||||
},
|
||||
"event": {
|
||||
"group": "thresh-event",
|
||||
"host": "192.168.10.4:9092",
|
||||
"consumer_topic": "events",
|
||||
"producer_topic": "alarm-state-transitions"
|
||||
}
|
||||
},
|
||||
"mysql": {
|
||||
"db": "mon",
|
||||
"host": "localhost:3306"
|
||||
},
|
||||
"zookeeper": {
|
||||
"host": "localhost:2181"
|
||||
}
|
||||
}
|
23
devstack.yml
Normal file
23
devstack.yml
Normal file
@ -0,0 +1,23 @@
|
||||
- hosts: devstack
|
||||
sudo: yes
|
||||
vars:
|
||||
keystone_url: http://192.168.10.5:35357/v3
|
||||
monasca_agent:
|
||||
user: monasca-agent
|
||||
password: password
|
||||
project: mini-mon
|
||||
service: monitoring
|
||||
monasca_api_url: http://192.168.10.4:8080/v2.0
|
||||
monasca_checks:
|
||||
host_alive:
|
||||
init_config:
|
||||
ssh_port: 22
|
||||
ssh_timeout: 0.5
|
||||
ping_timeout: 1
|
||||
instances:
|
||||
- mini-mon:
|
||||
name: mini-mon
|
||||
host_name: 192.168.10.4
|
||||
alive_test: ssh
|
||||
roles:
|
||||
- {role: tkuhlman.monasca-agent, tags: [agent]}
|
@ -11,7 +11,6 @@
|
||||
},
|
||||
"chef_type": "role",
|
||||
"run_list": [
|
||||
"recipe[mini-mon]",
|
||||
"recipe[ds-build]"
|
||||
],
|
||||
"env_run_lists": {
|
||||
|
94
mini-mon.yml
Normal file
94
mini-mon.yml
Normal file
@ -0,0 +1,94 @@
|
||||
- name: Installs DBs, kafka and other core dependencies.
|
||||
hosts: mini-mon
|
||||
sudo: yes
|
||||
vars:
|
||||
influxdb:
|
||||
version: 0.8.1
|
||||
raft_port: 9090
|
||||
seed_servers: []
|
||||
replication_factor: 1
|
||||
mini_mon_host: 192.168.10.4
|
||||
zookeeper_hosts: "{{mini_mon_host}}:2181"
|
||||
pre_tasks:
|
||||
- name: apt-get update
|
||||
apt: update_cache=yes
|
||||
tasks:
|
||||
- name: Install postfix, needed by notification engine
|
||||
apt: name=postfix state=present
|
||||
- name: Install pip from apt
|
||||
apt: name=python-pip state=present
|
||||
- name: pip upgrade pip
|
||||
pip: name=pip state=latest
|
||||
- name: Install python-dev
|
||||
apt: name=python-dev state=present
|
||||
roles:
|
||||
- {role: tkuhlman.kafka, kafka_listen_address: "{{mini_mon_host}}", tags: [kafka]}
|
||||
- {role: stympy.influxdb, tags: [influxdb]}
|
||||
- {role: tkuhlman.percona, mysql_root_password: password, percona_package: percona-xtradb-cluster-56, tags: [mysql, percona]}
|
||||
|
||||
- name: Sets up schema and Installs Monasca apps
|
||||
hosts: mini-mon
|
||||
sudo: yes
|
||||
vars:
|
||||
mini_mon_host: 192.168.10.4
|
||||
influxdb_host: "{{mini_mon_host}}"
|
||||
influxdb_users:
|
||||
mon_api: password
|
||||
mon_persister: password
|
||||
kafka_topics:
|
||||
metrics: { replicas: 1, partitions: 4 }
|
||||
events: { replicas: 1, partitions: 4 }
|
||||
raw-events: { replicas: 1, partitions: 4 }
|
||||
transformed-events: { replicas: 1, partitions: 4 }
|
||||
alarm-state-transitions: { replicas: 1, partitions: 4 }
|
||||
alarm-notifications: { replicas: 1, partitions: 4 }
|
||||
kafka_hosts: "{{mini_mon_host}}:9092"
|
||||
keystone_url: http://192.168.10.5:35357/v3
|
||||
monasca_agent:
|
||||
user: monasca-agent
|
||||
password: password
|
||||
project: mini-mon
|
||||
service: monitoring
|
||||
monasca_api_url: http://192.168.10.4:8080/v2.0
|
||||
monasca_checks:
|
||||
host_alive:
|
||||
init_config:
|
||||
ssh_port: 22
|
||||
ssh_timeout: 0.5
|
||||
ping_timeout: 1
|
||||
instances:
|
||||
- devstack:
|
||||
name: devstack
|
||||
host_name: 192.168.10.5
|
||||
alive_test: ssh
|
||||
mysql_host: "{{mini_mon_host}}"
|
||||
zookeeper_hosts: "{{mini_mon_host}}:2181"
|
||||
roles:
|
||||
- {role: tkuhlman.monasca-schema, tags: [schema]}
|
||||
- {role: tkuhlman.monasca-api,
|
||||
api_region: useast,
|
||||
influxdb_user: mon_api,
|
||||
influxdb_password: password,
|
||||
keystone_host: 192.168.10.5,
|
||||
keystone_admin: admin,
|
||||
keystone_admin_password: password,
|
||||
keystone_admin_token: ADMIN,
|
||||
mysql_user: monapi,
|
||||
mysql_password: password,
|
||||
tags: [api]}
|
||||
- {role: tkuhlman.monasca-persister,
|
||||
kafka_uri: "{{kafka_hosts}}",
|
||||
influxdb_user: mon_persister,
|
||||
influxdb_password: password,
|
||||
tags: [influxdb]}
|
||||
- {role: tkuhlman.monasca-notification,
|
||||
mysql_user: notification,
|
||||
mysql_password: password,
|
||||
smtp_host: localhost,
|
||||
tags: [notification]}
|
||||
- {role: tkuhlman.storm, nimbus_host: "{{mini_mon_host}}", storm_nimbus_enabled: true, storm_supervisor_enabled: true, tags: [storm]}
|
||||
- {role: tkuhlman.monasca-thresh,
|
||||
mysql_user: thresh,
|
||||
mysql_password: password,
|
||||
tags: [thresh]}
|
||||
- {role: tkuhlman.monasca-agent, tags: [agent]}
|
@ -5,24 +5,6 @@
|
||||
"default_attributes": {
|
||||
"apt": {
|
||||
"periodic_update_min_delay": 60
|
||||
},
|
||||
"monasca_agent": {
|
||||
"plugin": {
|
||||
"host_alive": {
|
||||
"init_config": {
|
||||
"ssh_port": 22,
|
||||
"ssh_timeout": 0.5,
|
||||
"ping_timeout": 1
|
||||
},
|
||||
"instances": {
|
||||
"mini-mon": {
|
||||
"name": "mini-mon",
|
||||
"host_name": "192.168.10.4",
|
||||
"alive_test": "ssh"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"override_attributes": {
|
||||
@ -31,8 +13,7 @@
|
||||
"run_list": [
|
||||
"recipe[devstack::mon-ui]",
|
||||
"recipe[devstack::keystone]",
|
||||
"recipe[devstack::agent_plugin_config]",
|
||||
"recipe[monasca_agent]"
|
||||
"recipe[devstack::agent_plugin_config]"
|
||||
],
|
||||
"env_run_lists": {
|
||||
}
|
||||
|
@ -1,110 +0,0 @@
|
||||
{
|
||||
"name": "Mini-Mon",
|
||||
"description": "Sets up the entire monitoring stack on one box",
|
||||
"json_class": "Chef::Role",
|
||||
"default_attributes": {
|
||||
"apt": {
|
||||
"periodic_update_min_delay": 60
|
||||
},
|
||||
"monasca_agent": {
|
||||
"plugin": {
|
||||
"host_alive": {
|
||||
"init_config": {
|
||||
"ssh_port": 22,
|
||||
"ssh_timeout": 0.5,
|
||||
"ping_timeout": 1
|
||||
},
|
||||
"instances": {
|
||||
"devstack": {
|
||||
"name": "devstack",
|
||||
"host_name": "192.168.10.5",
|
||||
"alive_test": "ssh"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"influxdb": {
|
||||
"config": {
|
||||
"logging": {
|
||||
"file": "/opt/influxdb/shared/influxdb.log"
|
||||
},
|
||||
"raft": {
|
||||
"port": 9090
|
||||
}
|
||||
},
|
||||
"version": "0.8.1"
|
||||
},
|
||||
"java": {
|
||||
"install_flavor": "openjdk",
|
||||
"jdk_version": "7"
|
||||
},
|
||||
"kafka": {
|
||||
"listen_address": "192.168.10.4",
|
||||
"topics": {
|
||||
"metrics": { "replicas": 1, "partitions": 4 },
|
||||
"events": { "replicas": 1, "partitions": 4 },
|
||||
"raw-events": { "replicas": 1, "partitions": 4 },
|
||||
"transformed-events": { "replicas": 1, "partitions": 4 },
|
||||
"alarm-state-transitions": { "replicas": 1, "partitions": 4 },
|
||||
"alarm-notifications": { "replicas": 1, "partitions": 4 }
|
||||
}
|
||||
},
|
||||
"percona": {
|
||||
"backup": {
|
||||
"password": "password"
|
||||
},
|
||||
"cluster": {
|
||||
"package": "percona-xtradb-cluster-56"
|
||||
},
|
||||
"main_config_file": "/etc/mysql/my.cnf",
|
||||
"server": {
|
||||
"bind_address": "0.0.0.0",
|
||||
"replication": {
|
||||
"password": "password"
|
||||
},
|
||||
"root_password": "password",
|
||||
"skip_name_resolve": true
|
||||
}
|
||||
},
|
||||
"storm": {
|
||||
"nimbus": {
|
||||
"host": {
|
||||
"fqdn": "127.0.0.1"
|
||||
}
|
||||
},
|
||||
"ui": {
|
||||
"port": "8088"
|
||||
},
|
||||
"zookeeper": {
|
||||
"quorum": [
|
||||
"127.0.0.1"
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
"override_attributes": {
|
||||
},
|
||||
"chef_type": "role",
|
||||
"run_list": [
|
||||
"recipe[mini-mon]",
|
||||
"recipe[percona::cluster]",
|
||||
"recipe[monasca_schema::mysql]",
|
||||
"recipe[zookeeper]",
|
||||
"recipe[kafka]",
|
||||
"recipe[mini-mon::postfix]",
|
||||
"recipe[kafka::create_topics]",
|
||||
"recipe[monasca_notification]",
|
||||
"recipe[influxdb]",
|
||||
"recipe[monasca_schema::influxdb]",
|
||||
"recipe[sysctl]",
|
||||
"recipe[monasca_persister]",
|
||||
"recipe[monasca_api]",
|
||||
"recipe[storm::nimbus]",
|
||||
"recipe[storm::supervisor]",
|
||||
"recipe[monasca_thresh]",
|
||||
"recipe[monasca_agent]"
|
||||
],
|
||||
"env_run_lists": {
|
||||
}
|
||||
}
|
7
smoke.yml
Normal file
7
smoke.yml
Normal file
@ -0,0 +1,7 @@
|
||||
- hosts: mini-mon
|
||||
sudo: yes
|
||||
tasks:
|
||||
- name: Run the smoke test
|
||||
command: /vagrant/tests/smoke.py
|
||||
register: smoke
|
||||
- debug: var=smoke.stdout_lines
|
@ -141,7 +141,7 @@ def smoke_test(mail_host, metric_host):
|
||||
notification_name = 'Monasca Smoke Test'
|
||||
notification_email_addr = 'root@' + mail_host
|
||||
alarm_definition_name = 'high cpu and load'
|
||||
metric_name = 'load.avg_1_min'
|
||||
metric_name = 'cpu.load_avg_1_min'
|
||||
metric_dimensions = {'hostname': metric_host}
|
||||
cleanup(notification_name, alarm_definition_name)
|
||||
|
||||
@ -164,7 +164,7 @@ def smoke_test(mail_host, metric_host):
|
||||
|
||||
# Create Alarm through CLI
|
||||
expression = 'max(cpu.system_perc) > 0 and ' + \
|
||||
'max(load.avg_1_min{hostname=' + metric_host + '}) > 0'
|
||||
'max(cpu.load_avg_1_min{hostname=' + metric_host + '}) > 0'
|
||||
description = 'System CPU Utilization exceeds 1% and ' + \
|
||||
'Load exceeds 3 per measurement period'
|
||||
alarm_def_id = cli_wrapper.create_alarm_definition(alarm_definition_name,
|
||||
|
Loading…
x
Reference in New Issue
Block a user