Commit Graph

59 Commits

Author SHA1 Message Date
Tony Murray
49f8269262
Improved Latency graph (#15940)
* Improved Latency graph
Store loss+jitter info in rrd instead of database
New graph icmp_perf (legacy ping_perf still valid referencing part of the newer data)
Delete device_perf table

* Change loss to an area so it is more visible

* Style fixes

* Cleanups from phpstan & tests

* exit_code fix

* Remove alert usage of device_perf

* Don't use magic __get

* Add test for bulkPing
Add host to previous tests

* style fixes

* Fix issue fping error responses
2024-04-18 09:57:01 -05:00
Jellyfrog
071ca9bc2a
Apply fixes from StyleCI (#15698)
Co-authored-by: StyleCI Bot <bot@styleci.io>
2024-01-04 22:39:12 -06:00
Pelt10
6d4e1f8d93
Return an 5XX error when an exception is raise (#15285) 2023-09-06 13:41:13 -05:00
Jellyfrog
b14e2d4609
Apply fixes from StyleCI (#15101)
Co-authored-by: StyleCI Bot <bot@styleci.io>
2023-06-13 13:35:00 +02: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
Tony Murray
04bb75f5f3
Alert transport cleanup, no_proxy support and other proxy cleanups (#14763)
* Add no_proxy and other proxy related settings
Set user agent on all http client requests
Unify http client usage

* Style fixes

* Remove useless use statements

* Correct variable, good job phpstan

* Add tests
fix https_proxy bug
add tcp:// to the config settings format

* style and lint fixes

* Remove guzzle from the direct dependencies

* Use built in Laravel testing functionality

* update baseline
2023-05-23 09:25:17 -05:00
Tony Murray
52f5f10231
Fix some lint issues (#14962) 2023-04-15 09:02:41 -05:00
Jellyfrog
f111ac22fe
APC: Add support for Battery Recommended Days Remaining (#14653)
* APC: Add support for Battery Recommended Days Remaining

* Extract number from string later during polling
Odd that this is different from the discovery process

* wip

* wip

* Apply fixes from StyleCI

* wip

* wip

* Apply fixes from StyleCI

---------

Co-authored-by: Tony Murray <murraytony@gmail.com>
2023-03-10 14:50:56 +01:00
Tony Murray
752bbc1531
Port search API search more than one fields (#14646)
* Fix port search columns

* Port search API search more than one fields
Fixup port APIs
Change validate_column_list api helper to throw a renderable exception on error and return the valid columns
DeviceCache::get() can handle a bigger range of input

* whitespace

* Refactor exceptions a bit

* change throws type to be more generic

* Lint fixes
2022-11-18 16:27:56 -06:00
Zane C. Bowers-Hadley
a166df006a
base64 gzip compression support for json_app_get (#14169)
* add lnms_return_optimizer

* add compression test using zfs-v1

* minor style fix

* save the original output if not json

* replace gzinflate with gzdecode as apparently that does not require yanking the header

* Minor comment cleanup. Also note it in the application notes as well.

* update docs on how it is called

* update the spelling of it in a few places

* and a few more

* dev docs updated a bit

* the suricata extend has native support for this now

* add exception handling for base64 and gzip decoding failure

* minor cleanup for new exceptions

* minor misc changes

* minor formatting fix

* more phpdoc tweaks

* minor formatting tweak

* remember to actually include the new exceptions

* more phpdoc tweaking

* correct name in JsonAppGzipDecodeException

* add debug and verbose output

* style fix

* not base64 is it starts with a line with only a integer
2022-10-21 10:05:49 -05:00
Tony Murray
fbcaccdbd4
Update dependencies (#14319)
* Update dependencies
 hpdocumentor/reflection-docblock (5.3.0)
 hpspec/prophecy (v1.15.0)
 ymfony/debug (v4.4.41)
 barryvdh/laravel-debugbar (v3.6.7 => v3.7.0)
 composer/ca-bundle (1.3.2 => 1.3.3)
 composer/class-map-generator (1.0.0)
 composer/composer (2.3.7 => 2.4.1)
 doctrine/annotations (1.13.2 => 1.13.3)
 doctrine/event-manager (1.1.1 => 1.1.2)
 doctrine/inflector (2.0.4 => 2.0.5)
 fakerphp/faker (v1.19.0 => v1.20.0)
 graham-campbell/result-type (v1.0.4 => v1.1.0)
 guzzlehttp/guzzle (7.4.5 => 7.5.0)
 guzzlehttp/promises (1.5.1 => 1.5.2)
 guzzlehttp/psr7 (2.4.0 => 2.4.1)
 laravel/dusk (v6.24.0 => v6.25.1)
 laravel/framework (v8.83.16 => v8.83.23)
 laravel/serializable-closure (v1.2.0 => v1.2.1)
 laravel/socialite (v5.5.2 => v5.5.5)
 maximebf/debugbar (v1.18.0 => v1.18.1)
 mews/purifier (3.3.7 => 3.3.8)
 mockery/mockery (1.5.0 => 1.5.1)
 monolog/monolog (2.7.0 => 2.8.0)
 nesbot/carbon (2.58.0 => 2.62.1)
 nikic/php-parser (v4.14.0 => v4.15.1)
 paragonie/constant_time_encoding (v2.6.1 => v2.6.3)
 phpmailer/phpmailer (v6.6.0 => v6.6.4)
 phpoption/phpoption (1.8.1 => 1.9.0)
 phpseclib/phpseclib (3.0.14 => 3.0.16)
 phpstan/phpstan (1.7.12 => 1.8.5)
 phpunit/php-code-coverage (9.2.15 => 9.2.17)
 phpunit/phpunit (9.5.20 => 9.5.24)
 psy/psysh (v0.11.5 => v0.11.8)
 sebastian/type (3.0.0 => 3.1.0)
 seld/phar-utils (1.2.0 => 1.2.1)
 seld/signal-handler (2.0.1)
 symfony/console (v5.4.9 => v5.4.12)
 symfony/css-selector (v5.4.3 => v5.4.11)
 symfony/deprecation-contracts (v2.5.1 => v2.5.2)
 symfony/error-handler (v5.4.9 => v5.4.11)
 symfony/event-dispatcher-contracts (v2.5.1 => v2.5.2)
 symfony/filesystem (v5.4.9 => v5.4.12)
 symfony/finder (v5.4.8 => v5.4.11)
 symfony/http-foundation (v5.4.9 => v5.4.12)
 symfony/http-kernel (v5.4.9 => v5.4.12)
 symfony/mime (v5.4.9 => v5.4.12)
 symfony/options-resolver (v5.4.3 => v5.4.11)
 symfony/process (v5.4.8 => v5.4.11)
 symfony/routing (v5.4.8 => v5.4.11)
 symfony/service-contracts (v2.5.1 => v2.5.2)
 symfony/string (v5.4.9 => v5.4.12)
 symfony/translation (v5.4.9 => v5.4.12)
 symfony/translation-contracts (v2.5.1 => v2.5.2)
 symfony/var-dumper (v5.4.9 => v5.4.11)
 symfony/yaml (v4.4.37 => v4.4.45)
 tecnickcom/tcpdf (6.4.4 => 6.5.0)

* changes

* try again

* Fix some issues because the message is changing between versions, just avoids it.
2022-09-09 09:55:59 -05:00
Tony Murray
302a989d4e
Email Transport: embed graphs by default (#14270)
* Email embed graphs

* Allow attachment for non-html
Add setting to webui
Correct $auth setting

* Cleanups, throw RrdGraphException instead of returning an error image.
Generate the error image later, giving more control.
Reduce code duplication a little

* Style and lint fixes
Change to flags

* Add baseline for lint errors I don't know how to resolve

* oopsie, changed the code after generating the baseline

* Tiny cleanups.  Make set DeviceCache primary, it is free.

* Docs.

* email_html note

* Allow control of graph embed at the email transport level to override the global config.

* Allow control of graph embed at the email transport level to override the global config.

* Add INLINE_BASE64 to make it easier to create inline image tags
2022-09-05 20:41:55 -05:00
Tony Murray
ec8629fb63
Discord ability to attach graph images (#14276)
* Discord ability to attach graph images
Must use @signedGraphTag()
Needs more work on the graph side of things still: issues with CORs and other.

* Fixes

* alert data is an array for transports

* No need to decode, that was a bug before
2022-09-05 16:20:10 -05:00
Tony Murray
75ba74fe5b
Migrate addhost.php to lnms device:add (#13870)
* Migrate addhost.php to lnms device:add
Have snmp-scan.py call lnms device:add (make exit codes line up so this works)
Fix issue with ping only devices trying to detect os via snmp
Reorder options in device:add help and improve formatting
Update docs to remove references to addhost.php
Fix a bit of code that was in functional code

* fixes

* fix snmp version message
2022-04-04 10:41:18 -05:00
Tony Murray
1bfd411995
New device:add code (#13842)
* New device:add code
pre-requisite for updating other code paths
includes option to set display name
separate validation code from device creation

* remove duplicate community and v3 creds

* style fixes

* some lint fixes

* fix phpstan

* Exception cleanup
improved messages and translations

* port association mode to enum
well, pseudo enum

* defaults and cleanups

* fixed/improved validation messages

* fix tests

* fix stupid ide refactor mistake

* lint fixes
2022-03-12 16:14:32 -06:00
Tony Murray
19e0ad604a
PHP8 phpstan fix (#13843) 2022-03-11 10:38:31 -06:00
Jellyfrog
29bdfe40a3
Use phpstan-deprecation-rules instead (#13582)
* Replace deprecated functions

* Use phpstan-deprecation-rules instead
2021-11-30 09:33:14 +01: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
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
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
07415ced77
Fix DB Inconsistent friendly error message (#13163)
Exception was causing an exception due to a type error, fix that so the nice message works.
2021-08-23 19:06:56 -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
bb39b4ad83
Rrd graph optimizations (#12806)
* RRD Graph optimization
Do not use temporary files to generate graphs
Don't start up a process to pipe commands to, just run the command
Error image improvements

* fix style issues

* run the rrdgraph command in the rrd directory
2021-05-03 09:48:15 -05:00
Tony Murray
7de808a4e8
Revert "RRD Graph optimization (#12735)" (#12805)
This reverts commit 2833d935e0.
2021-04-28 09:07:31 -05:00
Tony Murray
2833d935e0
RRD Graph optimization (#12735)
* RRD Graph optimization
Do not use temporary files to generate graphs
Don't start up a process to pipe commands to, just run the command
Error image improvements

* fix style issues
2021-04-28 05:28:07 -05:00
Jellyfrog
a0a3a1c8d8
PHPDoc fixes (#12693) 2021-04-01 00:35:19 +02:00
Jellyfrog
efb157f5fb
Fix more PHPDoc (#12665)
* Fix PHPDoc

* Fix PHPDoc
2021-03-28 12:18:47 -05:00
Jellyfrog
20b4215204
Swich links to https (#12511)
* Switch librenms links to https

* Convert librenms links in comments

* Switch gnu.org url to https

* switch php urls to https
2021-02-09 00:29:04 +01:00
Tony Murray
f2f169ae78
Modernize mempools (#12282)
* mempools to modern module
quick hacky hrstorage port

* port ucd-snmp-mib to Mempools

* Populate DB for ucd
Prep for yaml

* initial yaml attempt

* more complex conversions
fixes to YamlDiscovery, make leading $ optional and allow mib::oid format

* walk full tables and skip values
normalize percentages above 100

* handle precent only ones (specify total as 100)

* Move default polling out of YamlMempoolsDiscovery

* fixes

* Update test data hrstorage should be correct.

* perc_warn for hrstorage

* Host Resources, record buffer, cached, and shared

* Host Resources is always better, don't do both HR and UCD

* fix unix, include warning levels

* variable size

* consolidate skip_values

* define mempools schema

* number instead of integer

* more schema refactor

* one more skip_values reference

* throw error for invalid oid translation
aos6

* a*  and Cisco

* updated test data

* update almost all hrstorage data files

* b*

* c* with test data
use standard cache for hrStorage

* use cache for storage module too

* hand bsnmp properly

* bdcom

* exclude total oid from yaml so it is not polled
May add a way to ignore this behavior and poll it, but I don't know if that is needed.

* automatically handle percent only values

* ciscowlc

* only poll used or free if we have used, free, and total.

* fix skipping

* the dlinkoning
fix find value when value "name" is numeric

* support numeric oids

* dnos/ftos attempt

* I guess we can't filter on total > 0

* edgecos

* e*

* f WIP

* f*

* gwd (aka g*)

* h* + procurve

* i*

* j*

* m*

* support 0% used memory (however unlikely)

* n*

* CISCO-PROCESS-MIB memory, share cache with processors module

* ignore mempools with invalid total

* p*

* quanta

* r*
fix raisecom mibs terribly broken

* s-z

* style fixes

* Move VRP back to PHP and make it actually work

* fix zynos

* update schema

* Update Cisco processor data for description bug fixes

* fix comware processors

* comware mempools with memory size
default precision to 1

* sophos-xg updated data

* hrstorage use ram size for buffers, cache, and shared

* Show memory available instead of free in device overview

* UCD, use same rrd format, store available instead of free in the db.

* Calculate availability for HOST-RESOURCES-MIB

* Convert UCD to standard polling

* rename old rrd files

* initial graph work

* graph WIP

* Graph looking decent

* Graph looking decent for hr

* remove old ucd_graph code

* handle availability mempool
more graph cleanup

* color adjustments

* remove accidental free calculation

* Update test data and fix corner cases

* fis pfsense

* update schema

* add default value for mempool_class

* fix whitespace

* update schema

* update schema correctly

* one more time

* fortigate_1500d-sensors missing oids

* Update docs.

* fix indent

* add implements MempoolsDiscovery explicitly to OS

* remove ucd_memory graph references
remove unused device_memory graph

* remove unused functions

* set devices with mempools to rediscover to prevent/minimize gaps

* use a subquery

* add overview graph

* port health mempools table

* Update device mempool

* only show overview if multiple

* Don't override user set warn percentages in discovery

* fix missed usage

* fix style

* Safety check to not rename rrd files incorrectly if migration has not been run.

* Fix overview percent bar and represent available and used on the bar

* missed an item to convert to mempool_class

* percent on the wrong side
2020-11-23 15:35:35 -06:00
Jellyfrog
b022a30a5b
Apply fixes from StyleCI (#12343) 2020-11-23 19:56:23 +01:00
Tony Murray
7ed34c889e
Distributed Poller improved validation (#12269) 2020-11-23 00:33:56 -06:00
Jellyfrog
29f45ca352
Apply fixes from StyleCI (#12124) 2020-09-21 15:59:34 +02:00
Jellyfrog
0d56bbd946
Apply fixes from StyleCI (#12123) 2020-09-21 15:51:53 +02:00
Jellyfrog
77c531527c
Apply fixes from StyleCI (#12117)
* Apply fixes from StyleCI

* Disable style check
2020-09-21 14:54:51 +02:00
Tony Murray
5fff03cff1 restore render 2020-06-27 07:47:08 -05:00
Tony Murray
d1ceb14b9a create .env if non-existing 2020-06-27 07:47:08 -05:00
Tony Murray
b1f526be48 finish conversion 2020-06-27 07:47:08 -05:00
Tony Murray
8b37eaf752
Maximum Execution Time Exceeded show error (#11720)
* Maximum Execution Time Exceeded show error
Migrate translations to php translation files.
Fix invalid view class in Handler

* Update MaximumExecutionTimeExceeded.php

* Update MaximumExecutionTimeExceeded.php
2020-05-28 14:39:19 -05:00
Tony Murray
a82cded552
Handle exception about unserializable route cache (#11625)
* Handle exception about unserializable route cache

* description

* Fix whitespace
2020-05-16 22:22:00 -05:00
Tony Murray
1c08c11a77
Remove Laravel helpers (#11428)
* Remove Laravel helpers

* Replace qualifier with import
2020-04-18 00:37:56 +02:00
Tony Murray
217969e140
Update php-codesniffer (#11368)
* PHPCS 3.5+

* Fix newly detected style issues
2020-04-03 08:41:24 -05:00
Tony Murray
b5714820de
Improved Exception handling (#9844)
* Update LibreNMS exception output
Use built-in laravel exception rendering.
DuskUnsafeExcpetion is triggered before Blade(view) is booted, so, try to boot it

* Cleaner blade registration

* Change 500 error page to generic LibreNMS error page.

* Handle generic exceptions from laravel better.

* Custome LdapMissingException

* Cleanup, don't need to override convertExceptionToResponse anymore

* Update unauthenticated code to current upstream style

* UpgradableException interface

* LdapMissingException extend AuthenticationException

* Code climate cleanups

* Fix code style
2019-02-21 12:08:35 -06:00
Tony Murray
ce6fae8dd1
Rewrite netcmd and ripe whois tools (#9724)
* Port RIPE whois to Laravel

* remove netcmd.php and port to laravel.
Escape CLI and set it to stream output live.

* fix browser buffer bust on a few browsers.
2019-01-25 15:30:58 -06:00
Tony Murray
607a567090
Don't check file permissions on every request, handle failures (#9264)
* Don't check file permissions on every request, handle failures
Improve error page visually

* only print minimal mkdir

* invert file_exists check, whoops

* docblock

* revert accidental changes

* rename variable

* Change database errors to use the new layout

* Add support url to the default layout

* Replaced \n for && in fix for user perms

* fix web output
2018-10-18 21:08:46 -05:00
VVelox
c3007b483a add json_app_get and convert fail2ban over to JSON (#8571)
* add json_app_get function

* add numeric testing and version support

* now use json_app_get

* remove some unneeded code

* update the docs for json_app_get some more

* make the format checker happy

* add in min version support and now take extend name instead of the partial OID

* hmm... don't make min version optional

* add Exception usage for this all make min version actually work

* minor formatting cleanup

* minor style cleanup

* update json_app_get with $throw_me setting

* Use exceptions to fully handle errors.
Always update the application.  Include error message for use in UI.
Move data to data key for easier parsing.
Add test data

* make a few changes to the lovely changes from @murrant

* style cleanup

* now attempt parsing it the old way if a error of -5 is returned

* add new exceptions and rework them all

* add new exceptions and min version 0 no longer bypasses the key checks

* redo the error codes a bit and improve the comment about it all

* fix a a bit of formatting

* added JsonAppException and make the other JsonApp stuff a sub of it

* note JsonAppException

* fix class creation

* JsonAppBlank now extends JsonApp

* doh! add <?php

* update the poller to properly use the new exceptions

* no longer check for error twice and make sure the data key is present

* cleanup processing of legacy scripts

* tweak this a bit

* white space fix

* fix the tests for fail2ban
2018-05-25 21:16:16 -05:00
Tony Murray
43b54fcf39 refactor: Handle database exceptions properly (#8720)
Display the errors to the user
Hide the query, unless APP_DEBUG=true in .env
Much easier to display output for other exceptions now, just need to add a render() function to them
2018-05-15 21:07:29 +01:00
Tony Murray
b2ce9b173b
save-test-data.php: Print a message when we encounter a bad module name (#8274)
* Print a message when we encounter a bad module name (likely a typo)

* Raise exception for invalid module name and handle it.
2018-02-25 20:03:18 -06:00