# Generated by Django 2.0.4 on 2021-02-25 12:12

from django.db import migrations, models


class Migration(migrations.Migration):

    initial = True

    dependencies = [
    ]

    operations = [
        migrations.CreateModel(
            name='Metric',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('created_time', models.DateTimeField(auto_now_add=True, verbose_name='创建时间')),
                ('updated_time', models.DateTimeField(auto_now=True, verbose_name='更新时间')),
                ('timestamp', models.CharField(max_length=256, null=True, verbose_name='本身时间戳10位(对应created_time)')),
                ('instance', models.CharField(max_length=256, null=True, verbose_name='指标名称')),
                ('instance_type', models.CharField(max_length=256, null=True, verbose_name='指标类型')),
                ('value', models.DecimalField(decimal_places=1, max_digits=20, null=True, verbose_name='真实值value')),
                ('mu', models.DecimalField(decimal_places=1, max_digits=20, null=True, verbose_name='基线mu')),
                ('n_lower', models.DecimalField(decimal_places=1, max_digits=20, null=True, verbose_name='n_lower')),
                ('n_upper', models.DecimalField(decimal_places=1, max_digits=20, null=True, verbose_name='n_upper')),
                ('std', models.DecimalField(decimal_places=1, max_digits=20, null=True, verbose_name='std')),
                ('status', models.CharField(max_length=256, null=True, verbose_name='异常或正常status')),
                ('is_outiler', models.BooleanField(default=False, verbose_name='是否超过阈值')),
                ('is_alert', models.BooleanField(default=False, verbose_name='是否告警')),
                ('during', models.CharField(max_length=256, null=True, verbose_name='告警持续时间')),
                ('alert_id', models.CharField(max_length=256, null=True, verbose_name='alert_id')),
            ],
        ),
        migrations.CreateModel(
            name='RiskEvent',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('created_time', models.DateTimeField(auto_now_add=True, verbose_name='创建时间')),
                ('updated_time', models.DateTimeField(auto_now=True, verbose_name='更新时间')),
                ('tag', models.CharField(max_length=256, null=True, verbose_name='tag(业务/性能/日志)')),
                ('instance', models.CharField(max_length=256, null=True, verbose_name='指标名称')),
                ('instance_type', models.CharField(max_length=256, null=True, verbose_name='指标类型')),
                ('cmdb_id', models.CharField(max_length=256, null=True, verbose_name='cmdb_id')),
                ('alert_id', models.CharField(max_length=256, null=True, verbose_name='alert_id')),
                ('reason', models.TextField(blank=True, null=True, verbose_name='告警原因')),
            ],
        ),
        migrations.CreateModel(
            name='Rule',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('created_time', models.DateTimeField(auto_now_add=True, verbose_name='创建时间')),
                ('updated_time', models.DateTimeField(auto_now=True, verbose_name='更新时间')),
                ('tag', models.CharField(max_length=256, null=True, verbose_name='tag(业务/性能/日志)')),
                ('instance', models.CharField(max_length=256, null=True, verbose_name='指标名称')),
                ('instance_type', models.CharField(max_length=256, null=True, verbose_name='指标类型')),
                ('cmdb_id', models.CharField(max_length=256, null=True, verbose_name='cmdb_id')),
                ('period', models.IntegerField(default=60, verbose_name='指标采样周期')),
                ('alert_level', models.CharField(max_length=256, null=True, verbose_name='alert_level')),
                ('values', models.CharField(max_length=256, null=True, verbose_name='告警配置参数')),
            ],
        ),
        migrations.CreateModel(
            name='StatisticMetric',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('time', models.DateTimeField(auto_now_add=True, verbose_name='创建时间')),
                ('timestamp', models.CharField(max_length=256, null=True, verbose_name='本身时间戳10位(对应time)')),
                ('instance', models.CharField(max_length=256, null=True, verbose_name='指标名称')),
                ('instance_type', models.CharField(max_length=256, null=True, verbose_name='指标类型')),
                ('n_lower', models.DecimalField(decimal_places=1, max_digits=20, null=True, verbose_name='n_lower')),
                ('n_upper', models.DecimalField(decimal_places=1, max_digits=20, null=True, verbose_name='n_upper')),
                ('std', models.DecimalField(decimal_places=1, max_digits=20, null=True, verbose_name='std')),
            ],
        ),
        migrations.AddIndex(
            model_name='statisticmetric',
            index=models.Index(fields=['instance'], name='statistic_instance_index'),
        ),
        migrations.AddIndex(
            model_name='statisticmetric',
            index=models.Index(fields=['instance_type'], name='statistic_instance_type_index'),
        ),
        migrations.AddIndex(
            model_name='rule',
            index=models.Index(fields=['instance'], name='rule_instance_index'),
        ),
        migrations.AddIndex(
            model_name='rule',
            index=models.Index(fields=['instance_type'], name='rule_instance_type_index'),
        ),
        migrations.AddIndex(
            model_name='riskevent',
            index=models.Index(fields=['instance'], name='risk_instance_index'),
        ),
        migrations.AddIndex(
            model_name='riskevent',
            index=models.Index(fields=['instance_type'], name='risk_instance_type_index'),
        ),
        migrations.AddIndex(
            model_name='metric',
            index=models.Index(fields=['timestamp'], name='metric_timestamp_index'),
        ),
        migrations.AddIndex(
            model_name='metric',
            index=models.Index(fields=['instance'], name='metric_instance_index'),
        ),
        migrations.AddIndex(
            model_name='metric',
            index=models.Index(fields=['instance_type'], name='metric_instance_type_index'),
        ),
    ]
