Commit Graph

247 Commits

Author SHA1 Message Date
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
d841625f12 refactor: Refactor database and config init (#8527)
* Refactor database and config init
Connect to the database without loading full config
Load config completely so post-processing is always done consistently.
Erase existing $config when loading, fixes issues in case we load the config twice.
If the database is not connected, don't try to load database settings. (Fixes some db errors on install)
Attempt to remove $config access/modification before init.php
Remove usage of db_name, that might not match the connected database.
Centralize db config loading, so we consistently apply db_test database settings.
Many of these changes are influenced by Laravel port.

* Some safety so we don't assign strings to numeric port field
Smooth out phpunit bootstrap

* Fix a couple of scrutinizer warnings.
2018-04-11 16:15:13 +01:00
Tony Murray
7250376104 refactor: Don't access $_SESSION directly for Auth (#8513)
* Don't access $_SESSION directly for Auth

* fix style

* add property annotations
2018-04-07 21:55:28 +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
Chip Gwyn
bc405194db webui: Modified styles.css to make the device group menu a bit larger (#8200)
* modified styles.css to make the device group menu a bit larger.  Was 200px, set to 800px.  Makes a huge difference in reaability.

* Changed .scrollable-menu to have a max-height of 600px

Changed .scrollable-menu to have a max-height of 600px after discussion, 600 seems a good compromise for size until something better can be found.

* force css update
2018-02-27 19:52:43 +00:00
Florian Beer
44d5a592f1 webui: Update badge background for selected pagemenu item (mono.css) (#8157)
* Update badge background for selected pagemenu item

This brings the background color in line with the user notification number badge background in the upper right corner.
The previous background was too bright for mono.css to properly read the white menu item text.

* CSS cache busting

Change last two digits to 42, because reasons.
2018-01-29 21:58:45 +00:00
Aldemir Akpinar
56561aa4dc feature: Added support for Host dependencies (#7332)
* First draft of the modals and the config interfaces

* GUI part done

* Backend code and db schema addition

* Documentation added, fixed alerting bug

* Fix typos

* Do not try to push an older db_schame.yaml

* Small db fix

* More db fixes

* Travis CI fixes

* missed a line in the travis error

* Fixed dependency clearing bug, Manage Host dependencies button now shows current selections

* Removed unnecessary index

* Correct faulty query

* Fixed sql query as requested, and renamed sql file

* Added requested changes

* Removed debug code

* Renamed sql file

* More fixes as requested

* Trying to fix db_schema.yaml

* adding laf's diff

* Corrected a small bug

* Try to resolve scrutinizer issue

* Main page bootgrid ajax modifications

* Also corrected travis ci errors

* Added select2 for pull downs, removed a redundant debug output. Changed parent_id to text

* Add missing class in the device settings page

* Fix bug where a link wasn't added after save

* Better parent down detection

* Add missing comma

* Behold the multi-parent code

* Added lookup table

* Ready for testing

* Trying to fix documentation conflicts

* Fix copy paste errors, and possible sql injection

* indentation problems

* Modified db_schema.yaml as well

* Typos, typos

* This should correct alerts

* Try to fix travis ci error

* Fix the typo in index.php

* Changed to Tony's query

* function explanation text changed

* Updated db_schema.yaml

* Trying to make automated tests happy

* Changes as requested

* Added acknowledgment for select2

* Added laf's patch

* dbBulkInsert when adding parents
2017-12-20 14:17:52 +00:00
Tony Murray
c22c879983 fix: Remove faulty memcached code (not related to distributed polling) (#7881) 2017-12-10 20:40:45 +00:00
Tony Murray
de8bcf3a6c fix: update notification for users with updates disabled (#7253)
Don't show the toast when the notification is marked as read
2017-08-29 09:32:24 -05: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
Tony Murray
b2c8f34039 refactor: Use anonymous functions for debug error_handler and shutdown_function in index.php (#7219) 2017-08-26 20:07:34 +01:00
Tony Murray
f43ad4629c remove eval() (#6648) 2017-05-17 22:38:00 +01:00
Tony Murray
683a10e723 fix: Improve authentication load time and security (#6615)
* fix: minimize session open time
page/graphs speedup part 2

Write close the session as soon as we no longer need to write to it. Prevents the session from blocking other requests.
Do not run through full authentication functions if the session is already authenticated.
Removes password from the session as well as some items to prevent session fixation from #4608.

WARNING: This will cause issues for ad/ldap users who do not have a bind user configured!

* Do no erase username when using cookie auth.
Properly close the session in ajax_setresolution.php

* write close the session as soon as possible in ajax_setresolution.php

* Remove session regeneration. It is not compatible with the current code and would require more changes.

* Totally refactor authentication.  Extract code to functions for re-use and improved readability

* Use exceptions for authentication and error logging
Tested: mysql, ad_auth with and without bind user

* fix a couple scrutinizer issues

* fix reauthenticate in radius
2017-05-15 22:18:23 -05:00
Neil Lathwood
41e7689c77 refactor: DB Updates will now file level lock to stop duplicate updates (#6469)
* refactor: DB Updates will now file level lock to stop duplicate updates

* scrut fixes

* renamed function from clear_lock() to release_lock()
2017-05-03 14:48:23 +01:00
Simon Mott
18784fdb89 webui: Updated rrdtool command output to use <pre>(#6345)
* fix whitespace display on RRDTool Command

* use a class instead
2017-04-05 07:54:55 +01:00
Tony Murray
4a705ea7e3 Fix vertical alingment of the main navbar. (#6256) 2017-03-23 16:22:50 +00:00
Tony Murray
20ae9e2ecd webui: Improve device header layout (#5990)
* webui: Improve device header layout

* Update css style version to break caches
Remove unused css.
2017-02-24 09:59:30 +00:00
Paul Heinrichs
097a827759 webui: display QR codes for API access (#5988)
* Generate qr code for api hash

Added qrcodejs ( https://github.com/davidshimjs/qrcodejs )

* Add head to modal window

* updated to use fontawesome
2017-02-23 22:19:22 -06:00
Richard Mayhew
5bfd23e7eb webui: New eventlog severity classification (#5830)
* New event log severity model

* Revert "New event log severity model"

This reverts commit 0783527af8.

* New event log severity model

* Fixed spaces vs tabs

* Learning the format requirements

* Learning the format requirements

* Moved the colours in to the stylesheet

* change SQL file to stop conflicting

* refactor log_event so severity isn't last, but reference is.

* keep having to move the file due to new PR conflicts

* Revert "keep having to move the file due to new PR conflicts"

This reverts commit f3030e7218.

* extended support to dashboard and eventlog page

* formatting
2017-02-12 22:41:05 +00:00
Neil Lathwood
5ae4f73ea8 webui: Added ?ver=X to LibreNMS style sheets so we can force refreshes in future (#5651) 2017-01-28 21:59:42 +00:00
Tony Murray
afe887d85e webui: New LibreNMS logo assets (#5629) 2017-01-27 18:02:49 +00:00
Richard Mayhew
47397d0083 webui: Updated icons to use Font Awesome (#5468) 2017-01-21 11:24:05 +00:00
Søren Rosiak
cdef7885aa webui: Small Best Practice Fixes 2017-01-02 00:03:23 +00:00
Tony Murray
db240cb4eb refactor: Collection and output of db and snmp stats (#5049) 2016-11-23 06:57:19 +00:00
Tony Murray
9a33464c52 refactor: Centralize includes and initialization (#4991) 2016-11-21 20:12:59 +00:00
Neil Lathwood
b5be6e9271 feature: Added custom css and include directories which are ignored by git (#4871) 2016-10-28 05:55:40 +00:00
Tony Murray
e0cc8dfb48 Disable refreshing on window resize when $no_refresh is set. 2016-09-20 10:16:22 -05:00
Tony Murray
0351b54fb8 webui: make d_echo work in webui (#4432)
* webui: make d_echo work in webui
Remove d_print_r(), it is redundant to d_echo()
Remove d_echo calls in services.inc.php

* Switched debug check to work with nginx
2016-09-14 10:05:49 +01:00
Neil Lathwood
7dec670494 refactor: Updated a lot of references to LibreNMS - copyright still left intact (#4339) 2016-09-08 08:12:23 -05:00
Tony Murray
b8e9b2d917 Implement an autoloader (#4140)
* Implement an autoloader

When cleaning up classes for psr2, things got a bit unwieldy, so I implemented a class autoloader.
I created a PSR-0 compliant LibreNMS directory and moved all classes there that made sense.
Implemented LibreNMS\ClassLoader which supports adding manual class mappings

This reduces the file includes needed and only loads classes when needed.

* Add teh autoloader to graph.php

* Add a small bit of docs
Fix incomplete class in includes/discovery/functions.inc.php
2016-08-21 14:07:14 +01:00
laf
5f8705bd37 Changed package names 2016-08-20 12:21:13 +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
f5f31e88ac Use namespaces for classes, take 2
CollectdColor, move into it's own file, change functions to camelCase
Plugins use LibreNMS\Plugins
2016-08-17 20:26:51 -05:00
Neil Lathwood
809969efc9 Revert "Use namespaces for classes" 2016-08-17 21:27:56 +01:00
Tony Murray
709de9a166 Use namespaces for classes
CollectdColor, move into it's own file, change functions to camelCase
Plugins use LibreNMS\Plugins
2016-08-15 14:04:39 -05:00
laf
06998420cf Updated unpolled notification to only show unpolled devices 2016-06-21 20:12:32 +01:00
Tony Murray
c7d551f6d1 Check that variables are set before using them.
This will hide ugly output for users not using a subdirectory, but may make it harder to diagnose issues for those that are.
2016-05-31 22:28:34 -05:00
Daniel Preussker
731e43bc66 Revert "[WIP] Sanity!" 2016-02-17 13:59:58 +00:00
f0o
21e94b3e3a
Sanity! 2016-02-10 15:21:31 +00:00
Daniel Preussker
2b55c06d9e Revert "Variable/Environment sanity" 2016-02-10 14:31:16 +00:00
f0o
37dccb3932
First effort in bringing some sanity 2016-02-10 13:42:55 +00:00
Mike Rostermund
e2d1a8e7d9 Replaced custom utime() function with microtime(true) 2016-01-08 13:33:32 +01:00
laf
a56ccd7a74 Added option to disable lazy loading of images 2015-12-09 15:50:10 +00:00
Tony Murray
e8d5756467 Fix missing path info on nginx.
Update nginx documentation to set the PATH_INFO variable.
Avoid hacks in index.php if it PATH_INFO is already set for both nginx and apache.
2015-12-03 13:23:37 -06:00
Louis Bailleul
b1fd1b3137 Only update resolution if session variables don't exist
Tune print-graphrow.inc.php to avoid last graph going to a new line in certain cases
2015-11-26 17:13:29 +00:00
laf
e9deae1315 Centralised the date selector for graphs for re-use 2015-10-20 21:35:08 +00:00
Daniel Preussker
335a68bb98 Update index.php
Hotfix for #2007
2015-10-02 00:49:18 +00:00
Neil Lathwood
e2dfab4ca0 Merge pull request #2007 from QuxLabs/qux-issue-8
Added working memcached support
2015-10-01 17:08:03 +01:00
Daniel Preussker
afdbb2406d
Added $nocache parameter
Fixed typo in caching
Excluded caching for MySQL-Authentication & /poll-log/
2015-09-30 15:20:06 +00:00
Alan Gregory
a86988605d Added Full screen Mobile support 2015-09-29 09:50:34 -03:00