Initial setup of a baremetal test cluster leveraging mini-mon
This commit is contained in:
parent
8a6c7b7fc0
commit
6e79fdbf2d
@ -7,7 +7,6 @@
|
||||
"api" : {
|
||||
"mon_api_url" : "http://localhost:8080/v2.0",
|
||||
"mon_api_project_id" : "82510970543135",
|
||||
"use_keystone" : "false",
|
||||
"aggregate_metrics" : "true"
|
||||
"use_keystone" : "false"
|
||||
}
|
||||
}
|
||||
|
@ -1,10 +1,8 @@
|
||||
{
|
||||
"id": "mon_credentials",
|
||||
"middleware": {
|
||||
"keystore_password": "changeit",
|
||||
"serverVip": "region-a.geo-1.identity-admin.hpcloudsvc.com",
|
||||
"truststore_password": "changeit",
|
||||
"keystore_file":"hpmiddleware-keystore-production.jks"
|
||||
"truststore_password": "changeit"
|
||||
},
|
||||
"mysql": {
|
||||
"hostname": "localhost",
|
||||
|
1
utils/__init__.py
Normal file
1
utils/__init__.py
Normal file
@ -0,0 +1 @@
|
||||
__author__ = 'kuhlmant'
|
@ -50,18 +50,10 @@ data_bag_path "{dir}/data_bags"'''.format(dir=chef_dir)
|
||||
sudo('chef-solo -c {dir}/solo.rb -j {dir}/node.json'.format(dir=chef_dir))
|
||||
|
||||
|
||||
@task(default=True)
|
||||
def install(install_dir='/vagrant', proxy=None):
|
||||
"""Installs the latest mini-mon and bits necessary to run chef-solo and runs chef-solo on the box.
|
||||
proxy is an optional proxy url used for http and https, it is not used for apt as that is assumed to be
|
||||
correctly setup.
|
||||
install_dir defaults to /vagrant to match assumptions from mini-mon even though vagrant is not used here
|
||||
@task
|
||||
def git_mini_mon(install_dir, proxy=None):
|
||||
"""Download mini-mon from git
|
||||
"""
|
||||
if proxy is not None:
|
||||
abort('Proxy support is incomplete.')
|
||||
execute(install_deps, proxy)
|
||||
|
||||
#Clone mini-mon
|
||||
with prefix(proxy_string(proxy)):
|
||||
# Update the install dir if it already has code, otherwise check out
|
||||
with settings(hide('running', 'output', 'warnings'), warn_only=True):
|
||||
@ -73,6 +65,20 @@ def install(install_dir='/vagrant', proxy=None):
|
||||
else:
|
||||
sudo('git clone https://github.com/hpcloud-mon/mon-vagrant.git %s' % install_dir)
|
||||
|
||||
@task(default=True)
|
||||
def install(install_dir='/vagrant', proxy=None):
|
||||
"""Installs the latest mini-mon and bits necessary to run chef-solo and runs chef-solo on the box.
|
||||
proxy is an optional proxy url used for http and https, it is not used for apt as that is assumed to be
|
||||
correctly setup.
|
||||
install_dir defaults to /vagrant to match assumptions from mini-mon even though vagrant is not used here
|
||||
"""
|
||||
if proxy is not None:
|
||||
abort('Proxy support is incomplete.')
|
||||
execute(install_deps, proxy)
|
||||
execute(git_mini_mon, install_dir, proxy)
|
||||
|
||||
#Clone mini-mon
|
||||
with prefix(proxy_string(proxy)):
|
||||
# download cookbooks
|
||||
with cd(install_dir):
|
||||
sudo('berks vendor')
|
||||
|
61
utils/cluster/__init__.py
Normal file
61
utils/cluster/__init__.py
Normal file
@ -0,0 +1,61 @@
|
||||
#!/usr/bin/env python
|
||||
#
|
||||
# Copyright (c) 2014 Hewlett-Packard Development Company, L.P.
|
||||
#
|
||||
# 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.
|
||||
""" Fabric Tasks for installing a cluster monitoring stack on baremetal
|
||||
These tasks were developed for hLinux but will likely work on any decently up to date debian based distro
|
||||
"""
|
||||
from fabric.api import *
|
||||
from fabric.tasks import Task
|
||||
|
||||
from baremetal import chef_solo, git_mini_mon, install_deps
|
||||
|
||||
|
||||
__all__ = ['setup']
|
||||
|
||||
|
||||
class SetupCluster(Task):
|
||||
|
||||
def __init__(self):
|
||||
"""Setup a cluster running monitoring.
|
||||
"""
|
||||
self.cluster_dir = '/var/tmp/chef-Mon-Node'
|
||||
self.cluster_hosts = None
|
||||
self.mini_mon_dir = '/vagrant' # mini_mon_dir is /vagrant to match assumptions in mini-mon
|
||||
|
||||
def run(self):
|
||||
"""Installs the latest cookbooks and dependencies to run chef-solo and runs chef-solo on each box.
|
||||
The data bags in the cluster subdir should be properly setup for the environment before running.
|
||||
"""
|
||||
self.cluster_hosts = env.hosts
|
||||
|
||||
execute(install_deps)
|
||||
execute(git_mini_mon, self.mini_mon_dir)
|
||||
|
||||
# download cookbooks
|
||||
with cd(self.cluster_dir):
|
||||
sudo('berks vendor')
|
||||
|
||||
# the vertica packages from my.vertica.com are needed, this assumes they are one level up from cwd
|
||||
put('../vertica*.deb', self.mini_mon_dir, use_sudo=True)
|
||||
|
||||
# Copy roles and data bags
|
||||
put('%s/utils/cluster/data_bags' % self.mini_mon_dir, self.cluster_dir, use_sudo=True)
|
||||
put('%s/utils/cluster/roles' % self.mini_mon_dir, self.cluster_dir, use_sudo=True)
|
||||
|
||||
execute(chef_solo, self.cluster_dir, "role[Mon-Node]")
|
||||
|
||||
|
||||
setup = SetupCluster()
|
8
utils/cluster/data_bags/kafka/mon.json
Normal file
8
utils/cluster/data_bags/kafka/mon.json
Normal file
@ -0,0 +1,8 @@
|
||||
{
|
||||
"id" : "mon",
|
||||
"brokers": {
|
||||
"mon-ae1test-04.useast.hpcloud.net" : { "id": 0, "ip": "10.22.156.14" },
|
||||
"mon-ae1test-05.useast.hpcloud.net" : { "id": 1, "ip": "10.22.156.15" },
|
||||
"mon-ae1test-06.useast.hpcloud.net" : { "id": 2, "ip": "10.22.156.16" }
|
||||
}
|
||||
}
|
13
utils/cluster/data_bags/mon_agent/mon_agent.json
Normal file
13
utils/cluster/data_bags/mon_agent/mon_agent.json
Normal file
@ -0,0 +1,13 @@
|
||||
{
|
||||
"id": "mon_agent",
|
||||
"dimensions": "Environment:Dev",
|
||||
"log_level": "INFO",
|
||||
"api_key": "",
|
||||
"send_to_mon_api": "true",
|
||||
"api": {
|
||||
"mon_api_url": "http://localhost:8080/v2.0/metrics",
|
||||
"mon_api_project_id": "82510970543135",
|
||||
"use_keystone": "True",
|
||||
"keystone_url": "https://10.22.156.19:35357/v3/auth/tokens"
|
||||
}
|
||||
}
|
17
utils/cluster/data_bags/mon_api/mon_api.json
Normal file
17
utils/cluster/data_bags/mon_api/mon_api.json
Normal file
@ -0,0 +1,17 @@
|
||||
{
|
||||
"id" : "mon_api",
|
||||
"vertica" : {
|
||||
"dbname" : "mon",
|
||||
"hostname" : "localhost"
|
||||
},
|
||||
"zookeeper" : {
|
||||
"hostname" : "localhost"
|
||||
},
|
||||
"mysql": {
|
||||
"hostname":"localhost",
|
||||
"schema": "mon"
|
||||
},
|
||||
"kafka": {
|
||||
"hostname": "localhost"
|
||||
}
|
||||
}
|
19
utils/cluster/data_bags/mon_api/mon_credentials.json
Normal file
19
utils/cluster/data_bags/mon_api/mon_credentials.json
Normal file
@ -0,0 +1,19 @@
|
||||
{
|
||||
"id": "mon_credentials",
|
||||
"middleware": {
|
||||
"serverVip": "10.22.156.19",
|
||||
"truststore_password": "changeit",
|
||||
},
|
||||
"mysql": {
|
||||
"hostname": "localhost",
|
||||
"username": "monapi",
|
||||
"password": "password",
|
||||
"schema": "mon"
|
||||
},
|
||||
"vertica": {
|
||||
"hostname": "localhost",
|
||||
"username": "mon_api",
|
||||
"password": "password",
|
||||
"schema": "mon"
|
||||
}
|
||||
}
|
7
utils/cluster/data_bags/mon_notification/hosts.json
Normal file
7
utils/cluster/data_bags/mon_notification/hosts.json
Normal file
@ -0,0 +1,7 @@
|
||||
{
|
||||
"id" : "hosts",
|
||||
"kafka": "localhost",
|
||||
"mysql": "localhost",
|
||||
"smtp": "localhost",
|
||||
"zookeeper": "localhost"
|
||||
}
|
@ -0,0 +1,7 @@
|
||||
{
|
||||
"id" : "mon_credentials",
|
||||
"vertica" : {
|
||||
"user" : "dbadmin",
|
||||
"password" : "password"
|
||||
}
|
||||
}
|
29
utils/cluster/data_bags/mon_persister/mon_persister.json
Normal file
29
utils/cluster/data_bags/mon_persister/mon_persister.json
Normal file
@ -0,0 +1,29 @@
|
||||
{
|
||||
"id": "mon_persister",
|
||||
"kafka": {
|
||||
"metrics_topic": "metrics",
|
||||
"num_threads": "1",
|
||||
"group_id": "1",
|
||||
"consumer_id": "1"
|
||||
},
|
||||
"disruptor": {
|
||||
"buffer_size": "1048576",
|
||||
"num_processors": "1"
|
||||
},
|
||||
"vertica_output_processor": {
|
||||
"batch_size": "10000"
|
||||
},
|
||||
"deduper_config": {
|
||||
"dedupe_run_frequencey_seconds": "30"
|
||||
},
|
||||
"vertica_metric_repository_config": {
|
||||
"max_cache_size": "2000000"
|
||||
},
|
||||
"vertica": {
|
||||
"dbname": "mon",
|
||||
"hostname": "localhost"
|
||||
},
|
||||
"zookeeper": {
|
||||
"hostname": "localhost"
|
||||
}
|
||||
}
|
22
utils/cluster/data_bags/mon_thresh/mon_thresh.json
Normal file
22
utils/cluster/data_bags/mon_thresh/mon_thresh.json
Normal file
@ -0,0 +1,22 @@
|
||||
{
|
||||
"id" : "mon_thresh",
|
||||
"kafka": {
|
||||
"metric": {
|
||||
"group": "thresh-metric",
|
||||
"topic": "metrics"
|
||||
},
|
||||
"event": {
|
||||
"group": "thresh-event",
|
||||
"host": "localhost:9092",
|
||||
"consumer_topic": "events",
|
||||
"producer_topic": "alarm-state-transitions"
|
||||
}
|
||||
},
|
||||
"mysql": {
|
||||
"db": "mon",
|
||||
"host": "localhost:3306"
|
||||
},
|
||||
"zookeeper": {
|
||||
"host": "localhost:2181"
|
||||
}
|
||||
}
|
23
utils/cluster/data_bags/vertica/nodes.json
Normal file
23
utils/cluster/data_bags/vertica/nodes.json
Normal file
@ -0,0 +1,23 @@
|
||||
{
|
||||
"id": "nodes",
|
||||
"nodes": {
|
||||
"mon-ae1test-04.useast.hpcloud.net" : {
|
||||
"ip": "10.22.156.14",
|
||||
"broadcast": "10.22.156.255",
|
||||
"network": "10.22.156.0",
|
||||
"netmask": "255.255.255.0"
|
||||
},
|
||||
"mon-ae1test-05.useast.hpcloud.net" : {
|
||||
"ip": "10.22.156.15",
|
||||
"broadcast": "10.22.156.255",
|
||||
"network": "10.22.156.0",
|
||||
"netmask": "255.255.255.0"
|
||||
},
|
||||
"mon-ae1test-06.useast.hpcloud.net" : {
|
||||
"ip": "10.22.156.16",
|
||||
"broadcast": "10.22.156.255",
|
||||
"network": "10.22.156.0",
|
||||
"netmask": "255.255.255.0"
|
||||
}
|
||||
}
|
||||
}
|
8
utils/cluster/data_bags/zookeeper/mon.json
Normal file
8
utils/cluster/data_bags/zookeeper/mon.json
Normal file
@ -0,0 +1,8 @@
|
||||
{
|
||||
"id" : "mon",
|
||||
"servers": {
|
||||
"mon-ae1test-04.useast.hpcloud.net" : { "id": 0, "ip": "10.22.156.14" },
|
||||
"mon-ae1test-05.useast.hpcloud.net" : { "id": 1, "ip": "10.22.156.15" },
|
||||
"mon-ae1test-06.useast.hpcloud.net" : { "id": 2, "ip": "10.22.156.16" }
|
||||
}
|
||||
}
|
64
utils/cluster/roles/Mon-Node.json
Normal file
64
utils/cluster/roles/Mon-Node.json
Normal file
@ -0,0 +1,64 @@
|
||||
{
|
||||
"name": "Mon-Node",
|
||||
"description": "Sets up one box in a Monitoring Cluster",
|
||||
"json_class": "Chef::Role",
|
||||
"default_attributes": {
|
||||
"apt": {
|
||||
"periodic_update_min_delay": 60
|
||||
},
|
||||
"kafka": {
|
||||
"cluster": "mon",
|
||||
"listen_address": "127.0.0.1",
|
||||
"topics": {
|
||||
"metrics": { "replicas": 1, "partitions": 4 },
|
||||
"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",
|
||||
"wsrep_cluster_address": "gcomm://10.22.156.14,10.22.156.15,10.22.156.16",
|
||||
"wsrep_cluster_name": "mon",
|
||||
"wsrep_sst_method": "xtrabackup-v2",
|
||||
"wsrep_provider": "/usr/lib/libgalera_smm.so"
|
||||
},
|
||||
"main_config_file": "/etc/mysql/my.cnf",
|
||||
"server": {
|
||||
"bind_address": "0.0.0.0",
|
||||
"replication": {
|
||||
"password": "password"
|
||||
},
|
||||
"root_password": "password",
|
||||
"skip_name_resolve": true
|
||||
}
|
||||
},
|
||||
"zookeeper": {
|
||||
"cluster": "mon"
|
||||
}
|
||||
},
|
||||
"override_attributes": {
|
||||
},
|
||||
"chef_type": "role",
|
||||
"run_list": [
|
||||
"recipe[mini-mon]",
|
||||
"recipe[percona::cluster]",
|
||||
"recipe[mini-mon::mysql_schema]",
|
||||
"recipe[zookeeper]",
|
||||
"recipe[kafka]",
|
||||
"recipe[mini-mon::postfix]",
|
||||
"recipe[mon_notification]",
|
||||
"recipe[vertica]",
|
||||
"recipe[sysctl]",
|
||||
"recipe[mon_api]",
|
||||
"recipe[mon_persister]",
|
||||
"recipe[mon_agent]",
|
||||
"recipe[mon_thresh]"
|
||||
],
|
||||
"env_run_lists": {
|
||||
}
|
||||
}
|
1
utils/fabfile.py
vendored
1
utils/fabfile.py
vendored
@ -1 +1,2 @@
|
||||
import baremetal
|
||||
import cluster
|
||||
|
Loading…
x
Reference in New Issue
Block a user