mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
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>
This commit is contained in:
committed by
Neil Lathwood
parent
8a9fc7783d
commit
e12e6720f8
@@ -306,3 +306,20 @@ function check_service($command)
|
||||
|
||||
return array ($status, $response, $metrics);
|
||||
}
|
||||
|
||||
/**
|
||||
* List all available services from nagios plugins directory
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
function list_available_services()
|
||||
{
|
||||
global $config;
|
||||
$services = array();
|
||||
foreach (scandir($config['nagios_plugins']) as $file) {
|
||||
if (substr($file, 0, 6) === 'check_') {
|
||||
$services[] = substr($file, 6);
|
||||
}
|
||||
}
|
||||
return $services;
|
||||
}
|
||||
|
Reference in New Issue
Block a user