395 Commits

Author SHA1 Message Date
674bb7e9f8 save-test-data.php improvements (#16367)
* save-test-data.php improvements
Message when snmprec data is not found
Output when venv setup fails

* Apply fixes from StyleCI

---------

Co-authored-by: Tony Murray <murrant@users.noreply.github.com>
2024-09-06 13:28:23 -05:00
1cceafb887 Improve Snmpsim usage to ease testing (#15471)
* Snmpsim use python venv
Patch to enable listening while minimizing output
Update lnms dev:simulate, tests, and ./scripts/save-test-data.php
removed old option to start snmpsim from older scripts, use lnms dev:simulate

* Apply fixes from StyleCI

* various fixes

* Remove patch official package is updated

---------

Co-authored-by: StyleCI Bot <bot@styleci.io>
2024-07-17 16:05:07 -05:00
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
c855d6c2fe Support for InfluxDB V2 API (#15861)
* Addition of influxdb-client-php to Composer.

* Addtion of InfluxDBv2 support.

* Addition of front-end options.

* Addition of documentation.

* Addition of the acknowledgement of the PHP library used.

* Fixed a unneeded bracket.

* Addition of a basic datastore test.

* StyleCI fixes.

* StyleCI fixes.

* StyleCI fixes.

* Fixed exception class.

* Revert accidental change.

* Fix to composer lock to not update all packages.

* Fix to composer lock to not update all packages, but still include the new Influx lib.

* Another attempt at getting Composer to behave the way I think it should work.

* Fixed merge-conflict in Composer due to #15869.

* Update composer.json

* Update composer.lock

* Update composer.json

* Update composer.lock

---------

Co-authored-by: Tony Murray <murraytony@gmail.com>
2024-03-07 12:26:21 -06:00
4c7181d010 [bugfix] Fix json-app-tool.php to work with Oid class. (#15844) 2024-02-21 21:35:11 +01:00
071ca9bc2a Apply fixes from StyleCI (#15698)
Co-authored-by: StyleCI Bot <bot@styleci.io>
2024-01-04 22:39:12 -06:00
ac61c38356 output Roles in auth_test script (#15587) 2023-11-17 07:24:29 -06:00
2392153a9b Fixed state flag causing sql issues in test-template.php (#15589) 2023-11-17 07:23:49 -06:00
be24993cbb Remove snmp functions that are barely used (#15377)
* Remove snmp functions that are barely used
Replace them with SnmpQuery calls

* Apply fixes from StyleCI

* Fix missing namespace

* Import Oid

* No more variables left may be repeated multiple times at the end with snmpsim, remove them all

* update data fixed by SnmpResponse bugfix

---------

Co-authored-by: StyleCI Bot <bot@styleci.io>
2023-10-05 01:29:22 -05:00
2cd207028a Implement RBAC (only built in roles) (#15212)
* Install bouncer

* Seeder and level migration

* Display and edit roles

* remove unused deluser page

* Update Radius and SSO to assign roles

* update AlertUtil direct level check to use roles instead

* rewrite ircbot auth handling

* Remove legacy auth getUserlist and getUserlevel methods, add getRoles
Set roles in LegacyUserProvider

* Small cleanups

* centralize role sync code
show roles on user preferences page

* VueSelect component WIP and a little docs

* WIP

* SelectControllers id and text fields.

* LibrenmsSelect component extracted from SettingSelectDynamic

* Handle multiple selections

* allow type coercion

* full width settings

* final style adjustments

* Final compiled assets update

* Style fixes

* Fix SSO tests

* Lint cleanups

* small style fix

* don't use json yet

* Update baseline for usptream package issues

* Change schema, not 100% sure it is correct
not sure why xor doesn't work
2023-08-28 00:13:40 -05:00
5a56e9081e Use Laravel schema migration command directly (#14039)
* Add new schema migration command

* Apply fixes from StyleCI
2023-08-03 19:26:48 -05:00
e9668550af add a flag for adding app data to tests generated via scripts/json-app-tool.php (#15080)
* add a means to easily add in the app data section for when generating the test data

* style fix

* minor fix for where the data should be
2023-07-21 11:55:48 -05:00
afe0a25d32 Exit non-zero if composer bin not found (#15120) 2023-06-26 17:25:42 +02:00
e9c08e21a5 Fix more divide by zero issues (#14954)
* Fix more divide by zero issues
fixes: 14932

* Round to the nearest integer, then cast

* Fix up dhcpatriot
2023-04-11 13:44:45 -05:00
68e0b3df28 Apply fixes from StyleCI (#14899)
Co-authored-by: StyleCI Bot <bot@styleci.io>
2023-03-13 22:32:22 +01:00
4446935901 Update github-apply (#14875) 2023-03-03 18:21:08 +01:00
7936c7daf2 Add Universal Input Output support for APC (#14766) 2023-01-10 16:25:16 +01:00
071173ffb9 Remove tabs from yaml (#14437)
* Remove tabs from yaml

* Remove tabs from random files
2022-10-10 18:13:10 +02:00
f817ae8586 Added Ubuntu and Raspbian to ifAlias script (#14399)
* Added Ubuntu and Raspbian to ifAlias script

* Improved to pass shellcheck and added support for "/etc/network/interfaces.d/*"

* Last shellcheck type and updated docs

* Last changes in docs

* Tabs vs Spaces
2022-10-07 22:10:37 +02:00
152497a098 PHPStan: Enable more checks (#14318)
* PHPStan: Enable more checks

* Fixes

* Fixes

* Deprecation fixes
2022-09-09 07:08:06 -05:00
969159f77a Save-test-data to refresh all variants of an OS (#14231)
* per OS

per OS

per OS

fixTest

fixTest

* fix empty variant
2022-08-26 15:29:14 -05:00
7d3811a2b0 Allow save-test-data.php to run all modules explicitely (#14212)
* add -m all

* add -m all
2022-08-18 18:55:32 -05:00
b827e2bbbd add support for Sagan (#14070)
* add sagan instance fetch function

* add sagan discovery

* add sagan poller

* add sagan graphs

* add graph sources

* add sagan to apps page

* remove alert

* more app graph work

* polling fix

* re-order keys and add alert key

* correct field key usage

* add alert and fix a missing unit

* more unit fixes

* add alert status

* add alert rules for sagan

* fix a missing : after S while I am here in the json stat tool helper... also add tests

* now add the tests

* add docs

* point php-cs-fixer at two files

* remove-unneeded sagan instance fetch function

* convert to use app_data

* style fix

* apply bennet-esyoil's suggestions here as well

* update for the new app model

* convert poller to the new method

* convert the sagan device app page

* convert sagan

* doc cleanup
2022-08-04 18:12:34 -05:00
0bbcde1227 add the ability for storing app data to prevent spamming of the event log via via component usage (#14087)
* initial work on add the ability to save/fetch app data

* update to use get_app_data for ZFS

* update the poller for the new app_data stuff

* ZFS now logs changes to pools

* add schema update for app_data stuff

* small formatting fix

* add a missing \

* now adds a column

* sql-schema is no longer used, so remove the file that was added here

* misc cleanups

* rename the method in database/migrations/2022_07_03_1947_add_app_data.php

* hopefully fix the migration bit

* add the column to misc/db_schema.yaml

* more misc small DB fixes

* update the test as the json column uses collat of utf8mb4_bin

* revert the last change and try manually setting it to what is expected

* remove a extra ;

* update suricata as well

* correct the instance -> instances in one location to prevent the old instance list from being stomped

* remove a extra ;

* update fail2ban to use it as well

* remove two unused functions as suricata and fail2ban no longer use components

* style cleanup

* postgres poller updated to use it

* update html side of the postgres bits

* chronyd now uses app data bits now as well

* portactivity now uses it as well

* style fix

* sort the returned arrays from app_data

* correct log message for port activity

* collocation change

* try re-ordering it

* add in the new data column to the tests

* remove a extra ,

* hmm... ->collate('utf8mb4_unicode_ci') is not usable as apparently collate does not exist

* change the column type from json to longtext

* mv chronyd stuff while I sort out the rest of the tests... damn thing is always buggy

* hmm... fix a missing line then likely move stuff back

* style fix

* add fillable

* add the expexcted data for fail2ban json

* escape a " I missed

* add data for portactivity

* add suricata app data

* add app data to zfs legacy test

* put the moved tests back into place and update zfs-v1 test

* add app data for chronyd test

* add app data for fail2ban legacy test

* update zfs v1 app data

* add some notes on application dev work

* add Developing/Application-Notes.md to mkdocs.yml

* add data column to it

* added various suggestions from bennet-esyoil

* convert from isset to sizeof

* type fix

* fully remove the old save app data function and move it into a helper function... the other still needs cleaned up prior to removal

* update docs

* get_app_data is fully removed now as well

* a few style fixes

* add $casts

* update chronyd test

* attempt to fix the data

* more doc cleanup and try changing the cast

* style fix

* revert the changes to the chronyd test

* apply a few of murrant's suggestions

* document working with ->data as json and non-josn

* remove two no-longer used in this PR exceptions

* ->data now operates transparently

* style fix

* update data tests

* fix json

* test fix

* update the app notes to reflect how app data now works

* app test fix

* app data fix for linux_lsi

* json fix

* minor doc cleanup

* remove duplicate querty and use json_decode instead

* style fix

* modelize the app poller

* use a anon func instead of foreach

* test update

* style cleanup

* style cleanup

* another test cleanup

* more test cleanup

* reverse the test changes and add in some more glue code

* revert one of the test changes

* another small test fix

* Make things use models
Left some array access, but those will still work just fine.

* missed chronyd and portactivity

* rename poll to avoid make it any confusion

* Remove extra save and fix timestamp

* save any changes made to app->data

* nope, that was not it

* What are magic methods and how do they work?

* fix two typos

* update linux_lsi test

* change quote type

Co-authored-by: Tony Murray <murraytony@gmail.com>
2022-07-22 16:01:55 -05:00
74a04e515c Fix auth_test.php debug (#14118) 2022-07-19 09:50:14 -05:00
53a892acad Simplify Oxidized syslog notify script and always notify oxidized (#14011)
When the script is called, it has already matched a regex.  I saw a user duplicating this script so they could notify oxidized.  That just makes things hard.  The only reason for the extra regex here should be to parse a user from the output.
2022-06-06 23:51:21 -05:00
6039293a7c Update syslog-notify-oxidized.php (#14005)
* Update syslog-notify-oxidized.php

For oxidized to be able to catch from syslog a configuration change on a CISCO switch via SNMP.

* Update syslog-notify-oxidized.php

Small mistake with ","

* Update syslog-notify-oxidized.php

Modify with @murrant helps.
2022-06-04 13:17:37 -05:00
f8d76b0571 scripts/json-app-tool.php JSON generation fix and add -S for SNMP extend name (#13948)
* add -S for setting a SNMP extend name and make sure the app is in a array

* minor formatting cleanup
2022-04-25 20:23:28 -05:00
4910761c25 Add MRV OptiDriver support in gen_rancid (#13900) 2022-04-08 13:37:20 +02:00
e7205b4527 Add support for VyOS on Rancid conf (#13874) 2022-03-24 23:14:48 +01:00
8ad389f161 Script that describes how to migrate traffic bills from observium. (#13757)
* Add  Traffic_bills.md

This script describes how to migrate traffic bills from observium to librenms.

* pretty print mysql and some cosmetics 

uppercase SQL Keywords
remove double spaces
2022-03-19 09:30:29 -05:00
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
36d8d9102e Use PHP_BINARY directly instead of trying to build path to PHP binary (#13690) 2022-01-20 08:50:43 -06:00
898aafcdd3 Gen RANCID host also for FS.com devices (#13682)
On the RANCID perspective, a FS.com switch behaves exactly as a Cisco switch,
and the RANCID modules for Cisco work well.
2022-01-18 21:27:35 +01:00
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
e57ec782f4 Install new python dependencies during daily maintenance (#13186)
* Improve check_requirements script to dynamically read requirements.txt

* Don't dynamically load requirements for python2

* Make sure we check python3 dependencies with python3 binary

* Quote variable to fix SC2086

* Add dynamic_check_requirements.py

* Use dynamic_check_requirements.py for python3

* Revert "Don't dynamically load requirements for python2"

This reverts commit 4485c8fcf9e0075fcf212e4f8bbc59ed75e144b5.

* Revert "Improve check_requirements script to dynamically read requirements.txt"

This reverts commit a9c83350d9de6b1b3b0a313dca23af749a08300a.

* Add LIBRENMS_DIR variable to exec, check for permission errors

* Make sure we check for permission errors on pip install

* Fix shellcheck SC2046 missing quotations

* Make sure we install pip packages as librenms user for Python3

* revert daily.sh, update dependencies in composer

* And in the validation

* should be executable

Co-authored-by: Tony Murray <murraytony@gmail.com>
2021-11-10 10:38:50 -06:00
nq5
5854244f5a Syslog hook examples and documentation for Procurve devices (#13397)
* Add support for Procurve devices

Syslog hook support added for automatic Oxidized backups of devices running Procurve

* Add documentation for HPE/Aruba Procurve devices

Update documentation to support configuration of example Syslog hooks for HPE and Aruba devices running Procurve
2021-10-21 09:45:16 +02:00
f94f7f23b8 Fully convert core to a modern module (#13347)
* Core module WIP

* update OS::make()

* core WIP

* try to finish up

* switch all core do os Model

* Mock WIP

* Working tests

* cleanup

* phpstan fixes

* style fixes

* fix agent

* trim space too
and a couple of cleanups

* corrected ios test data

* missed space

* update test data

* put escapes back

* another net-snmp difference

* Fix class description

* revert snmp.inc.php change, that can be a different PR

* revert snmp.inc.php change, that can be a different PR
2021-10-19 15:43:43 -05:00
258505ed44 Apply fixes from StyleCI (#13224) 2021-09-10 20:09:53 +02:00
1a97559816 Fix scripts to allow pathname with space (#13027) 2021-07-14 22:00:21 -05:00
cac5910040 Support for fortiswitch in gen_rancid (#12894) 2021-05-22 00:08:35 +02:00
61c89794e4 Remove debug globals (#12811)
* Remove $debug global
and $vdebug global
makes these variables more accessible and protects from collisions.

* the on boot set sends application as the first parameter, just handle that

* Relocate other debug related functions

* Log debug to stdout

* Wrong output

* remove stupid constants

* Fix lint and style issues
2021-04-29 22:42:18 -05:00
a70d55bfd8 Add feature to capture a full snmprec (#12706) 2021-04-06 17:26:31 -05:00
1c379dcd05 Remove legacy function calls (#12651)
* massive inlines

* fix style and wtf

* remove rrdtool.inc.php include

* fix CommonFunctions namespace issues

* looking for missing class space, fix undefined class issues

* style fixes
2021-03-29 00:25:30 +02:00
9946fe8b15 Format python code with Black (#12663) 2021-03-28 11:02:33 -05:00
f9b25ccdbc Lint with shellcheck (#12666) 2021-03-28 10:47:21 -05:00
b851e140dc "variant" is now required for test data (#12531)
* Stop snmpsim after we done

* "variant" is now required for test data
2021-02-14 20:39:08 -06:00
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
4126dddf73 GitHub Actions dev:check ci (#12392)
* Refactor test for GitHub Actions

* Checkout pull request HEAD commit instead of merge commit

* Fetch changed files from API instead of git

* HEAD commit

* Origin

* Fix env

* force full unit checks on gh actions change

* Fix DB conn

* Update test.yml

* Also set port in PDO connection

* Exit with correct exit code

* Update CiHelper.php

* Update test.yml

* Update CiHelper.php

* Update Proc.php

* Cleanups

Remove extra unit test run on php 7.4
Add names that will hopefully show in github.
Remove redundant DB env variables.

* Fix

Shorter names
and DB_TEST env is required

* Change command for information purposes

Co-authored-by: CrazyMax <crazy-max@users.noreply.github.com>
Co-authored-by: Tony Murray <murraytony@gmail.com>
Co-authored-by: Jellyfrog <Jellyfrog@users.noreply.github.com>
2021-01-03 00:54:01 -06:00
e1497ecf0b shellcheck (#12258)
* remove unneeded semi-colons at end of line

* fix SC2206: Quote to prevent word splitting/globbing

* fix SC2164: Use 'cd ... || exit' in case cd fails

* fix SC2004: $/${} is unnecessary on arithmetic variables.

* fix SC2155: Declare and assign separately to avoid masking return values.

* fix SC2124: Assigning an array to a string! Assign as array, or use * instead of @ to concatenate.

* fix SC2059: Don't use variables in the printf format string. Use printf "..%s.." "$foo".

* fix SC2076: Don't quote rhs of =~, it'll match literally rather than as a regex.

* fix SC1090: Can't follow non-constant source. Use a directive to specify location.

* fix SC2166: Prefer [ p ] || [ q ] as [ p -o q ] is not well defined.

* SC2223: This default assignment may cause DoS due to globbing. Quote it.

* fix SC2164: Use 'cd ... || exit' or 'cd ... || return' in case cd fails.

* fix SC1117: Backslash is literal in "\n". Prefer explicit escaping: "\\n"

* better handling of branch comapre

* add missing local ver_73 from merge

* remove duplicate definition
2020-11-11 23:21:15 +01:00