mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
Added ability to set a custom SQL query for alert rules. (#9094)
* Added support for AVG in rules * More updates * Final work to have advanced sql queries * Added missing use * Fix exception when invalid json is passed * Fixed api for alert rules * updated docs
This commit is contained in:
committed by
Tony Murray
parent
53a1730fc7
commit
466b5a35a8
@@ -146,7 +146,7 @@ class QueryBuilderParser implements \JsonSerializable
|
||||
public static function fromJson($json)
|
||||
{
|
||||
if (!is_array($json)) {
|
||||
$json = json_decode($json, true);
|
||||
$json = json_decode($json, true) ?: [];
|
||||
}
|
||||
|
||||
return new static($json);
|
||||
@@ -235,7 +235,7 @@ class QueryBuilderParser implements \JsonSerializable
|
||||
$wrap = false;
|
||||
|
||||
if ($expand) {
|
||||
$sql = 'SELECT * FROM ' . implode(',', $this->getTables());
|
||||
$sql = 'SELECT * FROM ' .implode(',', $this->getTables());
|
||||
$sql .= ' WHERE ' . $this->generateGlue() . ' AND ';
|
||||
|
||||
// only wrap in ( ) if the condition is OR and there is more than one rule
|
||||
|
Reference in New Issue
Block a user