List service plugins alphabetically.

This commit is contained in:
Tony Murray
2016-05-19 14:20:42 -05:00
parent ebcbd1815d
commit 4920c39dfd
2 changed files with 8 additions and 15 deletions

View File

@@ -16,15 +16,11 @@ else {
}
}
if ($handle = opendir($config['nagios_plugins'])) {
while (false !== ($file = readdir($handle))) {
if ($file != '.' && $file != '..' && !strstr($file, '.') && strstr($file, 'check_')) {
list(,$check_name) = explode('_',$file,2);
$servicesform .= "<option value='$check_name'>$check_name</option>";
}
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>";
}
closedir($handle);
}
foreach (dbFetchRows('SELECT * FROM `devices` ORDER BY `hostname`') as $device) {

View File

@@ -14,14 +14,11 @@ if (is_admin() === true || is_read() === true) {
}
// Build the types list.
if ($handle = opendir($config['nagios_plugins'])) {
while (false !== ($file = readdir($handle))) {
if ($file != '.' && $file != '..' && !strstr($file, '.') && strstr($file, 'check_')) {
list(,$check_name) = explode('_',$file,2);
$servicesform .= "<option value='$check_name'>$check_name</option>";
}
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>";
}
closedir($handle);
}
$dev = device_by_id_cache($device['device_id']);