2013-09-27 Ramon Novoa <rnovoa@artica.es>
* include/functions_netflow.php, operation/netflow/nf_live_view.php: Show an error if nfdump version older than 1.6.8 is installed (this is the minimum version required to work with Pandora FMS). git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@8820 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
parent
db229cccf2
commit
aae0b70106
|
@ -1,3 +1,10 @@
|
||||||
|
2013-09-27 Ramon Novoa <rnovoa@artica.es>
|
||||||
|
|
||||||
|
* include/functions_netflow.php,
|
||||||
|
operation/netflow/nf_live_view.php: Show an error if nfdump version
|
||||||
|
older than 1.6.8 is installed (this is the minimum version required
|
||||||
|
to work with Pandora FMS).
|
||||||
|
|
||||||
2013-09-27 Miguel de Dios <miguel.dedios@artica.es>
|
2013-09-27 Miguel de Dios <miguel.dedios@artica.es>
|
||||||
|
|
||||||
* include/javascript/jquery.pandora.js: the button to close in the
|
* include/javascript/jquery.pandora.js: the button to close in the
|
||||||
|
|
|
@ -1345,4 +1345,47 @@ function netflow_format_aggregate ($aggregate) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check the nfdump binary for compatibility.
|
||||||
|
*
|
||||||
|
* @param string nfdump binary full path.
|
||||||
|
*
|
||||||
|
* @return 1 if the binary does not exist or is not executable, 2 if a
|
||||||
|
* version older than 1.6.8 is installed or the version cannot be
|
||||||
|
* determined, 0 otherwise.
|
||||||
|
*/
|
||||||
|
function netflow_check_nfdump_binary ($nfdump_binary) {
|
||||||
|
|
||||||
|
// Check that the binary exists and is executable
|
||||||
|
if (! is_executable ($nfdump_binary)) {
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Check at least version 1.6.8
|
||||||
|
$output = '';
|
||||||
|
$rc = -1;
|
||||||
|
exec ($nfdump_binary . ' -V', $output, $rc);
|
||||||
|
if ($rc != 0) {
|
||||||
|
return 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
$matches = array();
|
||||||
|
foreach ($output as $line) {
|
||||||
|
if (preg_match ('/Version:\s*(\d+)\.(\d+)\.(\d+)/', $line, $matches) === 1) {
|
||||||
|
if ($matches[1] < 1) {
|
||||||
|
return 2;
|
||||||
|
}
|
||||||
|
if ($matches[2] < 6) {
|
||||||
|
return 2;
|
||||||
|
}
|
||||||
|
if ($matches[3] < 8) {
|
||||||
|
return 2;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return 2;
|
||||||
|
}
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|
|
@ -104,11 +104,20 @@ $start_date = $end_date - $period;
|
||||||
if (! defined ('METACONSOLE')) {
|
if (! defined ('METACONSOLE')) {
|
||||||
//Header
|
//Header
|
||||||
ui_print_page_header (__('Netflow live view'), "images/op_netflow.png", false, "", false, array ());
|
ui_print_page_header (__('Netflow live view'), "images/op_netflow.png", false, "", false, array ());
|
||||||
if (! is_executable ($config['netflow_nfdump'])) {
|
|
||||||
|
// Check the nfdump binary
|
||||||
|
$check_result = netflow_check_nfdump_binary ($config['netflow_nfdump']);
|
||||||
|
|
||||||
|
// Not found or not executable
|
||||||
|
if ($check_result == 1) {
|
||||||
ui_print_error_message(
|
ui_print_error_message(
|
||||||
sprintf(__('nfdump binary (%s) not found!'),
|
sprintf(__('nfdump binary (%s) not found!'),
|
||||||
$config['netflow_nfdump']));
|
$config['netflow_nfdump']));
|
||||||
}
|
}
|
||||||
|
// Wrong version
|
||||||
|
else if ($check_result == 2) {
|
||||||
|
ui_print_error_message(sprintf(__('Make sure nfdump version 1.6.8 or newer is installed!')));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$nav_bar = array(array('link' => 'index.php?sec=main', 'text' => __('Main')),
|
$nav_bar = array(array('link' => 'index.php?sec=main', 'text' => __('Main')),
|
||||||
|
|
Loading…
Reference in New Issue