Commit Graph

383 Commits

Author SHA1 Message Date
Garcia MICHEL
afe0a25d32
Exit non-zero if composer bin not found (#15120) 2023-06-26 17:25:42 +02:00
Tony Murray
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
Jellyfrog
68e0b3df28
Apply fixes from StyleCI (#14899)
Co-authored-by: StyleCI Bot <bot@styleci.io>
2023-03-13 22:32:22 +01:00
electrocret
4446935901
Update github-apply (#14875) 2023-03-03 18:21:08 +01:00
dennypage
7936c7daf2
Add Universal Input Output support for APC (#14766) 2023-01-10 16:25:16 +01:00
Jellyfrog
071173ffb9
Remove tabs from yaml (#14437)
* Remove tabs from yaml

* Remove tabs from random files
2022-10-10 18:13:10 +02:00
Tim de Boer
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
Jellyfrog
152497a098
PHPStan: Enable more checks (#14318)
* PHPStan: Enable more checks

* Fixes

* Fixes

* Deprecation fixes
2022-09-09 07:08:06 -05:00
PipoCanaja
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
PipoCanaja
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
Zane C. Bowers-Hadley
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
Zane C. Bowers-Hadley
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
Tony Murray
74a04e515c
Fix auth_test.php debug (#14118) 2022-07-19 09:50:14 -05:00
Tony Murray
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
kruczek8989
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
Zane C. Bowers-Hadley
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
Cliff Albert
4910761c25
Add MRV OptiDriver support in gen_rancid (#13900) 2022-04-08 13:37:20 +02:00
Stefano Sasso
e7205b4527
Add support for VyOS on Rancid conf (#13874) 2022-03-24 23:14:48 +01:00
manonfgoo
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
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
Jellyfrog
36d8d9102e
Use PHP_BINARY directly instead of trying to build path to PHP binary (#13690) 2022-01-20 08:50:43 -06:00
Stefano Sasso
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
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
Orsiris de Jong
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
Tony Murray
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
Jellyfrog
258505ed44
Apply fixes from StyleCI (#13224) 2021-09-10 20:09:53 +02:00
Sean
1a97559816
Fix scripts to allow pathname with space (#13027) 2021-07-14 22:00:21 -05:00
Cliff Albert
cac5910040
Support for fortiswitch in gen_rancid (#12894) 2021-05-22 00:08:35 +02:00
Tony Murray
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
Jellyfrog
a70d55bfd8
Add feature to capture a full snmprec (#12706) 2021-04-06 17:26:31 -05:00
Tony Murray
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
Jellyfrog
9946fe8b15
Format python code with Black (#12663) 2021-03-28 11:02:33 -05:00
Jellyfrog
f9b25ccdbc
Lint with shellcheck (#12666) 2021-03-28 10:47:21 -05:00
Jellyfrog
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
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
CrazyMax
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
RobJE
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
Jellyfrog
b7676e4cc8
Update to Composer 2 (#12263)
* Update to Composer 2

No need to roll our own checks anymore since this is now built in.
Also limit the update check to once a week.

* update

* Make Composer wrapper report correct exit code

* Update composer_wrapper.php

* re-enable extension check

Co-authored-by: Tony Murray <murraytony@gmail.com>
2020-11-09 00:28:07 -06:00
Tony Murray
25722bbbd5
Faster initial database creation (#12297)
* Faster initial database creation
Add db dumps to improve initial db migration
On my test system 13s -> 7s, a 46% reduction.
Should help out a lot on systems like RPi

* lnms schema:dump command

--snapshots saves db snapshots, otherwise it saves the yaml

* fix style

* fix timezones...

* not working with in-memory db yet
remove build.sql
2020-11-06 01:19:15 +01:00
Jellyfrog
b866bcf2ab
Revert "Check PHP dependencies in daily.sh (#12260)" (#12271)
This reverts commit d82d2f1f19.
2020-10-29 15:11:32 +01:00
Jellyfrog
d82d2f1f19
Check PHP dependencies in daily.sh (#12260) 2020-10-29 01:34:42 +01:00
Jellyfrog
bd81f76caa
Use variable for PHP min version in docs (#12256)
* Use variable for PHP min version in docs

* Bump mkdocs deps
2020-10-24 11:19:45 +02:00
Jellyfrog
4068b04cc9
Add missing mkdocs extension (#12193)
Regression from 551e95a2e0
2020-10-06 01:52:16 +02:00
Tony Murray
88b40c3d6c
All os detection now uses Yaml (#12186)
* All os detection now uses Yaml
Move OS detection code into the Core module.
Defer all OS with snmp queries.
Add snmpwalk option.
Port ubnt and mobileiron to yaml.

* Silly ide refactor
2020-10-05 14:26:37 +02:00
Birkir Freyr
cb7e191f31
Add panos (paloalto) to rancid_map (#12161)
Add panos (paloalto) to rancid_map
2020-09-28 17:57:54 +02:00
Tony Murray
caf1979529
fix gen_rancid.php permissions (#12153)
broken by #12144
2020-09-24 06:48:14 -05:00
Tony Murray
e944456943
Use lnms dev:check instead of pre-commit.php (#12149)
* Remove pre-commit.php references WIP

* remove pre-commit.php references
2020-09-24 12:32:03 +02:00
Cliff Albert
a85b1e8bbd
scripts/gen_rancid.php: Add support for H3C/Comware (#12144)
* allied, radlan, ciscowlc rancid router.db configuration support
allied and radlan represent allied telesis

* tab/spaces

* allied, radlan, ciscowlc rancid router.db configuration support
allied and radlan represent allied telesis

* * Added rancid support for H3C/Comware

* extraneous newline
2020-09-23 13:35:14 +02:00
Jellyfrog
29f45ca352
Apply fixes from StyleCI (#12124) 2020-09-21 15:59:34 +02:00