"Fossies" - the Fresh Open Source Software Archive

Member "monasca-api-3.1.0/monasca_api/tests/sqlite_alarm.sql" (27 Sep 2019, 4305 Bytes) of package /linux/misc/openstack/monasca-api-3.1.0.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) PL/SQL source code syntax highlighting (style: standard) with prefixed line numbers. Alternatively you can here view or download the uninterpreted source code file.

    1 PRAGMA synchronous = OFF;
    2 PRAGMA journal_mode = MEMORY;
    3 BEGIN TRANSACTION;
    4 CREATE TABLE `alarm_state` (
    5   `name` varchar(20) NOT NULL,
    6   PRIMARY KEY (`name`)
    7 );
    8 CREATE TABLE `alarm_definition_severity` (
    9   `name` varchar(20) NOT NULL,
   10   PRIMARY KEY (`name`)
   11 );
   12 CREATE TABLE `notification_method_type` (
   13   `name` varchar(20) NOT NULL,
   14   PRIMARY KEY (`name`)
   15 );
   16 CREATE TABLE `notification_method` (
   17   `id` varchar(36) NOT NULL,
   18   `tenant_id` varchar(36) NOT NULL,
   19   `name` varchar(250) DEFAULT NULL,
   20   `type` varchar(20) NOT NULL,
   21   `address` varchar(512) DEFAULT NULL,
   22   `period` int NOT NULL DEFAULT 0,
   23   `created_at` datetime NOT NULL,
   24   `updated_at` datetime NOT NULL,
   25   PRIMARY KEY (`id`)
   26 );
   27 CREATE TABLE `alarm_definition` (
   28   `id` varchar(36) NOT NULL,
   29   `tenant_id` varchar(36) NOT NULL,
   30   `name` varchar(255) NOT NULL DEFAULT '',
   31   `description` varchar(255) DEFAULT NULL,
   32   `expression` longtext NOT NULL,
   33   `severity` varchar(20) NOT NULL,
   34   `match_by` varchar(255) DEFAULT '',
   35   `actions_enabled` tinyint(1) NOT NULL DEFAULT '1',
   36   `created_at` datetime NOT NULL,
   37   `updated_at` datetime NOT NULL,
   38   `deleted_at` datetime DEFAULT NULL,
   39   PRIMARY KEY (`id`)
   40 );
   41 CREATE TABLE `alarm` (
   42   `id` varchar(36) NOT NULL,
   43   `alarm_definition_id` varchar(36) NOT NULL DEFAULT '',
   44   `state` varchar(20) NOT NULL,
   45   `lifecycle_state` varchar(50) DEFAULT NULL,
   46   `link` varchar(512) DEFAULT NULL,
   47   `created_at` datetime NOT NULL,
   48   `state_updated_at` datetime,
   49   `updated_at` datetime NOT NULL,
   50   PRIMARY KEY (`id`)
   51 );
   52 CREATE TABLE `alarm_action` (
   53   `alarm_definition_id` varchar(36) NOT NULL,
   54   `alarm_state` varchar(20) NOT NULL,
   55   `action_id` varchar(36) NOT NULL,
   56   PRIMARY KEY (`alarm_definition_id`,`alarm_state`,`action_id`)
   57 );
   58 CREATE TABLE `alarm_metric` (
   59   `alarm_id` varchar(36) NOT NULL,
   60   `metric_definition_dimensions_id` binary(20) NOT NULL DEFAULT '\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0',
   61   PRIMARY KEY (`alarm_id`,`metric_definition_dimensions_id`)
   62 );
   63 CREATE TABLE `metric_definition` (
   64   `id` binary(20) NOT NULL DEFAULT '\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0',
   65   `name` varchar(255) NOT NULL,
   66   `tenant_id` varchar(36) NOT NULL,
   67   `region` varchar(255) NOT NULL DEFAULT '',
   68   PRIMARY KEY (`id`)
   69 );
   70 CREATE TABLE `metric_definition_dimensions` (
   71   `id` binary(20) NOT NULL DEFAULT '\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0',
   72   `metric_definition_id` binary(20) NOT NULL DEFAULT '\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0',
   73   `metric_dimension_set_id` binary(20) NOT NULL DEFAULT '\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0',
   74   PRIMARY KEY (`id`)
   75 );
   76 CREATE TABLE `metric_dimension` (
   77   `dimension_set_id` binary(20) NOT NULL DEFAULT '\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0',
   78   `name` varchar(255) NOT NULL DEFAULT '',
   79   `value` varchar(255) NOT NULL DEFAULT ''
   80 );
   81 CREATE TABLE `sub_alarm_definition` (
   82   `id` varchar(36) NOT NULL,
   83   `alarm_definition_id` varchar(36) NOT NULL DEFAULT '',
   84   `function` varchar(10) NOT NULL,
   85   `metric_name` varchar(100) DEFAULT NULL,
   86   `operator` varchar(5) NOT NULL,
   87   `threshold` double NOT NULL,
   88   `period` int(11) NOT NULL,
   89   `periods` int(11) NOT NULL,
   90   `is_deterministic` tinyint(1) NOT NULL DEFAULT(0),
   91   `created_at` datetime NOT NULL,
   92   `updated_at` datetime NOT NULL,
   93   PRIMARY KEY (`id`)
   94 );
   95 CREATE TABLE `sub_alarm_definition_dimension` (
   96   `sub_alarm_definition_id` varchar(36) NOT NULL DEFAULT '',
   97   `dimension_name` varchar(255) NOT NULL DEFAULT '',
   98   `value` varchar(255) DEFAULT NULL
   99 );
  100 CREATE TABLE `sub_alarm` (
  101   `id` varchar(36) NOT NULL,
  102   `alarm_id` varchar(36) NOT NULL DEFAULT '',
  103   `sub_expression_id` varchar(36) NOT NULL DEFAULT '',
  104   `expression` longtext NOT NULL,
  105   `created_at` datetime NOT NULL,
  106   `updated_at` datetime NOT NULL,
  107   PRIMARY KEY (`id`)
  108 );
  109 
  110 insert into `alarm_state` values ('UNDETERMINED');
  111 insert into `alarm_state` values ('OK');
  112 insert into `alarm_state` values ('ALARM');
  113 
  114 insert into `alarm_definition_severity` values ('LOW');
  115 insert into `alarm_definition_severity` values ('MEDIUM');
  116 insert into `alarm_definition_severity` values ('HIGH');
  117 insert into `alarm_definition_severity` values ('CRITICAL');
  118 
  119 insert into `notification_method_type` values ('EMAIL');
  120 insert into `notification_method_type` values ('WEBHOOK');
  121 insert into `notification_method_type` values ('PAGERDUTY');
  122 
  123 END TRANSACTION;