Commit Graph

35 Commits

Author SHA1 Message Date
Justin Lentz
90b16bab81
port_error_perc macro (#15016)
* port_error_perc

* Update macros.json

* Update macros.json

* Update querybuilder.json

* Revert

* Update macros.json

* Change macro names so they match usage_perc

* Try *100.0

* Attempt 2 - Encapsulate in parenthesis

* Undo Parenthesis

* Trying laf's suggestions

* Update QueryBuilderFilter.php
2023-07-31 22:26:21 -05:00
Jellyfrog
2b3575a5e9
Laravel 10.x Shift (#14995)
* Apply code style

* Remove explicit call to register policies

* Shift core files

* Shift config files

* Default config files

In an effort to make upgrading the constantly changing config files
easier, Shift defaulted them and merged your true customizations -
where ENV variables may not be used.

* Bump Laravel dependencies

* Add type hints for Laravel 10

* Shift cleanup

* wip

* wip

* sync translation

* Sync back config

* Public Path Binding

* QueryException

* monolog

* db::raw

* monolog

* db::raw

* fix larastan collections

* fix phpstan bug looping forever

* larastan errors

* larastan: fix column type

* styleci

* initialize array

* fixes

* fixes

---------

Co-authored-by: Shift <shift@laravelshift.com>
2023-05-24 22:21:54 +02:00
Jellyfrog
68e0b3df28
Apply fixes from StyleCI (#14899)
Co-authored-by: StyleCI Bot <bot@styleci.io>
2023-03-13 22:32:22 +01:00
Jellyfrog
be1a2cec50
Miscellaneous fixes, mostly undefined variables (#14432)
* Miscellaneous fixes, mostly undefined variables

* Update phpstan-baseline.neon
2022-10-11 11:30:00 +02:00
Jellyfrog
2264229b8b
Silence return type mismatch (#14298)
* Silence return type mismatch

To keep PHP7 compatibility

* Update QueryBuilderFilter.php

* Update DynamicConfigItem.php

* Update ObjectCache.php

* Update DynamicConfigItem.php
2022-09-05 16:19:39 -05:00
Jellyfrog
258505ed44
Apply fixes from StyleCI (#13224) 2021-09-10 20:09:53 +02:00
Jellyfrog
26b95c0ccc
Apply fixes from StyleCI (#13208) 2021-09-08 23:35:56 +02:00
Jellyfrog
6616727a95
Fix alert template variable ping_timestamp (#12690)
* Fix RunAlerts typo

* Update Template.php

* Update QueryBuilderFluentParser.php

* Update QueryBuilderParser.php
2021-03-31 18:06:07 -05:00
Jellyfrog
58af994c6b
Linting (#12677)
* Fix Canopsis Transport

* Lint Hipchat

* Lint IRCBot.php

* Misc

* Update Hipchat.php

* Update Notification.php
2021-03-31 17:29:22 +02:00
Jellyfrog
dc160c6813
PHPDoc fixes (#12687) 2021-03-31 17:18:43 +02:00
Jellyfrog
20b4215204
Swich links to https (#12511)
* Switch librenms links to https

* Convert librenms links in comments

* Switch gnu.org url to https

* switch php urls to https
2021-02-09 00:29:04 +01:00
Jellyfrog
29f45ca352
Apply fixes from StyleCI (#12124) 2020-09-21 15:59:34 +02:00
Jellyfrog
0d56bbd946
Apply fixes from StyleCI (#12123) 2020-09-21 15:51:53 +02:00
Jellyfrog
77c531527c
Apply fixes from StyleCI (#12117)
* Apply fixes from StyleCI

* Disable style check
2020-09-21 14:54:51 +02:00
Tony Murray
1c08c11a77
Remove Laravel helpers (#11428)
* Remove Laravel helpers

* Replace qualifier with import
2020-04-18 00:37:56 +02:00
SourceDoctor
f7f6c63e86
QueryBuilder Filter alphabetic sorting (#11358)
* Global Settings - Alert Default Settings

* Revert "Global Settings - Alert Default Settings"

This reverts commit a1af62b146.

* Sort Querybuilder Filter alphabetic
2020-03-31 04:30:51 +02:00
SourceDoctor
fa753c2c57
Fix - not - not in - Operator Crash in Device Group (#11250) 2020-03-07 16:29:46 +01:00
Chris A. Evans
5bdfd57b84 Add check_oracle service include file and make 'packet_loss_' macro alerts not use radio buttons (#10807)
* - Adjust Alerting Query Builder logic to not use boolean/radio buttons for 'packet_loss_' macros
- Add nagios check script for "check_oracle", which fails on the fallback logic because it does not accept IP/hostname via the '-H' flag

* Update check_oracle.inc.php
2019-11-14 18:45:00 +00:00
Tony Murray
ef4e6de867
Fix device_groups in alert/group builder (#10643) 2019-10-02 13:54:54 +00:00
Tony Murray
7f6a342d71
Fix device group queries that don't start with devices table (#10360) 2019-06-21 06:53:48 -05:00
Tony Murray
b5ca6573df
Fix device groups not using cached joins sometimes (#10353)
for device groups that only reference the devices table
2019-06-20 08:58:35 -05:00
Tony Murray
1a60c44eb0
Device groups rewrite (#10346)
* 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

* Fix some QueryBuilderFluentParser issues with OR
updated/more test data

* Show device groups runtime
fix querybuilder.json format

* Store table joins in the rules to minimize polling time
Update group joins in daily.sh (and when they are saved)

* Update daily.php

* Add units to time
2019-06-19 16:01:53 -05:00
Tony Murray
c2b09b8f80
Revert "Rewritten device groups (including static) (#10295)" (#10340)
This reverts commit cfc51d51f5.
2019-06-16 21:52:57 -05:00
Tony Murray
cfc51d51f5
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
2019-06-16 08:27:22 -05:00
Tony Murray
cc0fa745b2
Don't include time macros in field list (#10299)
They can only be used as the value
2019-06-03 22:34:34 -05:00
TheGreatDoc
eeac7060c5 Fixed integers fields in alert rules to be string (#9496)
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.
2018-12-05 12:13:46 +00:00
TheGreatDoc
0874dce8a5 Fixed field type for processor_usage and _perc_warn (#9357)
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.
2018-10-21 20:02:06 +01:00
Neil Lathwood
466b5a35a8 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
2018-09-19 07:47:45 -05:00
Neil Lathwood
3db26c1d36
refactor: Allow _perc and _current columns to be string for alert rules (#8532)
* refactor: Allow _perc and _current columns to be string for alert rules

* Moved the check for column type
2018-04-14 14:11:11 +01:00
Tony Murray
333efe1402 Query builder fix root OR with more than one rule (#8457)
pushed the first recursion loop down, makes the code cleaner.
2018-03-23 14:39:13 +00:00
Neil Lathwood
544b363951 alert: Added support for disabling recovery notifications (#8430)
* alert: Added support for disabling recovery notifications

* reversed use of recovery

* removed debug + small update
2018-03-22 12:38:16 -05:00
Tony Murray
2f25d11747 More complete query builder parsing (#8422)
* fix like and is null operators

* Add between operator support

* Can't have one if ($expand) clause

* fix up empty, add tests

* Use single quotes for strings

* Fix moxa sensors order

* Fixed travis
2018-03-20 10:54:02 +00:00
Tony Murray
2bd6ceadc2 Fix query builder empty (#8408) 2018-03-17 13:03:51 +00:00
Neil Lathwood
8136a1be33
Fixed LIKE parsing to work (#8406)
* Fixed LIKE parsing to work

* Do not add quotes for values that will already have them
2018-03-16 23:30:51 +00:00
Neil Lathwood
03076c4025
feature: Added new alert rule builder UI and rule mapping UI (#8293)
* feature: Added new alert rule builder UI

* Updated to export sql queries

* More updates

* more changes

* removed debug

* fix scrut

* Updated to include import options + various other fixes

* fix rule

* Populate name from collection rules.

* Fix default rule import
Allow new and old style rules in the collection.
Don't add new yet as I'm not sure GenSQL() is working.

* Fix GenSQL call

* Extract filter building to class so it is nicely contained in one place

* moved schema

* some fixes and tweaks

* travis fixes

* Some more features / updates

* Fix up my mistakes when adding default rules

* Use a modal for new alert (Incomplete)
Larger dialog!!
Remove page loading stuff.

Working:
Loading rules, resetting dialog, importing from collection.

Not working yet:
select width
device limited rule access? don't know what this is...

Lots of unused stuff to delete...

* reload "table" after save

* fixed editing rule

* Auto select2 width

* Reload window on save

* Restore per-device alert. Remove debug.

* Small cleanups. Rule Name first.

* Restore button to button type. Rename schema.

* Fixes: wrong command to reload window, remove extra attributes, rule is never passed

* Fixed old rule editing

* some small updates for old imports

* travis update to use trusty

* maybe travis fix

* Ability to set alert rule mappings on the rule edit screen

* pip installs one line, no quiet for deploy

* update schema def

* Fix style and some copyright headers

* fix docs missing file

* Allow new versions of snmpsim and libraries

* Parser WIP

* Fix default rules insert

* reorganize

* Legacy import first draft done

* Implement saving
Skip translation to sql for now

* Working on glues

* small rule collection fix

* Working on glues

* Working on glues

* Docs updates + small UI changes

* Parser WIP

* reorganize

* Legacy import first draft done

* Implement saving
Skip translation to sql for now

* Working on glues

* Working on glues

* Working on glues

* Add table mapping, should move to it's own class

* WIP

* Glue working!!

* Extract Schema class

* Some final touches.
revert alerts_rules.json for now.

* Finish up initial implementation
Needs more tests

* Fix a few places

* small doc updates

* Fix finding tables in grouped rules.

* remove unused code

* code format fixes

* Some quick tests for Schema
Simplified output for findRelationshipPath. Always includes start and target in the result.
This simplifies a lot of code in QueryBuilderParser.php
This also always loads the target table data now (which we want)

* Make bill_id the PRIMARY index for the bills table

* Load macros from a json file in misc instead of the database.

* Fix whitespace and wrong key for collection.

* Handle IN properly when generating SQL

* Fix glue (devices.device_id = ports.port_id) is incorrect :D
Show ALL tables we can resolve relationships for in the query builder filter.

* Remove all macros from the database
Remove insert statements, leave updates to update user's existing rules.
2018-03-14 20:25:19 +00:00