mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
Fix alert last modified timestamps
mysql timestamp columns do not accept timestamps
This commit is contained in:
@@ -114,7 +114,7 @@ class AlertRules
|
|||||||
if (is_null($current_state)) {
|
if (is_null($current_state)) {
|
||||||
dbInsert(array('state' => AlertState::ACTIVE, 'device_id' => $device_id, 'rule_id' => $rule['id'], 'open' => 1,'alerted' => 0), 'alerts');
|
dbInsert(array('state' => AlertState::ACTIVE, 'device_id' => $device_id, 'rule_id' => $rule['id'], 'open' => 1,'alerted' => 0), 'alerts');
|
||||||
} else {
|
} else {
|
||||||
dbUpdate(['state' => AlertState::ACTIVE, 'open' => 1, 'timestamp' => Carbon::now()->timestamp], 'alerts', 'device_id = ? && rule_id = ?', [$device_id, $rule['id']]);
|
dbUpdate(['state' => AlertState::ACTIVE, 'open' => 1, 'timestamp' => Carbon::now()], 'alerts', 'device_id = ? && rule_id = ?', [$device_id, $rule['id']]);
|
||||||
}
|
}
|
||||||
c_echo(PHP_EOL . 'Status: %rALERT');
|
c_echo(PHP_EOL . 'Status: %rALERT');
|
||||||
}
|
}
|
||||||
@@ -127,7 +127,7 @@ class AlertRules
|
|||||||
if (is_null($current_state)) {
|
if (is_null($current_state)) {
|
||||||
dbInsert(['state' => AlertState::RECOVERED, 'device_id' => $device_id, 'rule_id' => $rule['id'], 'open' => 1, 'alerted' => 0], 'alerts');
|
dbInsert(['state' => AlertState::RECOVERED, 'device_id' => $device_id, 'rule_id' => $rule['id'], 'open' => 1, 'alerted' => 0], 'alerts');
|
||||||
} else {
|
} else {
|
||||||
dbUpdate(['state' => AlertState::RECOVERED, 'open' => 1, 'note' => '', 'timestamp' => Carbon::now()->timestamp], 'alerts', 'device_id = ? && rule_id = ?', [$device_id, $rule['id']]);
|
dbUpdate(['state' => AlertState::RECOVERED, 'open' => 1, 'note' => '', 'timestamp' => Carbon::now()], 'alerts', 'device_id = ? && rule_id = ?', [$device_id, $rule['id']]);
|
||||||
}
|
}
|
||||||
|
|
||||||
c_echo(PHP_EOL . 'Status: %gOK');
|
c_echo(PHP_EOL . 'Status: %gOK');
|
||||||
|
|||||||
Reference in New Issue
Block a user