librenms-librenms/html/pages/addsrv.inc.php

44 lines
1.2 KiB
PHP
Raw Normal View History

<?php
2015-07-13 20:10:26 +02:00
if ($_SESSION['userlevel'] < '10') {
include 'includes/error-no-perm.inc.php';
}
2015-07-13 20:10:26 +02:00
else {
if ($vars['addsrv']) {
2015-07-13 20:10:26 +02:00
if ($_SESSION['userlevel'] >= '10') {
$updated = '1';
$service_id = add_service($vars['device'], $vars['type'], $vars['descr'], $vars['ip'], $vars['params'], 0);
2015-07-13 20:10:26 +02:00
if ($service_id) {
$message .= $message_break.'Service added ('.$service_id.')!';
$message_break .= '<br />';
}
}
}
2016-05-19 14:20:42 -05:00
foreach (scandir($config['nagios_plugins']) as $file) {
if (substr($file, 0, 6) === 'check_') {
$check_name = substr($file, 6);
$servicesform .= "<option value='$check_name'>$check_name</option>";
2015-07-13 20:10:26 +02:00
}
}
2015-07-13 20:10:26 +02:00
foreach (dbFetchRows('SELECT * FROM `devices` ORDER BY `hostname`') as $device) {
$devicesform .= "<option value='".$device['device_id']."'>".$device['hostname'].'</option>';
}
2015-05-19 17:18:39 +01:00
2015-07-13 20:10:26 +02:00
if ($updated) {
print_message('Device Settings Saved');
}
2015-05-19 17:18:39 +01:00
2015-07-13 20:10:26 +02:00
$pagetitle[] = 'Add service';
2015-05-19 17:18:39 +01:00
2015-07-13 20:10:26 +02:00
echo "<div class='row'>
<div class='col-sm-6'>";
2015-07-13 20:10:26 +02:00
include_once 'includes/print-service-add.inc.php';
2015-07-13 20:10:26 +02:00
echo '</div>
</div>';
}//end if