diff --git a/pandora_console/ChangeLog b/pandora_console/ChangeLog index 4819241fa6..323046471e 100644 --- a/pandora_console/ChangeLog +++ b/pandora_console/ChangeLog @@ -41,6 +41,16 @@ 2009-12-04 Sancho Lerena + * extensions/users_connected.php: New extension that shows + currently active users connected to console. + + * extensions/pandora_logs.php: New extension that show to the + user the contents of main log files (console, and server logs) + only for Pandora administrators, of course. + + * general/header.php: Removed text label, this give problems + on some languages and doesn't give needed information. + * include/styles/pandora.css: Modified style for 3.0 * images/pandora_textlogo.png, diff --git a/pandora_console/extensions/pandora_logs.php b/pandora_console/extensions/pandora_logs.php new file mode 100644 index 0000000000..de9649672f --- /dev/null +++ b/pandora_console/extensions/pandora_logs.php @@ -0,0 +1,50 @@ +".__("Cannot find file"). "(".$file_name; + echo ")"; + } else { + if (filesize ($file_name) > 512000) { + echo "

".__("File is too large (> 500KB)"). "(".$file_name; + echo ")

"; + } else { + $data = file_get_contents ($file_name); + echo "

$file_name (".format_numeric(filesize ($file_name)/1024)." KB)

"; + echo "

"; + } + } +} + + +function pandoralogs_extension_main () { + global $config; + + echo "

".__('Extensions'). " » ".__("System logfile viewer"). "

"; + echo "

This tool is used just to view your Pandora FMS system logfiles directly from console

"; + + view_logfile ($config["homedir"]."/pandora_console.log"); + view_logfile ("/var/log/pandora/pandora_server.log"); + view_logfile ("/var/log/pandora/pandora_server.error"); +} + +add_godmode_menu_option (__('System logfiles'), 'PM','gservers',""); +add_extension_godmode_function('pandoralogs_extension_main'); + +?> diff --git a/pandora_console/extensions/users_connected.php b/pandora_console/extensions/users_connected.php new file mode 100644 index 0000000000..74da350bda --- /dev/null +++ b/pandora_console/extensions/users_connected.php @@ -0,0 +1,64 @@ +".__('Extensions'). " » ".__("Users connected"). ""; + + $sql = "SELECT id_usuario, ip_origen, fecha, accion FROM tsesion WHERE descripcion = 'Logged in' AND utimestamp > (UNIX_TIMESTAMP(NOW()) - 3600) GROUP BY id_usuario, ip_origen, accion"; + + $rows = get_db_all_rows_sql ($sql); + if (empty ($rows)) { + $rows = array (); + } + + $table->cellpadding = 4; + $table->cellspacing = 4; + $table->width = 600; + $table->class = "databox"; + $table->size = array (); + $table->data = array (); + $table->head = array (); + + $table->head[0] = __('User'); + $table->head[1] = __('IP'); + $table->head[2] = __('Date'); + + $rowPair = true; + $iterator = 0; + + // Get data + foreach ($rows as $row) { + if ($rowPair) + $table->rowclass[$iterator] = 'rowPair'; + else + $table->rowclass[$iterator] = 'rowOdd'; + $rowPair = !$rowPair; + $iterator++; + + $data = array (); + $data[0] = $row["id_usuario"]; + $data[1] = $row["ip_origen"]; + $data[2] = $row["fecha"]; + array_push ($table->data, $data); + } + + print_table ($table); + +} + +add_operation_menu_option(__('Users connected'), 'estado_server',""); + +add_extension_main_function ('users_extension_main'); + +?> diff --git a/pandora_console/general/header.php b/pandora_console/general/header.php index 1592671fa0..3efe8b87ce 100644 --- a/pandora_console/general/header.php +++ b/pandora_console/general/header.php @@ -31,7 +31,7 @@ require_once ("include/functions_messages.php"); .png" class="bot" alt="user" /> - [] + [] 0) { diff --git a/pandora_console/include/config_process.php b/pandora_console/include/config_process.php index 026d0129eb..8fc8ec80a6 100644 --- a/pandora_console/include/config_process.php +++ b/pandora_console/include/config_process.php @@ -22,7 +22,7 @@ /** * Pandora build version and version */ -$build_version = 'PC091204'; +$build_version = 'PC091207'; $pandora_version = 'v3.0RC3-dev'; /* Help to debug problems. Override global PHP configuration */