Commit Graph

62 Commits

Author SHA1 Message Date
Tony Murray
1afc6abdb5
Always return json for api requests (#12335)
even if the client does not properly request it
2020-11-22 03:21:47 +01:00
Jellyfrog
b7676e4cc8
Update to Composer 2 (#12263)
* Update to Composer 2

No need to roll our own checks anymore since this is now built in.
Also limit the update check to once a week.

* update

* Make Composer wrapper report correct exit code

* Update composer_wrapper.php

* re-enable extension check

Co-authored-by: Tony Murray <murraytony@gmail.com>
2020-11-09 00:28:07 -06: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
Tony Murray
89fae9be1d
Move API routing to Laravel (#10457)
* Add more api helper functions
to centralize code more

* Enable cors

* Initial Legacy route in Laravel

* Force api v0 responses to json
Add a couple more routes

* more paths, pretty print the json response
pass parameters to the api function

* devices basic functions

* Port generic graph function
check permissions function accepts callback to avoid lots of if statements

* move vlans

* links

* graphs

* fdb

* health

* wireless

* port graphs

* ip functions
split em up

* port_stack

* components

* compoment add/edit/delete

* get_device_groups

* port stats

* port graphs

* get_devices_by_group

* port_groups

* api_get_graph

* show_endpoints

* get_bill

* get_bill_graph

* get_bill_graphdata

* get_bill_history

* get_bill_history_graph

* remaining bill functions

* list_alerts

* ack/unmute alert

* Some cleanups

* Some cleanups

* list_alert_rules

* alert rule add/edit/delete

* inventory

* list_cbgp

* vrf

* list_ipsec

* list_fdb

* list_links (fix both usages)

* list_locations

* list_locations

* list_vlans

* list_ip_addresses

* list_arp

* list_ip_networks

* cleanup

* services

* list_logs and fix authlog.......

* cleanup

* cleanup 2

* remove slim

* don't load schema more than once

* basic test

* fix style

* downgrade laravel-cors to a version that supports PHP 7.1
2019-07-29 16:32:37 -05:00
Tony Murray
1ad7f3138b
Add Laravel to LibreNMS (#8318)
* Add Laravel to LibreNMS.

* Try to set permissions during initial install and first composer update to Laravel.

* Fix composer.lock
Fix missing db config keys

* Start building v1 layout
Port ajax_setresolution, inject csrf into jquery ajax calls
Layout works, building menu
Partially done.

* Fix device group list
remove stupid count relationships

* Print messages for common boot errors.
Don't log to laravel.log file.
Log to error_log until booted, then librenms.log

* Fix up some issues with Config loading
Start of custom directives

* Custom blade directives: config, notconfig, admin

* Preflight checks
Only load config files once.

* Update the composer.lock for php 5.6

* Menu through routing

* Start of alert menu

* Better alert scopes

* reduce cruft in models

* Alerting menu more or less working :D

* Fix style

* Improved preflight

* Fix chicken-eggs!

* Remove examples

* Better alert_rule status queries
Debugbar

* fix app.env check

* User Menu

* Settings bar (dropped refresh)
Search JS

* Toastr messages

* Rename preflight

* Use hasAccess(User) on most models.
Add port counts

* Missed a Preflight -> Checks rename

* Fix some formatting

* Boot Eloquent outside of Laravel
Use Eloquent for Config and Plugins so we don't have to connect with dbFacile inside Laravel.
Move locate_binary() into Config class

* Config WIP

* Try to fix a lot of config loading issues.

* Improve menu for non-admins removing unneeded menus
url() for all in menu

* Only use eloquent if it exists

* Include APP_URL in initial .env settings

* Implement Legacy User Provider

* Helper class for using Eloquent outside of Laravel.
Allows access to DB style queries too and checking the connection status.

* Fix up tests

* Fix device groups query

* Checking Travis

* copy config.test.php earlier

* dbFacile check config before connecting
Don't use exception to check if eloquent is connected, it gets grabbed by the exception handler.
Ignore missing config.php error.

* Fix config load with database is not migrated yet.

* Remove Config::load() from early boot.

* Use laravel config settings to init db (this prefers .env settings)
Fix bgp vars not set in menu
add _ide_helper.php to .gitignore

* Restrict dependencies to versions that support php 5.6

* Update ConfigTest

* Fix a couple of installation issues

* Add unique NODE_ID to .env

* Correct handling of title image

* Fix database config not loading. Thanks @laf

* Don't prepend /

* add class_exists checks for development service providers

* Fix config value casting

* Don't use functions that may not exist

* Update dbFacile.php

* d_echo may not be defined when Config used called.

* Add SELinux configuration steps
More detailed permissions check.
Check all and give complete corrective commands in one step.

* Ignore node_modules directory

* Re-add accidetal removal
2018-05-09 08:05:17 -05:00
Nils Büchner
59f99f1962 api: Added routes to delete,add/edit traffic bills (#8272)
* add API calls to delete,add/edit traffic bills

* scrutinizer fixes

* app needed

* explicitly use === null

* requested changes
2018-02-27 19:51:29 +00:00
Richard Lawley
10829893ec api: Added Billing Graphs & Data (#8245)
* Move Billing/Bandwidth Graphs to common format, extract data generation to central function

* Add API functions to access billing graphs and graph data

* Scrutinizer fixes

* Fix transfer graphs with from/to

* Scrutinizer Fix

* Fix docs, transfer page and missing from API param

* Document and fix reducefactor, Add Graph Stats to Graph Data

* Standardise times in graphdata

* Fixed renamed function for History GraphData
2018-02-20 14:57:56 +00:00
Richard Lawley
2018c9f804 api: Added History to Billing API Functions (#8209)
* Add Previous Period options to Bill API functions

* Add Bill History API Functions
2018-02-09 21:14:55 +00:00
Rémy Jacquin
e12e6720f8 api: Added add_service_for_host endpoint to API (#8113)
* Add add_service_for_host endpoint to API

Signed-off-by: Rémy Jacquin <remy@remyj.fr>

* Change permissions to allow users to modify device

Signed-off-by: Rémy Jacquin <remy@remyj.fr>
2018-01-21 19:56:57 +00:00
Misha Komarovskiy
06c46765f2 api: Added API calls for routing and resources management (#8017)
* api: Added API call for VRF listing

Signed-off-by: Misha Komarovskiy <zombah@gmail.com>

* api: Added API call to retrive VRF by ID

Signed-off-by: Misha Komarovskiy <zombah@gmail.com>

* api: Change list_vrf permissions

Signed-off-by: Misha Komarovskiy <zombah@gmail.com>

* api: Added new api calls for routing and resources mgmt

* This commit includes list_cbgp, list_vlans,
list_ip_addresses, list_ip_networks and
get_network_ip_addresses calls

Signed-off-by: Misha Komarovskiy <zombah@gmail.com>

* fix: Correct indentation issue in get_ip_addresses

Signed-off-by: Misha Komarovskiy <zombah@gmail.com>

* api: Fix per device permissions and messages

Signed-off-by: Misha Komarovskiy <zombah@gmail.com>

* Fix identation issues

Signed-off-by: Misha Komarovskiy <zombah@gmail.com>

* api: Remove excessive result counters

Signed-off-by: Misha Komarovskiy <zombah@gmail.com>

* api: Add list_locations api call

* Get devices by location not very comfortable
without list all locations api call

Signed-off-by: Misha Komarovskiy <zombah@gmail.com>

* Spelling fix

Signed-off-by: Misha Komarovskiy <zombah@gmail.com>
2018-01-18 15:43:15 +00:00
Neil Lathwood
e2f122aac8
api: Added 404 fallback for bad / invalid calls (#7952) 2018-01-06 23:34:00 +00:00
Thom Seddon
d6d4a3a69a api: Added API method to rename devices (#7895) 2017-12-19 09:32:31 +00:00
Neil Lathwood
daa0773f48
api: Added support for wireless sensors (#7846)
* api: Added support for wireless sensors

* Added docs for new api calls
2017-12-06 22:27:30 +00:00
Lee Spottiswood
e3082873f6 api: Added retrieve BGP sessions by ID (#7825)
* add support for retrieving BGP sessions via id

* fix syntax, use router params

* use count properly

* add get_bgp docs

* streamlined get_bgp sql query
2017-11-30 22:51:20 +00:00
Neil Lathwood
c6a0c9d124
api: Added support for Oxidized asking for a single host (#7705) 2017-11-16 21:21:52 +00:00
Neil Lathwood
1be550826e api: Added ability to supports CORS for API (#7357)
* Update defaults.inc.php

* api: Added ability to supports CORS for API

* added acknowledge

* Update Configuration.md
2017-09-21 18:07:31 +01:00
Thom Seddon
20aa23508f api: Added simple OSPF API route 2017-09-07 20:04:36 +01:00
Neil Lathwood
fc2041caaf api: Added api routes for eventlog, syslog, alertlog, authlog (#7071) 2017-07-27 19:56:38 +01:00
Tony Murray
4ab358501d api: API allow cidr network searches of the ARP table (#6378)
* api: API allow cidr network searches of the ARP table

* Allow non-encoded / in request
I also noticed that all is allowed to be called without device, which the sql query does not support.
2017-04-07 21:05:46 +01:00
Neil Lathwood
014682b60b api: Added new route for multiport bit graphs + asn list_bgp filter (#6129)
* api: Added new route for multiport bit graphs + asn list_bgp filter

* fixed scrut errors
2017-03-12 21:17:09 -05:00
William George
7240741b69 web: Added IP and port calls to API 2017-02-07 09:46:09 +00:00
Neil Lathwood
6df39b9bbd api: Added support for retrieving health information and graphs #5399 (#5446) 2017-01-19 10:09:20 +00:00
Tony Murray
e20a242785 refactor: use Composer to manage php dependencies (#5216) 2017-01-01 09:37:15 +00:00
Tony Murray
9a33464c52 refactor: Centralize includes and initialization (#4991) 2016-11-21 20:12:59 +00:00
nerdalertdk
4db541cc32 tabs to spaces 2016-08-26 10:10:29 +02:00
nerdalertdk
d26a1ff2a8 Get services from API
/services = list all services
/services/:hostname = get services by host
2016-08-26 09:17:01 +02:00
Tony Murray
8c639aa5a4 PSR2 Cleanup: /html edition
Travis tests for code conformance. Ignore warnings for now.
Fixed all errors, left most warnings.
2016-08-18 21:29:30 -05:00
Tony Murray
bf2c522c89 Move third party software to html/lib form html/includes 2016-08-15 13:16:10 -05:00
laf
0b8f06efa3 Added support for searching for arp entry 2016-06-27 14:48:07 +01:00
laf
78204f3971 Added api call for ipsec tunnels 2016-04-22 13:41:38 +00:00
jnewell
e40042bd5c Added device/port_stack API endpoint 2016-04-05 13:03:17 -07:00
Aaron Daniels
9706a85454 - Added add, edit and delete API calls for components.
- Added documentation for the new calls.
2016-03-30 17:16:14 +10:00
Aaron Daniels
6286d7cb6a Merge branch 'master' of https://github.com/adaniels21487/librenms into issue-1650
Conflicts:
	html/api_v0.php
	html/includes/api_functions.inc.php
2015-12-22 11:16:54 +10:00
Aaron Daniels
c63b7119cb Device Components.
The purpose of this feature is to provide a framework for discovery modules to store
information in the database, without needing to add new tables for each feature.

This Feature provides:
- A database structure to store data.
- An API to store and retrieve data from the database.
- Integration to the LibreNMS APIv0.
- Ability to disable/ignore components.
- Default alerting rules.

- The API returns $COMPONENT[$device_id][$component_id] to allow pulling of data for multiple devices.
  The intent is to be able to create 'Applications' the consolidate data from applications covering multiple devices.
- Added some developer documentation
2015-12-14 07:52:03 +10: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
977cdd558d Added API route to update devices columns in DB 2015-12-08 22:53:52 +00:00
PandaWawawa
060926571a Adding route 2015-10-08 17:00:22 +02:00
Job Snijders
d8693f05ae Fix coding style part 2 2015-07-15 11:04:22 +02:00
laf
f5d02ab18d Added API to feed into Oxidized 2015-05-07 00:32:58 +01:00
laf
28724cbae1 Added inventory endpoint to API 2015-03-23 15:15:05 +00:00
laf
c1ef9b6808 Resolved a large number index issues and update Console_Color to V2 2015-03-01 18:04:57 +00:00
Neil Lathwood
b6d935e608 API for alerting 2014-12-16 20:39:58 +00:00
laf
a152f3566e Fixed API route order to resolve get_port_graphs working 2014-12-12 19:35:49 +00:00
laf
1108ef7939 Added new api route for billing 2014-12-02 23:43:11 +00:00
Paul Gear
05d998c1f8 Merge remote-tracking branch 'laf/issue-laf-90'
Conflicts:
	html/api_v0.php
	html/includes/api_functions.inc.php
2014-12-01 20:27:50 +00:00
laf
1a3f5504d0 Added new API route to obtain available ports for a device 2014-11-30 15:45:10 +00:00
laf
4d7b4ef432 Added new route for retrieving available device graphs 2014-11-29 15:43:19 +00:00
Paul Gear
9930670119 Tidy API entry points & doc; error if something other than image/png is asked for from portgroup graphs 2014-11-25 21:45:15 +10:00