Commit Graph

148 Commits

Author SHA1 Message Date
5871ee1c67 fixed get_all_ports() for api (#7829) 2017-11-30 21:29:36 +00:00
f0a908cfb1 api: Add Permission checks to API (#7710)
* Add Permission checks to API

* Consistent API Returns and SQL restrictions on list_devices, list_bills

* Scrut fixes

* Restore global  for graph functions

* Minor fixes following review
2017-11-29 09:42:52 +00:00
c56f04e1e2 fix: Set API log start at 0 rather than 1(#7772) 2017-11-20 15:31:21 +00:00
c9728a1f71 refactor: Refactored authorizers to classes (#7497)
* Refactored authorizers to classes

* Merge changes for #7335

* ! fix php 5.3 incompatibility

* Update ADAuthorizationAuthorizer.php

* Fix get_user -> getUser

* Rename AuthorizerFactory to Auth, fix interface missing functions

* Add phpdocs to all interface methods and normalize the names a bit.

* Re-work auth_test.php AD bind tests to work properly with the new class.
Reflection is not the nicest tool, but I think it is appropriate here.
Handle exceptions more nicely in auth_test.php

* Restore AD getUseList fix

Not sure how it got removed

* fix auth_test.php style
2017-11-18 10:33:03 +00:00
c6a0c9d124 api: Added support for Oxidized asking for a single host (#7705) 2017-11-16 21:21:52 +00:00
00fc5bf0e8 API: Validate columns parameter against fields in table (#7717)
* Validate columns parameter against fields in table

* Removed unused return var

* Replace schema check from DB with yaml

* Style fixes
2017-11-14 09:15:12 -06:00
f8d7ccfe0d feature: Support for up/down detection of ping only devices.
* Added support for ping only devices.

* Renamed sql-schema/206 to 207.

* Discovery tried to detect the OS when it shouldn't.

* Updated db_schema.yaml

* Added ping icon.

* Don't show unused graphs and tabs when SNMP is disabled.

* Allow the user to specify OS of ping only devices.

* Removing custom OS now changes it to 'ping'.

* Removed unnecessary use of mres().

* UI select box for SNMP enable/disable.

* Hide device_ping_perf if ping is disable on device.

* Fixed SNMP settings update status messages.

* Added functionality to add ping only devices via the web ui.

* Added ping only option to addhost.php

* Added ping only support to snmp-scan.py

* Moved sql 208 to 211

* Fixed scrutinizer issues.

* Fixed broken ossearch.

* Added ping only support to the API.

* Updated API doc.

* Added (optional) to OS and hardware description. Hid Port Settings, Applications, Modules, Storage, Processors, Memory and Components from the edit menu

* Style fix.

* Updated ping icon.

* clean() instead of mres(). More escaping. Better help in snmp-scan.py and addhost.php

* Fixed scrutinizer issue.

* Always try SNMP in snmp-scan.py, new option for it in addhost.php. Slice instead of chunk in ajax_ossuggest.php. Other minor style changes.

* Updated sql modifications to insert the new column in the same place as in db_schema.yaml.
2017-10-27 22:59:25 -05:00
348f5012b1 api: Added sysname as filtering group for oxidized (#7485)
* Add sysname as filtering group for oxidized

* Updated Oxidized docs with new filtering option
2017-10-15 19:37:20 +01:00
20aa23508f api: Added simple OSPF API route 2017-09-07 20:04:36 +01:00
1d777693e1 feature: New IP parsing classes. Removes usage of Pear Net_IPv4 and Net_IPv6. (#7106)
* Refactor remove use of pear Net_IPv4 and Net_IPv6

Caution, I added tests to test the functionality of the new functions, but I'm not 100% certain the replaced usages match 100%.  Please test.

Left usage in generate-iplist.php because I'm not sure the use of that script, so I didn't want to implement additional functionality to support it.

Add support for ipv6 fo ipInNetwork() function

Add phpdocs to functions
Remove accidental inclusion

Use binary operations instead of string for networKFromIp()
Tidy up binary operations in ipInNetwork()

tidy parsing cidr network

Change to a class based implementation.

Update phpdocs.
Fully catch exceptions for hex parsing.

Fix mistake.

support older phpunit versions

Fix php shifting to negative with php 5

* Fix graph authorization. Uncaught exception and checking an ipv4 against an ipv6 network == fail.

* Also remove colons from hex strings.

* Fix typo in bgp polling
Two passes of removing invalid characters from hex strings. (That way we don't mangle valid IPs)
2017-08-08 14:14:58 -05:00
fc2041caaf api: Added api routes for eventlog, syslog, alertlog, authlog (#7071) 2017-07-27 19:56:38 +01:00
2ba7093d9c api: Added ability to call get_graph_by_port_hostname() with hostname or id (#6936)
* Fix bug get_graph_by_port_hostname() only hostname

From the documentation:

Function: get_graph_by_port_hostname top
Get a graph of a port for a particular device.

hostname can be either the device hostname or id

But the function is only works with a hostname and not with a ID.
I have modified a few things that solve the problem.

* Update api_functions.inc.php
2017-07-04 22:41:22 +01:00
0fd7f3f5ed Fix for API services bug #6894 (#6895)
* Fixed an issue with the output including all services from a host that had a single matched service  regardless of whether they matched the filter.

* Cleaned up some bits

* Updated based on murrants suggestions

* A couple small cleanups
2017-06-28 01:00:46 -05:00
52fabcb770 api: Add search by os to list_devices (#6861) 2017-06-19 19:49:43 +02:00
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
54deb1d429 fix: API call for graphs not working (#6184) (#6186)
* fix: API call for graphs not working (#6184)

* I agree to the conditions of the Contributor Agreement contained in doc/General/Contributing.md

* updated set_image_type to use new function
2017-03-13 16:39:43 +00:00
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
dc41c0eae1 api: Expose ports in API requests for bills (#6069)
* Expose ports in API requests for bills
2017-03-03 20:40:15 +00:00
bbc7d71cf9 some small updates (#6022) 2017-02-27 14:39:02 +00:00
a8691680ab feature: Added ability to output graphs as svg (#5959)
* feature: Added ability to output graphs as svg

* Update graph.inc.php

* added ability to gzip various files for web servers
2017-02-22 06:08:18 -06:00
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
debb945477 api: Limit get_graph_by_port_hostname() to one port and exclude deleted (#5936) 2017-02-17 21:19:15 +00:00
8b401fd05b api: Added the ability to list devices by location in the api (#5693)
* Adding location based filter for api-device calls

* I agree to the conditions of the Contributor Agreement contained in doc/General/Contributing.md.

* configured linting etc, now pr should pass

* rebase and add entry to docs
2017-02-08 21:57:15 +00:00
7240741b69 web: Added IP and port calls to API 2017-02-07 09:46:09 +00:00
483c40eddd api: Added parent_id to VMs that have a host #3523 (#5621) 2017-01-26 22:38:43 +00:00
9bcb825560 api: Fixed zombie processes when generating graphs (#5597) 2017-01-25 13:16:59 -06:00
6df39b9bbd api: Added support for retrieving health information and graphs #5399 (#5446) 2017-01-19 10:09:20 +00:00
8636a3c3a2 fix: Correction on addHost function to handle the force_add parameter in api (#5329) 2017-01-06 21:47:00 +00:00
4671fb48ab fix: Restrict inventory api calls to the device requested (#5267) 2017-01-01 09:37:28 +00:00
6efdecfd95 fix: support columns filter in get_port_stats_by_port_hostname api call (#5230) 2016-12-23 20:54:13 +00:00
a970a8ddd1 fix: Fix get_port_stats_by_port_hostname() to only return non-deleted ports #5131 2016-12-08 15:40:00 +00:00
32668026a7 api: Added support for updating multiple device table fields in one call #4954 (#5033) 2016-11-26 20:55:24 +00:00
9a33464c52 refactor: Centralize includes and initialization (#4991) 2016-11-21 20:12:59 +00:00
e514e6dc51 fix: api rate percent calculation incorrect (#4956) 2016-11-08 22:26:24 +00:00
d724cb4ea9 Fixed API call to services to return services from all devices 2016-10-25 12:10:42 +02:00
56557f68a4 api: Added additional port stats info like pps, perc and rate (#4759) 2016-10-15 00:42:54 +01:00
8e4be8bbb2 api: Add severity on list alerts API method (#4436)
* Added severity field from the alert rule to the output of list_alerts.

* I agree to the conditions of the Contributor Agreement contained in doc/General/Contributing.md.
2016-09-14 14:29:46 +01:00
8924e954c4 Missing variable in services api call
fix: Missing variable in services api call
2016-08-27 14:46:54 +01:00
8a6ad076e2 Update api_functions.inc.php 2016-08-26 11:45:25 +02:00
feb6696026 tabs to spaces 2016-08-26 10:11:20 +02:00
c873a3556e use space not tabs 2016-08-26 09:26:52 +02:00
0f12c61259 list_services
/services?state = filter by service state
/service?type = filter by service type
2016-08-26 09:19:05 +02:00
b8e9b2d917 Implement an autoloader (#4140)
* Implement an autoloader

When cleaning up classes for psr2, things got a bit unwieldy, so I implemented a class autoloader.
I created a PSR-0 compliant LibreNMS directory and moved all classes there that made sense.
Implemented LibreNMS\ClassLoader which supports adding manual class mappings

This reduces the file includes needed and only loads classes when needed.

* Add teh autoloader to graph.php

* Add a small bit of docs
Fix incomplete class in includes/discovery/functions.inc.php
2016-08-21 14:07:14 +01:00
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
f3fc6f2906 Use Exceptions
Use exceptions for addHost()
Gets rid of silly mixed return and only returns the device_id.  Throwing an exception if we run into any issues.
Slightly modifies api add host output again to include device_id
2016-08-07 12:16:40 -05:00
66bed276c2 Reconstruct addHost() so it is easier to understand
Update addHost() to return either device_id or a string
modify print_error(), print_message() to allow for $quiet variable
Only call addHost() once in addhost.php, if the snmp version isn't set, addHost will cope
Fix up snmp-scan.php and discovery-protocols.inc.php to detect when a device already exists
change in ip_exists() to make it more readable
2016-08-02 00:31:27 -05:00
53a4e0385c Merge pull request #3726 from laf/api-arp 2016-07-10 22:08:21 +02:00
4ad75fb89d create common method for generating type_wheres 2016-06-30 17:05:55 -07:00
laf
0b8f06efa3 Added support for searching for arp entry 2016-06-27 14:48:07 +01:00
5cb9d751c3 Revert "deduping type_where code, adding manual types to graph widgets " 2016-06-07 09:15:04 +01:00