0020_alert_systemperformance.py 2.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. # Generated by Django 4.2 on 2025-04-28 20:22
  2. from django.db import migrations, models
  3. class Migration(migrations.Migration):
  4. dependencies = [
  5. ("api", "0019_alter_graph_user"),
  6. ]
  7. operations = [
  8. migrations.CreateModel(
  9. name="Alert",
  10. fields=[
  11. (
  12. "id",
  13. models.BigAutoField(
  14. auto_created=True,
  15. primary_key=True,
  16. serialize=False,
  17. verbose_name="ID",
  18. ),
  19. ),
  20. ("create_time", models.DateTimeField(auto_now_add=True)),
  21. ("update_time", models.DateTimeField(auto_now=True)),
  22. ("name", models.CharField(default="未命名告警规则", max_length=64)),
  23. (
  24. "level",
  25. models.CharField(
  26. choices=[("system", "系统级"), ("process", "进程级")],
  27. default="system",
  28. max_length=16,
  29. ),
  30. ),
  31. (
  32. "indicator",
  33. models.CharField(
  34. choices=[("cpu", "cpu使用率"), ("mem", "内存占用"), ("disk", "硬盘占用")],
  35. default="cpu",
  36. max_length=16,
  37. ),
  38. ),
  39. ("threshold", models.FloatField()),
  40. (
  41. "handle",
  42. models.CharField(
  43. choices=[
  44. ("noAction", "不做处理"),
  45. ("closeLatest", "关闭最新进程"),
  46. ("closeHighestCpu", "关闭CPU占用最高进程"),
  47. ("closeHighestMem", "关闭MEM占用最高进程"),
  48. ],
  49. default="noAction",
  50. max_length=16,
  51. ),
  52. ),
  53. (
  54. "state",
  55. models.CharField(
  56. choices=[("enable", "启用"), ("disable", "未启用")],
  57. default="disable",
  58. max_length=16,
  59. ),
  60. ),
  61. ],
  62. ),
  63. migrations.CreateModel(
  64. name="SystemPerformance",
  65. fields=[
  66. (
  67. "id",
  68. models.BigAutoField(
  69. auto_created=True,
  70. primary_key=True,
  71. serialize=False,
  72. verbose_name="ID",
  73. ),
  74. ),
  75. ("cpu", models.FloatField()),
  76. ("mem_total", models.FloatField()),
  77. ("mem_used", models.FloatField()),
  78. ("create_time", models.DateTimeField(auto_now_add=True)),
  79. ],
  80. ),
  81. ]