Commit Graph

33 Commits

Author SHA1 Message Date
Jellyfrog
071ca9bc2a Apply fixes from StyleCI (#15698)
Co-authored-by: StyleCI Bot <bot@styleci.io>
2024-01-04 22:39:12 -06:00
Wheel
f0bbab2419 Minor fix and tweak for graylog integration (#15455)
* Minor fix and tweak for graylog integration

* More flexible in other use cases

* fix again?
2023-11-01 22:35:44 -05:00
Hans Erasmus
4fc27d98e9 Another OR statement in GrayLog API (#15246)
* Another OR statement in GL-api

* try again to fix linting issue

* yet more linting issues

* Cannot fix me being an idiot
2023-08-25 07:56:29 -05:00
Tony Murray
77fc6a34df Graylog API properly throw errors (#15188)
* Graylog API properly throw errors
remove unused legacy graylog code

* Add type casts
2023-08-02 19:59:53 -05: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
Skylark
02e78aab1d Fix for RIPE NCC API Tools (#14757) 2022-12-24 22:36:26 +00:00
Tony Murray
752bbc1531 Port search API search more than one fields (#14646)
* Fix port search columns

* Port search API search more than one fields
Fixup port APIs
Change validate_column_list api helper to throw a renderable exception on error and return the valid columns
DeviceCache::get() can handle a bigger range of input

* whitespace

* Refactor exceptions a bit

* change throws type to be more generic

* Lint fixes
2022-11-18 16:27:56 -06:00
Jellyfrog
f411c1a6a7 Fix GeocodingHelper type-hinting (#14604)
* Fix GeocodingHelper type-hinting

* Update GeocodingHelper.php
2022-11-09 10:10:04 -06:00
Tony Murray
e938458cde Fix BaseApi uninitialized (#14557) 2022-11-02 09:02:52 -05:00
Félix Bouynot
3a61955658 Fix Type error (#14555)
Fix production.ERROR: Typed property App\ApiClients\BaseApi::$client must not be accessed before initialization
cf. https://stackoverflow.com/a/59265626/3236342
2022-11-02 14:40:05 +01:00
Félix Bouynot
b59cf980ca Type API methods and properties (#14476)
* Type properties

* Comment method

* Update base_uri child property

* Update BingApi.php

* Update GoogleMapsApi.php

* Update MapquestApi.php

* Update NominatimApi.php

* Update RipeApi.php

* Update phpstan-baseline.neon

* Update phpstan-baseline.neon

* Fix indent

* Fix escaping

* Update phpstan-baseline.neon

* Update phpstan-baseline.neon

* Update phpstan-baseline.neon

* Update phpstan-baseline.neon

* Update phpstan-baseline.neon

* Update phpstan-baseline.neon

* Update phpstan-baseline.neon

* Update phpstan-baseline.neon

* StyleCI indent

* Update phpstan-baseline.neon

* Make possible for $client to be null

* Remove comments

* Remove comments

* Remove comments

* Update MapquestApi.php

* Update NominatimApi.php

* Remove comments

* Remove comments

* $base_uri not nullable

* $base_uri not nullable

* $base_uri not nullable

* $base_uri not nullable

* $base_uri not nullable

* $base_uri not nullable

* Type method and properties

* Type method and properties

* Type method and properties

* Type method and properties

* Type method and properties

* Type method and properties

* Type $client

* Type method and properties

* Remove errors not matched anymore

* Fix type errors in graylogapi

* Mixed can't be ORed

* uri never null

* Update app/ApiClients/GraylogApi.php

* Fix getAdresses Type

* Collection changed its folder?

* Fix directory, there was just a backslash missing

Co-authored-by: Tony Murray <murraytony@gmail.com>
2022-11-02 01:06:15 +01:00
Félix Bouynot
333ba7c2cd Fix oxidized web requests unclosed connections or responding fast enough (#14370)
* Fix oxidized web requests not closing connections or responding fast enough

* Update showconfig.inc.php

* Add method to get the text content of an oxidized page

* Use Oxidized getContent method instead of file_get_content

* Too much brackets with copy paste

* Fix carriage return errors because of copy paste

* Fix copy paste error again

* Fix indent

* PHPStan is waiting for a return even outside of the if loop

* Single quotes

* Variabilize timeout in baseapi

* Set Oxidized Api class timeout var to 90 because oxidized is slow and to be sure not to break half the installs here

* fix typo

* Variabilize timeout

* Variabilize timeout

* Variabilize timeout

* Variabilize timeout

* Variabilize timeout

* Spacing

* Remove timeout type because of this error

Unexpected 'int' (T_STRING), expecting function (T_FUNCTION) or const (T_CONST) in app/ApiClients/BaseApi.php on line 34

* Lint needs type finally

* Use contruct instead of setting variable

* Type hinting instead for php7.3

* Type hinting fix

* Set property value instead of calling parent constructor

* Typo

* Remove unneededconstructors

* Remove unneeded constructors

* Remove unneeded constructors

* Remove unneeded constructors

* Remove unneeded constructors

* Remove unneeded constructors

* Typing not casting

* Typing not casting

* Cannot type variables outside of a class

Co-authored-by: PipoCanaja <38363551+PipoCanaja@users.noreply.github.com>
2022-09-24 14:24:11 -05:00
Félix Bouynot
9cff8acb29 Match displayname source for graylog (#14339)
* Match displayname source for graylog

* Update GraylogApi.php

* Reorder addresses
2022-09-13 07:44:19 -05:00
Jellyfrog
5ffbceb7e8 Regression fix from b6a8b602b8 for location population (#13819) 2022-03-02 23:37:52 +00: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
258505ed44 Apply fixes from StyleCI (#13224) 2021-09-10 20:09:53 +02:00
Jellyfrog
26b95c0ccc Apply fixes from StyleCI (#13208) 2021-09-08 23:35:56 +02:00
Jellyfrog
3cfffb9912 Cleanups (#12642)
Should only be cosmetic
2021-03-24 09:13:43 -05:00
Jellyfrog
800ae95b90 Cleanup (#12641) 2021-03-23 08:47:38 -05: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
Jellyfrog
29f45ca352 Apply fixes from StyleCI (#12124) 2020-09-21 15:59:34 +02:00
Jellyfrog
0d56bbd946 Apply fixes from StyleCI (#12123) 2020-09-21 15:51:53 +02:00
Jellyfrog
77c531527c Apply fixes from StyleCI (#12117)
* Apply fixes from StyleCI

* Disable style check
2020-09-21 14:54:51 +02:00
Jellyfrog
d8eb3ab90e Fix timeout typo in apiclients (#10615) 2019-09-21 00:49:14 +00:00
rsys-dev
89e00aa4b4 Added Spaces in implode because missing spaces can cause unexpected search results in graylog tables (#10583) 2019-09-06 04:20:29 +00:00
rsys-dev
a79837aada Bug: Fixed Incorrect device match in Graylog (#10501)
* Incorrect device match fixed. Because getAddresses(Device $device) also returned 127.0.0.1 and ::1,
always matched the first device with a loopback address. Introduced in
https://github.com/librenms/librenms/pull/10458

* Changed code as suggested by murrant
Expanded ::1 because IPv6 Adresses are not stored compressed.

* Fixed incorrect parenthesis
2019-08-09 07:52:43 -05:00
rsys-dev
6394c35ce6 Graylog entry matching device if source is not hostname or primary ip (#10458)
* Added findByHostnameOrIp($hostnameOrIp) for devices.
    Returns Device or null
Fixed Graylog device links, "device" parameter in URL was IP or Hostname instead of device id before
Added Severity number to name conversion. Can be activated by setting $config['graylog']['severity-names'] = "true" in config
Added Facility number to name conversion. Can be activated by setting $config['graylog']['facility-names'] = "true" in config

* Added $config['graylog']['match-any-address']. To enable matching Graylog entries by any interface address set to "true"
Added code to match Graylog entries by any interface address instead of only hostname or primary address

* Fixed missing quotation marks in <script> block in includes/html/common/graylog.inc.php:46, causing graylog page only load header with empty table. Introduced in https://github.com/librenms/librenms/pull/10447

* Modified code to reduce complexity as mentioned by codeclimate

* Changed findByHostnameOrIp($hostnameOrIp) as mentioned by https://github.com/murrant

* Added Language File "syslog.php" for Syslog Severity and Facility
Merged functions "levelName($level)" and "facilityName($facility)" to "syslogPrioParser($type, $value)" where $type should be "facility" or "severity" and $value the numeric or text facility or severity. Returns "NUMBER (NAME)" if possible, otherwhise returns $value

* Shortened findByHostnameOrIp($hostnameOrIp) as mentioned by https://github.com/murrant

* Add shortcut ipv4 and ipv6 device relationships
Better code for adding source addresses
Only translate level and facility if they are numeric
Allow level and facility to be sortable
No need for device link if we know it won't work.  Before the code was punting to save sql queries.

* Cache devices
Took queries from 69 to 6 in my quick test.

* Added Documentation for $config['graylog']['match-any-address']

* Fixed missing quotation marks in app/ApiClients/GraylogApi.php:125
2019-07-26 15:13:35 -05:00
Tony Murray
478c1a6070 Remove accidentally left in dd() 2019-02-18 11:48:01 -06:00
Tony Murray
ce6fae8dd1 Rewrite netcmd and ripe whois tools (#9724)
* Port RIPE whois to Laravel

* remove netcmd.php and port to laravel.
Escape CLI and set it to stream output live.

* fix browser buffer bust on a few browsers.
2019-01-25 15:30:58 -06:00
Franck Zoccolo
114b3b36fe Update GraylogApi.php (#9617)
Fix the following exception, occurring when device known IP address is different than the one returned by gethostbyname() function call.

production.ERROR: ErrorException: Array to string conversion in /opt/librenms/app/ApiClients/GraylogApi.php:128
2019-01-06 20:51:26 -06:00
Tony Murray
74882e3950 Dashboard widget update (#9515)
Implemented in Laravel
Doesn't use legacy PHP session
Several widgets have new features and settings, for example:

- Multiple ports in one graph
- Maps settings are configurable and override system settings but default to system settings
- Graylog stream and/or device selection
- Much improved graph widget selection
- Many more

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 21:18:17 +00:00
Tony Murray
957ecc2441 Locations UI and editing (#9480)
* Better handling of errors
Mapquest seems to return the center of the US on error.......

* Editable locations WIP

* Change to bootgrid ajax table WIP

* Graphs working, using handlebars
update js libs
add current location button

* remove sql query, change icon

* Add the map to the device view, only when gps is expanded.
Allow edit on device page, share js code

* fix chevron rotation, improve click area

* extra warning

* fix overview layout (remove containers)

* fix style

* fix html divs, change collapse ui a bit
move css, update css/js versions

* start zoomed out on new locations

* don't double load scripts, zoom to 17

* fix php-md errors, remove unused use statement

* improve non-admin experience

* Move locations page to Laravel
More functions in Url and Html util classes
reduce code duplication

* translation buttons too

* fix whitespace

* move formatters to the frontend

* small changes

* disable traffic for locations with no devices

* change down 0 to green from gray

* missing "

* Fix paginate all

* working fix for paginate all

* allow sort by counts

* fix down sort

* a little safety

* Don't call the function twice

* btn-xs
2018-11-29 19:23:40 -06:00
Tony Murray
3e35ee0e7d Refactored and update Location Geocoding (#9359)
- Fix location so it is a regular database relation (this allows multiple devices to be accurately linked to one location and saves api calls)
- Parse coordinates from the location more consistently
- Add settings to webui
- ~~Used [PHP Geocoder](http://geocoder-php.org/), which has lots of backends and is well tested. (also includes reverse and geoip)~~
- Google Maps, Bing, Mapquest, and OpenStreetMap supported initially.
- Default to OpenStreetMap, which doesn't require a key.  They will liberally hand out bans if you exceed 1 query per second though.
- All other Geocoding APIs require an API key. (Google requires a credit card on file, but seems to be the most accurate)
- Update all (I think) sql queries to handle the new structure
- Remove final vestiges of override_sysLocation as a device attribute
- Update existing device groups and rules in DB
- Tested all APIs with good/bad location, no/bad/good key, and no connection.
- Cannot fix advanced queries that use location

This blocks #8868

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-11-28 22:49:18 +00:00