Now using monasca_schema for mysql/influxdb/vertica db creation and schema.
Change-Id: I4eaf9f75c943e0e7baaf029f7944f9af48950ba8
This commit is contained in:
parent
bd3f9323cc
commit
8377961217
@ -12,6 +12,7 @@ cookbook 'kafka', git: 'https://github.com/hpcloud-mon/cookbooks-kafka'
|
||||
cookbook 'mon_agent', git: 'https://github.com/hpcloud-mon/cookbooks-mon_agent'
|
||||
cookbook 'monasca_notification', git: 'https://github.com/stackforge/cookbook-monasca-notification'
|
||||
cookbook 'mon_persister', git: 'https://github.com/hpcloud-mon/cookbooks-mon_persister.git'
|
||||
cookbook 'monasca_schema', git: 'https://github.com/hpcloud-mon/cookbook-monasca-schema'
|
||||
cookbook 'mon_thresh', git: 'https://github.com/hpcloud-mon/cookbooks-mon_thresh'
|
||||
cookbook 'storm', git: 'https://github.com/tkuhlman/storm'
|
||||
cookbook 'vertica', git: 'https://github.com/hpcloud-mon/cookbooks-vertica'
|
||||
|
@ -9,7 +9,4 @@ apt cookbook
|
||||
Recipes
|
||||
---------
|
||||
- default - configures base apt repostories needed for mini-mon as well as option apt cache
|
||||
- influxdb - creates an influxdb database and users
|
||||
- keystone - simple keystone installation
|
||||
- mysql_schema - Defines the mysql_schema used by mini-mon
|
||||
- postfix - extremely simple postfix install
|
||||
|
@ -1,38 +0,0 @@
|
||||
CREATE DATABASE IF NOT EXISTS `addr_validate` DEFAULT CHARACTER SET latin1;
|
||||
USE `addr_validate`;
|
||||
|
||||
DROP TABLE IF EXISTS `address_blacklist`;
|
||||
CREATE TABLE `address_blacklist` (
|
||||
`name` varchar(100) NOT NULL,
|
||||
`type` enum('SMS','EMAIL') NOT NULL,
|
||||
`comment` varchar(256) NOT NULL,
|
||||
PRIMARY KEY (`name`,`type`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
|
||||
|
||||
DROP TABLE IF EXISTS `limits`;
|
||||
CREATE TABLE `limits` (
|
||||
`tenant_id` varchar(64) NOT NULL,
|
||||
`max_addresses` int(11) DEFAULT NULL,
|
||||
`max_outstanding_requests` int(11) DEFAULT NULL,
|
||||
PRIMARY KEY (`tenant_id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
|
||||
|
||||
DROP TABLE IF EXISTS `requests`;
|
||||
CREATE TABLE `requests` (
|
||||
`id` varchar(36) NOT NULL,
|
||||
`address` varchar(128) DEFAULT NULL,
|
||||
`type` enum('EMAIL','SMS') DEFAULT NULL,
|
||||
`state` enum('in-progress','timed-out','verified') DEFAULT NULL,
|
||||
`created` datetime DEFAULT NULL,
|
||||
`updated` datetime DEFAULT NULL,
|
||||
`tenant_id` varchar(64) DEFAULT NULL,
|
||||
`token` varchar(128) DEFAULT NULL,
|
||||
`name` varchar(128) DEFAULT NULL,
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
|
||||
|
||||
DROP TABLE IF EXISTS `schema_migrations`;
|
||||
CREATE TABLE `schema_migrations` (
|
||||
`version` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
|
||||
UNIQUE KEY `unique_schema_migrations` (`version`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
|
@ -1,86 +0,0 @@
|
||||
CREATE DATABASE IF NOT EXISTS `mon` DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
|
||||
USE `mon`;
|
||||
|
||||
SET foreign_key_checks = 0;
|
||||
|
||||
DROP TABLE IF EXISTS `alarm`;
|
||||
CREATE TABLE `alarm` (
|
||||
`id` varchar(36) COLLATE utf8mb4_unicode_ci NOT NULL,
|
||||
`tenant_id` varchar(36) COLLATE utf8mb4_unicode_ci NOT NULL,
|
||||
`name` varchar(250) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
|
||||
`description` varchar(250) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
|
||||
`expression` mediumtext COLLATE utf8mb4_unicode_ci,
|
||||
`state` enum('UNDETERMINED','OK','ALARM') COLLATE utf8mb4_unicode_ci NOT NULL,
|
||||
`severity` enum('LOW','MEDIUM','HIGH','CRITICAL') COLLATE utf8mb4_unicode_ci NOT NULL,
|
||||
`actions_enabled` tinyint(1) NOT NULL DEFAULT '1',
|
||||
`created_at` datetime NOT NULL,
|
||||
`updated_at` datetime NOT NULL,
|
||||
`deleted_at` datetime DEFAULT NULL,
|
||||
PRIMARY KEY (`id`),
|
||||
KEY `tenant_id` (`tenant_id`),
|
||||
KEY `created_at` (`created_at`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
|
||||
|
||||
DROP TABLE IF EXISTS `alarm_action`;
|
||||
CREATE TABLE `alarm_action` (
|
||||
`alarm_id` varchar(36) COLLATE utf8mb4_unicode_ci NOT NULL,
|
||||
`alarm_state` enum('UNDETERMINED','OK','ALARM') COLLATE utf8mb4_unicode_ci NOT NULL,
|
||||
`action_id` varchar(36) COLLATE utf8mb4_unicode_ci NOT NULL,
|
||||
PRIMARY KEY (`alarm_id`,`alarm_state`,`action_id`),
|
||||
CONSTRAINT `fk_alarm_action_alarm_id` FOREIGN KEY (`alarm_id`) REFERENCES `alarm` (`id`) ON DELETE CASCADE
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
|
||||
|
||||
DROP TABLE IF EXISTS `notification_method`;
|
||||
CREATE TABLE `notification_method` (
|
||||
`id` varchar(36) COLLATE utf8mb4_unicode_ci NOT NULL,
|
||||
`tenant_id` varchar(36) COLLATE utf8mb4_unicode_ci NOT NULL,
|
||||
`name` varchar(250) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
|
||||
`type` enum('EMAIL','SMS') COLLATE utf8mb4_unicode_ci NOT NULL,
|
||||
`address` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
|
||||
`created_at` datetime NOT NULL,
|
||||
`updated_at` datetime NOT NULL,
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
|
||||
|
||||
DROP TABLE IF EXISTS `sub_alarm`;
|
||||
CREATE TABLE `sub_alarm` (
|
||||
`id` varchar(36) COLLATE utf8mb4_unicode_ci NOT NULL,
|
||||
`alarm_id` varchar(36) COLLATE utf8mb4_unicode_ci NOT NULL,
|
||||
`function` varchar(10) COLLATE utf8mb4_unicode_ci NOT NULL,
|
||||
`metric_name` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
|
||||
`operator` varchar(5) COLLATE utf8mb4_unicode_ci NOT NULL,
|
||||
`threshold` double NOT NULL,
|
||||
`period` int(11) NOT NULL,
|
||||
`periods` int(11) NOT NULL,
|
||||
`state` varchar(20) COLLATE utf8mb4_unicode_ci NOT NULL,
|
||||
`created_at` datetime NOT NULL,
|
||||
`updated_at` datetime NOT NULL,
|
||||
PRIMARY KEY (`id`),
|
||||
KEY `fk_sub_alarm` (`alarm_id`),
|
||||
CONSTRAINT `fk_sub_alarm` FOREIGN KEY (`alarm_id`) REFERENCES `alarm` (`id`) ON DELETE CASCADE
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
|
||||
|
||||
DROP TABLE IF EXISTS `sub_alarm_dimension`;
|
||||
CREATE TABLE `sub_alarm_dimension` (
|
||||
`sub_alarm_id` varchar(36) COLLATE utf8mb4_unicode_ci NOT NULL,
|
||||
`dimension_name` varchar(50) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
|
||||
`value` varchar(300) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
|
||||
PRIMARY KEY (`sub_alarm_id`,`dimension_name`),
|
||||
CONSTRAINT `fk_sub_alarm_dimension` FOREIGN KEY (`sub_alarm_id`) REFERENCES `sub_alarm` (`id`) ON DELETE CASCADE
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
|
||||
|
||||
DROP TABLE IF EXISTS `schema_migrations`;
|
||||
CREATE TABLE `schema_migrations` (
|
||||
`version` varchar(255) NOT NULL,
|
||||
UNIQUE KEY `unique_schema_migrations` (`version`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
|
||||
|
||||
CREATE USER 'notification'@'%' IDENTIFIED BY 'password';
|
||||
GRANT SELECT ON mon.* TO 'notification'@'%';
|
||||
|
||||
CREATE USER 'monapi'@'%' IDENTIFIED BY 'password';
|
||||
GRANT ALL ON mon.* TO 'monapi'@'%';
|
||||
|
||||
CREATE USER 'thresh'@'%' IDENTIFIED BY 'password';
|
||||
GRANT ALL ON mon.* TO 'thresh'@'%';
|
||||
SET foreign_key_checks = 1;
|
@ -4,6 +4,5 @@ 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.0.11"
|
||||
version "0.1.0"
|
||||
depends "apt"
|
||||
depends "influxdb"
|
||||
|
@ -1,18 +0,0 @@
|
||||
# Create an influxdb database and users
|
||||
# Leverages the cookbook from https://github.com/SimpleFinance/chef-influxdb
|
||||
|
||||
service 'influxdb' do
|
||||
action :start
|
||||
end
|
||||
|
||||
influxdb_database 'mon' do
|
||||
action :create
|
||||
end
|
||||
|
||||
['mon_api', 'mon_persister'].each do |user|
|
||||
influxdb_user user do
|
||||
action :create
|
||||
password 'password'
|
||||
databases ['mon']
|
||||
end
|
||||
end
|
@ -1,27 +0,0 @@
|
||||
# Temporary way of loading in the mysql schema
|
||||
|
||||
bash 'mon_schema' do
|
||||
action :nothing
|
||||
code 'mysql -uroot -ppassword < /var/lib/mysql/mon.sql'
|
||||
end
|
||||
|
||||
bash 'addr_validate_schema' do
|
||||
action :nothing
|
||||
code 'mysql -uroot -ppassword < /var/lib/mysql/addr_validate.sql'
|
||||
end
|
||||
|
||||
cookbook_file '/var/lib/mysql/mon.sql' do
|
||||
action :create
|
||||
owner 'root'
|
||||
group 'root'
|
||||
source 'mon.sql'
|
||||
notifies :run, "bash[mon_schema]"
|
||||
end
|
||||
|
||||
cookbook_file '/var/lib/mysql/addr_validate.sql' do
|
||||
action :create
|
||||
owner 'root'
|
||||
group 'root'
|
||||
source 'addr_validate.sql'
|
||||
notifies :run, "bash[addr_validate_schema]"
|
||||
end
|
@ -66,14 +66,14 @@
|
||||
"run_list": [
|
||||
"recipe[mini-mon]",
|
||||
"recipe[percona::cluster]",
|
||||
"recipe[mini-mon::mysql_schema]",
|
||||
"recipe[monasca_schema::mysql]",
|
||||
"recipe[zookeeper]",
|
||||
"recipe[kafka]",
|
||||
"recipe[kafka::create_topics]",
|
||||
"recipe[mini-mon::postfix]",
|
||||
"recipe[monasca_notification]",
|
||||
"recipe[influxdb]",
|
||||
"recipe[mini-mon::influxdb]",
|
||||
"recipe[monasca_schema::influxdb]",
|
||||
"recipe[sysctl]",
|
||||
"recipe[mon_persister]",
|
||||
"recipe[mon_api]",
|
||||
|
@ -27,7 +27,7 @@
|
||||
"run_list": [
|
||||
"role[Basenode]",
|
||||
"recipe[percona::cluster]",
|
||||
"recipe[mini-mon::mysql_schema]"
|
||||
"recipe[monasca_schema::mysql]"
|
||||
],
|
||||
"env_run_lists": {
|
||||
}
|
||||
|
@ -10,6 +10,7 @@
|
||||
"run_list": [
|
||||
"role[Basenode]",
|
||||
"recipe[vertica]",
|
||||
"recipe[monasca_schema::vertica]",
|
||||
"recipe[sysctl]"
|
||||
],
|
||||
"env_run_lists": {
|
||||
|
Loading…
x
Reference in New Issue
Block a user