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`
* 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.
* LDAP debug
Updated LDAP and AD docs
ldap protocol default to v3 (so we don't have to set it all the time). If this fails it should revert to v2.
ad was using auth_ad_timeout incorrectly (1 I think)
* Add option to list all users.
* Adding 1st rev of manage_bills.php
* Stlye fixes
* Freshinging PR 7633. Changing -r to -f, to be less confusing. Adding code style changes as per @laf's suggesting
* Adding in option for sysname or hostname variable. Fixing hostname lookup bug
* style fixes
* -renaming add_ports to add_ports_to_bill
- changing -i to -b for clarity sake
- Will print help if -s and -h are not set
* Adding check to ensure -i is set via cli
* I'm stupid
* I'm stupid
* Fixing help messages, fixing argument checking, moving help to it's own function
* Adding create_bill functionality, update help and opts as needed
* Adding 1st rev of manage_bills.php
* Stlye fixes
* Freshinging PR 7633. Changing -r to -f, to be less confusing. Adding code style changes as per @laf's suggesting
* Adding check to ensure -i is set via cli
* I'm stupid
* Use custom phpcs ruleset for LibreNMS
PSR2 with exclusions
* Don't check line length
* Restore build_excludes()
Drop influxdb lib exclusion
* Fix whitespace
* 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.
* Use composer.phar first and self-update it.
* Ansi output for interactive shells.
If HOME isn't writable, set COMPOSER_HOME.
Simulated cron with env -i
* More verbose failures when attempting to download composer.phar.
* Change the regex again
Matches all versions here https://getcomposer.org/download/
* More secure password hashes
Use PHP 5.5 password_hash(), currently uses bcrypt
increase password field length as per php documentation
* Use password_hash()/password_verify() for cookies too
* forgot to update db_schema.yaml
* 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
* Prep for composer changes
* Update composer.json, composer.lock and a small update to phpmailer and Yaml
* Prevent accidental `composer update` runs
* Add --no-interaction to daily.sh
* Add mass update to save-test-data.
Fail when snmpsim doesn't start and try to give a hint.
* Split save-test-data.php into two scripts
One for updating snmprec files.
One for updating db dump files.
* Add Support for cambium-ptp500
Added mibs for ptp500, ptp300
* ptp500 - Switch modulation to a state
* Update label on 500 to 500/300
300 and 500 use the same mibs
* Request changes
Added overhead graph's to all current ptp devices
* wrap text in quotes
* Fix discovery bug
* Ptp600 support
* PTP800 Support
* Fix ptp600 issues
* Remove meh copy and pasta
* Remove modulation from OS file
* Update value modifiers / typos
* +x rename-mibs.php
* Modify cambium mibs
* 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.
* refactor: Updated discovery to use a core module for sysDescr/sysObjectID use
* final update hopefully
* revert changes
* more changes + docs
* migrated poller to use numerical sysObjectID
* more updates for sysObjectID
* update any alert rules which might have enterprises. in
* moved schema file
* small updates
* updated getHostOS()
* scrut fixes
* updated sysObjectId -> sysObjectID
* updated sysObjectId -> sysObjectID
* updated remainder of sysObjectId -> sysObjectID
* another sysObjectId -> sysObjectID
* fixed secureplatform test data
* Fix tests: $device is not pulled from the database before polling
Also, update the db in the core discovery module.
* 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
* OS Testing update
Option on pre-commit.php to run tests for just one OS. Reorganize tests a bit to support this.
Improved bgp-peers capture and os module capture (initial)
Better output when phpunit tests fail
* fix a couple issues. Better output for another
* Use the correct setup function
* 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
* Adding 1st rev of manage_bills.php
* Stlye fixes
* Freshinging PR 7633. Changing -r to -f, to be less confusing. Adding code style changes as per @laf's suggesting
* Adding in option for sysname or hostname variable. Fixing hostname lookup bug
* style fixes
* -renaming add_ports to add_ports_to_bill
- changing -i to -b for clarity sake
- Will print help if -s and -h are not set
* Adding check to ensure -i is set via cli
* I'm stupid
* I'm stupid
* refactor: AD Auth defer connection until it is needed
Nice error if php-ldap is missing instead of http 500.
* Add the same error when ldap is missing to other auth methods.
Not as graceful looking in the authorizers since they do not defer connection.
* Refactored authorizers to classes
* Merge changes for #7335
* ! fix php 5.3 incompatibility
* Update ADAuthorizationAuthorizer.php
* Fix get_user -> getUser
* Rename AuthorizerFactory to Auth, fix interface missing functions
* Add phpdocs to all interface methods and normalize the names a bit.
* Re-work auth_test.php AD bind tests to work properly with the new class.
Reflection is not the nicest tool, but I think it is appropriate here.
Handle exceptions more nicely in auth_test.php
* Restore AD getUseList fix
Not sure how it got removed
* fix auth_test.php style
* Script to collect port polling data and compare full walk vs selective port polling.
* Select hosts. Colors. Percent. Units (s). Enable sel poll.
* Moved the colors. Disable selective if needed. Report set status and count.
* Style fix.
* CLI help.
* Docs.
* Style fix.
* Allow comma separated device_id list.
Better color formatting for output
Fix issue when using &$device by reference
* Add purge-port scipt to allow deleting of ports from the CLI.
This script allows deleting single ports by their port_id or a list
of ports read from a file or STDIN.
LibreNMS Port purge tool
-p <port_id> Purge single port by it's port-id
-f <file> Purge a list of ports, read port-ids from <file>, one on each line.
A filename of - means reading from STDIN.
Signed-off-by: Maximilian Wilhelm <max@sdn.clinic>
* Update CLI-Tools.md
* feature: LDAP auth update: alerts, api, remember me
Defer ldap connection until it is needed (saves connections from pollers)
Add ability to use a bind account if the server does not allow anonymous bind.
If the server does allow anonymous bind, no config change is needed.
Use Config class
FYI, I have no way to test this.
TODO: update/validate docs
* prevent duplicate users in get_userlist()
* fix bug in Config get for auth_ldap_uid_attribute, `.` should have been `,`
Change case of uidNumber to match common configs (should be case insensitive anyway)
* revert uidnumber case changes and fix up user supplied ones as it is unintuitive that they need to be lowercase.
Add auth_ldap_binddn setting to allow more a more specific way to enter the bind user.
* refactor: convert validations to modules to prep for gui integration
* accidentally dropped, schema update
* fix accidental output to webui
* mention discovery-wrapper.py and re-arrange.
* refine some fix statements
* rename the Config validation group to Configuration.
* fix some scrutinizer issues
remove as many local functions from validator.php as possible
move extensions from pre-check
remove duplicate timezone check
looks like there is some db schema differences between mariadb 10.1 and 10.2, investigating
* mariadb version diff take2
* Check schema version first for database.
Remove stop to go back to command line for install docs.
Add helpful link when there is no devices added to /addhost
* fix incorrect validation for empty string defaults
* Fix style
* Add additional file permissions checks
* catch exception and fail for invalid timezone
Change visuals a bit.
* add php version warning
* fix space
* Fixed IPv6 host renaming
* Added get_rrd_dir() and modified other files to use it where appropriate.
* rrd_name() now uses the new function get_rrd_dir(), to make it simpler to modify the escaping in the future.
* Wrong function name in rrdstep.php
* Added limited support for ASA using emblem logging
* Updated documentation
* Updated ASA support to cover regular and emblem logging
* Gave the variable a more suitable name
* Removed debug output
* feature: Added script (scripts/test-template.php) to test alert templates
* moved remaining functions, fixed php 5.3 and include dir
* added docs on use for test-template script
* Where shebangs had no flags, updated them to use /usr/bin/env for cross-platform compatibility
Updated daily.sh to support FreeBSD (su has different args, replaced with sudo when not on linux)
* Added myself to AUTHORD.md as per contributor guidelines
* Set all platforms to use sudo rather than su
Re-added missing arguments to sudo
* 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
* 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
* feature: bind user for active_directory auth
Optional, allows the use of "remember me", API, and alerting.
* missing global (but still may not be working)
* always return a value from reauthenticate()
* Make sure the ldapbind credentials are correct on reauth.
Do not send output if they are incorrect (use d_echo) this breaks ajax calls, etc.
Add scripts/auth_test.php, to make it easier to debug authentication.
* Refine auth_test.php a bit more
A few small cleanups in other places of the auth
* Add auth_test.php to docs
Some more improvements in the auth_test.php output.
* Update Authentication.md
* add support for dynamic interfaces in ifAlias script
* netlink and ip support alias (`ip link set IFACE alias ALIAS`). In an
environment with dynamic interfaces, it is useful to be able retrieve
aliases from ip.
* we cannot assume next iface oid is n + 1 since oids do not necessarily
follow incrementally when some interfaces has been destroyed and
recreated.
* use straight POSIX shell
* I agree to the conditions of the Contributor Agreement contained in
doc/General/Contributing.md.
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
* 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
* 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
* 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
By default libreNMS used the ifIndex to associate ports just found via SNMP
with ports discoverd/polled before and stored in the database. On Linux boxes
this is a problem as ifIndexes are rather likely to be unstable between reboots
or (re)configuration of tunnel interfaces (think: GRE/OpenVPN/Tinc/...), bridges,
Vlan interfaces, Bonding interfaces, etc.
This patch adds a »port association mode« configuration option per device which
allows to map discovered and known ports by their ifIndex, ifName, ifDescr, or
maybe other means in the future.
The default port association mode still is ifIndex for compatibility reasons.
As port RRD files were stored by their ifIndex before, they are now identified
by their unique and stable port_id to ensure a stable and unique mapping and
allow future port association modes to be added without requireing any further
internal changes. Existing RRD files are renamend accordingly in discovery and
poller tools to ensure stability of port associations in both modules as we
don't know which might run first after an update.
Signed-off-by: Maximilian Wilhelm <max@rfc2324.org>
On Arch systems, /etc/lsb-release contains the placeholder version string
"rolling".
Prevent parsing /etc/lsb-release on Arch systems to the script won't report the
distribution "Arch rolling".
Replaced the crude parsing of /etc/SuSE-release (which is due to be removed in
future OpenSUSE versions) with equally crude parsing of /etc/os-release.
/etc/os-release is present on several different distributions and usually
contains the same information as /etc/lsb-release when both files are
available.
For now, parsing /etc/lsb-release takes precedence and /etc/os-release is only
used as a fallback when the former is not available.
This eliminates nearly all of the user-facing references to Observium,
including in the names of temporary files and in the metadata of PDFs. Many
of these may not be used any more, but I've adjusted them anyway. These
changes should also make it easier to change the branding later if it is
needed. There are a few references of which I still don't understand the
significance, so I've left them as-is for now. The Unix agent in particular
is rather untidy.