2010-06-20 17:21:35 +00:00
|
|
|
<?php
|
|
|
|
|
|
2019-08-05 14:16:05 -05:00
|
|
|
if (Auth::user()->hasGlobalRead()) {
|
2016-03-16 08:37:15 +10:00
|
|
|
if ($vars['addsrv']) {
|
2019-08-05 14:16:05 -05:00
|
|
|
if (Auth::user()->hasGlobalAdmin()) {
|
2016-03-15 22:16:08 +10:00
|
|
|
$updated = '1';
|
2010-06-20 17:21:35 +00:00
|
|
|
|
2016-03-22 07:35:39 +10:00
|
|
|
$service_id = add_service($vars['device'], $vars['type'], $vars['descr'], $vars['ip'], $vars['params'], 0);
|
2016-03-15 22:16:08 +10:00
|
|
|
if ($service_id) {
|
|
|
|
|
$message .= $message_break.'Service added ('.$service_id.')!';
|
|
|
|
|
$message_break .= '<br />';
|
|
|
|
|
}
|
2015-05-19 17:18:39 +01:00
|
|
|
}
|
|
|
|
|
}
|
2010-06-20 17:21:35 +00:00
|
|
|
|
2016-03-15 22:16:08 +10:00
|
|
|
// Build the types list.
|
2019-06-23 00:29:12 -05:00
|
|
|
foreach (scandir(\LibreNMS\Config::get('nagios_plugins')) as $file) {
|
2016-05-19 14:20:42 -05:00
|
|
|
if (substr($file, 0, 6) === 'check_') {
|
|
|
|
|
$check_name = substr($file, 6);
|
|
|
|
|
$servicesform .= "<option value='$check_name'>$check_name</option>";
|
2015-05-19 17:18:39 +01:00
|
|
|
}
|
|
|
|
|
}
|
2011-03-16 12:12:10 +00:00
|
|
|
|
2015-07-13 20:10:26 +02:00
|
|
|
$dev = device_by_id_cache($device['device_id']);
|
|
|
|
|
$devicesform = "<option value='".$dev['device_id']."'>".$dev['hostname'].'</option>';
|
2011-03-16 12:12:10 +00:00
|
|
|
|
2015-05-19 17:18:39 +01:00
|
|
|
if ($updated) {
|
2015-07-13 20:10:26 +02:00
|
|
|
print_message('Device Settings Saved');
|
2015-05-19 17:18:39 +01:00
|
|
|
}
|
2010-06-20 17:21:35 +00:00
|
|
|
|
2015-05-19 17:18:39 +01:00
|
|
|
echo '<div class="col-sm-6">';
|
2011-03-16 12:12:10 +00:00
|
|
|
|
2019-04-11 23:26:42 -05:00
|
|
|
include_once 'includes/html/print-service-add.inc.php';
|
2016-08-18 20:28:22 -05:00
|
|
|
} else {
|
2019-04-11 23:26:42 -05:00
|
|
|
include 'includes/html/error-no-perm.inc.php';
|
2015-07-13 20:10:26 +02:00
|
|
|
}
|