mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
Fixed Alert rules Advanced SQL query (#9350)
DO NOT DELETE THIS TEXT #### Please note > Please read this information carefully. You can run `./scripts/pre-commit.php` to check your code before submitting. - [X] Have you followed our [code guidelines?](http://docs.librenms.org/Developing/Code-Guidelines/) #### Testers If you would like to test this pull request then please run: `./scripts/github-apply <pr_id>`, i.e `./scripts/github-apply 5926` After you are done testing, you can remove the changes with `./scripts/github-remove`. If there are schema changes, you can ask on discord how to revert.
This commit is contained in:
committed by
Neil Lathwood
parent
7a2c9d9e62
commit
51220e6b77
@@ -67,9 +67,16 @@ On the Advanced tab, you can specify some additional options for the alert rule:
|
||||
- Override SQL: Enable this if you using a custom query
|
||||
- Query: The query to be used for the alert.
|
||||
|
||||
> An example of this would be an average rule for all CPUs over 10%:
|
||||
> SELECT *,AVG(processors.processor_usage) as cpu_avg FROM devices,processors WHERE (devices.device_id = ? AND devices.device_id = processors.device_id) AND (devices.status = 1 && (devices.disabled = 0 && devices.ignore = 0)) = 1 HAVING AVG(processors.processor_usage) > 10
|
||||
> cpu_avg would then contain the average CPU usage value.
|
||||
- An example of this would be an average rule for all CPUs over 10%
|
||||
|
||||
```sql
|
||||
SELECT *,AVG(processors.processor_usage) as cpu_avg FROM devices,processors WHERE (devices.device_id = ? AND devices.device_id = processors.device_id) AND (devices.status = 1 && (devices.disabled = 0 && devices.ignore = 0)) = 1 HAVING AVG(processors.processor_usage) > 10
|
||||
```
|
||||
|
||||
> The 10 would then contain the average CPU usage value, you can change this value to be whatever you like.
|
||||
|
||||
- You will to need copy and paste this into the Alert Rule under Advanced then paste into Query box and switch the Override SQL.
|
||||
|
||||
|
||||
## Procedure
|
||||
You can associate a rule to a procedure by giving the URL of the procedure when creating the rule. Only links like "http://" are supported, otherwise an error will be returned. Once configured, procedure can be opened from the Alert widget through the "Open" button, which can be shown/hidden from the widget configuration box.
|
||||
|
Reference in New Issue
Block a user