Commit Graph

315 Commits

Author SHA1 Message Date
Mitt
273c6c5b97 fix: grabled characters when oid already UTF-8 (#15615) 2023-12-05 07:13:16 -06:00
Tony Murray
c3d4edaf5e Prevent non-unicode characters in ifAlias (#15585)
non-unicode characters will show up oddly, but at least they won't cause an error.
2023-11-16 11:43:22 -06:00
Tony Murray
f0aa80e73d ports ifPhysAddress use MAC helper (#15478)
* Ports min polled period of 1
Prevent divide by 0
Use Mac utility

* fix bad snmprec for airos-af-ltu

* Update a large amount of invalid mac addresses
either the script is capturing them wrong or users are mangling them

* More updated test data

* Update test data with bad input

* Fix ones using encoded <private> and attempt to fix capture

* Update awplus data

* restore missing data

* update other DNOS

* Fix ones using encoded <private> and attempt to fix capture

* Fix ones using encoded <private> and attempt to fix capture

* fix typo

* Update some data

* update data

* update ruijie
2023-10-19 20:10:52 +02:00
Tony Murray
36080f5ca3 Ports min polled period of 1 (#15472)
Prevent divide by 0
2023-10-18 09:06:07 -05:00
Tony Murray
78a85fe3ef Ports module: fix nulls not updating (#15467)
* Ports module fix nulls not updating

* Fix broken test data
I'd like to see how it came out broken in the first place, but I don't have access

* Update json data

* Fix fortivoice snmprec

* Fix scs-ks

* Fix bad siteboss550 data
2023-10-18 01:59:18 -05:00
Tony Murray
a5198d7d57 Remove some lightly used or unused dbFacile functions (#15418)
* Remove some lightly used or unused dbFacile functions
['NULL'] legacy behavior seems unsupported, replace with actual nulls

* Fix refactor mishap

* another

* update baseline

* these were very wrong... what happened?
2023-10-12 09:15:03 -05:00
Tony Murray
7c5b0e3612 Fix port module wrong null (#15431)
* Fix port module wrong null

* Update test data

* revert incidental data changes
2023-10-11 20:42:05 -05:00
Tony Murray
e6be5f777b Use modern device attrib handling (#15429)
* Use modern attrib handling
Remove device attribs array.

fixes #15422

* Apply fixes from StyleCI

---------

Co-authored-by: StyleCI Bot <bot@styleci.io>
2023-10-11 18:29:47 -05:00
MrMoCoDev
7bbe0a22fd FIX TP-Link JetStream 3.0.0 Build 20180511 Rel.36491(s) T1500-28PCT 3.0 (#15318) 2023-09-14 10:33:23 -05:00
Tony Murray
6d1b1ac1fa Fix port ifAlias polling (#15279)
Fixes static ifAlias as well.
2023-09-03 22:47:23 -05:00
Tony Murray
b04e31710d Fix ifSpeed override not being applied (#15237) 2023-08-21 00:31:19 -05:00
Tony Murray
6e4d124619 Misc fixes 2 (#15190)
* Fix error when missing poller data

* Apparently impossible to detect regex without error, so require regex always.  Update docs.

* Apparently this adva code is garbage :D

* Missing count sensor type

* Processor handle missing input

* Handle missing ifName a little better

* Yep, ports module is a dumpster fire.  Attempt to clean up some.

* apparently os yaml trying to replace on non-existent fields

* Might as well define all sensor type units

* revert previous fix, real issue was vlans module does not have polling.
2023-08-13 18:43:52 +02:00
AdamB
519fc00367 Change ESXi port naming to be stable (#14639)
* Change ESXi port naming to be stable

Currently every time discovery runs against ESXi, the port names change generating a lot of log spam.

This is because ESXi uses this as the ifDescr:
```Device vmnic1000202 at 01:00.0 nmlx4_en```

The poller parses this, and extracts the interface name, whereas discovery does not, causing the interface names to flip every 6 hours.
https://github.com/librenms/librenms/blob/22.10.0/includes/polling/ports.inc.php#L578-L580

This change gives the discovery process the same behaviour, so the naming is now stable.

* Try to fix test data with a squash

* vcsa test data

* Synthesise VCSA ifName, use it in place of ifDescr

* Refresh test data

* Update ports.inc.php

---------

Co-authored-by: Tony Murray <murraytony@gmail.com>
2023-04-16 12:58:38 -05:00
Tony Murray
cafdec6285 Remove unused port fields (#14963)
* Remove unused port fields
(and set vlan to default to null)

* Update test data for deleted fields

* update vlan to null

* missed field removals

* More correct migration

* Update new data

* restore accidental deletions
2023-04-14 16:47:26 -05:00
PipoCanaja
228c4ca78d bug - wrong type in ports.inc.php (#14952)
Yet another of these :) 

```
[2023-04-07T19:55:28.777810+02:00] production.ERROR: Error polling ports module for xxxxxxxxxx. TypeError: Unsupported operand types: string - int in /opt/librenms/includes/polling/ports.inc.php:785
Stack trace:
#0 /opt/librenms/includes/polling/functions.inc.php(339): include()
#1 /opt/librenms/poller.php(126): poll_device(Array, false)
#2 {main}  
[2023-04-07T19:55:28.780705+02:00] production.ERROR: Unsupported operand types: string - int {"exception":"[object] (TypeError(code: 0): Unsupported operand types: string - int at /opt/librenms/includes/polling/ports.inc.php:785)"} 
```
2023-04-07 14:09:57 -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
Jellyfrog
b6620746c5 Miscellaneous cleanup - part 5 (#14502)
* Miscellaneous cleanup - part 5

* Update includes/discovery/sensors/pre-cache/ipoman.inc.php

Co-authored-by: Tony Murray <murraytony@gmail.com>

* Update ipoman.inc.php

* string for trim()

* Update ciscosb.inc.php

Co-authored-by: Tony Murray <murraytony@gmail.com>
2022-10-25 19:27:28 +02:00
Jellyfrog
0f13b37b4c Fix fetch ifEntry logic (#14483)
* Fix fetch ifEntry logic

* Update includes/polling/ports.inc.php

Co-authored-by: Tony Murray <murraytony@gmail.com>

Co-authored-by: Tony Murray <murraytony@gmail.com>
2022-10-21 07:28:41 -05:00
Jellyfrog
b18ba17af0 Miscellaneous cleanup - part 4 (#14452)
* Miscellaneous cleanup - part 4

* wip

* wip
2022-10-19 01:33:06 +02:00
Jellyfrog
34a58c3f9f Miscellaneous cleanup, mostly undefined variables - part2 (#14445)
* Miscellaneous cleanup, mostly undefined variables - part2

* wip

* Update Number.php

* Update BridgeMib.php

* Update Xdsl.php

* Update cisco.inc.php

* Update Cisco.php

* Update entity-sensor.inc.php

* Update entity-sensor.inc.php

* Update entity-sensor.inc.php

* Update avtech.inc.php

* Update functions.inc.php

* Update HostResources.php

* Update ports.inc.php

* Update route.inc.php

* Update cisco.inc.php

* Update Cisco.php
2022-10-18 13:30:42 +02:00
Jellyfrog
7207614437 Trim whitespaces from device data (#14429)
* Trim whitespace from sensor and ports data

* Update arista_eos_vrf.json

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* Update Os.php

* wip

* wip

* wip

* Update querybuilder.json
2022-10-11 12:50:38 -05:00
PipoCanaja
53bfb24ef9 Migrate xDSL code to module, and add support for VDSL2 MIB (#14207)
* use component to discover if xDSL polling is needed

use component to discover if xDSL polling is needed

* Components OK, Polling in correct files, no DB for VDSL

* GUI

GUI_suite

* per port as well

* rename

* interface listing

* draytek_snmpsim

* fix arraymerge

fix names and max value

* schema

schema

style

* remove one dbFetchRows

remove 2x dbFetchCell

style

style

remove Legacy dbFetchRow

tests

tests

eloquent

more eloquent

more eloquent

one more gone

* fix properties access

eloquent_insert_update

style

tests

tests

tests

tests

* tests

tests

tests

* adslLineCoding

* Models

* fix not nullable cols in DB from code

default values

typo

rename

typo

schema

fix

fix

vdsl fix now

typo

typo

fix size

fix size

* Power values for VDSL

Power values for VDSL

Power values for VDSL

DB

* cleanup

* Rrd::checkRrdExists

* always enable DSL discovery

style

* xdsl module

* cleanup and move to Module

cleanup and move to Module

cleanup and move to Module

cleanup and move to Module

* Fix display

* fix polling and tenth

* remove legacy poller

* Style and Cosmetics

Cosmetics

Cleanup

* Translations

Translations

* exists

exists

* add test support for xdsl

* remove last component call

unused

* translations

* remove non standard onclick event on xdsl line

* Update Discovery Support.md

Update Poller Support.md

toner_gone

* Notification for removal of lnms config:set enable_ports_adsl true

* enable on devices with potential DSL interfaces

* tests are working now

fix teldat tests

* os_schema

* teldat

* move to new module structure

* move to new module structure

* wrong dump function

* wrong dump function

* laravel_through_key hidden

* Update notifications.rss

* Update notifications.rss

Co-authored-by: Tony Murray <murraytony@gmail.com>
2022-09-07 19:29:17 -05:00
Tony Murray
db54161b10 Fix os_group unset errors (#14238)
Instead of requiring an isset check for os_group, just set it, but to null
valid isset checks will still work right since it is now set to null.
2022-08-24 14:45:43 -05:00
Tony Murray
34163703fb Percentage calculation helper (#14235)
* Percentage calculation helper
Helper function to prevent divide by zero mistakes
Replace all percent calculations

* style
2022-08-24 21:01:54 +02:00
Tony Murray
465fa3986a Fix Undefined variable/key warnings (#14134)
* Fix Undefined variable/key warnings

* massage for test data

* restore set_numeric, only generates noise

* Fix ucd storage used (apparently free is not stored in discovery...)
2022-08-21 16:23:43 -05:00
Nash Kaminski
acfd09287a Add support for Cisco Nexus 3550 series (formerly Exalink Fusion) devices (#13992)
* Add support for Cisco Nexus 3550-F (formerly Exalink Fusion) devices

* Refactor to refer to the Exalink Fusion as the Cisco Nexus 3550 (post m&a of Exablaze by Cisco) as well as use YAML based OS discovery

* Rename Cisco N3550 ports include

* styleci fixes to n3550 ports include

* Correct N3550/Exalink OS discovery and improve tests

* Improve N3550 OS discovery and poller support

* styleci

* Rename Cisco Nexus 3550 OS from ciscon3550 -> exalink-fusion

* Update file header
2022-06-04 15:39:21 -05:00
Tony Murray
5076deccf3 Improve the efficiency of some queries (#13974)
* Improve the efficiency of some queries
Mostly by switching from whereIn to whereIntegerInRaw.
This inserts integers directly into the query instead of using placeholders (also escapes them)

also remove extra json_encode/json_decode in PingCheck

* Fix return types

Probably will result in some missing baseline exceptions.

* Update PingCheck.php

* whitespace
2022-05-16 09:57:58 +02: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
2dcc70301c Fix < 0 exception in ports poller (#13732) 2022-02-02 17:31:54 +01:00
Julian Lehrhuber
064463915c Fix poller for Bintec Be.IP Plus (#13453)
* Fix OID not increasing

* restore default flags

* Update ports.inc.php

Co-authored-by: Tony Murray <murraytony@gmail.com>
2021-10-29 23:20:23 -05:00
Tony Murray
b0e0d65c86 Fixes for misc unset variables in polling (#13421)
Remove $attribs global
2021-10-25 21:35:18 +02:00
Roy Cruse
aa6d685c9e Update ports.inc.php (#13393)
ifType of draytek router reporting as vdsl2 since firmware upgrade to v3.9.6.2
2021-10-20 18:54:56 -05:00
Tony Murray
8a883140cb Infer character encoding for ifAlias and sysLocation (#13248)
* Infer character encoding for ifAlias and sysLocation
Tries to convert character encoding for non-UTF-8 encoded strings.
This will only work for snmp strings that are type-hinted, not ones forced to ASCII with -Oa or similar
Only works for your default charset or Windows-1251 or LATIN1.
You can set your character encoding in .env with CHARSET

Please save us all and just use UTF-8

* style fixes

* less Yoda

* ensure return type

* fall back to passed string

* don't convert strings with any unprintable characters (such as line return)

* Update LibreNMS/Util/StringHelpers.php

Co-authored-by: Jellyfrog <Jellyfrog@users.noreply.github.com>

* Fix CP850

* fix space

Co-authored-by: Jellyfrog <Jellyfrog@users.noreply.github.com>
2021-09-21 08:47:44 -05:00
Tony Murray
b3e2309af6 Format port speed changes in the event log (#13174)
* Format port speed changes in the event log

* Delete SettingSelect2.vue
2021-08-26 17:56:55 +02:00
Tony Murray
d74bb37971 Show port speed on port graphs, optionally set scale (#11858)
* Show ifSpeed on Graph
Drop ifHighSpeed, we really don't want to store that value.

* safer truth check

* Allow global setting and per-graph variable

* match surrounding case

* Style fixes

* Remove old function usage

* update schema

* remove some old usages

* cleanup more ifHighSpeed references

* update test data to remove ifHighSpeed

* fix down migration

* Add button on graph page
Change default
tweak wording
2021-08-23 06:47:44 -05:00
Justin Bronn
d214ec4a28 TP-Link Jetstream DDM and PoE Support (#12990)
* Add TP-Link's DDM and PoE MIBs via their 20210310 archive.

* Add support for DDM sensors on TP-Link Jetstream switches.

* Add support for PoE on TP-Link switches.

* Fix linting issues.

* Fix group discrepancy in test data.

* Fix multiple discrepancies in DDM test data.

* Improve `num_oid` and `index` fields for Jetstream PoE sensors.

* Test data for PoE sensor `index` change.

* Convert Jetstream sensors to YAML and refine index names.
2021-07-04 17:51:57 +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
Dave Browning
ea6bd6af85 Allow getting VDSL stats on "down" VDSL ports (#12753)
https://community.librenms.org/t/broken-vdsl-stats-after-update/11471/20
2021-04-14 07:33:12 -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
Tony Murray
61316ce2cc PHP 8 fixes (#12528)
* port related errors

* more fixes

* fix storage count

* add tests for php8

* style

* only need not empty

* aix fixes....

* storage WIP

* fix aix discovering hrstorage
fix db test adding .gitkeep
fix os modules when discovery only

* fix aos processors wrong oid

* fix mempool number casting

* fix aos7 cpu

* use + 0 cast instead of floatval()

* more verbose error on invalid json

* remove invalid data in json

* actually fix the json

* correct json error fix

* cast_number() function
fix aruba-instant and aos6 bugs exposed by new function, probably more...

* fix a-f
fix inadequate sort for component data

* fix global port poll time

* fix mempools precent 0, route count, ntp const

* fix schleifenbauer liberal current usage

* further number casting refinement

* vrp

* fix tests

* fix arbos

* warn cleanups adjust to :: change

* fix ciena-sds

* fix drac

* fix dell-rpdu anddlink

* fix and improve arubaos
better error when getting an array in Processor

* fix atenpdu, add missing arubaos files

* aruba-instant to yaml
apparently I didn't need to do this, the diff just looks really odd
It did add ranged sub-index replacements

* docker app, was completely wrong... fixed

* fix sentry4 divide by 0...

* fixed root issue, remove check

* nicer cidr in ipv6 code

* remove bogus enuxus battery bank skip_values

* Fix InfluxDB tests

* remove extra import

* fix other style issues.

* influx "style" fixes
2021-03-12 18:10:14 -06:00
Jellyfrog
28591c0330 Split VMware into seperate OS (#12243)
* Split VMware into separate OS

* Bump VMware MIBs
2020-11-03 21:27:23 +01:00
PipoCanaja
9797be3677 Update DSL stats even if port is down (#12262)
* Update DSL stats even if port is down

* Correct swapped Upload/download on graphs

* Display attainable line speed in the ADSL page

* Correct SNR graph

* Rewrite labels to avoid misunderstanding

* last swap I hope
2020-10-29 02:08:29 +01:00
Jellyfrog
29f45ca352 Apply fixes from StyleCI (#12124) 2020-09-21 15:59:34 +02:00
Jellyfrog
2fc3a21211 Apply fixes from StyleCI (#12121) 2020-09-21 15:43:38 +02:00
Tony Murray
b9f4b221f7 Include ifName for bad_ifXEntry OS (#12104)
* ifEntry does not include ifName

* Walk ifName for bad_ifXEntry os
2020-09-17 23:00:31 -05:00
craig-nokia
db7ac390b2 Added check for incorrect ifConnectorPresent truth values, if invalid… (#11634)
* Added check for incorrect ifConnectorPresent truth values, if invalid, save it as false

* Added space after comma line 629

* Update ports.inc.php

Updated per murrant and tested.

* Update ports.inc.php

* Update ports.inc.php

Changed to check if ifConnector is set and if the response is not true or false, set it to null.

* Update ports.inc.php

* Update ports.inc.php

Fixed the codeclimate space issue

* Update test data

* fix differing escapes

* fix ciena-sds eol

* Revert timos.json

Co-authored-by: Tony Murray <murraytony@gmail.com>
2020-07-08 08:44:45 -05:00
Nick Peelman
e4b2d98222 only try to optimize port polling when it is enable by the global setting. (#11908) 2020-07-06 19:31:45 -05:00
footstep86
031c644ab3 Implemented a generic approach for ifHighSpeed values that cannot be … (#11504)
* Implemented a generic approach for ifHighSpeed values that cannot be stored in the database

Typo

* Added os check
2020-06-12 07:45:00 -05:00
Albert Siersema
cd362b7983 Fix missing PoE port graphs for Cisco Catalyst 9K (#11698)
* Fix missing PoE port graphs for Cisco Catalyst 9K

* Reworked code: 2 assignments, added tests

* Simplify code

Checking the MIBs...
CISCO-POWER-ETHERNET-EXT-MIB: AUGMENTS { pethPsePortEntry  } 
POWER-ETHERNET-MIB: INDEX { pethPsePortGroupIndex , pethPsePortIndex  }

This means cpeExtPsePortEntry is always indexed by exactly 2 values.  No point in populating slot.subslot.port

Co-authored-by: Tony Murray <murraytony@gmail.com>
2020-06-04 22:10:06 -05:00
SourceDoctor
fc921a143c Cleanup unused code (#11391)
* Global Settings - Alert Default Settings

* Revert "Global Settings - Alert Default Settings"

This reverts commit a1af62b146.

* remove not more used code

* Travis restart
2020-04-08 15:56:44 -05:00