From f1bb532d302a24796608df151712b682bcdcef3b Mon Sep 17 00:00:00 2001 From: Rosiak Date: Sat, 12 Mar 2016 23:27:21 +0100 Subject: [PATCH] check_valid_sensors - Correction #3229 --- includes/discovery/functions.inc.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/includes/discovery/functions.inc.php b/includes/discovery/functions.inc.php index 6329886292..ba418332ab 100644 --- a/includes/discovery/functions.inc.php +++ b/includes/discovery/functions.inc.php @@ -392,10 +392,14 @@ function check_valid_sensors($device, $class, $valid, $poller_type = 'snmp') { foreach ($entries as $entry) { $index = $entry['sensor_index']; $type = $entry['sensor_type']; + $class = $entry['sensor_class']; d_echo($index . ' -> ' . $type . "\n"); if (!$valid[$class][$type][$index]) { echo '-'; + if ($class == 'state') { + dbDelete('sensors_to_state_indexes', '`sensor_id` = ?', array($entry['sensor_id'])); + } dbDelete('sensors', '`sensor_id` = ?', array($entry['sensor_id'])); log_event('Sensor Deleted: ' . $entry['sensor_class'] . ' ' . $entry['sensor_type'] . ' ' . $entry['sensor_index'] . ' ' . $entry['sensor_descr'], $device, 'sensor', $sensor_id); }