mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
Rewritten device groups (including static) (#10295)
* Device Groups rewrite Updated web ui Static or dynamic groups allowed Alert rule query builder Translation support Permissions support * cleanup, make relationship save, and validate it * builder WIP * rules builder and rules saving/loading * Parse query builder to Laravel Fluent query * Upgrade existing groups when editing. Properly update only dynamic groups when polling. * remove unused old code Update API and other places to use Eloquent * debug output in poller restored * Fix up some things creating static improved validation fix js error on creation Fix static groups in polling * hide pattern for static group * Implement authorization Use in the menu too * update schema * fix rollback * Don't abort on invalid queries * fixes to query builder * add test data, looks like macros aren't handled (omitted them because groups don't use them generally) * Add macro support for QueryBuilderFluentParser * add test for macro that accepts value * More space in forms Retain rules when converted to static no duplicate names allowed * Better error feedback Update related devices on save * Add button icon * format * update docs * fix tests
This commit is contained in:
@@ -3,33 +3,24 @@ path: blob/master/doc/
|
||||
|
||||
LibreNMS supports grouping your devices together in much the same way as you can configure alerts. This document will hopefully help you get started.
|
||||
|
||||
### Patterns
|
||||
# Dynamic Groups
|
||||
|
||||
Patterns work in the same way as Entities within the alerting system, the format of the pattern is based on the MySQL structure your data is in. Such
|
||||
as __tablename.columnname__. If you already know the entity you want, you can browse around inside MySQL using `show tables` and `desc <tablename>`.
|
||||
### Rule Editor
|
||||
|
||||
As a working example and a common question, let's assume you want to group devices by hostname. If your hostname format is dcX.[devicetype].example.com. You would use the pattern
|
||||
`devices.hostname`. Select the condition which in this case would be `Like` and then enter `dc1\..*\.example.com`. This would then match dc1.sw01.example.com, dc1.rtr01.example.com but not
|
||||
dc2.sw01.example.com.
|
||||
The rule is based on the MySQL structure your data is in. Such as __tablename.columnname__.
|
||||
If you already know the entity you want, you can browse around inside MySQL using `show tables` and `desc <tablename>`.
|
||||
|
||||
#### Wildcards
|
||||
As a working example and a common question, let's assume you want to group devices by hostname. If your hostname format is dcX.[devicetype].example.com. You would use the field
|
||||
`devices.hostname`.
|
||||
|
||||
As with alerts, the `Like` operation allows MySQL Regular expressions.
|
||||
If you want to group them by device type, you would add a rule for routers of `devices.hostname` endswith `rtr.example.com`.
|
||||
|
||||
A list of common entities is maintained in our [Alerting docs](/Alerting/Entities/).
|
||||
If you want to group them by DC, you could use the rule `devices.hostname` regex `dc1\..*\.example\.com` (Don't forget to escape periods in the regex)
|
||||
|
||||
### Conditions
|
||||
# Static Groups
|
||||
|
||||
Please see our [Alerting docs](/Alerting/Rules/#syntax) for explanations.
|
||||
|
||||
### Connection
|
||||
|
||||
If you only want to group based on one pattern then select And. If however you want to build a group based on multiple patterns then you can build a SQL like
|
||||
query using And / Or.
|
||||
|
||||
As an example, we want to base our group on the devices hostname AND it's type. Use the pattern as before, `devices.hostname`, select
|
||||
the condition which in this case would be `Like` and then enter `dc1.@.example.com` then click And. Now enter `devices.type` in the pattern, select `Equals`
|
||||
and enter `firewall`. This would then match dc1.fw01.example.com but not dc1.sw01.example.com as that is a network type.
|
||||
You can create static groups (and convert dynamic groups to static) to put specific devices in a group.
|
||||
Just select static as the type and select the devices you want in the group.
|
||||
|
||||

|
||||
|
||||
|
||||
Reference in New Issue
Block a user