Commit Graph

65 Commits

Author SHA1 Message Date
rj-taylor
c46a14af53 Prevent syslog table purge from spamming daily.log (#10851)
daily.php's syslog purge block writes output for every dbDelete() except for the final one.  The deletes are done in blocks of 1000 rows.  This can lead to verbose output while the table is purged.  This patch saves up all that excitement for a single echo at the end of the operation.  It also outputs the total amount of rows deleted.
2019-11-19 23:57:56 +01:00
rj-taylor
a28a17d963 Fixed syslog pruning when dbFetchRow() returns array (#10850)
If dbFetchRow() returns an array, dbDelete() won't do its work pruning the syslog table and we'll drop out of the block via break.  This if statement will take the value return inside the array and replace $limit with that value.  This way, dbDelete() can successfully prune the syslog table.

dbFetchCell() can return an array that won't work when fed to dbDelete().  This keeps that from occurring so the syslog table can be pruned.
2019-11-19 20:25:11 +01:00
PipoCanaja
bf181b9dc2
Added support for routing table collection in discovery (#10182)
* Clean broken VRF lite code
* Change DB table for route discovery
* Add VRF simple support
* add port_id to db and discovery
* static-fy the translation arrays
* sort and search cleaning
* Sorting refactor and validation
* formatItem shortened
* Handle ifIndex==0 meaning no next hop defined (MPLS)
* Sync all create/updates
* purge in daily
* remove old route table
* get rid of inetCidrRouteNextHop_device_id
* fix wonky column orders
* add route snmprec
* fix sorting by interface
* Move to new config
* rename to route the new table
* Properly display ipv6 compressed addresses
* Translation before merge ./lnms translation:generate
* Update manifest
2019-11-17 16:30:43 +01:00
louis-oui
0b01daa84c Do not purge alert_log table entries that have a matching active alert in alerts table (#10744)
* https://github.com/librenms/librenms/issues/10686

* Do not purge alert_logs table when there is a matching active alert in alerts table

* Do not purge alert_log table when there is a matching active alert in alerts table

* Do not purge alert_log table entries that has a matching active alert in alerts table

* Update daily.php

* Do not purge alert_log table entries that has a matching active alert in alerts table

* Do not purge alert_log table entries that has a matching active alert in alerts table

* Update functions.php

Missing }

* Do not purge alert_log table entries that has a matching active alert in alerts table

* Do not purge alert_log table entries that has a matching active alert in alerts table

* Do not purge alert_log table entries that has a matching active alert in alerts table

* Add deleting history of active alert_logs more than ? days

* Commit to replay CI

* Commit to replay CI
2019-11-05 14:49:09 +01:00
Tony Murray
36a5da00ca
Fix missed alert function renames (#10452) 2019-07-18 11:05:43 -05:00
Tony Murray
e8e6ed5142
Fix broken updates (#10380) 2019-06-26 08:49:04 -05:00
Tony Murray
f3ba8947f7
Use Config helper (#10339)
remove usage of global variable
2019-06-23 00:29:12 -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
PipoCanaja
e2f835ad9d
FDB table with history capabilities (#9804)
* Migration script and data feeding

* Adding the columns in the GUI

* build schema

* update FDB test data

* Use of timestamps()

* ignore created_at and updated_at in tests, and regenerate test impacted

* daily.sh does the cleaning

* space cleaning codeclimate

* Use carbon instead of str-val

* handle when $fdb_entry->updated_at and created at are null

* handle when $fdb_entry->updated_at and created at are null (force travis rerun)

* Doc update

* Doc update
2019-02-21 13:23:01 +01:00
Tony Murray
bc93d8c037
Fix php version notification removal (#9796) 2019-02-08 08:17:02 -06:00
Neil Lathwood
6fdafd137c Deprecate PHP < 7.1.3 (#9645)
* Added validation and support for users on PHP < 7.1.3

* Branch name php56
2019-02-07 13:23:30 -06:00
Søren Rosiak
0db8d0ca70 Fix reference (#9328) 2018-10-16 08:00:50 +01:00
Neil Lathwood
3aeab9ed7d Fixed daily.sh overwriting custom alert sql (#9326) 2018-10-15 16:03:56 -05:00
Tony Murray
e9ff8c48b6 Fixed IN db queries (#9077)
Most were fine as they hardcoded the in into the query.
Change them all to use PDO properly.
Did not fix IRCBot, they are are all hardcoded.

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`
2018-08-26 13:42:21 +01:00
Tony Murray
9bc0c542a5 Allow ping checks to be ran separately from polling (#8821)
Allows ping checks at intervals not tied to the poller.  Pointless if you are not alerting on device status.
I updated the rrdstep.php script to treat ping-perf files separately and made it so it only converts if needed.

Docs here: https://docs.librenms.org/Extensions/Fast-Ping-Check/

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`
2018-07-30 22:58:38 +01:00
Neil Lathwood
d9ceaf7830 Added support for auto purging deleted ports (#8861) 2018-07-03 08:27:20 -05: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
Neil Lathwood
c14efbf904
Updated email subject for failed updates to include hostname (#8258) 2018-02-16 10:08:26 +00:00
Tony Murray
d515f5043e refactor: Move install to php53 branch if running an unsupported version of PHP (#8042)
* Move install to php53 branch if running an unsupport version of PHP

* Update validate

* Move PHP version check after update check.  This will prevent us from moving no update users to the php53 branch.

Hopefully if daily.php -f update fails it returns a non-zero and we can move them to the php53 branch still.

* Wiggle things around more.

* Also, send release installs to the php53 branch.

* Set notification error for old PHP version.
2018-01-10 14:40:58 +00:00
Tony Murray
2e73b75297 fix: Use memcached to lock daily processes on Distributed Pollers (#7735)
* fix: use memcached to lock daily processes on Distributed Pollers

* All the locks!
2017-11-24 09:37:52 +00:00
Tony Murray
54b476c769
fix: devices detected as ibmtl or generic (#7618)
* fix: devices detected as ibmtl
Guess at the sysObjectID, please report if you have devices that should be ibmtl and are no longer detected.
Add output of os in discovery.

* Always load all os for discovery.  Should be cached most of the time.
2017-11-03 16:10:24 -05:00
Tony Murray
8a051aa295 fix: Fix a couple of OS cache invalidation issues (#7567)
* fix: fix a couple of OS cache invalidation issues
Fixes issues where we might be using outdated os definitions.

* use Config and fix style issue

* only pull in settings from config.php (otherwise will possibly contain populated os config)
2017-10-27 21:03:58 +01:00
Tony Murray
1cd4fcb8b1 feature: issue warning notification if php version is less than 5.6.4 (#7418)
* feature: issue warning notification if php version is less than 5.6.4
rename set_notification function in daily.sh to set_notifiable_result
print output when a daily.sh process fails

* further notifiable clarification

* Update the notification message.

* make sure to remove the notification when updates are disabled
move the notification code into the php check
2017-10-22 19:30:31 +01:00
Tony Murray
0def643e09 feature: Notify about failed updates, block detectable bad updates (#7188)
* Feature: Notify about failed updates, block detectable bad updates
Ability to post notifications when the update fails.
Detect and roll back updates that will cause broken installs. (Needs testing)
Add severity to notifications, critical (2) notifications will display a toast.

This will be used for removing in-tree dependencies and raising the minimum php version.

* Improve naming a bit add phpdoc to new_notification
In case multiple notifications are created, remove them all.

* Remove notifications when update is disabled.

* update travis to use db testing

* added missing index
2017-08-26 21:35:39 +01:00
Neil Lathwood
5f5dc2a854 feature: Peeringdb integration to show the Exchanges and peers for your AS' (#6178) 2017-03-22 10:17:13 +00:00
Tony Murray
370e368ffe fix: msyql errors bgp-peers, daily, callback (#5425)
* fix: msyql errors bgp-peers, daily, callback

* select cell instead of an row
2017-01-13 22:21:29 +00:00
Neil Lathwood
63fc4679db feature: Added support for sending email notifications to default_contact if updating fails (#5026) 2016-12-12 14:26:17 +00:00
Tony Murray
9a33464c52 refactor: Centralize includes and initialization (#4991) 2016-11-21 20:12:59 +00:00
Neil Lathwood
e1fac851f9 refactor: Update alert rules to generate sql query and store in db (#4748) 2016-10-15 00:29:55 +01:00
Tony Murray
d2193f76ca feature: allow scripts to be run from any working directory (#4437)
* feature: allow validate.php to be run from any working directory

* remove redundant realpath() call

* re-add realpath() to remove symbolic links

* realpath() isn't needed...

* chdir() in all php scripts in ./ and ./scripts/

* update-sql.php clearly is not used, as it was broken.

* Change some scripts to executable
Remove extra chdir() call in snmp-scan.php

* Missed console-ui.php
Kind of fixed console-ui.php help output

* Re-add newline
2016-09-14 16:53:04 +01:00
Tony Murray
abc6a5b799 PSR-2 Final cleanup (#4247)
refactor: Final PSR2 cleanup
2016-08-28 23:32:55 +01:00
Tony Murray
218c4e6b52 Do not delete directories, only files. 2016-08-01 13:24:25 -05:00
laf
b0d05ad149 Added -print to find + description of why we have deleted files 2016-08-01 18:31:19 +01:00
laf
f73385999e Updated rrd_purge to echo removed files/folders 2016-08-01 15:08:57 +01:00
laf
5a7a606abd Updated as per pr comments 2016-07-31 23:39:45 +01:00
laf
318c9cd2b0 Added cleanup for old RRD files 2016-07-30 16:57:09 +01:00
laf
c14577db34 Added alert log purge setting - defaults to 365 2016-05-02 19:06:51 +00:00
Neil Lathwood
5566163eeb Merge pull request #3156 from richardlawley/billing-perf-2 2016-03-15 21:00:44 +00:00
Richard
dc0f695796 Add optional cleanup task for old bill_data 2016-03-07 18:31:12 +00:00
laf
d85a9f688f Removed innodb check from daily and updated validate to warn 2016-03-03 20:52:23 +00:00
Christopher Smith
73c409dcdc check if auto-updates are enabled before checking innodb settings (if they are disabled, this would still throw an alert to say innodb needs adjusting even though they arent wanted) 2016-02-23 09:10:56 +11:00
Daniel Preussker
c11cf53658 Merge pull request #2815 from laf/notifications-update
Added local rss file + tidied up locations of notifications and callback
2016-01-20 20:01:07 +00:00
laf
a45259377b Added local rss file + tidied up locations of notifications and callback 2016-01-19 21:50:00 +00:00
laf
57c802cd4e Updated active directory auth to support dashboards 2016-01-17 15:26:35 +00:00
Eldon Koyle
ceb3c2264c Fix daily.php not deleting device_perf entries
Add -d option to daily.php to show SQL and fix bug where daily.php does
not delete device_perf entries because a unix timestamp (integer) can't
be cast to a datetime.

MariaDB [librenms]> select * from device_perf where timestamp < UNIX_TIMESTAMP(DATE_SUB(NOW(),INTERVAL '7' DAY));
Empty set, 1 warning (1.20 sec)

MariaDB [librenms]> show warnings;
+---------+------+----------------------------------------+
| Level   | Code | Message                                |
+---------+------+----------------------------------------+
| Warning | 1292 | Incorrect datetime value: '1451944875' |
+---------+------+----------------------------------------+
1 row in set (0.00 sec)

MariaDB [librenms]>
2016-01-11 14:58:40 -07:00
laf
58d585e6fe Updated daily.sh/daily.php to support removing users that have not logged in for X days - Radius only for now 2015-12-13 16:16:39 +00:00
Daniel Preussker
b2034cb329
Added master and release update-channels 2015-11-22 17:06:21 +00:00
Neil Lathwood
47e035d4fd Merge pull request #2004 from QuxLabs/qux-issue-5
Added notification system
2015-11-21 14:24:42 +00:00
Daniel Preussker
0ff693bd0e
Added notifications poller,page,schema,display 2015-11-21 11:22:59 +00:00
laf
2e791308f1 Centralised innodb buffer check and added to validate 2015-11-19 10:20:56 +00:00