Commit Graph

48 Commits

Author SHA1 Message Date
Tony Murray
b09963782a
Fix docs build (#10461)
* Upgrade PIP to fix docs build

* Install python3 setuptools
2019-07-25 08:10:47 -05:00
Tony Murray
d44dd55239
Fix chrome driver version mis-match (#10154) 2019-04-26 21:52:33 -05:00
Tony Murray
6e6e54cb98
New User Management (#9348)
* Rewrite user management.

Error management

Revert edituser legacy page

Connect user permissions button to legacy page for now.

Implement user creation
Refine form

Remove PingCheck.php accidental add :)

Fixes for redirection and deletion

More fixes: realname accidental validation setting, hide can modify for read-only auths

Use a panel to improve style

Add icon to panel-title

Not allowed to delete own user (at least via the click of a button)

Use request validation to reduce complexity of controller.
Improve protection against users doing things they should not.

Switch to horizontal form and not nearly as wide of layout :)

delete without refresh.
Fix for buttons

Include all users (not just from this auth)
Hide the auth column if there is only one auth type

Show username if real name isn't set

Don't allow creation of demo users via the webui

a fix to the lnms user:add command, it didn't set auth_id

update edituser.inc.php to current
just redirect to users page

* Remove TwoFactorTest for now

* Update edituser.inc.php

* Update .env.dusk.testing

* Enable 2fa for 2fa test...
2019-04-22 19:01:39 -05:00
Tony Murray
63de34e295
php artisan serve and dusk testing (#9422)
* php artisan serve and dusk testing

* Fix style

* move if into, in case we need to have different configs

* fix travis yml

* Add missing folders files

* Try to fixup Travis-ci

* revert variable, change check

* skip browser tests for phpunit runs
set up env correctly

* maybe bg is needed

* attempt to fix env

* install Chrome

* Update tests
fix migrations

* Move pylint to python2

* use testing .env

* Running chrome on port 9515 conflicts with the instance started by the tests.  It is probably not needed.

* suppress some artisan serve output

* remove the unused updater
2019-02-14 09:06:10 -06:00
Tony Murray
e18f4522d5
Update to Laravel 5.7 (PHP 7.3 support) (#9800)
* Move assets to 5.7 location

* Add 5.7 SVGs

* add cache data dir

* update QUEUE_DRIVER -> QUEUE_CONNECTION

* Update trusted proxy config

* update composer.json

* 5.5 command loading

* @php and @endphp can't be inline

* Laravel 5.6 logging, Nice!

* Update blade directives

* improved redirects

* remove unneeded service providers

* Improved debugbar loading

* no need to emulate renderable exceptions anymore

* merge updated 5.7 files (WIP)

* Enable CSRF

* database_path() call causes issue in init.php

* fix old testcase name

* generic phpunit 7 fixes

* add missed file_get_contents
Keep migrations table content

* fix duplicate key

* Drop old php versions from travis-ci

* remove hhvm

* fix code climate message

* remove use of deprecated function assertInternalType

* Disable CSRF, we'll enable it separately.
All forms need to be updated to work.

* Update document references
2019-02-12 17:45:04 -06:00
Paul Heinrichs
ebe2ecf524 Laravel migrations (#8868)
* Add migrations and seeds

* Fix spacing validation issues

* Fix linting

* Update tabs to spaces

* Update daily and install process

* Make build-base.php use the new migrations if empty or at dbschema 1000.
Seed 1000 into the database.
Temp fix for the route table index length (this table basically isn't used...)

* Fix typo in seed.
Hard code legacy schema checks to version 1000 (999 would have worked as is)

* Port association table no longer exists

* Make database validate again

* DB schema, remove as many DB::statement as possible

* update migrations
add librenms cli entry point (artisan)
update validate to check laravel migrations

* remove statements from users migration

* Fix up daily.sh and the 1000 migration

* Update migrations to current state
Take advantage of environment variables to set DB credentials.

* Fix style issues

* Update schema

* fix test db collation

* Fix migration table definition

* update db migrations

* Update migrations

* Update stats callback.  Just count the total migrations applied.

* Update 1000.sql.

* update migrations

* remove the graph type seeder, it is no longer needed

* update docs

* fix whitespace

* remove extra schema

* update tests

* fix sort

* add message

* dbSchema should actually be 1000

* add character set to db create

* Fix some artisan issues

* Update schema
2019-01-14 06:44:23 -06:00
Neil Lathwood
1ee2e8e0e0
Updated to use new theme for docs site (#9320)
* Updated to use new theme for docs site

* Updated theme location

* Removed librenms.css

* Updated index page + re-added librenms.css

* Use built in theme modification

* flexbox grid, dump bootstrap

* tidy up things

* Added path and updated deploy script + mkdocs config

* Removed db schmea changes

* Updated to install python/pip 3

* Removed pip3 install

* Pip3 install

* Updated deploy-docs

* Updated deploy-docs
2018-10-27 23:04:34 +01:00
Neil Lathwood
56afc654f4 Re-enable unit tests for PHP 5.6 (#9251) 2018-09-21 17:55:19 -05:00
Neil Lathwood
5e9d032e16 Speed up testing based on changed files (#9214)
* Speed up testing based on changed files

* Updated to use phpunit instead of foreach loop
2018-09-17 21:32:41 -05:00
Tony Murray
d08593e8d6
Only run unit tests on 7.2 (#9201)
* Only run unit tests on 7.2
Move style check to 7.1

* stop build when a script fails
2018-09-13 12:18:42 -05:00
Tony Murray
af7539ff3b
Fix Travis (#9176)
Output something for phpunit tests, if they take over 10 mins, it will fail the test.
2018-09-10 09:16:32 -05:00
Tony Murray
1ad7f3138b
Add Laravel to LibreNMS (#8318)
* Add Laravel to LibreNMS.

* Try to set permissions during initial install and first composer update to Laravel.

* Fix composer.lock
Fix missing db config keys

* Start building v1 layout
Port ajax_setresolution, inject csrf into jquery ajax calls
Layout works, building menu
Partially done.

* Fix device group list
remove stupid count relationships

* Print messages for common boot errors.
Don't log to laravel.log file.
Log to error_log until booted, then librenms.log

* Fix up some issues with Config loading
Start of custom directives

* Custom blade directives: config, notconfig, admin

* Preflight checks
Only load config files once.

* Update the composer.lock for php 5.6

* Menu through routing

* Start of alert menu

* Better alert scopes

* reduce cruft in models

* Alerting menu more or less working :D

* Fix style

* Improved preflight

* Fix chicken-eggs!

* Remove examples

* Better alert_rule status queries
Debugbar

* fix app.env check

* User Menu

* Settings bar (dropped refresh)
Search JS

* Toastr messages

* Rename preflight

* Use hasAccess(User) on most models.
Add port counts

* Missed a Preflight -> Checks rename

* Fix some formatting

* Boot Eloquent outside of Laravel
Use Eloquent for Config and Plugins so we don't have to connect with dbFacile inside Laravel.
Move locate_binary() into Config class

* Config WIP

* Try to fix a lot of config loading issues.

* Improve menu for non-admins removing unneeded menus
url() for all in menu

* Only use eloquent if it exists

* Include APP_URL in initial .env settings

* Implement Legacy User Provider

* Helper class for using Eloquent outside of Laravel.
Allows access to DB style queries too and checking the connection status.

* Fix up tests

* Fix device groups query

* Checking Travis

* copy config.test.php earlier

* dbFacile check config before connecting
Don't use exception to check if eloquent is connected, it gets grabbed by the exception handler.
Ignore missing config.php error.

* Fix config load with database is not migrated yet.

* Remove Config::load() from early boot.

* Use laravel config settings to init db (this prefers .env settings)
Fix bgp vars not set in menu
add _ide_helper.php to .gitignore

* Restrict dependencies to versions that support php 5.6

* Update ConfigTest

* Fix a couple of installation issues

* Add unique NODE_ID to .env

* Correct handling of title image

* Fix database config not loading. Thanks @laf

* Don't prepend /

* add class_exists checks for development service providers

* Fix config value casting

* Don't use functions that may not exist

* Update dbFacile.php

* d_echo may not be defined when Config used called.

* Add SELinux configuration steps
More detailed permissions check.
Check all and give complete corrective commands in one step.

* Ignore node_modules directory

* Re-add accidetal removal
2018-05-09 08:05:17 -05:00
Tony Murray
8afafe7eb0 refactor: pre-commit.php updates (#8679)
Disable the log for unit tests to speed things up hopefully
2018-05-09 12:53:45 +01: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
Tony Murray
11147d3bbf
Major Processors rewrite (#8066)
* Extract DiscoveryItem and move some things to better places.
Extract model class
Fix up model construction.  I have problem with construction...
Makeshift model working.  Switch constructor to factory.  discover() and create()
Support legacy discovery.
Remove uneeded custom pollers
Remove netonix custom detection as we try ucd on all os now.
Add a few yaml procs.  Fix a couple things.
More processor discovery conversions
Move Calix e7 to standard hrProcessorLoad, but it doesn't fully implement the HR-MIB, move things around to make it work.
Add a few yaml procs.  Fix a couple things. Correct some stupid mib stuff.
Move more, drop php 5.3
Add netscaler which uses string indexes.  Port fiberhome to yaml and use skip_values
More conversions.  BroadcomProcessorUsage Trait
Serveriron and Ironware share some mibs.  Create a common abstract os for them.
Add yaml support for mib specification in each data entry
Make legacy discover_processor() set 0 for hrDeviceIndex

Untangle Dell switch OS processors

Use use shared OS for groups if they don't have a specific group.
fix silly mib mistake

Make index optional

Move HR and UCD to Traits and out of Processor.

* forgot to update the fortiswitch index

* Make sgos and avaya-ers match the old index.

* fix comware test data

* fix merge errors

* fix dsm and remove pointless empty modules

* file not found exception is in the wrong place.

* Updated processor development docs
2018-02-05 07:39:13 -06:00
Tony Murray
8a9fc7783d
only tail the snmpsimd.log (#8121)
so we see failures, but it isn't massive.
2018-01-21 13:36:21 -06:00
Tony Murray
9356d527e7 Drop tests for unsupported php versions (#8070) 2018-01-12 14:11:04 +00:00
Tony Murray
5c5de59f8e
Test docs before deploying (#7992)
* Test docs before deploying
fix issue with docs

* Actually check the result of the doc build
add error for testing

* Fix up docs

* use original logic

* only deploy docs if build succeeds.
Make pip quiet
2018-01-02 08:20:19 -06:00
Tony Murray
fff66d3c00
Feature: Generic discovery and poller tests (#7873)
* Processor Tests!

* Capture data from live devices easily.

* fix up some stuff, remove powerconnect things as they seem to be just broken.

* formatting, fix missing assignment
add netonix processor data

* fix multi-line, always add sysDescr and sysObjectID
ios cpm test file

* revert composer change and fix whitespace issues

* add help text

* missed help text

* tighter debug output

* handle empty strings properly and mibs with numbers

* use keys for sorting as intended

* fix type with empty data

* oops :)

* whitespace fix

* try installing fping

* Fix TestCase collision + cleanup

* mark TestCase as abstract
don't run two instances of snmpsim

* better database dumps, improved capture

* style fixes

* fix quotes add a few more tables

* add --prefer-new, properly merge data

* Support separate discovery and poller data. But don't waste space if they aren't needed.

* refactor to use class
collects all code in one place for reusability

* reorganize

* Print out when not saving.

* Support for running multiple (or all) modules at once.

* tidy

* Change unit test to a generic name and test all modules we have data for.

* Add documentation and a few more tidies

* whitespace fixes

* Fix tests, add a couple more modules, more docs

* More docs updates

* Fix scrutinizer issues

* add bgp-peers
2017-12-20 08:36:49 -06:00
Neil Lathwood
35cbc737a2
fixed travis pylint check for poller-service.py (#7919)
* fixed travis pylint check for poller-service.py

* added mysql-python
2017-12-16 21:50:02 +00: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
9dd9bc1d49 fix: Updated 113 schema to use 255 chars for index (#7054)
* fix: Updated 113 schema to use 255 chars for index

* update travis to fix php build issues
2017-07-18 16:33:36 -05:00
Neil Lathwood
f9b9652167 Set travis to use php 5.6.29 whilst upstream issue is fixed (#6862) 2017-06-19 14:52:57 +01:00
Tony Murray
b1483e3d2e feature: Unit test to validate the db schema (#6367)
* Unit test to validate the db schema
Changes build-schema.php to just write misc/db_schema.yaml

* Only build base if needed
Fix 178.sql

* Database is always created by init.php
add dbSchema test too, should guard against testing against an empty database

* feature: support non-standard unix socket (#5724)

* Add support for custom MySQL unix-socket

* NULL must be lowercase!

* Naive edit of html/install.php

* fixup

* Refactor dbConnect
Use it everywhere

* $config needs to be global
Don't need to set $database_link

* small cleanups

* Connect to the database for every test.

* travis fix for blank line
2017-04-07 15:07:44 +01:00
Neil Lathwood
b321844f11 Deploy schema (#6359)
* updated username

* updated username

* updated username

* updated username

* updated username

* small update
2017-04-05 12:35:50 +01:00
Neil Lathwood
03deb6434a feature: Added ability to validate database schema (#6303)
* feature: Added ability to validate database schema

* small scrut fixes

* Check for extra tables and columns
Print 30 items of schema updates, easier to copy paste sql

* Now supports detections and suggested fix for:
tables: missing, extra
columns: missing, extra, incorrect
indexes: missing, extra, incorrect

* final changes + hook into travis
2017-04-05 09:00:28 +01:00
Tony Murray
85413f526f fix travis phpunit version (#6145) 2017-03-08 23:22:34 -06:00
Neil Lathwood
253cbe59e2 require specific snmpsimd version (#6015)
* require specific snmpsimd version

* require specific snmpsimd version
2017-02-26 12:13:54 +00:00
Neil Lathwood
200b762478 feature: Added phpunit db setup tests (#5594) 2017-02-07 15:08:52 +00:00
Tony Murray
00771769a9 Run our .travis.yml through the lint check (#5599) 2017-01-25 20:12:29 +00:00
Neil Lathwood
6bed6cbea1 Travis bash and python testing (#4917) 2016-11-03 07:42:29 +00:00
Tony Murray
a9d3bbfaf4 Don't cache the snmpsimd cache 2016-09-23 15:07:00 -05:00
Tony Murray
c31b3c0301 feature: use snmpsim for testing
fallback feature so we don't have to run snmpsim on devel computers, should be adequate for now
./scripts/pre-commit.php -u -snmpsim will start an snmpsimd.py process automatically
2016-09-23 14:57:31 -05:00
Tony Murray
b7d0b97c64 More pre-commit.php improvements (#4224)
* more pre-commit.php improvements
do not check influx-db on hhvm
Use parallel-lint to increase lint check speed and improve output
Add option to print out the commands that would be executed, makes it easier to modify them and run by hand
Fixed a couple of bugs

* Integrate the environment check
Flip it so we don't interfere with command line users
2016-08-28 21:44:36 +01:00
Tony Murray
f042f9aa56 Use pre-commit.php in for travis-ci tests (#4212) 2016-08-26 10:30:43 +01:00
Daniel Preussker
9c3d398b63 Merge pull request #4214 from murrant/fix-constructors
Fix deprecated constructors
2016-08-26 06:58:49 +00:00
Tony Murray
e588c171e2 Don't allow php7 failures anymore 2016-08-26 00:36:46 -05:00
Neil Lathwood
9f1930a81e More more docs (#4197)
* Updated docs + some small code changes

* Added validating code doc for developers

* Doc updates

* Updates and improvements
2016-08-25 18:40:11 -05:00
Tony Murray
46adc8b60c Fix merge errors 2016-08-19 14:05:27 -05:00
Tony Murray
cfe2cf8069 Merge remote-tracking branch 'upstream/master' into psr2-html 2016-08-19 13:54:45 -05:00
Tony Murray
c75f744931 Restore phpunit tests in travis-ci 2016-08-19 13:15:51 -05:00
laf
ae7d13d299 Ready for new docs site 2016-08-19 14:37:44 +01:00
Tony Murray
8c639aa5a4 PSR2 Cleanup: /html edition
Travis tests for code conformance. Ignore warnings for now.
Fixed all errors, left most warnings.
2016-08-18 21:29:30 -05:00
Tony Murray
64399c833a Prep Travis.yml for codesniffer changes 2016-08-15 13:23:21 -05:00
laf
bcd2476f32 Updated travis + added build icons 2016-08-08 20:13:33 +01:00
laf
ec4535dae7 Added php lint checking for travis 2016-08-08 19:53:04 +01:00
laf
8cd767f22f Fixed .travis.yml 2016-03-03 20:04:09 +00:00
Tony Murray
985ea9bea6 Enable phpunit testing in Travis CI. 2016-03-03 11:56:29 -06:00