Commit Graph

113 Commits

Author SHA1 Message Date
Tony Murray
55f603c30c Refactor SnmpResponse mapTable (#16238)
Replace previous code with a couple of foreach loops
2024-07-22 21:23:10 -05:00
Joe Clarke
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
Tony Murray
04101c2c6f SnmpQuery default improvements (#16204)
Always ignore underscores. Vendors constantly break this rule and it doesn't seem to have any side effects to enable -Pu.
translate respect hideMib() option
2024-07-15 08:52:37 -05:00
Walkablenormal
99f72823bb InfluxDBv2 allow filter by group and disable debug by default (#16186)
* CHG: Dynamic debug flag and ability to exclude networks.

* Update config_definitions.json

* Update settings.php

* Update documentation.

* FIX: StyleCI Fixes.

* FIX: StyleCI Fixes.

* CHG: Changed excluding by network to by group membership

* Update settings.php

* Update config_definitions.json

* Update documentation.

* FIX: StyleCI Fixes.

* FIX: StyleCI Fixes.

* FIX: Fetch device data from cache.

* Add a check to see if we are trying to exclude by group before fetching groups.

* remove whitespace

---------

Co-authored-by: Tony Murray <murraytony@gmail.com>
2024-07-14 18:17:02 -05:00
Tony Murray
3aedfb4f3b Fix some testing issues (#16174)
* Fix some testing issues
index doesn't exist in ModuleTestHelper
Cache issue in NetSnmpQuery (specifically affects testing)

* Apply fixes from StyleCI

---------

Co-authored-by: Tony Murray <murrant@users.noreply.github.com>
2024-07-02 09:21:39 -05:00
Tony Murray
8bf40c5eef Fix fping bulk (#16085)
* Fix Fping bulk
When an ICMP unreachable message was returned (stderr), the output processing would save it as if it were a partial line, breaking parsing.
Only save a line if it is the last line of the output (not ending in a new line)

* Add test case

* safer logic
2024-06-03 21:29:29 -05:00
Warren Ashcroft
1aa712e189 Fix graph_type variable (svg / png) (#15972) 2024-04-26 08:33:08 -05:00
Tony Murray
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
Walkablenormal
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
Justin Lentz
d61c71bcbe Change default graph image to SVG (#15586)
* Update config_definitions.json

* Update Rrd.php
2023-11-27 18:43:15 -06:00
Tony Murray
1dd1ddc2ca Prometheus on failure, disable for rest of run (#15546) 2023-11-05 18:29:25 -06:00
PipoCanaja
63f33642b8 string VS array (#15533) 2023-10-31 15:22:18 -05:00
Tony Murray
7c542d70af SnmpQuery runtime cache (#15512)
* SnmpQuery runtime cache
Optionally cache the SnmpResponse from queries for the rest of the runtime.
It would be nice to have cache hits for these to help prevent wasting memory caching data that is only used once.
Key data must match: device, context, options, oids

* Apply fixes from StyleCI

* Add command to the cache key

* Caching in the wrong spot, cache individual commands...

* Apply fixes from StyleCI

---------

Co-authored-by: StyleCI Bot <bot@styleci.io>
2023-10-29 22:46:04 -05:00
Tony Murray
921872369d Fix rrd exists check (#15466)
Filename incorrect for test
2023-10-16 12:48:01 -05:00
Tony Murray
fcfaded91f Always create rrd folder on localhost (#15457)
for some reason rrdcached cannot create folders when it is running on localhost
Always create directories on the local poller in case rrdcached is running on the same machine
A few small changes to checkRrdExists() too
2023-10-14 15:29:13 -05:00
Tony Murray
5386b24888 Type safety check (#15409)
* Type safety check
now fails silently, we already have schema validation to check it is a string, but... people find a way.

* Fixup
2023-10-07 18:45:30 -05:00
Tony Murray
366be4cd49 Re-fix bug in Graphite (#15394)
preg_replace can handle arrays of subjects :D
2023-10-06 00:11:33 +02:00
Tony Murray
affb68e2bc Fix bug in graphite (#15393)
It was quite wrong.  Not sure if the fixed code is correct though.
fixes #15391
2023-10-05 14:38:48 -05:00
Tony Murray
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
Tony Murray
c1258320f8 Availability module fixes (#15369)
* Refactor poller to allow modules to run even if the device is down
Include core in config (but not webui) to avoid silly shenanigans
Inject datastore into polling

* Needed to split datastore interface

* Cleanup some data_udpate() references

* Apply fixes from StyleCI

* Fix legacy poller :D

* Output to the correct stream

* Fix lint issues

* Apply fixes from StyleCI

* Fix discovery not including core and submodule handling

* Use whereRaw

---------

Co-authored-by: StyleCI Bot <bot@styleci.io>
2023-10-04 10:32:59 -05:00
Tony Murray
e978025553 Fix typo in default mibs for SnmpQuery (#15297) 2023-09-08 08:32:01 -05:00
AdamB
daf36ef48f fping 4.0+ prefers IPv6 (#14825)
Additionally fping6 is no longer a thing - this breaks IPv4 hosts entirely in a dual stack environment

It's not possible to reconcile these options, so we have to have a toggle until distro's with fping 3.x fall out of support.
2023-08-10 20:16:59 -05:00
Tony Murray
d1b7004fef Severity Enum (#14620)
* Severity Enum
Replace old Alert constants

* Fix whitespace

* Additional uses

* style fixes

* Fix test too

* More missed locations

* More
2023-08-05 12:12:36 -05:00
Tony Murray
9382959c8c Set mibs explicitly in SnmpQuery (#15199)
* Set mibs explicitly in SnmpQuery
Always override system mibs, so we have consistency
New method to control mibs

* Lint fixes
2023-08-05 14:45:15 +02:00
Tony Murray
3908bddb49 Miscellaneous fixes (#15162) 2023-07-26 01:08:10 +02:00
Jellyfrog
2b3575a5e9 Laravel 10.x Shift (#14995)
* Apply code style

* Remove explicit call to register policies

* Shift core files

* Shift config files

* Default config files

In an effort to make upgrading the constantly changing config files
easier, Shift defaulted them and merged your true customizations -
where ENV variables may not be used.

* Bump Laravel dependencies

* Add type hints for Laravel 10

* Shift cleanup

* wip

* wip

* sync translation

* Sync back config

* Public Path Binding

* QueryException

* monolog

* db::raw

* monolog

* db::raw

* fix larastan collections

* fix phpstan bug looping forever

* larastan errors

* larastan: fix column type

* styleci

* initialize array

* fixes

* fixes

---------

Co-authored-by: Shift <shift@laravelshift.com>
2023-05-24 22:21:54 +02:00
Tony Murray
04bb75f5f3 Alert transport cleanup, no_proxy support and other proxy cleanups (#14763)
* Add no_proxy and other proxy related settings
Set user agent on all http client requests
Unify http client usage

* Style fixes

* Remove useless use statements

* Correct variable, good job phpstan

* Add tests
fix https_proxy bug
add tcp:// to the config settings format

* style and lint fixes

* Remove guzzle from the direct dependencies

* Use built in Laravel testing functionality

* update baseline
2023-05-23 09:25:17 -05:00
eskyuu
ce0734ff5d Added support for user timezones and user browser timezone by default (incomplete) (#13626)
* Added support for user timezones and user browser timezone byt default

* Formatting fixes

* Use the timezone for alert log display

also added validation for the timezone because it's being used in SQL.

* Formatting fixes

* Added return type

* Formatting"

* Update the latency graphs to use the user timezone

* Simplify the web routes config

* Update phpstan to ignore type error

* Fixed up the phpstan config

* Reverse phpstan change

* Re-apply phpstan override

* Remove the option to unset the session timezone

* Formatting fix

* Update outge and event logs to use session timezone

* Fix route for the timezone control

* Made the timezone more dynamic

* Fix a logic error that was stopping the timezone from being set automatically on login

* Prevent getPref from being called twice

* again prevent getPref double call

* getPref double call

* Fixed typo made during merge

* Fixed merge error in phpstan-baseline.neon

* Change spaces to tabs in phpstan-baseline.neon

* Update error count

---------

Co-authored-by: Tony Murray <murraytony@gmail.com>
2023-05-09 10:24:48 -05:00
Tony Murray
a15a27da3a Fix scale_rigid accidentally being set to false (#14992) 2023-04-21 21:08:35 -05:00
Tony Murray
2ddfba51dd Set ping_perf scale_min to 0 (#14989)
And allow scale_min, scale_max, and scale_rigid to be set via url parameter
2023-04-20 22:30:32 -05:00
Jellyfrog
0a351b49fd Laravel 9.x Shift (#14504)
* Move `resources/lang` folder

* Shift registered middleware

* Remove `fruitcake/laravel-cors` dependency

* Streamline `$commands` property

* Upgrade to Flysystem 3.0

* Shift core files

* Convert `optional()` to nullsafe operator

* Remove unnecessary `$model` property

* Convert route options to fluent methods

Laravel 8 adopts the tuple syntax for controller actions. Since the old options array is incompatible with this syntax, Shift converted them to use modern, fluent methods.

* Convert deprecated `$dates` property to `$casts`

* Shift config files

* Default config files

In an effort to make upgrading the constantly changing config files
easier, Shift defaulted them and merged your true customizations -
where ENV variables may not be used.

* Bump Laravel dependencies

* Use `<env>` tags for configuration

`<env>` tags have a lower precedence than system environment variables making it easier to overwrite PHPUnit configuration values in additional environments, such a CI.

Review this blog post for more details on configuration precedence when testing Laravel: https://jasonmccreary.me/articles/laravel-testing-configuration-precedence/

* Fix error provider

* Match new symfony syntax

* Match upstream syntax

* Fix route syntax

* generate composer.lock

* Sync back configs

* routes

* composer

* Fix more flare

* fix cors

* sync lang

* Apply fixes from StyleCI (#14517)

Co-authored-by: StyleCI Bot <bot@styleci.io>

* bump larastan

* update packages

* wip

* Temporarily lower phpstan level

* Update phpstan.neon

* wip

* wip

* wip

* Apply fixes from StyleCI (#14592)

Co-authored-by: StyleCI Bot <bot@styleci.io>

* test

* Update CiHelper.php

* Update test.yml

* Update CiHelper.php

* Update CiHelper.php

* Apply fixes from StyleCI (#14616)

Co-authored-by: StyleCI Bot <bot@styleci.io>

* test?

* fix phpstan problems

* dont run snmpsim on github ci

* Fix whitespace

* More whitespace

* More whitespace ???

* I think the space broke it

* fix the reset of the whitespace

* hard code auth guard

---------

Co-authored-by: Shift <shift@laravelshift.com>
Co-authored-by: StyleCI Bot <bot@styleci.io>
Co-authored-by: Tony Murray <murraytony@gmail.com>
2023-04-17 06:51:35 -05:00
Tony Murray
d09c5540ed Fix SnmpQuery and max_oid (#14955)
If the snmpget had less oids than the max, it would run them one at a time instead of all together.
2023-04-10 12:07:32 -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
Tony Murray
d3f02e6bb7 SnmpQuery, respect snmp.max_oid (#14894)
Previously, the code would query all the oids it received. Now it will split it up into multiple queries if too many are sent.

Prevents some devices snmp service from crashing.
2023-03-13 10:17:34 -05:00
Tony Murray
e8c3b2c924 Improve SnmpResponse value() (#14605)
* Improve SnmpResponse value
Can now return a specific oid or the first non-empty oid in a list.
Cache values() call on object to avoid repeated parsing
Improved types

* fix style

* extract getOidParts to fix errors from different parts of the code parsing differently

* new object to deal with cache

* More tests

* whitespace

* style
2022-11-30 19:50:46 -06:00
Tony Murray
7635ace4fa Split out lnms snmp convenience commands (#14603)
* Split out lnms snmp convenience commands

* Use SnmpQuery->valuesByIndex()

* Fix style
2022-11-19 22:10:25 -06:00
Jellyfrog
71d740770b Remove Log::event (#14526)
* Remove Log::event

Use the Eventlog class directly instead

* wip

* wip

* wip

* Apply fixes from StyleCI

* Update Eventlog.php
2022-11-09 09:47:19 +01:00
Tony Murray
0801af7a81 Consolidate and improve snmptranslate usage (#14567)
* Consolidate and improve snmptranslate usage

* Fix style

* lint fixes

* fix typo

* allow multiple mib directories

* Only add mib if it is not already set

* oid first, in case we have key length issues

* if there is a full oid, don't add other mibs

* debug in ci

* more debug in ci

* better debug in ci

* remove debug

* Use numeric index

* revert dlink change

* Don't add -On twice

* unit tests and hopefully better heuristics

* remove dump and add one more set of tests

* style fixes

* handle bad input in old functions

* shortcut whole snmp_translate function
2022-11-07 12:00:47 -06:00
Tony Murray
e5e169358f SnmpQuery Handle empty oids in get more gracefully (#14577) 2022-11-05 00:38:20 -05:00
Tony Murray
35bea945ba SnmpQuery fix mib directory order (#14580) 2022-11-04 23:12:56 -05:00
Tony Murray
0c365d08e3 SnmpQuery numeric accept a boolean (#14565) 2022-11-02 18:50:46 -05:00
Tony Murray
b04211bf73 Fix scale when it is zero (#14560) 2022-11-02 09:11:23 -05:00
Tony Murray
95a0050074 Remove $_GET from graphs (#14554)
Fixes issues setting variables in other contexts
2022-11-02 08:24:42 -05:00
Tony Murray
e864ed7795 Fix graph font sizes (#14550)
flipped big and small
2022-10-31 21:01:35 -05:00
Tony Murray
55d81fde1e Improve embedded graph title handling (#14544)
* Do not always show graph title.
Setting the default title too early cause the titles to always be shown.
AFAIK, they should only be shown when:
 - title is set by the user or graph itself (not 100% sure)
 - the title variable is set

* Use default for empty titles too

* Don't clean titles so aggressively

* Only show title if explicitly shown

* A little more consistent default titles

* use built-in escape

* Actually show user titles if set
Handle single quotes in title

* initialize title

* $title doesn't need to be nullable
add method getTitle() to always get some text

* Revert incorrect formatting change

* whitespace fix
2022-10-30 23:56:17 -05:00
Tony Murray
4b65dc41d2 Graphing cleanup (#14492)
* WIP

* Fixes and cleanups

* Move parseAtTime to Time util class

* lint fixes, explicitly define variables

* Style fixes
2022-10-28 08:06:29 -05:00
Jellyfrog
be1a2cec50 Miscellaneous fixes, mostly undefined variables (#14432)
* Miscellaneous fixes, mostly undefined variables

* Update phpstan-baseline.neon
2022-10-11 11:30:00 +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
Tony Murray
9fdc213f25 Return GraphImage to include more metadata (#14307)
* Return GraphImage to include more metadata
Allows things like including title.
Implements __toString for backwards compatability
getImageData to allow controlling the output through flags

* Style and Lint
2022-09-06 07:33:57 -05:00
Tony Murray
69d1c2022a SnmpResponse filterBadLines fix (#14306)
Actually filter lines (instead of full responses) with No Such Instance regex
2022-09-06 12:10:29 +02:00