foreach ($bins as $bin) { if (!is_file($config[$bin])) { print_fail("{$bin} location is incorrect or bin not installed"); } } $disabled_functions = explode(',', ini_get('disable_functions')); $required_functions = array('exec', 'passthru', 'shell_exec', 'escapeshellarg', 'escapeshellcmd', 'proc_close', 'proc_open', 'popen'); foreach ($required_functions as $function) { if (in_array($function, $disabled_functions)) { print_fail("{$function} is disabled in php.ini"); } } if (!function_exists('openssl_random_pseudo_bytes')) { print_warn("openssl_random_pseudo_bytes is not being used for user password hashing. This is a recommended function (https://secure.php.net/openssl_random_pseudo_bytes)"); if (!is_readable('/dev/urandom')) { print_warn("It also looks like we can't use /dev/urandom for user password hashing. We will fall back to generating our own hash - be warned"); } } // Modules test $modules = explode(',', $options['m']); foreach ($modules as $module) { switch ($module) { case 'mail': if ($config['alert']['transports']['mail'] === true) { $run_test = 1; if (empty($config['alert']['default_mail'])) { print_fail('default_mail config option needs to be specified to test email'); $run_test = 0; } else { if ($config['email_backend'] == 'sendmail') { if (empty($config['email_sendmail_path'])) {
if (!$config['rrdcached']) { $rrd_dir = stat($config['rrd_dir']); if ($rrd_dir[4] == 0 || $rrd_dir[5] == 0) { print_warn('Your RRD directory is owned by root, please consider changing over to user a non-root user'); } if (substr(sprintf('%o', fileperms($config['rrd_dir'])), -3) != 775) { print_warn('Your RRD directory is not set to 0775, please check our installation instructions'); } } // Disk space and permission checks if (substr(sprintf('%o', fileperms($config['temp_dir'])), -3) != 777) { print_warn('Your tmp directory (' . $config['temp_dir'] . ") is not set to 777 so graphs most likely won't be generated"); } $space_check = disk_free_space($config['install_dir']) / 1024 / 1024; if ($space_check < 512 && $space_check > 1) { print_warn('Disk space where ' . $config['install_dir'] . ' is located is less than 512Mb'); } if ($space_check < 1) { print_fail('Disk space where ' . $config['install_dir'] . ' is located is empty!!!'); } // Check programs $bins = array('fping'); foreach ($bins as $bin) { if (!is_file($config[$bin])) { print_fail("{$bin} location is incorrect or bin not installed"); } else { print_ok("{$bin} has been found"); } } // Modules test $modules = explode(',', $options['m']);
print_warn("Some devices have not been polled in the last 5 minutes, check your poll log"); } if (dbFetchCell('SELECT COUNT(`device_id`) FROM `devices` WHERE last_polled_timetaken > 300 AND `ignore` = 0 AND `disabled` = 0 AND `status` = 1') > 0) { print_fail("Some devices have not completed their polling run in 5 minutes, this will create gaps in data.\n Check your poll log and refer to http://docs.librenms.org/Support/Performance/"); } if ($versions['local_branch'] != 'master') { print_warn("Your local git branch is not master, this will prevent automatic updates."); } // check for modified files $modifiedcmd = 'git diff --name-only --exit-code'; if ($username === 'root') { $modifiedcmd = 'su ' . $config['user'] . ' -c "' . $modifiedcmd . '"'; } exec($modifiedcmd, $cmdoutput, $code); if ($code !== 0 && !empty($cmdoutput)) { print_warn("Your local git contains modified files, this could prevent automatic updates.\nModified files:"); echo ' ' . implode("\n ", $cmdoutput) . "\n"; } // Modules test $modules = explode(',', $options['m']); foreach ($modules as $module) { switch ($module) { case 'mail': if ($config['alert']['transports']['mail'] === true) { $run_test = 1; if (empty($config['alert']['default_mail'])) { print_fail('default_mail config option needs to be specified to test email'); $run_test = 0; } elseif ($config['email_backend'] == 'sendmail') { if (empty($config['email_sendmail_path'])) { print_fail("You have selected sendmail but not configured email_sendmail_path");
if (!$config['rrdcached']) { $rrd_dir = stat($config['rrd_dir']); if ($rrd_dir[4] == 0 || $rrd_dir[5] == 0) { print_warn("Your RRD directory is owned by root, please consider changing over to user a non-root user"); } if (substr(sprintf('%o', fileperms($config['rrd_dir'])), -3) != 775) { print_warn("Your RRD directory is not set to 0775, please check our installation instructions"); } } // Disk space and permission checks if (substr(sprintf('%o', fileperms($config['temp_dir'])), -3) != 777) { print_warn("Your tmp directory (" . $config['temp_dir'] . ") is not set to 777 so graphs most likely won't be generated"); } $space_check = disk_free_space($config['install_dir']) / 1024 / 1024; if ($space_check < 512 && $space_check > 1) { print_warn("Disk space where " . $config['install_dir'] . " is located is less than 512Mb"); } if ($space_check < 1) { print_fail("Disk space where " . $config['install_dir'] . " is located is empty!!!"); } // Check programs $bins = array('fping'); foreach ($bins as $bin) { if (!is_file($config[$bin])) { print_fail("{$bin} location is incorrect or bin not installed"); } else { print_ok("{$bin} has been found"); } } // Modules test $modules = explode(",", $options['m']);