zabbix 后台数据库清除数据

alerts 表 problem 表 escalations 表 events 表  event_recovery表 对 这些表进行清除 防止不停发送邮件

 

  1 -- alerts table rebuild.
  2 -- ----------------------------
  3 -- Table structure for alerts
  4 -- ----------------------------
  5 SET FOREIGN_KEY_CHECKS=0;
  6 DROP TABLE IF EXISTS `alerts`;
  7 CREATE TABLE `alerts` (
  8   `alertid` bigint(20) unsigned NOT NULL,
  9   `actionid` bigint(20) unsigned NOT NULL,
 10   `eventid` bigint(20) unsigned NOT NULL,
 11   `userid` bigint(20) unsigned DEFAULT NULL,
 12   `clock` int(11) NOT NULL DEFAULT '0',
 13   `mediatypeid` bigint(20) unsigned DEFAULT NULL,
 14   `sendto` varchar(100) COLLATE utf8_bin NOT NULL DEFAULT '',
 15   `subject` varchar(255) COLLATE utf8_bin NOT NULL DEFAULT '',
 16   `message` text COLLATE utf8_bin NOT NULL,
 17   `status` int(11) NOT NULL DEFAULT '0',
 18   `retries` int(11) NOT NULL DEFAULT '0',
 19   `error` varchar(2048) COLLATE utf8_bin NOT NULL DEFAULT '',
 20   `esc_step` int(11) NOT NULL DEFAULT '0',
 21   `alerttype` int(11) NOT NULL DEFAULT '0',
 22   `p_eventid` bigint(20) unsigned DEFAULT NULL,
 23   `acknowledgeid` bigint(20) unsigned DEFAULT NULL,
 24   PRIMARY KEY (`alertid`),
 25   KEY `alerts_1` (`actionid`),
 26   KEY `alerts_2` (`clock`),
 27   KEY `alerts_3` (`eventid`),
 28   KEY `alerts_4` (`status`),
 29   KEY `alerts_5` (`mediatypeid`),
 30   KEY `alerts_6` (`userid`),
 31   KEY `alerts_7` (`p_eventid`),
 32   KEY `c_alerts_6` (`acknowledgeid`),
 33   CONSTRAINT `c_alerts_1` FOREIGN KEY (`actionid`) REFERENCES `actions` (`actionid`) ON DELETE CASCADE,
 34   CONSTRAINT `c_alerts_2` FOREIGN KEY (`eventid`) REFERENCES `events` (`eventid`) ON DELETE CASCADE,
 35   CONSTRAINT `c_alerts_3` FOREIGN KEY (`userid`) REFERENCES `users` (`userid`) ON DELETE CASCADE,
 36   CONSTRAINT `c_alerts_4` FOREIGN KEY (`mediatypeid`) REFERENCES `media_type` (`mediatypeid`) ON DELETE CASCADE,
 37   CONSTRAINT `c_alerts_5` FOREIGN KEY (`p_eventid`) REFERENCES `events` (`eventid`) ON DELETE CASCADE,
 38   CONSTRAINT `c_alerts_6` FOREIGN KEY (`acknowledgeid`) REFERENCES `acknowledges` (`acknowledgeid`) ON DELETE CASCADE
 39 ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
 40 SET FOREIGN_KEY_CHECKS=1;
 41 
 42 --------------------------------------------------------------------------------------------------------
 43 -- problem table rebuild.
 44 -- ----------------------------
 45 -- Table structure for problem
 46 -- ----------------------------
 47 SET FOREIGN_KEY_CHECKS=0;
 48 DROP TABLE IF EXISTS `problem`;
 49 CREATE TABLE `problem` (
 50   `eventid` bigint(20) unsigned NOT NULL,
 51   `source` int(11) NOT NULL DEFAULT '0',
 52   `object` int(11) NOT NULL DEFAULT '0',
 53   `objectid` bigint(20) unsigned NOT NULL DEFAULT '0',
 54   `clock` int(11) NOT NULL DEFAULT '0',
 55   `ns` int(11) NOT NULL DEFAULT '0',
 56   `r_eventid` bigint(20) unsigned DEFAULT NULL,
 57   `r_clock` int(11) NOT NULL DEFAULT '0',
 58   `r_ns` int(11) NOT NULL DEFAULT '0',
 59   `correlationid` bigint(20) unsigned DEFAULT NULL,
 60   `userid` bigint(20) unsigned DEFAULT NULL,
 61   PRIMARY KEY (`eventid`),
 62   KEY `problem_1` (`source`,`object`,`objectid`),
 63   KEY `problem_2` (`r_clock`),
 64   KEY `problem_3` (`r_eventid`),
 65   CONSTRAINT `c_problem_1` FOREIGN KEY (`eventid`) REFERENCES `events` (`eventid`) ON DELETE CASCADE,
 66   CONSTRAINT `c_problem_2` FOREIGN KEY (`r_eventid`) REFERENCES `events` (`eventid`) ON DELETE CASCADE
 67 ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
 68 SET FOREIGN_KEY_CHECKS=1;
 69 
 70 ------------------------------------------------------------------------------------------------------
 71 -- escalations table rebuild
 72 -- ------------------------------------
 73 -- Table structure for escalations
 74 ---------------------------------------
 75 SET FOREIGN_KEY_CHECKS=0;
 76 DROP TABLE IF EXISTS `escalations`;
 77 CREATE TABLE `escalations` (
 78   `escalationid` bigint(20) unsigned NOT NULL,
 79   `actionid` bigint(20) unsigned NOT NULL,
 80   `triggerid` bigint(20) unsigned DEFAULT NULL,
 81   `eventid` bigint(20) unsigned DEFAULT NULL,
 82   `r_eventid` bigint(20) unsigned DEFAULT NULL,
 83   `nextcheck` int(11) NOT NULL DEFAULT '0',
 84   `esc_step` int(11) NOT NULL DEFAULT '0',
 85   `status` int(11) NOT NULL DEFAULT '0',
 86   `itemid` bigint(20) unsigned DEFAULT NULL,
 87   `acknowledgeid` bigint(20) unsigned DEFAULT NULL,
 88   PRIMARY KEY (`escalationid`),
 89   UNIQUE KEY `escalations_1` (`actionid`,`triggerid`,`itemid`,`escalationid`)
 90 ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
 91 SET FOREIGN_KEY_CHECKS=1;
 92 
 93 ---------------------------------------------------------------------------------------------------
 94 -- events table rebuild
 95 -- ------------------------------------
 96 -- Table structure for events
 97 ---------------------------------------
 98 SET FOREIGN_KEY_CHECKS=0;
 99 DROP TABLE IF EXISTS `events`;
100 CREATE TABLE `events` (
101   `eventid` bigint(20) unsigned NOT NULL,
102   `source` int(11) NOT NULL DEFAULT '0',
103   `object` int(11) NOT NULL DEFAULT '0',
104   `objectid` bigint(20) unsigned NOT NULL DEFAULT '0',
105   `clock` int(11) NOT NULL DEFAULT '0',
106   `value` int(11) NOT NULL DEFAULT '0',
107   `acknowledged` int(11) NOT NULL DEFAULT '0',
108   `ns` int(11) NOT NULL DEFAULT '0',
109   PRIMARY KEY (`eventid`),
110   KEY `events_1` (`source`,`object`,`objectid`,`clock`),
111   KEY `events_2` (`source`,`object`,`clock`)
112 ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
113 SET FOREIGN_KEY_CHECKS=1;
114 
115 -----------------------------------------------------------------------------
116 -- event_recovery table rebuild
117 -- ------------------------------------
118 -- Table structure for event_recovery
119 ---------------------------------------
120 SET FOREIGN_KEY_CHECKS=0;
121 DROP TABLE IF EXISTS `event_recovery`;
122 CREATE TABLE `event_recovery` (
123   `eventid` bigint(20) unsigned NOT NULL,
124   `r_eventid` bigint(20) unsigned NOT NULL,
125   `c_eventid` bigint(20) unsigned DEFAULT NULL,
126   `correlationid` bigint(20) unsigned DEFAULT NULL,
127   `userid` bigint(20) unsigned DEFAULT NULL,
128   PRIMARY KEY (`eventid`),
129   KEY `event_recovery_1` (`r_eventid`),
130   KEY `event_recovery_2` (`c_eventid`),
131   CONSTRAINT `c_event_recovery_1` FOREIGN KEY (`eventid`) REFERENCES `events` (`eventid`) ON DELETE CASCADE,
132   CONSTRAINT `c_event_recovery_2` FOREIGN KEY (`r_eventid`) REFERENCES `events` (`eventid`) ON DELETE CASCADE,
133   CONSTRAINT `c_event_recovery_3` FOREIGN KEY (`c_eventid`) REFERENCES `events` (`eventid`) ON DELETE CASCADE
134 ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
135 SET FOREIGN_KEY_CHECKS=1;

 

转载于:https://www.cnblogs.com/shuitian-ys/p/10024946.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值