fix: Use correct entity columns for sensors (#7775)

* fix: Use correct entity columns for sensors

* updated schema

* Update custom rules too
This commit is contained in:
Neil Lathwood
2017-11-22 04:41:22 +00:00
committed by Tony Murray
parent a56267e5ba
commit ccbe3ea2e3
4 changed files with 13 additions and 14 deletions

7
sql-schema/216.sql Normal file
View File

@@ -0,0 +1,7 @@
UPDATE `sensors` SET `entPhysicalIndex_measured` = 'ports', `entPhysicalIndex` = entity_link_index WHERE entity_link_type='port';
UPDATE `config` SET `config_value` = "(%sensors.entPhysicalIndex_measured = 'ports' && %sensors.entPhysicalIndex = %ports.ifIndex && %macros.port_up)", `config_default` = "(%sensors.entPhysicalIndex_measured = 'ports' && %sensors.entPhysicalIndex = %ports.ifIndex && %macros.port_up)" WHERE `config_name` = 'alert.macros.rule.sensor_port_link';
UPDATE `alert_rules` SET `query` = REPLACE(query, 'entity_link_type', 'entPhysicalIndex_measured');
UPDATE `alert_rules` SET `query` = REPLACE(query, 'entity_link_index', 'entPhysicalIndex');
UPDATE `alert_rules` SET `rule` = REPLACE(rule, 'entity_link_type', 'entPhysicalIndex_measured');
UPDATE `alert_rules` SET `rule` = REPLACE(rule, 'entity_link_index', 'entPhysicalIndex');
ALTER TABLE `sensors` DROP `entity_link_type` , DROP `entity_link_index`;