Commit Graph

30 Commits

Author SHA1 Message Date
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
Tony Murray
e9ff8c48b6 Fixed IN db queries (#9077)
Most were fine as they hardcoded the in into the query.
Change them all to use PDO properly.
Did not fix IRCBot, they are are all hardcoded.

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-08-26 13:42:21 +01:00
Tony Murray
eeb3d58f5b Improved Logging and Debugging (#8870)
Use Log facility when Laravel is booted.
Update init.php so we can easily boot Laravel for CLI scripts. (and just Eloquent, but that may go away)
Move all debug setup into set_debug() function and use that across all scripts.
Log Laravel database queries.
Send debug output to librenms log file when enabling debug in the webui.
Allow for colorized Log CLI output. (currently will leave % tags in log file output)

** Needs testing and perhaps tweaking still.

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-07-13 23:08:00 +01:00
Neil Lathwood
bbc7d71cf9 some small updates (#6022) 2017-02-27 14:39:02 +00:00
gilrim
1c9cbc42f5 api: Add ability to return all device info for get_devices_by_group() (#5971)
* Changed GetDevicesFromGroup to output all columns if  is defined in url
2017-02-22 09:37:40 +00:00
Tony Murray
02b84cf3f7 Support device group definitions from v2 (#4591)
* Support device group definitions from v2
Disable editing v2 groups.

V2 Device groups are defined as follows:
pattern = WHERE query with ? placeholders for values
params = json encoded array of values

* Can't array_unshift something that isn't an array...
2016-09-27 17:50:52 +01:00
Tony Murray
c48b71d0af Remove external uses of GenGroupSQL() 2016-09-18 19:08:33 -05:00
Tony Murray
9284bc60ff Update code in includes to be PSR-2 compliant (#4220)
refactor: Update code in /includes to be psr2 compliant #4220
2016-08-28 18:32:58 +01:00
Florian Beer
a50bb344ed This probably can be deleted since it was wrong 2016-08-09 02:57:45 +02:00
Florian Beer
84f695e372 Fix: Failed opening file for inclusion 2016-08-07 15:39:30 +02:00
Tony Murray
c4c98128d6 Fix device group search 2016-07-06 17:13:13 -05:00
Neil Lathwood
6665fd8f95 Merge pull request #3700 from f0o/issue-3683
Fixed Device-Groups for multiple entries and glue-expansion
2016-07-05 09:09:09 +01:00
f0o
0f161921b9
Fix lookup syntax 2016-07-02 06:44:49 +00:00
f0o
21a0a18055
Fixed Device-Groups for multiple entries and glue-expansion 2016-06-22 08:42:48 +00:00
laf
a05cfbe9fb Removed global $debug line 2016-06-21 19:34:13 +01:00
laf
a194009917 Pretty up the polling process output 2016-06-21 01:41:45 +01:00
Tony Murray
009840bf8a Store device group relationships in a pivot table. 2016-06-02 13:25:01 -05:00
laf
d5b6e0e8da Updated device-groups functions to support returning all data or just group id 2015-12-13 17:20:34 +00:00
laf
a73a997edc Added API call for listing devices by groups 2015-12-12 13:47:44 +00:00
laf
62b4c21a12 Added API calls for device groups 2015-12-12 12:58:07 +00:00
laf
d153cf4d6b Strip && and || from query for alerts in polling 2015-11-19 08:40:49 +00:00
Daniel Preussker
03e8eacbfd Revert "Remove last logical operator from generated SQL in GenGroupSQL" 2015-11-21 09:23:17 +01:00
Thom Seddon
05d60936e6 Remove last logical operator from generated SQL in GenGroupSQL
Previously this function would output invalid SQL as a logical
operator would be included after every condition. This change
removes the final logical operator so the SQL is valid.

For example, previously the single rule:
`bgpPeers.bgpPeerRemoteAs = "6939" &&"`

Would generate:
```
SELECT DISTINCT(bgpPeers.device_id) FROM bgpPeers WHERE device_id=? && (bgpPeers.bgpPeerRemoteAs = "6939" &&) LIMIT 1
```

This changes means it will generate:
```
SELECT DISTINCT(bgpPeers.device_id) FROM bgpPeers WHERE device_id=? && (bgpPeers.bgpPeerRemoteAs = "6939") LIMIT 1
```
2015-11-20 14:58:21 +00:00
f0o
407afd022a
Add RegEx support to alert rules and device groups 2015-09-26 17:30:19 +00:00
David M. Syzdek
b5db25c436 Adding ORDER BY so device groups are sorted by name instead of creation.
Currently the function for retrieving device_groups returns rows in the order
in which they were created.  This causes the WebUI to display is a semi-random
order.  This patch causes the devices to be sorted by name which makes the
group lists easier to navigate.
2015-08-03 15:18:21 -08:00
f0o
89caa7758f
Added DeviceGroup-Macros 2015-07-15 19:56:18 +00:00
Job Snijders
d8693f05ae Fix coding style part 2 2015-07-15 11:04:22 +02:00
laf
4bef35c90a Now save the connection value selected and remove when not needed 2015-06-27 17:41:31 +01:00
f0o
c75d00a5af
Updated Device-Group SQL-Update 2015-04-20 16:44:01 +00:00
f0o
ba99eb25a2 Device-Groups Draft 2015-04-03 18:22:29 +00:00