mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
API: get poller group (#15493)
* API: get poller group * missed string in doc * return all poller groups if name/id aren't specified * add missing doc link * style fixes * more style --------- Co-authored-by: Tony Murray <murraytony@gmail.com>
This commit is contained in:
23
doc/API/PollerGroups.md
Normal file
23
doc/API/PollerGroups.md
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
###`get_poller_group`
|
||||||
|
|
||||||
|
Gets a specific poller group or all if none is specified
|
||||||
|
|
||||||
|
Route: `/api/v0/poller_group/:poller_group`
|
||||||
|
|
||||||
|
- poller_group: optional name or id of the poller group to get
|
||||||
|
|
||||||
|
Output:
|
||||||
|
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"status": "ok",
|
||||||
|
"get_poller_group": [
|
||||||
|
{
|
||||||
|
"id": 1,
|
||||||
|
"group_name": "test",
|
||||||
|
"descr": "test group"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"count": 1
|
||||||
|
}
|
||||||
|
```
|
@@ -21,6 +21,7 @@ use App\Models\Location;
|
|||||||
use App\Models\MplsSap;
|
use App\Models\MplsSap;
|
||||||
use App\Models\MplsService;
|
use App\Models\MplsService;
|
||||||
use App\Models\OspfPort;
|
use App\Models\OspfPort;
|
||||||
|
use App\Models\PollerGroup;
|
||||||
use App\Models\Port;
|
use App\Models\Port;
|
||||||
use App\Models\PortGroup;
|
use App\Models\PortGroup;
|
||||||
use App\Models\PortsFdb;
|
use App\Models\PortsFdb;
|
||||||
@@ -2949,6 +2950,21 @@ function del_location(Illuminate\Http\Request $request)
|
|||||||
return api_error(500, "Failed to delete the location $location");
|
return api_error(500, "Failed to delete the location $location");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function get_poller_group(Illuminate\Http\Request $request)
|
||||||
|
{
|
||||||
|
$poller_group = $request->route('poller_group_id_or_name');
|
||||||
|
if (empty($poller_group)) {
|
||||||
|
return api_success(PollerGroup::get(), 'get_poller_group');
|
||||||
|
}
|
||||||
|
|
||||||
|
$data = ctype_digit($poller_group) ? PollerGroup::find($poller_group) : PollerGroup::where('group_name', $poller_group)->first();
|
||||||
|
if (empty($data)) {
|
||||||
|
return api_error(404, 'Poller Group does not exist');
|
||||||
|
}
|
||||||
|
|
||||||
|
return api_success($data, 'get_poller_group');
|
||||||
|
}
|
||||||
|
|
||||||
function del_service_from_host(Illuminate\Http\Request $request)
|
function del_service_from_host(Illuminate\Http\Request $request)
|
||||||
{
|
{
|
||||||
$service_id = $request->route('id');
|
$service_id = $request->route('id');
|
||||||
|
@@ -231,6 +231,7 @@ nav:
|
|||||||
- Inventory: API/Inventory.md
|
- Inventory: API/Inventory.md
|
||||||
- Locations: API/Locations.md
|
- Locations: API/Locations.md
|
||||||
- Logs: API/Logs.md
|
- Logs: API/Logs.md
|
||||||
|
- PollerGroups: API/PollerGroups.md
|
||||||
- Port_Groups: API/Port_Groups.md
|
- Port_Groups: API/Port_Groups.md
|
||||||
- PortGroups: API/PortGroups.md
|
- PortGroups: API/PortGroups.md
|
||||||
- Ports: API/Ports.md
|
- Ports: API/Ports.md
|
||||||
|
@@ -96,6 +96,8 @@ Route::prefix('v0')->namespace('\App\Api\Controllers')->group(function () {
|
|||||||
Route::patch('services/{id}', 'LegacyApiController@edit_service_for_host')->name('edit_service_for_host');
|
Route::patch('services/{id}', 'LegacyApiController@edit_service_for_host')->name('edit_service_for_host');
|
||||||
Route::post('bgp/{id}', 'LegacyApiController@edit_bgp_descr')->name('edit_bgp_descr');
|
Route::post('bgp/{id}', 'LegacyApiController@edit_bgp_descr')->name('edit_bgp_descr');
|
||||||
Route::post('syslogsink', 'LegacyApiController@post_syslogsink')->name('post_syslogsink');
|
Route::post('syslogsink', 'LegacyApiController@post_syslogsink')->name('post_syslogsink');
|
||||||
|
|
||||||
|
Route::get('poller_group/{poller_group_id_or_name?}', 'LegacyApiController@get_poller_group')->name('get_poller_group');
|
||||||
});
|
});
|
||||||
|
|
||||||
// restricted by access
|
// restricted by access
|
||||||
|
Reference in New Issue
Block a user