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:
Paul Heinrichs
2018-05-19 00:36:06 -04:00
committed by Tony Murray
parent 57a23a7548
commit 2d7423cdaa
7 changed files with 115 additions and 0 deletions

View File

@@ -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');
}