2009-12-07 Sancho Lerena <slerena@artica.es>

* 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.




git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@2167 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
slerena 2009-12-07 13:25:30 +00:00
parent d60e0e9360
commit b84ad8550d
5 changed files with 126 additions and 2 deletions

View File

@ -41,6 +41,16 @@
2009-12-04 Sancho Lerena <slerena@artica.es>
* 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,

View File

@ -0,0 +1,50 @@
<?php
//Pandora FMS- http://pandorafms.com
// ==================================================
// Copyright (c) 2005-2009 Artica Soluciones Tecnologicas
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation for version 2.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
function view_logfile ($file_name) {
global $config;
if (!file_exists($file_name)){
echo "<h2 class=error>".__("Cannot find file"). "(".$file_name;
echo ")</h1>";
} else {
if (filesize ($file_name) > 512000) {
echo "<h2 class=error>".__("File is too large (> 500KB)"). "(".$file_name;
echo ")</h1>";
} else {
$data = file_get_contents ($file_name);
echo "<h2>$file_name (".format_numeric(filesize ($file_name)/1024)." KB) </h2>";
echo "<textarea style='width: 95%; height: 200px;' name='$file_name'>";
echo $data;
echo "</textarea><br><br>";
}
}
}
function pandoralogs_extension_main () {
global $config;
echo "<h2>".__('Extensions'). " &raquo; ".__("System logfile viewer"). "</h2>";
echo "<p>This tool is used just to view your Pandora FMS system logfiles directly from console</p>";
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');
?>

View File

@ -0,0 +1,64 @@
<?php
//Pandora FMS- http://pandorafms.com
// ==================================================
// Copyright (c) 2005-2009 Artica Soluciones Tecnologicas
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation for version 2.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
function users_extension_main () {
echo "<h2>".__('Extensions'). " &raquo; ".__("Users connected"). "</h2>";
$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');
?>

View File

@ -31,7 +31,7 @@ require_once ("include/functions_messages.php");
</td>
<td width="20%">
<img src="images/user_<?php if (is_user_admin ($config["id_user"]) == 1) echo 'suit'; else echo 'green'; ?>.png" class="bot" alt="user" />
<a href="index.php?sec=usuarios&sec2=operation/users/user_edit" class="white"><?php echo __('You are');?> [<b><?php echo $config["id_user"];?></b>]</a>
<a href="index.php?sec=usuarios&sec2=operation/users/user_edit" class="white"> [<b><?php echo $config["id_user"];?></b>]</a>
<?php
$msg_cnt = get_message_count ($config["id_user"]);
if ($msg_cnt > 0) {

View File

@ -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 */