211 Commits

Author SHA1 Message Date
8d5bc3fc41 Use Measurements for all statistic collection (#13333)
* Use Measurements for all statistic collection

* fix space

* Use colors
cleanup

* fix style

* manually fix license notice

* add return times and new line

* add return times and new line

* fix mistake in copyright template

* fix style
2021-10-06 17:09:54 -05:00
258505ed44 Apply fixes from StyleCI (#13224) 2021-09-10 20:09:53 +02:00
8ef70f8bec Fix snmp_bulk setting not being applied (#13209) 2021-09-08 19:04:16 -05:00
26b95c0ccc Apply fixes from StyleCI (#13208) 2021-09-08 23:35:56 +02:00
4f50c3c05d Rename nobulk -> snmp_bulk (#13098) 2021-09-01 19:01:41 -05:00
e981570c34 enclose IPv6 literal in [brackets] for snmpget and unix-agent (#13130)
Co-authored-by: Kevin Wallace <kevinwallace@users.noreply.github.com>
2021-08-19 18:00:06 -05:00
f7586973c9 ignore Wrong Type errors in snpm_get and snmp_get_multi_oid (#12800)
Works around some awfully broken devices.
2021-05-02 14:38:12 +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
643c1ca3aa Correct snmp function usage (#12714)
* Use snmp_translate correctly

* use snmp_get correctly

device array instead of object

* Update snmp.inc.php
2021-04-09 11:11:57 -05:00
8c2a5d5a16 Issue with snmpwalk_group string splitting (#12701)
* handling invalid data for snmpwalk_group

* style

* new approach

* new guess

* split trim

* cleaning
2021-04-05 22:47:11 +02:00
09d30ce75d Global Settings - SNMP Timeout (#12579)
* Global Settings - SNMP Timeout

* omit snmp timeout if it is 1

* add retries field

* filter default retries too

* fix typo

Co-authored-by: Tony Murray <murraytony@gmail.com>
2021-03-04 20:18:26 -06:00
c0060dc6ed DynamicDiscovery - Guess num_oid if not provided in YAML file (#12570)
* Guess num_oid if not provided in YAML file
* Discover Processor num_oid if necessary
* num_oid is now optional

* documentation upgrade
2021-03-01 16:54:29 +01:00
f2f169ae78 Modernize mempools (#12282)
* mempools to modern module
quick hacky hrstorage port

* port ucd-snmp-mib to Mempools

* Populate DB for ucd
Prep for yaml

* initial yaml attempt

* more complex conversions
fixes to YamlDiscovery, make leading $ optional and allow mib::oid format

* walk full tables and skip values
normalize percentages above 100

* handle precent only ones (specify total as 100)

* Move default polling out of YamlMempoolsDiscovery

* fixes

* Update test data hrstorage should be correct.

* perc_warn for hrstorage

* Host Resources, record buffer, cached, and shared

* Host Resources is always better, don't do both HR and UCD

* fix unix, include warning levels

* variable size

* consolidate skip_values

* define mempools schema

* number instead of integer

* more schema refactor

* one more skip_values reference

* throw error for invalid oid translation
aos6

* a*  and Cisco

* updated test data

* update almost all hrstorage data files

* b*

* c* with test data
use standard cache for hrStorage

* use cache for storage module too

* hand bsnmp properly

* bdcom

* exclude total oid from yaml so it is not polled
May add a way to ignore this behavior and poll it, but I don't know if that is needed.

* automatically handle percent only values

* ciscowlc

* only poll used or free if we have used, free, and total.

* fix skipping

* the dlinkoning
fix find value when value "name" is numeric

* support numeric oids

* dnos/ftos attempt

* I guess we can't filter on total > 0

* edgecos

* e*

* f WIP

* f*

* gwd (aka g*)

* h* + procurve

* i*

* j*

* m*

* support 0% used memory (however unlikely)

* n*

* CISCO-PROCESS-MIB memory, share cache with processors module

* ignore mempools with invalid total

* p*

* quanta

* r*
fix raisecom mibs terribly broken

* s-z

* style fixes

* Move VRP back to PHP and make it actually work

* fix zynos

* update schema

* Update Cisco processor data for description bug fixes

* fix comware processors

* comware mempools with memory size
default precision to 1

* sophos-xg updated data

* hrstorage use ram size for buffers, cache, and shared

* Show memory available instead of free in device overview

* UCD, use same rrd format, store available instead of free in the db.

* Calculate availability for HOST-RESOURCES-MIB

* Convert UCD to standard polling

* rename old rrd files

* initial graph work

* graph WIP

* Graph looking decent

* Graph looking decent for hr

* remove old ucd_graph code

* handle availability mempool
more graph cleanup

* color adjustments

* remove accidental free calculation

* Update test data and fix corner cases

* fis pfsense

* update schema

* add default value for mempool_class

* fix whitespace

* update schema

* update schema correctly

* one more time

* fortigate_1500d-sensors missing oids

* Update docs.

* fix indent

* add implements MempoolsDiscovery explicitly to OS

* remove ucd_memory graph references
remove unused device_memory graph

* remove unused functions

* set devices with mempools to rediscover to prevent/minimize gaps

* use a subquery

* add overview graph

* port health mempools table

* Update device mempool

* only show overview if multiple

* Don't override user set warn percentages in discovery

* fix missed usage

* fix style

* Safety check to not rename rrd files incorrectly if migration has not been run.

* Fix overview percent bar and represent available and used on the bar

* missed an item to convert to mempool_class

* percent on the wrong side
2020-11-23 15:35:35 -06:00
0fbd60416f snmpwalk_cache_oid() handle multiline strings (#12254)
* snmpwalk_cache_oid handle multiline strings

* remove useless function

* some output has no space after equals

* airos-af-ltu use hr processors

* don't try to append with empty strings

* fix changed test data due to fix

* revert smartax

* better regex
additional check
2020-10-24 22:56:01 -05:00
a0f91de9b2 Capture OSPF test data (#12215) 2020-10-19 09:35:41 -05:00
29f45ca352 Apply fixes from StyleCI (#12124) 2020-09-21 15:59:34 +02:00
82f43cb98d Apply fixes from StyleCI (#12120) 2020-09-21 15:40:17 +02:00
941037e44e Convert OS discovery to new style (#12099)
* terra

* airos

* port cisco os polling
old wwan polling was broken and deprecated anyway

* enterasys

* Brother, a few changes

* AW Plus

* Fabos

* set expected test data

* 3com

* Adva FSP150

* advantech

* airos-af

* aix

* akcp

* allied

* allworx and missed mibs

* anyos

* fixup some zyxel shared stuffs
zywall graph polling

* aos

* apc

* apex

* apsoluteos

* fix copyrights

* arris

* arris

* aruba-instant

* ArubaOS

* Ascom

* asuswrt-merlin, ats

* audiocodes

* avocent

* avtech

* barracuda

* binox

* boss

* canonprinter

* cdata

* ceraos

* ciena-waveserver

* fix 3com

* fix airos

* fix brother yaml?

* fix aos more

* fix and improve apc

* fix arista test data

* yaml discovery (basic)

* cimc

* mib not used

* remove old discovery file

* ciscosat

* ciscosb fixes + improvements

* comware

* ctm

* cumulus

* cxr-ts

* cyberoam-utm

* cyberpower

* dahua-nvr

* dasan-nos

* datadomain

* dcn-software and fallback oids

* dd-wrt

* dell-laser

* d*

* e* and location

* forti, post processing, oid coalescing

* Freebsd array of sysDescr regex

* finish f*

* g*

* h*

* i* WIP

* i*

* Junos

* j*

* k*

* unix refactor previous to yaml more
inject $device

* fixes

* fixes

* l*

* m*

* n* ability to set other fields in regex
tnmsne polling to eloquent

* o*

* p*

* q* + bonus calix

* r*

* s* WIP

* s*

* t*

* u*

* v*
rework vrp to yaml (hybrid)

* w*

* x*

* z*

* a* easy no-data

* fixes

* style fixes

* missed ApexPlus

* fix signature

* Add missing location data

* rename getDevice functions

* add new cisco ftd data

* update docs

* revert sill snmp format

* fix snmp options

* update for new smartax test data

* rebase dsm

* fix voss
2020-09-18 15:12:07 +02:00
000b8e0f7c Improve mib_dir setting consistency (#12069)
yaml os discovery now respects the os mib_dir definition
mib_dir now only allows strings, not arrays
changed schema validation to account for that
consolidated dell mibs, no reason for them to be spread out
2020-09-08 12:55:29 +02:00
020c5fd7e1 Remove legacy code and fix missing device graphs (#11950)
* removing $graphs global

* remove unused things

* fix some additional graphs

* Fix graphs persisting too soon

* correct name for poller module performance graph

* only one type of graph is used here
2020-07-23 09:57:22 -05:00
0e96589879 Fix bug when timeout exceeded (#11934)
Uncaught exception probably causing some of the "unpolled" reports.
2020-07-15 07:45:09 -05:00
d5a52ca4eb Fix various issues with loading os definitions (#11640)
* Ping only device doesn't display
if os was set to something, ping os wasn't loaded and we try to get overview graphs from it.

* Fix snmp_disable device page load error
When other os is set.

* Revamp os setting loading
the only safe way to access is Config::getOsSetting()

* Remove getOsSetting fallback behavior
Most instances don't use it and it can have unexpected results Config::getOsSetting('blah', 'group') == 'librenms'

* refactor and remove unneeded load_os/loadOs calls now since getOsSetting automatically loads it.

* restore unix overview graphs, they are different
small cleanups

* fix
2020-05-19 14:35:32 -05:00
ee4ae0b2af Fix inconsistent escapes (#11637)
should probably stripslashes() instead
2020-05-19 08:22:57 -05:00
1c08c11a77 Remove Laravel helpers (#11428)
* Remove Laravel helpers

* Replace qualifier with import
2020-04-18 00:37:56 +02:00
c8bdd10e6a Reduce DB polling while getting SNMP data (#11162) 2020-02-18 13:26:41 +01:00
aea0b6180f Invalidate 'Wrong Type' snmp_walk() data (#11159)
* Invalidate 'Wrong Type' snmp_walk() data

* remove blank line, space before $data
2020-02-17 02:33:39 +01:00
7950893cd1 Alternate Poller IP instead of Hostname (#10981)
* optional alternative poller ip

* add missing schema update

* .

* enhance API Call 'add_device' with overwrite_ip key

* .

* .

* updating docs
2020-01-30 06:20:30 -06:00
25b5c64bff FDB for ArubaOS (#10940)
* Add FDB support for ArubaOS; modify some SNMP calls to allow community string indexing
* Apply coding styles, changed arubaos.inc.php comment headers
* Coding style
* Modify per items discussed at pull 10940
* ArubaOS test data
* ArubaOS header doc

Co-authored-by: PipoCanaja <38363551+PipoCanaja@users.noreply.github.com>
2020-01-12 17:23:33 +01:00
dec9a498ee Updated device cache support (#10795)
* Device Cache
also some additional device related models

* attribs from cache

* replace common attribute functions

* remove legacy cache usage
tidy up some collection manipulation
remove some unused or single use functions

* cleanup some items

* always return a device, to prevent bugs

* clear device cache when testing after each test

* fix double assignment

* Clean up function to take advantage of null object
2019-11-14 21:56:06 +00:00
e5849ca055 Remove function report_this_text() (#10728) 2019-10-21 11:39:30 +00:00
f715c2ea94 add support for per-OS SNMP max repeaters configuration file setting. (#10628)
* add support for per-OS SNMP max repeaters configuration file setting.

* Simplify function

I think it should be equivalent

* whitespace...
2019-09-30 10:45:09 +00:00
f3ba8947f7 Use Config helper (#10339)
remove usage of global variable
2019-06-23 00:29:12 -05:00
65e766156f Add Raisecom Sensors (#9738)
* update some mibs

* extend snmpwalk_cache_twopart_oid function

* add raisecom dbm and temperature sensors

* add test data

* add some more sensors

* Update raisecom.inc.php

* Update raisecom.inc.php
2019-01-30 21:34:15 -06:00
d4f32a250e Support for Alcatel OmniPCX (#9375)
* device: support for Alcatel OmniPCX Server

* device: support for Alcatel OmniPCX Server - add test data

* rename

* Add a new versatile type of sensor, without unit - doc extension

* tests data updated for omnipcx

* new count test after funny rebase

* clean

* tests

* index in yaml file ...

* Update omnipcx.json

* try to add pbx state

* Change function snmpwalk_cache_oid to allow snmpvalue without index

* testdata

* Adapt the discovery_schema (to allow a non_indexed oid)

* Update snmp.inc.php
2019-01-22 17:34:45 -06:00
fad0bffc43 Escape SNMP & IPMI shell commands (#9537)
hopefully doesn't break anything
Mostly issues with snmp oids and options containing spaces.  Try to remove all of those.

DO NOT DELETE THIS TEXT

#### Please note

> Please read this information carefully. You can run `./scripts/pre-commit.php` to check your code before submitting.

- [x] Have you followed our [code guidelines?](http://docs.librenms.org/Developing/Code-Guidelines/)

#### Testers

If you would like to test this pull request then please run: `./scripts/github-apply <pr_id>`, i.e `./scripts/github-apply 5926`
After you are done testing, you can remove the changes with `./scripts/github-remove`.  If there are schema changes, you can ask on discord how to revert.
2018-12-16 13:42:50 +00:00
c78f92a4c2 snmp_max_oid per Os support and snmpv1 multi_oid fix (#9343)
* Added snmp_max_oid config at Os level.

* Added check for snmpv1 on multi_oid requests.

* Check  device_oid_limit on multi get

* Use array_chunk

* Update snmp.inc.php

* remove dump, unused variable and extra plodes

* per device settings should take priority over OS

* Update Settings.md

* don't discard the data :P
2018-11-21 13:25:39 -06:00
5c4a298cfc Remove duplicate mib directories from snmp queries (#9148)
General cleanup of that function

DO NOT DELETE THIS TEXT

#### Please note

> Please read this information carefully. You can run `./scripts/pre-commit.php` to check your code before submitting.

- [x] Have you followed our [code guidelines?](http://docs.librenms.org/Developing/Code-Guidelines/)

#### Testers

If you would like to test this pull request then please run: `./scripts/github-apply <pr_id>`, i.e `./scripts/github-apply 5926`
2018-09-04 22:14:03 +01:00
f2253d70fd SNMP v3 auth is no longer checked for case sensitivity + push pass v3 creds to front of queue (#9102)
* Match api code to addhost.php for v3 config order

* Updated v3 auth checks for case insensitivity + docs
2018-08-29 09:16:33 -05:00
4a6b56d8f2 Generic snmp_translate() function (#8156)
Translates between numeric and textual oids.

Rename existing function to snmp_mib_transate(). It is only used for mib polling. Modifying it could break mib polling.
2018-02-15 16:37:37 -06:00
88b4e31912 refactor: Refactored bgp-peers (#7972)
* bgp-peers update
Use IP parsing library more effectively.
Fix update issue
Include comware bgp-peers test data
deeper refactoring
Allow JunOS fallback to BGP4-MIB, some models only use that.
Add junos bgp4 data
Actually update all bpg data in the poller

* fix arista data. refactor some to prevent missing data from mucking things up

* refactor to use $oid_map for BGP4-MIB too

* A few comments to break up teh file a bit

* Junos bgp data an a quick revert for now.

* small cleanup

* fix ios bgp polling, add test data

* check the correct variable
2018-01-18 20:54:38 +00:00
e11e84f2ee snmp_walk remove multiple No more variables (#8050)
Optimize code so it is a faster when no more variables is not present.
Only saving 10s of microseconds, but better than an increase.
2018-01-10 15:30:19 -06:00
81fbe95039 Add snmp_getnext_multi() function (#8052)
* Added snmp_getnext_multi() function using syntax of existing snmp_get_multi() function

* Fixed typo in comment and spurious newline in file

* Removed return of index value

* Correct statistic
2018-01-08 23:39:58 -06:00
42e5819130 refactor: Updated discovery/poller to use numeric sysObjectID (#7922)
* refactor: Updated discovery to use a core module for sysDescr/sysObjectID use

* final update hopefully

* revert changes

* more changes + docs

* migrated poller to use numerical sysObjectID

* more updates for sysObjectID

* update any alert rules which might have enterprises. in

* moved schema file

* small updates

* updated getHostOS()

* scrut fixes

* updated sysObjectId -> sysObjectID

* updated sysObjectId -> sysObjectID

* updated remainder of sysObjectId -> sysObjectID

* another sysObjectId -> sysObjectID

* fixed secureplatform test data

* Fix tests: $device is not pulled from the database before polling
Also, update the db in the core discovery module.
2018-01-06 23:00:47 -06:00
4ffdbe0e6a fix: Fix can't find CPQHOST-MIB (#8024) 2018-01-04 22:42:16 +00:00
dbeaf3b35e device: Added Mikrotik POE sensors (#7883)
* Add Mikrotik POE sensors

* Add Mikrotik POE sensors
2017-12-09 19:53:40 +00:00
ab2aacec0f fix: Don't work around bad implementations in snmpwalk_group (#7876) 2017-12-09 16:39:37 +00:00
301af24ace fallback to snmpgetnext if db is unavailable (#7698)
running tests without DBTEST=1 for example.
2017-11-10 12:52:31 +00:00
acb1de5772 feature: Implement snmp_getnext() (#7678)
find correct path to snmpgetnext (will do the same for others later)
fix undefined index in get_mib_dir()
2017-11-08 15:15:49 +00:00
0d07f85257 feature: Allow snmpget in os discovery yaml (#7587)
* feature: Allow snmpget in os discovery yaml

Re-submit after release

* Remove extra trim in discovery and in snmp_get.
also trim() always returns a string, so is_string() check is a waste of cpu cycles.
2017-11-02 12:41:18 +00:00
1dfcde3060 fix: function snmp_get delete quotes in snmp query (#7467)
* fix: ups-nut delete quotes in snmp query

* fix: ups-nut delete quotes in snmp query

* Update snmp.inc.php

* Update snmp.inc.php

* Update snmp.inc.php

* Update snmp.inc.php

* Update snmp.inc.php
2017-10-31 21:50:18 +00:00