Commit Graph

152 Commits

Author SHA1 Message Date
Tony Murray
0cdb58fab9
Don't run poller validations when there are no devices (#16088)
* Don't run poller validations when there are no devices

* Missing import
2024-06-04 21:55:24 +02:00
Tony Murray
86793653b3
Validate secure cookies (#15401)
* Validate secure session cookies if HTTPS
When HTTPS is available, secure session cookies should be enabled
SESSION_SECURE_COOKIE=true

* Apply fixes from StyleCI

* Note config:cache

---------

Co-authored-by: StyleCI Bot <bot@styleci.io>
2023-10-05 22:18:49 -05:00
Tony Murray
4211b1c46f
Remove unused functions (#15371)
* Remove unused functions
inline other legacy functions

* Apply fixes from StyleCI

---------

Co-authored-by: StyleCI Bot <bot@styleci.io>
2023-10-04 10:17:34 -05:00
Tony Murray
12f8bb2040
MAC Vendor OUI use scheduler (#15187)
* MAC Vendor OUI use scheduler
Add command to update `lnms maintenance:fetch-ouis`
Show vendor column in tables if mac_oui.enabled is set to true
Improve scheduler validation handle non-standard install directories and systems without systemd
Add index to table to improve speed and improve mac->vendor lookup speed
Scheduled weekly with random wait to prevent stampeding herd issues for upstream
drop oui update from daily

* MAC Vendor OUI use scheduler
Add command to update `lnms maintenance:fetch-ouis`
Show vendor column in tables if mac_oui.enabled is set to true

* Lint fixes and better prefix detection

* update schema file
2023-08-03 19:29:30 -05:00
Jellyfrog
5a56e9081e
Use Laravel schema migration command directly (#14039)
* Add new schema migration command

* Apply fixes from StyleCI
2023-08-03 19:26:48 -05:00
Garcia MICHEL
9c6541f3a4
Fix validation: memcached required only if it is configured in .env (#15122)
* Fix validation: memcached required if it is configured in .env

* Remove unuse namespace
2023-07-05 08:29:32 -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
f271019f6c
Add a validation for checking if the scheduler is running (#14987) 2023-04-24 10:04:50 +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
Hans Erasmus
c330f91e01
Fix empty output on validation test (#14822)
* Fix empty output on validation test

* tried to fix indentation issue

* tried to fix indentation issue again

* tried to fix stylci test error

* remove trailing spaces

* Applied styleci diff
2023-02-01 10:52:36 -06:00
Tony Murray
e4451714e2
version and git helper improvements (#14412)
* Fix up version and git helpers
Improve method names
Move all git calls into the git helper
Allow runtime and external cache of results where appropriate
Consolidate version headers for discovery, poller, and validate

* Style fixes

* improve consistency in git calls

* fix style

* don't send name inconsistently

* Improve database versions

* No need to cache Version it is not used more than once currently.
2022-10-02 00:41:56 -05:00
Tony Murray
1c2e446326
New Poller validations (#14148)
* New Poller validations
Seperated poller and distributed poller validations to make poller validations generally available
One auto fixer added
Translatable strings

* lint and style fixes

* and style

* and style

* Update LibreNMS/Validations/Poller/CheckLocking.php

Co-authored-by: Jellyfrog <Jellyfrog@users.noreply.github.com>

* Update CheckPythonWrapper.php

* Try to check if cron is even installed before warning about not being able to read the cron files.
Likely most systems they won't be readable, but also, it is very unlikely we hit the cron check and it is meaningfully different than the first Poller::exists() check.

* Work on poller validation
Remove errors/warnings when at least one poller of the other type is active.

* style fixes

Co-authored-by: Jellyfrog <Jellyfrog@users.noreply.github.com>
2022-08-02 16:02:37 -05:00
TheMysteriousX
a2c705bd87
queit -> quiet (#14163) 2022-07-31 16:05:37 +02:00
Mark Nagel
3309750f35
replace git show --no-patch option with --quiet (#14160)
* replace git show --no-patch option with --quiet

Older versions of git do not support --no-patch or -q, but both older and modern versions support --quiet.

* Merge #14161

Co-authored-by: Tony Murray <murraytony@gmail.com>
2022-07-30 14:57:26 +02:00
Jellyfrog
670f964e98
Validate: use "database version" instead of "mysql version" (#14158)
* Validate: use "database version" instead of "mysql version"

* wip

* wip
2022-07-29 11:36:18 -05:00
Jellyfrog
6ebcde3c04
Prepare for PHP 8.1 (#14156) 2022-07-28 22:09:09 -05:00
Nash Kaminski
d0503fbdef
Fix 500 error in validation when UI containers and poller containers have differing node_ids (#14146)
* Fix 500 error in validation when UI containers and poller containers have unique node_ids

* Update DistributedPoller.php

Co-authored-by: Tony Murray <murraytony@gmail.com>
2022-07-27 03:08:17 -05:00
Jellyfrog
a214dbc8f3
Use --no-patch to support old git clients (#14137) 2022-07-26 01:21:19 +02:00
Tony Murray
0f13f2343f
Fix more webserver validation issues (#14096)
IPv6 and undefined index errors
2022-07-08 23:36:48 -05:00
Tony Murray
c1a59e29e5
Git version validation fix (#14042)
Instead of erroring because the date is empty, print the error message from git.
2022-06-14 13:36:46 -05:00
Tony Murray
1d35d9391d
server name validation, handle ports better (#14041)
Ignore standard ports and include non-standard ports in the base_url setting
2022-06-14 10:14:44 -05:00
Tony Murray
967c880d86
Fix rrd version check (#14036)
Remove hardcoded version
Add version display in error message
2022-06-13 11:20:13 -05:00
Tony Murray
7a0d604cdd
Automatic fixes for validation failures (#13930)
* Automatic fixes for validations

* webui

* lint fixes

* Fix an install issue with ConfigSeeder requesting cli input in web page.

* Do not use c_echo in validate.php print_fail()
2022-06-10 16:25:33 -05:00
Tony Murray
7644c994ee
Validate base_url and server_name (#13941)
* Validate base_url and server_name

* Fix style

* add return types
2022-06-07 20:53:39 -05:00
Nash Kaminski
4fe3b0fd57
Fix 500 error in validations when capabilities are not supported or set (#13991)
* Fix 500 error in validations when capabilities are not supported or set

* Update Programs.php

* Update Programs.php

Co-authored-by: Tony Murray <murraytony@gmail.com>
2022-06-04 15:38:09 -05:00
Tony Murray
d57b225d5d
Improve lnms shortcut validation (#13982) 2022-05-14 08:11:13 -05:00
Tony Murray
014213680f
Move Config loading to a service provider (#13927)
* Move Config loading to a service provider
That way other service providers can depend on it
Move various random listener registrations into the EventServiceProvider
Various startup cleanup

* Config::persist Set live variable before persisting incase db update fail

* Disable strict mode for legacy code (init.php)

* Disable debug after os test data is gathered

* remove Eloquent::boot it is never used

* remove Eloquent::version

* lint fixes

* style fixes

* there is no c_echo here
2022-04-22 19:12:07 -05:00
Tony Murray
0a84098211
Port Validation Page to Laravel (#13921)
* Revamp validate web page
 to load page then validate, instead of validate then load page

* style fixes

* lint cleanups

* fixes

* translations and a couple fixes

* style fixes

* move result serialization into the class.
2022-04-14 11:22:40 -05:00
Jellyfrog
fdebee86b4
Implement system for user packages in composer (#13718) 2022-02-02 17:33:23 +01:00
Jellyfrog
7c2af16541
Update recommended PHP version to 8.0 (#13687)
In preparation for Laravel 9
2022-01-20 08:07:29 -06:00
Tony Murray
c79b187d72
Poller rewrite (Try 2) (#13525)
* core WIP

* try to finish up

* trim space too
and a couple of cleanups

* update test data

* put escapes back

* another net-snmp difference

* correct copy paste error

* WIP

* Use new code YAY

* a tiny bit more

* Kind of working

* Handle manual modules correctly

* convert core to modern module

* Only save metrics if modules is not overridden

* correct module exists check

* database error handling

* debug handling

* restore bad changes

* Introduce Actions
 RunAlertRulesAction
 UpdateDeviceGroupsAction

* tweaks to output

* Fix some issues in outside code

* Style fixes

* fixes to module status checks

* typehints!

* Use logger only and DI

* OS module not named correctly

* Work on quiet output a bit more

* generically don't change output when disabling debug if the driver is already stack

* Fix missing $device variable for legacy os polling
Fix missing dbFacile functions when no legacy modules polled in RunAlertRulesAction

* restore legacy os module shim

* use the new poller code for tests

* PollingDevice event

* Fix some issues and enable/disable error reporting around legacy modules

* typehints

* fully update baseline

* Use Process for version commands so we don't leak debug output.

* don't detect rrdtool version in ci every time

* style fixes

* Warning fixes

* more fixes

* re-update baseline

* remove diff noise

* fix up alerts

* Catch exceptions in device ip lookup

* Revert accidental snmp.inc.php poller target change
(should have been ?: not ??)
2021-11-17 19:23:55 -06:00
Tony Murray
31c9d9c307
Link for can't check Python dependencies validation (#13520)
* Link for can't check Python dependencies validation
Hopefully gives the user some direction

* Fix style
2021-11-17 17:23:37 +01:00
Tony Murray
f8764ddcb5
Revert "Poller command rewrite (#13414)" (#13524)
This reverts commit 1752d1efd4.
2021-11-16 21:40:29 -06:00
Tony Murray
1752d1efd4
Poller command rewrite (#13414)
* core WIP

* try to finish up

* trim space too
and a couple of cleanups

* update test data

* put escapes back

* another net-snmp difference

* correct copy paste error

* WIP

* Use new code YAY

* a tiny bit more

* Kind of working

* Handle manual modules correctly

* convert core to modern module

* Only save metrics if modules is not overridden

* correct module exists check

* database error handling

* debug handling

* restore bad changes

* Introduce Actions
 RunAlertRulesAction
 UpdateDeviceGroupsAction

* tweaks to output

* Fix some issues in outside code

* Style fixes

* fixes to module status checks

* typehints!

* Use logger only and DI

* OS module not named correctly

* Work on quiet output a bit more

* generically don't change output when disabling debug if the driver is already stack

* Fix missing $device variable for legacy os polling
Fix missing dbFacile functions when no legacy modules polled in RunAlertRulesAction

* restore legacy os module shim

* use the new poller code for tests

* PollingDevice event

* Fix some issues and enable/disable error reporting around legacy modules

* typehints

* fully update baseline

* Use Process for version commands so we don't leak debug output.

* don't detect rrdtool version in ci every time

* style fixes

* Warning fixes

* more fixes

* re-update baseline

* remove diff noise

* fix up alerts
2021-11-16 16:59:46 -06:00
Orsiris de Jong
e57ec782f4
Install new python dependencies during daily maintenance (#13186)
* Improve check_requirements script to dynamically read requirements.txt

* Don't dynamically load requirements for python2

* Make sure we check python3 dependencies with python3 binary

* Quote variable to fix SC2086

* Add dynamic_check_requirements.py

* Use dynamic_check_requirements.py for python3

* Revert "Don't dynamically load requirements for python2"

This reverts commit 4485c8fcf9e0075fcf212e4f8bbc59ed75e144b5.

* Revert "Improve check_requirements script to dynamically read requirements.txt"

This reverts commit a9c83350d9de6b1b3b0a313dca23af749a08300a.

* Add LIBRENMS_DIR variable to exec, check for permission errors

* Make sure we check for permission errors on pip install

* Fix shellcheck SC2046 missing quotations

* Make sure we install pip packages as librenms user for Python3

* revert daily.sh, update dependencies in composer

* And in the validation

* should be executable

Co-authored-by: Tony Murray <murraytony@gmail.com>
2021-11-10 10:38:50 -06:00
Jellyfrog
8ffd573cf2
Remove text about report sql issues (#13307) 2021-10-01 14:03:53 -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
Tony Murray
e81ee98b31
Validate schema in utc (#13182)
if timestamp is off, prepend sql query to set UTC for session
2021-08-30 11:02:48 -05:00
Tony Murray
9b8b1b814a
Validate APP_KEY (#13171)
* Validate APP_KEY
key:rotate command to rotate keys, only rotates validation data for now

* fixes, swapped encrypters, not saving new value to db, check that key exists first

* add confirmation

* Option to generate new key, re-encrypt data and then save it to .env
A lot more text to try to prevent disaster.  Print out both keys 1-2 times.
Fix bug in EnvHelper (when key is commented but not empty)

* fix style

* oops, good phpstan
2021-08-27 22:48:21 -05:00
Tony Murray
5d691dc375
Consolidate DB version code (#13111)
* Consilidate DB version
and don't use dbConnected() function

* cleanup imports
2021-08-09 18:33:31 -05:00
Sean
1a97559816
Fix scripts to allow pathname with space (#13027) 2021-07-14 22:00:21 -05:00
Tony Murray
bd3da058d3
Human readable database inconsistent error (#12950)
* Human readable database inconsistent error
In case a db error causes an exception, check validate and show the db errors to the user in the webui.

* only failed validations

* fix style
2021-06-14 13:33:59 -05:00
Tony Murray
ba4ccc1c61
Fix database validations (#12882)
Query output changed using Laravel Fluent, fix output parsing
2021-05-14 12:38:00 -05:00
Tony Murray
77a17dac88
Fix installer when DB is empty (#12873)
(which is every time)
2021-05-13 13:02:43 -05:00
Tony Murray
df5096e449
Install: Validate database before migrating (#12867)
* Validate database during install
Needed to remove usages of legacy functions in the validation

* Fix output, restore real versions
2021-05-13 07:18:54 -05:00
Jellyfrog
f7fbf9fe07
Add support for when group doesnt exist (#12817)
Previously this errored out the validation
2021-04-29 22:44:31 -05:00
Jellyfrog
edb36fd69d
More cleanups (#12715)
* PHPDoc

* Replace Auth > Illuminate\Support\Facades\Auth

* Return inside when()

* use str_replace correct

* Misc

* dead code

* use int $port

* styleci
2021-04-08 08:14:49 -05:00
Cas de Reuver
4ade67097b
Fix Config reference in System validations (#12668) 2021-03-28 12:19:14 -05:00
Jellyfrog
f06e81b357
Switch to utf8mb4 (#12580)
* Switch to utf8mb4

This allows emojis to function correctly

* Update URLs
2021-03-28 16:23:08 +02:00