1560 Commits

Author SHA1 Message Date
4dd369294e Fix Discord Transport when Fields to Embed Left Empty (#16439)
* Add PHPUnit test for LibreNMS Discord transport

* Style

* Adding comments for methods and others.

* Refactor title, color, embedFields and footer to its own methods.
Renaming and comments.

* testDiscordDelivery includes img and html tags.

* testDiscordDelivery tests INI options

* renamed getter methods for clarity.
Refactor to includeINIFields() method.

* refactor attribute $discord_message;

* Discord.php: Bugfix "Error: Invalid Field" when discord-embed-fields is left empty.
Discord.php: Removed DEFAULT_EMBEDS (defaults are not working with text fields).

DiscordTest.php: transport config tests improved.

* Transport.md: Documented options, images and ebed fields. Better examples.

* typos

* styleCI and PHPStan

* StyleCI

* StyleCI
2024-10-06 21:40:08 +01:00
a29b9b8ecc Snmpsim setup: fix python exe name (#16492)
call python3 like every other script
2024-10-05 00:41:04 +02:00
bb944b9a06 Improve OcNOS port breakout detection (#16466)
* Improve OcNOS port breakout detection
Old code required a transceiver to exist in one of the breakout ports

* Allow functionality without prots module running
2024-09-30 10:58:21 -05:00
cf897d278e Bump version to 24.9.0 2024-09-29 16:47:37 -05:00
763156ac6a Transceivers - Extend to more Cisco Containers (#16456)
* Extend to more Cisco Containers

* more
2024-09-29 16:33:57 -05:00
e08571c38c Transceiver Support (#16165)
* Add transceivers module

Move os specific code to OS

Fix errors and updated connector names

Add RouterOS, a lot less data there.

Add Comware

Add Exa, required a transformer function (mw to dBm)

Add Junos, revision was too short

Just starting on ui

Graphs, and more ui
some polling fixes

collapse header for small screens

refactor a bit

Missed graphs

Transceivers icon inline

Use @once on popup javascript

update db_schema.yaml

Don't show transceivers in basic view
basic view could use a review

Apply fixes from StyleCI

API functions

Comware don't fail if port is missing

Apply fixes from StyleCI

Add alert rules to collection

Device Overview

Attempt to fix bad alert rule, probably needs more

Fix up Comware and remove old sensors

Mark transceiver metrics without thresholds as Unknown

Routeros cleanup

Exa cleanup

Handle missing port

Graph allow filter by channel

More translations

Add transceiver graphs to port graphs

Add Cisco support, use entPhyscial module data if available

Fix OcNos divisors

Labels on transceiver page

Show encoding if available

Hacky OcNos port mapping

Fix up Junos optics and remove old sensors

FS switch support
Metric casts to prevent thrashing
Extra transform_function support

Add link to transceivers page from overview

Change default sort to group by type, then channel
move some code out of overview blade template
Fix bad type ocnos

Apply fixes from StyleCI

Add scales to graphs

Add some test data

Default sort order for metrcis in SQL applied by default

Transceiver metrics threshold manual settings via WebUI and API

Fixes to channels verbiage

Fix severity calculations

Add cable field for SM/MM/Copper

Apply fixes from StyleCI

update test data

Show DDM

Update DB schema file

Extend serial field to 32, even though devices shouldn't be able to have one longer than 16

Missing import

Add status field to database, that way we can support snmp implementations that only return an enum

Add missing files

Fix db_schema

Fix style

Fixes

Style fix

Work around phpstan issue

Update transceivers.blade.php

Missed getStatus() call

Prevent extra dots when channels are not changed

Update module to match upstream

Save ocnos metrics as sensors

Move to regular sensors

add entity physical index

Update UI to sensors WIP

Apply fixes from StyleCI

Forgot one change

Update ui to use sensors

Remove transceiver metrics

Remove metric os discover code
fs-switch pending

Remove transceiver metrics for fs-centec

Exa link up

Revert all test data

Fix up transceiver module interface

Remove unused Convert class

comware cache and transceiver type

Fix some transceiver metrics filtering and formatting issues

Consolidate display formatting

Coalesce commare hh3cTransceiverTable walks to prevent double walk

Use group to identify transceiver sensors

Fixup routeros

Fix up cisco

update db_schema

Small addition to docs

Improve overview layout and add graph popup

Update Junos

update css files

ddm should be nullable

Increase the field length for type and model

Cisco Improve detection when there is an intermediary container

Add transceiver test data

Apply fixes from StyleCI

Fix incorrect test data

Improve display formatting

Fix test data

Apply fixes from StyleCI

Fix up more data

Fix up more data

Fix incorrect return type in routeros

Update ocnos data

* Remove some remaining references to transceiver_metrics table
2024-09-29 11:05:44 -05:00
ee1afba003 Fix Alert transport details xss (#16444)
* Fix stored XSS in alert transport details

https://github.com/librenms/librenms/security/advisories/GHSA-7f84-28qh-9486

* Fix password double encode
2024-09-29 13:45:16 +01:00
0a5c174f4f Fix test regressions introduced while tests were broken (#16399)
* AuthSSOTest: clear roles cache

* PollingJob: When a poller module doesn't exist, return null instead of false.  Skip all other checks and disable polling in that case.

* Sensors: Guess high and low limits separately as needed

* Sensors: drac test psu current data was wrong, referencing the snmprec, 8 / 10 and 0 / 10 should be the values
NOTE: drac is messed up and runs a billion snmp queriess for no reason

* please phpstan

* Sensors: limits reference old code
move to "creating"

* Fix gw-eydfa accidental assignment

* Fix ies5000 test data now that the bad state is removed

* Fix ies5000 test data part 2

* Move sensor discovery reset into discover_device()

* infinera remove duplicate sensor (also a lot of trailing whitespace apparently)

* Fix innovaphone bad yaml discovery

* module tests should be using null when test data doesn't exist, not an empty array

* When discovery or polling is not supported, dump null instead of an array.
Account for nulls in testing

* update ISE serial

* Janitza was seemingly wrong before

* Remove some private data

* bgp-peers requires ipv4-addresses and ipv6-addresses for bgpPeerIface

* fix polycomLens broken state sensor discovery

* Raritan pdu and pdu2 test data was combined in one test file, split it out

* scs-ks duplicate temperature sensor indexes

* sentry3 someone tried to avoid breaking stuff but just broke things more

* smartos-dcp-m fix incorrect numeric oids

* ssu2000 apparently test data was wrong, must have fixed a bug in the code.

* timos remove duplicate dbm sensor definitions

* bgpPeerIface is working in tests now

* Fix moxa-etherdevice when mibs are a bit different

* xw_to_dbm negative values should return null

* Update cisco test data due previous fixes/changes

* One more bgpPeerIface

* Add orderBy to ospf module db dumps

* Remove links test data for now

* Improve handling of bad data in ipv6-addresses module
2024-09-23 10:11:05 -05:00
375903025d Bump minimum PHP version to 8.2 (#16413) 2024-09-20 02:22:24 +02:00
7d450345df Fix sensor state translations (#16393)
* Fix sensor state translations

* Fix up lint/style

* Set state_index_id

* Apply fixes from StyleCI

* Wrong call

* just use a loop

* Wrong id column

* Missing fillable

* Handle sensors missing state translations

* Before making a state index

* Can't map to a state index if it doesn't exist

* Apply fixes from StyleCI

* ies5000 overflowing tinyint

* Accept state translations directly add that in the translation

* handle duplicate state names, but with different case (skip no way to work there)

* Apply fixes from StyleCI

* Fix type stuffs

---------

Co-authored-by: Tony Murray <murrant@users.noreply.github.com>
2024-09-15 02:13:11 +02:00
13da0aef4c Remove legacy db config (#16385)
* Remove legacy db config
Should be configured via the environment or .env.

* Lint fix

* Remove call to removed method
2024-09-13 16:25:23 +02:00
2501b7a4db Remove internal usages of config_to_json.php (#16388)
* Remove internal usages of config_to_json.php

* Appease lint
2024-09-13 13:22:01 +02:00
4c72856046 Matrix: critical alerts now notify (#16355)
* Update Matrix.php

Changing 'm.text' to 'm.notice' so that when an alert is issued, you get notified on your Matrix client.

The current 'm.text' parameter will silently send you the message, whereas 'm.notice' will send you a message with an alert.

* Enabling notifications on Matrix client

Changing 'm.text' to 'm.notice' (line 47) so that when an alert is issued, you get notified on your Matrix client.

The current 'm.text' parameter will silently send you a message, whereas 'm.notice' will send you a message with an alert.

* Update Matrix.php

* Update Matrix.php

---------

Co-authored-by: Tony Murray <murraytony@gmail.com>
2024-09-12 10:13:21 -05:00
77fa7573cf Revert "Convert Config to a singleton (#16349)" (#16382)
This reverts commit f1e7a218f047d71d17952dcddcfa1acebbd9400c.
2024-09-10 09:59:20 +02:00
f1e7a218f0 Convert Config to a singleton (#16349)
* Convert Config to a singleton
Continuation of #14364 by @Jellyfrog
This time, make the old class a shim for the facade.  Will update references in a separate PR.

* Remove logging config call

* Apply fixes from StyleCI

* Fix bad Git constructor call

* Fail on config table does not exist instead of throw exception

* Inline LibrenmsConfig::isRegistered()

* Debug call in case there are more issues,
remove before merge.

* Fix up config tests

* Allow config cache controlled by CONFIG_CACHE_TTL (disabled by default for now)

* Enable config cache for tests

* Remove debug statement and deprecation phpdoc

* Apply fixes from StyleCI

---------

Co-authored-by: Tony Murray <murrant@users.noreply.github.com>
2024-09-09 18:48:07 +02:00
071076149a Improved module controls (#16372)
* Improved module controls
Ability to clear device module overrides from webui
Ability to clear all database data for a module (helpful for module you have disabled that still have data)

Database reset only works for modern modules.

* Update functions.php
2024-09-09 09:09:19 +02:00
fc26490bc4 Fix not-nullable columns (#16373) 2024-09-07 16:59:23 -05:00
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
fc9b77c672 Availability calculations, handle bad data (#16368)
* Availability calculations, handle bad data
Add some unit tests as well

* whitespace
2024-09-06 13:27:39 -05:00
2ba6f164f2 Cisco C9800 Wireless Controller AP Count Support (#16342)
* Update CISCO-LWAPP-TC-MIB

Uploaded latest version from Cisco Feature Navigator

From the original Cisco MIB:
Deleted duplicate END in line 868
Change the names “dot11_6ghz” and “dot11_xor_5_6ghz” by removing the underscore (example: “dot11-6ghz” “dot11-xor-5-6ghz”)

* Update Iosxe.php

Added Wireless Controller module

* Update iosxe.yaml

Added AP count and Wireless Client

Credit to @AllanHahn

* Create iosxewlc.yaml

Added IOS-XE WLC. Need to add sysObjectID for the future devices beyond WLC9800.

System description has IOS-XE in it

* Update iosxe.yaml

* Update iosxe.yaml

WLC 9800 not included, have own YAML file

* Create iosxewlc.php

* Update Iosxe.php

Remove WLC Module

* Rename iosxewlc.php to Iosxewlc.php

* C9800 WLC detection

* Update iosxewlc.yaml

* Remove CiscoWLC notes

* Remove ISIS

* Update Iosxewlc.php

* Fix syntax

* Remove Cisco WLC notes

Need some cleanup since already created new PHP file for Cisco IOS-XE WLC

* Update Iosxewlc.php

* Update CISCO-LWAPP-AP-MIB

Downloaded the latest from Cisco MIBS to support AP count for Cisco WLC C9800 models.

* Update Copyright

* Change type from network to wireless

* Patterned with AirOS Cisco WLC

* Create iosxewlc_c9800.snmprec

Added test file

* styleci compliance

* styleci compliance

* styleci compliance

* Uploaded data from actual device

* styleci compliance

* styleci compliance - remove space

* Merge iosxe and iosxewlc 

As discussed

* Merhe iosxewlc.yaml to iosxe.yaml

No over graphs for Number of Clients and AP Count or IOSXE WLCs but still can view via Tabs

* remove iosxewlc.yaml

Covered by iosxe.yaml

* Delete iosxewlc.php

Covered by iosxe.php

* Rename iosxewlc_c9800.snmprec to iosxe_c9800.snmprec

due to removal of iosxewlc template which was merged.

* styleci compliance

* styleci compliance

* Update iosxe_c9800.snmprec

* Update iosxe_c9800.snmprec

* rerun-tests

* Remove pollOS block from Iosxe

* Check before polling and add additional IP discovery

* lint fix

* Added raw data from actual device

Convert sensitive data to <private>

* Create iosxe_c9800.json

---------

Co-authored-by: PipoCanaja <38363551+PipoCanaja@users.noreply.github.com>
Co-authored-by: Tony Murray <murraytony@gmail.com>
2024-09-06 10:36:44 -05:00
40b629011f Fix alert -1 count (#16359) 2024-09-04 16:04:06 -05:00
dc2f70592b Fix rrd show command (#16357)
buildCommand needs to be public access for show command, reverted to protected because I thought it was only for tests, and that doesn't require it to be public anymore.
2024-09-04 09:53:04 -05:00
f15f8fa63a Sensors remove reliance on global variable (#16344)
* Sensors remove reliance on global variable

* Apply fixes from StyleCI

* Clear the instance instead of reset.
Remove $valid['sensors'] from docs

---------

Co-authored-by: Tony Murray <murrant@users.noreply.github.com>
2024-09-03 21:04:34 -05:00
f89ed301d7 Improve Rrd datastore test (#16353)
* Improve Rrd datastore test
Don't start rrdtool process to test buildCommand

* lint fixes
2024-09-03 13:18:38 -05:00
64c0d6ff7f Ignore entity-sensor invalid values (#16347) 2024-09-02 21:44:29 -05:00
b096ff86fc OcNOS Add AS7712-32X port mapping (#16332)
Fix walking ifName multiple times
Add EdgeCore test data
2024-09-02 11:43:34 -05:00
7b767dd7cc Fix setting the device wrong field in module tests (#16296) 2024-08-27 17:03:41 -05:00
3e3d09bb26 OcNOS Inventory support (#16320)
* IP Infusion OcNOS inventory

* Hide strings that say item is missing
Handle more sfp ethernet types

* Add Edgecore models AS5912 & AS7316 port mapping

* Test data

* Apply fixes from StyleCI

---------

Co-authored-by: Tony Murray <murrant@users.noreply.github.com>
2024-08-27 07:06:47 -05:00
db5fdf705d Poll device job (#16306)
* Split out single device polling to a Laravel Job
Probably totally broken :)

* Add dispatch option to device:poll

* Fix up submodules

* Add missing logger parameter

* Apply fixes from StyleCI

* Update module format in test helper

* Apply fixes from StyleCI

* Use Log facade to match other code

---------

Co-authored-by: Tony Murray <murrant@users.noreply.github.com>
2024-08-25 19:56:50 -05:00
3dd4084404 Replace echo with Log calls in OS code (#16310) 2024-08-22 17:23:09 +02:00
89d70bd48e Fix alert detail count missing (try2) (#16309) 2024-08-21 21:41:22 -05:00
46396a9393 Remove echo from modern modules (#16308)
* Remove echo from modern modules
Still used many other places, further PRs will follow

* Apply fixes from StyleCI

---------

Co-authored-by: Tony Murray <murrant@users.noreply.github.com>
2024-08-21 12:20:45 +02:00
7aeb540e5a Bug - VRP - fix OutOfRange QueryException + missing key (#16290)
* fix OutOfRange QueryException

* move up

* missing key

* another

* another
2024-08-21 01:26:48 -05:00
9d35fbc6a7 Entity Physical discovery: Rewrite to modern style (#16289)
* Initial entity-physical code

* Split out Entity-MIB trait

* Cisco Cellular inventory

* Fix bad test data

* alfo80hd - we now include all entPhysical entries

* Correct aos7 test data

* Add entPhysicalClass as last resort for label in ui

* aos add previously filtered data

* Fixup arista-eos data

* Update ariast_eos data

* Arris, clean garbage in Rev fields

* Aruba Instant custom inventory ported

* ArubaOS CX add vendor type mib

* aviat-wtm test data refresh

* axos add shelf fix data fields a bit

* ciena-rls

* ciena-sds

* Skip cimc for now... no test data

* Cisco updates

* Comware data update

* Update dnos

* Clean Edgeos garbage, make code from Arris shareable

* Relaxed ifIndex match, some devices cheat and send back static strings instead of formatted OIDs

* Regex refinement and updated edgeos with new clean data

* Update edgeswitch data

* Update eltex-mes21xx data

* eltex-mes23xx

* Guess at eltex-mes24xx since there is no test data

* Update eurostor, fix firmware version

* Apply fixes from StyleCI

* fixes

* Update fortigate data

* Update fortiweb, ftd, and fusion

* Update linux LSI

* Fix hexToAscii null removal with different seperator handling

* icotera add final snmprec data to avoid snmpsim bug

* Update IOS data

* Update mrv-od

* Add junos translation

* Generic data updates n-r

* ruijie workaround snmpsim bug

* Port saf-cfm

* Recode Schleifenbauer, and fix entPhysicalIndex values

* SmartAX fixes

* sm-os and tait-infra93

* timos inventory was not right, fix it up

* ubiquoss-pon

* VRP, has custom data collection on top of normal
adapt port ifIndex lookup to handle it

* VRP exceeded the string length specified in ENTITY-MIB...

* data updates

* Final data update and code cleanup

* Apply fixes from StyleCI

* Lint fixes

* Add missing SnmpResponse->pluck() code

* Update db_schema.yaml

* Fix bad test data

* Another instant-on update

* oops

* Remove some unused code

# Conflicts:
#	includes/html/pages/device/overview.inc.php

---------

Co-authored-by: Tony Murray <murrant@users.noreply.github.com>
2024-08-21 01:12:09 -05:00
50ff4fafed Work around alert with bad data (#16287)
Avoid trying to count null by making sure it is an array
2024-08-15 18:21:50 -05:00
f6fe0cf2da Bump version to 24.8.0 2024-08-15 15:14:10 -05:00
9455173edc Fix alert bug when key missing (#16281) 2024-08-12 12:21:14 -05:00
f296464dae validate.php proper exit code (#16274)
some fixes around database & poller checks
2024-08-08 20:00:56 -05:00
cc971b6233 Fix runtime cache (#16272)
Fix runtime cache when redis is enabled, but not running
2024-08-06 13:11:44 -05:00
a61cd16f86 Nac polling improvement (#16265)
* Nac polling improvement
Was loading all nac entries from the DB, then filtering them. Now it only loads non-historical entries off the bat.
All this because the filter was returning the wrong type...

* Add missing get
2024-08-02 20:44:47 -05:00
d67df039e3 device - Added Baicells Atom OD04 CPE support (#14838)
This adds a MIB from the Baicells website, lightly modified
(s/BAICELLS-MIB/BAICELLS-CPE-MIB), and yaml files for LibreNMS. Currently OS
detection works, but sensors are reporting '0'.

I can easily get the data with snmpget, so I know that part is working. The
issue I'm seeing looks like the {{ $index }} substitution in my sensor yaml
isn't being filled out. Here's some example output from poller.php that backs
this up:

```
.1.3.6.1.4.1.53058.2.2.7.: Unknown Object Identifier ()
.1.3.6.1.4.1.53058.2.2.8.: Unknown Object Identifier ()
.1.3.6.1.4.1.53058.2.2.12.: Unknown Object Identifier ()
.1.3.6.1.4.1.53058.2.2.13.: Unknown Object Identifier ()
```

* adjustments to baicells od04

* undo modification to mib

* add original unmodified mib, tweak yaml, add time conversion function

* added baicells od04 snmprec

* skip invalid values

* Rename baicells-od04.snmprec.txt to baicells-od04.snmprec

* Update and rename BaiCE-BM-2.5.23_SNMP_MIB-CAT4.txt to BAICELLS-MIB

* Update baicells-od04.yaml

* Create BaicellsOd04.php

* move userfunc into OS

* style

* squash php casting warning

* missing static

* style

* fix {{ $index }}

* Create baicells-od04.json

---------

Co-authored-by: PipoCanaja <38363551+PipoCanaja@users.noreply.github.com>
2024-08-02 19:18:17 +02:00
4777247327 Cleanup - Ensure percentage is calculated out of positive values only (#16250)
* Percentage and positivity

* fix bug victims hpe-ilo
2024-07-31 09:37:07 -05:00
b41d1b7ffb Fix Port Channels take 2 (#16246)
* Resubmit of #16227

* Add missing new files
2024-07-26 08:45:34 -05:00
e45dd59f77 Revert "Fix Port Channel (#16227)" (#16245)
This reverts commit 0d201c44c992106dbf6664f7e2657d62e4bd289a.
2024-07-26 15:26:04 +02:00
0d201c44c9 Fix Port Channel (#16227)
* Fix expandable sizing

* Temp fix: port_id_{low,high} is actually ifIndex

* new PortsStack discovery module, store actual port_ids

* Show 4 rows of ports by default

* Add test data

* Fix up the single port view too

* Apply fixes from StyleCI

* Update db_schema.yaml

* Update base migration because sqlite cannot add primary keys

* Fix phpstan failures

---------

Co-authored-by: Tony Murray <murrant@users.noreply.github.com>
2024-07-25 23:39:36 -05:00
6dbcdceab2 Fix poller wrapper debug option (#16214)
* Fix poller wrapper debug

* fix lint failure
2024-07-25 23:13:17 -05:00
55f603c30c Refactor SnmpResponse mapTable (#16238)
Replace previous code with a couple of foreach loops
2024-07-22 21:23:10 -05:00
e6f02ea7ff Add support for Prometheus pushgateway basic auth (#16230)
Co-authored-by: Joe Clarke <jclarke@cisco.com>
2024-07-21 20:03:32 +02:00
23965cee49 Add support for memory, power status and transceiver monitoring to Fiberstore S3900 series switches (#16225) 2024-07-19 19:39:39 +02:00
090611f6c1 Add support for FortiNet FortiExtender (#16219)
* Add support for FortiExtender - Wireless Sensors

* Add support for FortiExtender - Discovery YAML

* Add support for FortiExtender - YAML Sensors

* FortiExtender 201E SNMPsim

* FortiExtender 201E - Test Data

* FortiExtender MIB

* StyleCI

* Fix StyleCI

* Better now?

* Whoops

* Update fortiextender_201e.json

* Update fortiextender_201e.json

* Add files via upload

* Delete mibs/fortinet/FORTINET-FORTIEXTENDER-MIB.mib
2024-07-18 22:47:40 +02:00