Commit Graph

30 Commits

Author SHA1 Message Date
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
09929bd686 Implement OAuth and SAML2 support (#13764)
* Implement OAuth and SAML2 support via Socialite

* Add socialite docs

* fixes

* Additional information added

* wip

* 22.3.0 targeted version

* Allow mysql auth as long as there is a password saved

Co-authored-by: laf <gh+n@laf.io>
Co-authored-by: Tony Murray <murraytony@gmail.com>
2022-02-20 22:05:51 +01:00
Jellyfrog
fdebee86b4 Implement system for user packages in composer (#13718) 2022-02-02 17:33:23 +01:00
Tony Murray
b6a8b602b8 Oxidized update and Device remove (#13730)
* Oxidized + Device remove
Was just working on oxidized, but then to properly update nodes after delete, updated delete_device()

* revert dumb style changes

* baseline update and no DI there...

* Fix OS first load and device deletion missing tables
2022-01-29 21:09:05 -06:00
Josh Jameson
0b85bceb34 Fix Temperature Sensor for AirOS 8.7.4+ (#13655)
* Fix Temperature Sensor for AirOS 8

* Update airos_airos8.json

* Update airos.json

* Add new skip_values feature to deal with Ubiquiti nonsense.
Tweak test data to test the change
fix not_regex

Co-authored-by: Tony Murray <murraytony@gmail.com>
2022-01-26 16:02:57 -06:00
Neil Lathwood
113cd1d98e Check for empty SLA tags so we skip bad entries (#13679)
* Check for empty SLA tags so we skip bad entries

* getSlaTag always return string

* accidentally left line

* Update phpstan-baseline.neon

Co-authored-by: Tony Murray <murraytony@gmail.com>
2022-01-26 08:32:29 -06:00
Jellyfrog
1debe5e166 Use built in method to render a string with Blade (#13688) 2022-01-26 07:10:06 -06:00
Jellyfrog
475a82bab6 Update dependencies (#13684)
* Update dependencies

  - Upgrading asm89/stack-cors (v2.0.3 => v2.1.1)
  - Upgrading barryvdh/laravel-debugbar (v3.6.3 => v3.6.5)
  - Upgrading barryvdh/laravel-ide-helper (v2.10.0 => v2.11.0)
  - Upgrading composer/ca-bundle (1.2.11 => 1.3.1)
  - Upgrading composer/composer (2.1.9 => 2.2.4)
  - Locking composer/pcre (1.0.0)
  - Upgrading composer/semver (3.2.5 => 3.2.7)
  - Upgrading composer/spdx-licenses (1.5.5 => 1.5.6)
  - Upgrading composer/xdebug-handler (2.0.2 => 2.0.4)
  - Upgrading doctrine/dbal (2.13.4 => 2.13.7)
  - Upgrading doctrine/inflector (2.0.3 => 2.0.4)
  - Upgrading doctrine/lexer (1.2.1 => 1.2.2)
  - Upgrading dragonmantank/cron-expression (v3.1.0 => v3.3.1)
  - Upgrading facade/ignition (2.15.0 => 2.17.4)
  - Upgrading fakerphp/faker (v1.16.0 => v1.17.0)
  - Upgrading fgrosse/phpasn1 (v2.3.0 => v2.4.0)
  - Upgrading filp/whoops (2.14.4 => 2.14.5)
  - Upgrading friendsofphp/php-cs-fixer (v2.19.2 => v2.19.3)
  - Upgrading fruitcake/laravel-cors (v2.0.4 => v2.0.5)
  - Upgrading graham-campbell/result-type (v1.0.3 => v1.0.4)
  - Upgrading guzzlehttp/guzzle (7.4.0 => 7.4.1)
  - Upgrading guzzlehttp/promises (1.5.0 => 1.5.1)
  - Upgrading laravel/dusk (v6.19.2 => v6.21.0)
  - Upgrading laravel/framework (v8.65.0 => v8.80.0)
  - Upgrading laravel/serializable-closure (v1.0.3 => v1.0.5)
  - Upgrading laravel/tinker (v2.6.2 => v2.7.0)
  - Upgrading laravel/ui (v3.3.0 => v3.4.1)
  - Upgrading league/commonmark (1.6.6 => 1.6.7)
  - Upgrading league/flysystem (1.1.5 => 1.1.9)
  - Upgrading league/mime-type-detection (1.8.0 => 1.9.0)
  - Upgrading maximebf/debugbar (v1.17.2 => v1.17.3)
  - Upgrading minishlink/web-push (v6.0.5 => v6.0.7)
  - Upgrading nesbot/carbon (2.53.1 => 2.55.2)
  - Upgrading nikic/php-parser (v4.13.0 => v4.13.2)
  - Upgrading nunomaduro/collision (v5.10.0 => v5.11.0)
  - Upgrading nunomaduro/larastan (1.0.0 => 1.0.2)
  - Upgrading nunomaduro/laravel-console-summary (v1.7.1 => v1.8.0)
  - Upgrading paragonie/constant_time_encoding (v2.4.0 => v2.5.0)
  - Upgrading php-amqplib/php-amqplib (v3.0.0 => v3.1.2)
  - Upgrading php-flasher/flasher (v0.9.4 => v0.9.6)
  - Upgrading php-flasher/flasher-laravel (v0.9.4 => v0.9.6)
  - Upgrading phpdocumentor/type-resolver (1.5.1 => 1.6.0)
  - Upgrading phpmailer/phpmailer (v6.5.1 => v6.5.3)
  - Upgrading phpoption/phpoption (1.8.0 => 1.8.1)
  - Upgrading phpseclib/phpseclib (3.0.10 => 3.0.12)
  - Upgrading phpspec/prophecy (1.14.0 => v1.15.0)
  - Upgrading phpstan/phpstan (1.0.1 => 1.4.2)
  - Upgrading phpunit/php-code-coverage (9.2.7 => 9.2.10)
  - Upgrading phpunit/php-file-iterator (3.0.5 => 3.0.6)
  - Upgrading phpunit/phpunit (9.5.10 => 9.5.11)
  - Upgrading predis/predis (v1.1.9 => v1.1.10)
  - Upgrading psy/psysh (v0.10.9 => v0.11.1)
  - Upgrading sebastian/exporter (4.0.3 => 4.0.4)
  - Upgrading seld/phar-utils (1.1.2 => 1.2.0)
  - Upgrading symfony/console (v5.3.7 => v5.4.2)
  - Upgrading symfony/css-selector (v5.3.4 => v5.4.2)
  - Upgrading symfony/debug (v4.4.31 => v4.4.36)
  - Upgrading symfony/error-handler (v5.4.0 => v5.4.2)
  - Upgrading symfony/filesystem (v5.3.4 => v5.4.0)
  - Upgrading symfony/finder (v5.3.7 => v5.4.2)
  - Upgrading symfony/http-foundation (v5.4.0 => v5.4.2)
  - Upgrading symfony/http-kernel (v5.4.0 => v5.4.2)
  - Upgrading symfony/mime (v5.4.0 => v5.4.2)
  - Upgrading symfony/options-resolver (v5.3.7 => v5.4.0)
  - Upgrading symfony/polyfill-ctype (v1.23.0 => v1.24.0)
  - Upgrading symfony/polyfill-iconv (v1.23.0 => v1.24.0)
  - Upgrading symfony/polyfill-intl-grapheme (v1.23.1 => v1.24.0)
  - Upgrading symfony/polyfill-intl-idn (v1.23.0 => v1.24.0)
  - Upgrading symfony/polyfill-intl-normalizer (v1.23.0 => v1.24.0)
  - Upgrading symfony/polyfill-mbstring (v1.23.1 => v1.24.0)
  - Upgrading symfony/polyfill-php72 (v1.23.0 => v1.24.0)
  - Upgrading symfony/polyfill-php73 (v1.23.0 => v1.24.0)
  - Upgrading symfony/polyfill-php80 (v1.23.1 => v1.24.0)
  - Upgrading symfony/polyfill-php81 (v1.23.0 => v1.24.0)
  - Upgrading symfony/process (v5.3.7 => v5.4.2)
  - Upgrading symfony/routing (v5.3.7 => v5.4.0)
  - Upgrading symfony/stopwatch (v5.3.4 => v5.4.0)
  - Upgrading symfony/string (v5.3.7 => v5.4.2)
  - Upgrading symfony/translation (v5.3.9 => v5.4.2)
  - Upgrading symfony/var-dumper (v5.4.0 => v5.4.2)
  - Upgrading symfony/yaml (v4.4.29 => v4.4.36)
  - Upgrading tecnickcom/tcpdf (6.4.2 => 6.4.4)
  - Upgrading tijsverkoyen/css-to-inline-styles (2.2.3 => 2.2.4)
  - Upgrading vlucas/phpdotenv (v5.3.1 => v5.4.1)

* Update debugbar facade path

* Update baseline
2022-01-23 19:43:48 +01:00
Tony Murray
3c0831c821 Use display name in alerts (#13650)
* Use display name in alerts

* remove error from baseline
2022-01-04 23:40:42 +00:00
Tony Murray
d5656d826e Tests dont include empty tables (#13619)
* Do not include empty tables in test data

* empty data is simpler to check now

* Update test data

* revert comment options that block update all test data

* clean existing data

* fixes

* another fix

* remov extra sensors???

* why is that using that ip...

* missed an empty table

* missed one

* restore ftos

* revert another ftos

* revert ird

* restore timos

* restore timos_7705

* oops

* double oops

* timos mpls

* timos_hc

* another timos_hc fix
2021-12-15 19:48:44 -06:00
Tony Murray
a95efd6d2a Global search: search device display (#13583)
* Global search: search device display
Add display field to search (also port_desc_descr, portName, and bgpPeerDescr)
Rewrite backend
update typeahead bundle
update devices and ports indexes
reduce some port field sizes so we can index them

* Style fixes

* remove nonsense
2021-12-06 16:12:24 +01:00
Tony Murray
b32524294c collect-snmp-data.php can now capture snmp context test data (#13596)
* collect-snmp-data.php can now capture snmp context test data
This is helpful for devices that use context for multiple data sets such as VLANs and VRFs.  Allows us to test things that use those now, but does make more snmprec files :/

* update typehints on affected methods and baseline
2021-12-03 13:27:06 -06:00
Tony Murray
b94f08cfdb Remove color markers when logging to files (#13541)
* Remove color markers when logging to files

* Update lint

* safety checks

* back to simple formatters, but two of them

* more correct comment
2021-11-24 23:33:02 +01:00
Tony Murray
790c4b3402 Configurable device display name (#13528)
* Configurable device display name
You can just set the display name in device settings.

It also accepts simple template format with  the variables: hostname, sysName, sysName_fallback, ip

Default controlled by device_display_default, (set from old force_hostname_to_sysname and force_ip_to_sysname settings

* remove second argument to format_hostname()

* Style fixes

* Update schema

* update phpstan baseline

* Improved settings strings (and add for translation)
2021-11-18 15:46:22 -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
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
Tony Murray
7e98e03338 Polling cleanup, fix PHP warnings (#13460)
* Fix warnings up to Arbos

* fixes a-c

* a-r

* a-vrp

* There and back again

* Update test data, couple fixes

* PHPSStan fixes

* style fixes, and fix Asyncos, whoops

* flip serial back.......

* less bogus data

* Poweralert sysName during polling too

* make sure things are calculated in the correct order

* fix style and bad nullables

* update test data

* A comple more conversions

* cambium ptp, misc, and hardware_mib

* remaining except vmware-esxi

* Fixes

* Update baseline

* fixes and fix up baseline

* adjust SnmpQueryMock to upstream options change

* data corrections

* restore slashes

* correctly handle all options input in SnmpQueryMock

* undo ftos changes

* restore vccodec sysDescr
2021-11-14 14:58:13 -06:00
Tony Murray
06701870cd Change how options are handled for SnmpQuery (#13488)
* Change how options are handled for SnmpQuery
Fix added backslashes when collecting snmp data.

* fix lint
2021-11-10 20:49:06 -06:00
Tony Murray
15632bb875 Fix net-snmp unformatted strings (#13486)
* Fix net-snmp unformatted strings
When net-snmp returns an unformatted string (with quotes around it), it also has backslashes to escape certain characters.  Remove those.

* Clean up sysDescr and sysName when setting to Device model.

* Lint fixes

* Hmm, additional formatting spots
2021-11-10 20:48:22 -06:00
Jellyfrog
307313f7df Update to Larastan 1.0 (#13466) 2021-11-02 19:43:14 +01:00
Tony Murray
2c77edf4d2 Better handling of some alerting errors (#13446)
* Better handling of some alerting errors

* Better error output

* Consolidate simple template parsing

* Fixes reported by phpstan (one was a bug, yay!)

* add back forgotten trim

* don't remove the template if there is no match

* Match previous behavior, which was inconsistent.

* use anonymous class for tests instead

* Oopsie, Stringable is PHP8+

* fix style
2021-10-29 22:12:20 -05:00
Jellyfrog
c075194d84 Use PHPStan level 6 (#13308) 2021-10-28 07:54:29 -05:00
Tony Murray
50cf1a49f1 Kick other sessions when changing password (#13194)
* Kick other session when changing password
Invalidate other sessions when a user password gets changed

* Don't logout admin users when they change passwords.
Cleanup phpstan exceptions

* only restore user if needed

* comment odd behavior

* $current_user typehint
2021-10-21 17:25:38 -05:00
Stuart Henderson
48a12be4be Don't hardcode index for Mikrotik LTE wireless statistics (#12976)
* don't hardcode index for Mikrotik LTE wireless statistics

* sync test data now that Mikrotik LTE index is no longer hardcoded

* sync tests data now that Mikrotik LTE index is no longer hardcoded

* fix whitespace

* sync test data now that Mikrotik LTE index is no longer hardcoded

* add test data for Mikrotik LtAP mini (aka RB912R-2nD)

* Re-write Routeros wireless code
It now works like most other devices

* fix style

* update baseline

* Remove station 60G rate

* use base unit of m, not km

* move interface stats name inside loop to avoid a walk when it does exist

* notification

* fix typo

Co-authored-by: Tony Murray <murraytony@gmail.com>
2021-10-20 20:50:59 -05:00
Jellyfrog
e873768845 Bump larastan (#13071)
* Bump larastan

* Use php7.4 for lint test
2021-07-26 09:00:34 -05:00
Jellyfrog
53d46044c3 Fix OS sensor array return (#12694) 2021-04-22 21:49:33 -05:00
Jellyfrog
3e3aa9077e Revert "Fix StringBlade errors with a stub file" (#12776)
This reverts parts of commit 165c4fd53c.
2021-04-21 23:22:15 +02:00
Jellyfrog
165c4fd53c Enable PHPStan linter (#12678)
* Enable PHPStan linter

* Add PHPStan baseline

* Switch to Level 5

* Fix StringBlade errors with a stub file
2021-04-21 07:41:34 -05:00