mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
API: System endpoint, more health graphs (#8730)
* API: System endpoint, more health graphs * Add new line api_functions * Get count of relationships Using eloquent * Add new lines in Models
This commit is contained in:
committed by
Tony Murray
parent
57a23a7548
commit
2d7423cdaa
@@ -825,6 +825,30 @@ function list_available_health_graphs()
|
||||
'name' => 'device_'.$graph['sensor_class'],
|
||||
);
|
||||
}
|
||||
$device = \App\Models\Device::find($device_id);
|
||||
|
||||
if ($device) {
|
||||
if ($device->processors()->count() > 0) {
|
||||
array_push($graphs, array(
|
||||
'desc' => 'Processors',
|
||||
'name' => 'device_processor'
|
||||
));
|
||||
}
|
||||
|
||||
if ($device->storage()->count() > 0) {
|
||||
array_push($graphs, array(
|
||||
'desc' => 'Storage',
|
||||
'name' => 'device_storage'
|
||||
));
|
||||
}
|
||||
|
||||
if ($device->mempools()->count() > 0) {
|
||||
array_push($graphs, array(
|
||||
'desc' => 'Memory Pools',
|
||||
'name' => 'device_mempool'
|
||||
));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return api_success($graphs, 'graphs');
|
||||
@@ -2136,3 +2160,14 @@ function add_service_for_host()
|
||||
api_error(500, 'Failed to add the service');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Display Librenms Instance Info
|
||||
*/
|
||||
function server_info()
|
||||
{
|
||||
$versions = version_info();
|
||||
api_success([
|
||||
$versions
|
||||
], 'system');
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user