Merge branch 'develop' of github.com:pandorafms/pandorafms into develop
This commit is contained in:
commit
7855f62714
|
@ -1,5 +1,5 @@
|
|||
package: pandorafms-agent-unix
|
||||
Version: 6.0dev-150129
|
||||
Version: 6.0dev-150202
|
||||
Architecture: all
|
||||
Priority: optional
|
||||
Section: admin
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
|
||||
pandora_version="6.0dev-150129"
|
||||
pandora_version="6.0dev-150202"
|
||||
|
||||
echo "Test if you has the tools for to make the packages."
|
||||
whereis dpkg-deb | cut -d":" -f2 | grep dpkg-deb > /dev/null
|
||||
|
|
|
@ -41,7 +41,7 @@ my $Sem = undef;
|
|||
my $ThreadSem = undef;
|
||||
|
||||
use constant AGENT_VERSION => '6.0dev';
|
||||
use constant AGENT_BUILD => '150129';
|
||||
use constant AGENT_BUILD => '150202';
|
||||
|
||||
# Commands to retrieve total memory information in kB
|
||||
use constant TOTALMEMORY_CMDS => {
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
#
|
||||
%define name pandorafms_agent_unix
|
||||
%define version 6.0dev
|
||||
%define release 150129
|
||||
%define release 150202
|
||||
|
||||
Summary: Pandora FMS Linux agent, PERL version
|
||||
Name: %{name}
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
#
|
||||
%define name pandorafms_agent_unix
|
||||
%define version 6.0dev
|
||||
%define release 150129
|
||||
%define release 150202
|
||||
|
||||
Summary: Pandora FMS Linux agent, PERL version
|
||||
Name: %{name}
|
||||
|
|
|
@ -34,7 +34,7 @@ AC_CHECK_LIB([psapi], [main], , AC_MSG_ERROR([libpsapi not found.]))
|
|||
AC_CHECK_LIB([ole32], [main], , AC_MSG_ERROR([libole32 not found.]))
|
||||
AC_CHECK_LIB([oleaut32], [main], , AC_MSG_ERROR([liboleaut not found.]))
|
||||
AC_CHECK_LIB([uuid], [main], , AC_MSG_ERROR([libuuid not found.]))
|
||||
AC_CHECK_LIB([boost_regex-mt-s], [main], , AC_MSG_ERROR([Boost.Regex not not found. Get it from http://www.boost.org/]))
|
||||
AC_CHECK_LIB([boost_regex-mt], [main], , AC_MSG_ERROR([Boost.Regex not not found. Get it from http://www.boost.org/]))
|
||||
AC_CHECK_LIB([gdi32], [main], , AC_MSG_ERROR([libgdi32 not found.]))
|
||||
AC_CHECK_LIB([crypto], [main], , AC_MSG_ERROR([libcrypto not found.]))
|
||||
AC_CHECK_LIB([ssl], [main], , AC_MSG_ERROR([libssl not found.]))
|
||||
|
|
|
@ -186,7 +186,7 @@ UpgradeApplicationID
|
|||
{}
|
||||
|
||||
Version
|
||||
{150129}
|
||||
{150202}
|
||||
|
||||
ViewReadme
|
||||
{Yes}
|
||||
|
|
|
@ -30,7 +30,7 @@ using namespace Pandora;
|
|||
using namespace Pandora_Strutils;
|
||||
|
||||
#define PATH_SIZE _MAX_PATH+1
|
||||
#define PANDORA_VERSION ("6.0dev(Build 150129)")
|
||||
#define PANDORA_VERSION ("6.0dev(Build 150202)")
|
||||
|
||||
string pandora_path;
|
||||
string pandora_dir;
|
||||
|
|
|
@ -11,7 +11,7 @@ BEGIN
|
|||
VALUE "LegalCopyright", "Artica ST"
|
||||
VALUE "OriginalFilename", "PandoraAgent.exe"
|
||||
VALUE "ProductName", "Pandora FMS Windows Agent"
|
||||
VALUE "ProductVersion", "(6.0dev(Build 150129))"
|
||||
VALUE "ProductVersion", "(6.0dev(Build 150202))"
|
||||
VALUE "FileVersion", "1.0.0.0"
|
||||
END
|
||||
END
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
package: pandorafms-console
|
||||
Version: 6.0dev-150129
|
||||
Version: 6.0dev-150202
|
||||
Architecture: all
|
||||
Priority: optional
|
||||
Section: admin
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
|
||||
pandora_version="6.0dev-150129"
|
||||
pandora_version="6.0dev-150202"
|
||||
|
||||
package_pear=0
|
||||
package_pandora=1
|
||||
|
|
|
@ -17,15 +17,9 @@
|
|||
if (isset($_GET['get_ptr'])) {
|
||||
if ($_GET['get_ptr'] == 1) {
|
||||
|
||||
if (file_exists("../include/config.php"))
|
||||
require ("../include/config.php");
|
||||
else {
|
||||
//TODO FIX AND SET AS RELATIVE DIRECTORY
|
||||
if (file_exists("/var/www/pandora_console/include/config.php"))
|
||||
require ("/var/www/pandora_console/include/config.php");
|
||||
if (file_exists("/srv/www/htdocs/pandora_console/include/config.php"))
|
||||
require ("/srv/www/htdocs/pandora_console/include/config.php");
|
||||
}
|
||||
$ownDir = dirname(__FILE__) . '/';
|
||||
$ownDir = str_replace("\\", "/", $ownDir);
|
||||
require_once ($ownDir.'../include/config.php');
|
||||
|
||||
if (! isset ($_SESSION["id_usuario"])) {
|
||||
session_start ();
|
||||
|
|
|
@ -10,21 +10,14 @@
|
|||
// You cannnot redistribute it without written permission of copyright holder.
|
||||
// ============================================================================
|
||||
|
||||
if (file_exists("../../../include/config.php"))
|
||||
require ("../../../include/config.php");
|
||||
else {
|
||||
//TODO FIX AND SET AS RELATIVE DIRECTORY
|
||||
if (file_exists("/var/www/pandora_console/include/config.php"))
|
||||
require ("/var/www/pandora_console/include/config.php");
|
||||
if (file_exists("/srv/www/htdocs/pandora_console/include/config.php"))
|
||||
require ("/srv/www/htdocs/pandora_console/include/config.php");
|
||||
}
|
||||
$ownDir = dirname(__FILE__) . '/';
|
||||
$ownDir = str_replace("\\", "/", $ownDir);
|
||||
require_once ($ownDir.'../include/config.php');
|
||||
|
||||
global $config;
|
||||
|
||||
require_once ($config["homedir"]."/include/functions.php");
|
||||
require_once ($config["homedir"]."/include/functions_db.php");
|
||||
require_once ($config["homedir"]."/enterprise/include/functions_reporting_csv.php");
|
||||
enterprise_include ($config["homedir"]."/enterprise/include/functions_reporting_csv.php");
|
||||
require_once ($config["homedir"]."/include/auth/mysql.php");
|
||||
|
||||
error_reporting(E_ALL);
|
||||
|
|
|
@ -82,14 +82,11 @@ foreach ($servers as $server) {
|
|||
}
|
||||
|
||||
// Type
|
||||
if ($server['type'] == 'data'){
|
||||
$data[2] = '<span style="white-space:nowrap;">'.$server["img"].'</span> (<span style="font-size:8px;">' . $server["version"]. '</span>)';
|
||||
}
|
||||
else{
|
||||
$data[2] = '<span style="white-space:nowrap;">'.$server["img"].'</span> ('.ucfirst($server["type"]).")";
|
||||
}
|
||||
if ($server["master"] == 1)
|
||||
$data[2] .= ui_print_help_tip (__("This is a master server"), true);
|
||||
$data[2] = '<span style="white-space:nowrap;">'.$server["img"];
|
||||
if ($server["master"] == 1){
|
||||
$data[2] .= ui_print_help_tip (__("This is a master server"), true);
|
||||
}
|
||||
$data[2] .= '</span> <span style="font-size:8px;"> v' . $server["version"]. '</span>';
|
||||
|
||||
switch ($server['type']) {
|
||||
case "snmp":
|
||||
|
|
|
@ -79,14 +79,15 @@ if ($get_module_detail) {
|
|||
|
||||
if (defined ('METACONSOLE')) {
|
||||
$server = metaconsole_get_connection ($server_name);
|
||||
$conexion = mysql_connect ($server['dbhost'], $server['dbuser'],
|
||||
$server['dbpass']);
|
||||
$select_db = mysql_select_db ($server['dbname'], $conexion);
|
||||
|
||||
if (metaconsole_connect($server) != NOERR)
|
||||
return;
|
||||
$conexion = false;
|
||||
}
|
||||
else {
|
||||
$conexion = false;
|
||||
}
|
||||
|
||||
html_debug_print($conexion, true);
|
||||
$selection_mode = get_parameter('selection_mode', 'fromnow');
|
||||
$date_from = (string) get_parameter ('date_from', date ('Y-m-j'));
|
||||
$time_from = (string) get_parameter ('time_from', date ('h:iA'));
|
||||
|
@ -159,11 +160,13 @@ if ($get_module_detail) {
|
|||
"Data" => array(
|
||||
"data",
|
||||
"modules_format_data",
|
||||
"align" => "left"),
|
||||
"align" => "left",
|
||||
"width" => 500),
|
||||
"Time" => array(
|
||||
"utimestamp",
|
||||
"modules_format_time",
|
||||
"align" => "center")
|
||||
"align" => "left",
|
||||
"width" => 500)
|
||||
);
|
||||
|
||||
if ($selection_mode == "fromnow") {
|
||||
|
@ -235,21 +238,21 @@ if ($get_module_detail) {
|
|||
$datos = "<span style='font-family: mono,monospace;'>" . $datos . "</span>";
|
||||
|
||||
// I dont why, but using index (value) method, data is automatically converted to html entities ¿?
|
||||
$data[$attr[1]] = $datos;
|
||||
$data[] = $datos;
|
||||
}
|
||||
elseif ($is_web_content_string) {
|
||||
//Fixed the goliat sends the strings from web
|
||||
//without HTML entities
|
||||
|
||||
$data[$attr[1]] = io_safe_input($row[$attr[0]]);
|
||||
$data[] = io_safe_input($row[$attr[0]]);
|
||||
}
|
||||
else {
|
||||
// Just a string of alphanumerical data... just do print
|
||||
//Fixed the data from Selenium Plugin
|
||||
if ($row[$attr[0]] != strip_tags($row[$attr[0]]))
|
||||
$data[$attr[1]] = io_safe_input($row[$attr[0]]);
|
||||
$data[] = io_safe_input($row[$attr[0]]);
|
||||
else
|
||||
$data[$attr[1]] = $row[$attr[0]];
|
||||
$data[] = $row[$attr[0]];
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -266,6 +269,9 @@ if ($get_module_detail) {
|
|||
html_print_table($table);
|
||||
}
|
||||
|
||||
if (defined ('METACONSOLE'))
|
||||
metaconsole_restore_db();
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -27,13 +27,14 @@ if (is_ajax ()) {
|
|||
|
||||
$getChildren = (bool) get_parameter('getChildren', 0);
|
||||
$getGroupStatus = (bool) get_parameter('getGroupStatus', 0);
|
||||
$get_detail = (bool) get_parameter('getDetail');
|
||||
$getDetail = (bool) get_parameter('getDetail');
|
||||
|
||||
if ($getChildren) {
|
||||
$type = get_parameter('type', 'group');
|
||||
$rootType = get_parameter('rootType', '');
|
||||
$id = get_parameter('id', -1);
|
||||
$rootID = get_parameter('rootID', -1);
|
||||
$serverID = get_parameter('serverID', false);
|
||||
$childrenMethod = get_parameter('childrenMethod', 'on_demand');
|
||||
|
||||
$default_filters = array(
|
||||
|
@ -45,10 +46,10 @@ if (is_ajax ()) {
|
|||
$filter = get_parameter('filter', $default_filters);
|
||||
|
||||
if (class_exists('TreeEnterprise')) {
|
||||
$tree = new TreeEnterprise($type, $rootType, $id, $rootID, $childrenMethod);
|
||||
$tree = new TreeEnterprise($type, $rootType, $id, $rootID, $serverID, $childrenMethod);
|
||||
}
|
||||
else {
|
||||
$tree = new Tree($type, $rootType, $id, $rootID, $childrenMethod);
|
||||
$tree = new Tree($type, $rootType, $id, $rootID, $serverID, $childrenMethod);
|
||||
}
|
||||
|
||||
$tree->setFilter($filter);
|
||||
|
@ -56,61 +57,38 @@ if (is_ajax ()) {
|
|||
return;
|
||||
}
|
||||
|
||||
if ($getGroupStatus) {
|
||||
$id = (int)get_parameter('id', 0);
|
||||
$type = get_parameter('type', 'group');
|
||||
$id = 0;
|
||||
|
||||
$status = array();
|
||||
|
||||
switch ($type) {
|
||||
case 'group':
|
||||
$data = reporting_get_group_stats($id);
|
||||
|
||||
$status['unknown'] = $data['agents_unknown'];
|
||||
$status['critical'] = $data['agent_critical'];
|
||||
$status['warning'] = $data['agent_warning'];
|
||||
$status['not_init'] = $data['agent_not_init'];
|
||||
$status['ok'] = $data['agent_ok'];
|
||||
$status['total'] = $data['total_agents'];
|
||||
$status['status'] = $data['status'];
|
||||
$status['alert_fired'] = $data['alert_fired'];
|
||||
|
||||
echo json_encode($status);
|
||||
break;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
if ($get_detail) {
|
||||
if ($getDetail) {
|
||||
require_once($config['homedir']."/include/functions_treeview.php");
|
||||
|
||||
// Clean the output
|
||||
ob_clean();
|
||||
|
||||
$id = (int) get_parameter('id');
|
||||
$type = (string) get_parameter('type');
|
||||
|
||||
$server = array();
|
||||
if (defined ('METACONSOLE')) {
|
||||
$server_name = (string) get_parameter('server');
|
||||
$server = metaconsole_get_connection($server_name);
|
||||
metaconsole_connect($server);
|
||||
$server_id = (int) get_parameter('serverID');
|
||||
$server = metaconsole_get_servers($server_id);
|
||||
|
||||
if (metaconsole_connect($server) != NOERR)
|
||||
return;
|
||||
}
|
||||
|
||||
switch ($type) {
|
||||
case 'agent':
|
||||
treeview_printTable($id, $server);
|
||||
break;
|
||||
case 'module':
|
||||
treeview_printModuleTable($id, $server);
|
||||
break;
|
||||
case 'alert':
|
||||
treeview_printAlertsTable($id, $server);
|
||||
break;
|
||||
default:
|
||||
// Nothing
|
||||
break;
|
||||
ob_clean();
|
||||
|
||||
if (!empty($id) && !empty($type)) {
|
||||
switch ($type) {
|
||||
case 'agent':
|
||||
treeview_printTable($id, $server);
|
||||
break;
|
||||
case 'module':
|
||||
treeview_printModuleTable($id, $server);
|
||||
break;
|
||||
case 'alert':
|
||||
treeview_printAlertsTable($id, $server);
|
||||
break;
|
||||
default:
|
||||
// Nothing
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!empty($server) && defined ('METACONSOLE')) {
|
||||
|
|
|
@ -18,6 +18,7 @@ class Tree {
|
|||
protected $rootType = null;
|
||||
protected $id = -1;
|
||||
protected $rootID = -1;
|
||||
protected $serverID = false;
|
||||
protected $tree = array();
|
||||
protected $filter = array();
|
||||
protected $childrenMethod = "on_demand";
|
||||
|
@ -27,12 +28,13 @@ class Tree {
|
|||
protected $strictACL = false;
|
||||
protected $acltags = false;
|
||||
|
||||
public function __construct($type, $rootType = '', $id = -1, $rootID = -1, $childrenMethod = "on_demand") {
|
||||
public function __construct($type, $rootType = '', $id = -1, $rootID = -1, $serverID = false, $childrenMethod = "on_demand") {
|
||||
|
||||
$this->type = $type;
|
||||
$this->rootType = !empty($rootType) ? $rootType : $type;
|
||||
$this->id = $id;
|
||||
$this->rootID = !empty($rootID) ? $rootID : $id;
|
||||
$this->serverID = $serverID;
|
||||
$this->childrenMethod = $childrenMethod;
|
||||
|
||||
$userGroups = users_get_groups();
|
||||
|
@ -45,6 +47,9 @@ class Tree {
|
|||
global $config;
|
||||
include_once($config['homedir']."/include/functions_servers.php");
|
||||
|
||||
if (defined("METACONSOLE"))
|
||||
enterprise_include_once("meta/include/functions_ui_meta.php");
|
||||
|
||||
$this->strictACL = (bool) db_get_value("strict_acl", "tusuario", "id_user", $config['id_user']);
|
||||
|
||||
if ($this->strictACL) {
|
||||
|
@ -150,7 +155,7 @@ class Tree {
|
|||
// Not init
|
||||
$agent_not_init_filter = $this->getAgentStatusFilter(AGENT_STATUS_NOT_INIT);
|
||||
$agents_not_init_count = "($agent_table
|
||||
$agent_not_init_filter) AS total_not_init_count";
|
||||
$agent_not_init_filter) AS total_not_init_count";
|
||||
$columns = "$agents_not_init_count, $agents_fired_count, $agents_total_count";
|
||||
break;
|
||||
case AGENT_STATUS_CRITICAL:
|
||||
|
@ -213,6 +218,9 @@ class Tree {
|
|||
// Get the root id
|
||||
$rootID = $this->rootID;
|
||||
|
||||
// Get the server id
|
||||
$serverID = $this->serverID;
|
||||
|
||||
// Agent name filter
|
||||
$agent_search_filter = "";
|
||||
if (!empty($this->filter['searchAgent'])) {
|
||||
|
@ -377,9 +385,10 @@ class Tree {
|
|||
ORDER BY $order_fields";
|
||||
}
|
||||
else {
|
||||
$columns = 'ta.id_agente AS id, ta.nombre AS name, ta.fired_count,
|
||||
ta.normal_count, ta.warning_count, ta.critical_count,
|
||||
ta.unknown_count, ta.notinit_count, ta.total_count';
|
||||
$columns = 'ta.id_agente AS id, ta.nombre AS name,
|
||||
ta.fired_count, ta.normal_count, ta.warning_count,
|
||||
ta.critical_count, ta.unknown_count, ta.notinit_count,
|
||||
ta.total_count, ta.quiet';
|
||||
$order_fields = 'ta.nombre ASC, ta.id_agente ASC';
|
||||
|
||||
$sql = "SELECT $columns
|
||||
|
@ -508,9 +517,10 @@ class Tree {
|
|||
}
|
||||
}
|
||||
else {
|
||||
$columns = 'ta.id_agente AS id, ta.nombre AS name, ta.fired_count,
|
||||
ta.normal_count, ta.warning_count, ta.critical_count,
|
||||
ta.unknown_count, ta.notinit_count, ta.total_count';
|
||||
$columns = 'ta.id_agente AS id, ta.nombre AS name,
|
||||
ta.fired_count, ta.normal_count, ta.warning_count,
|
||||
ta.critical_count, ta.unknown_count, ta.notinit_count,
|
||||
ta.total_count, ta.quiet';
|
||||
$order_fields = 'ta.nombre ASC, ta.id_agente ASC';
|
||||
|
||||
$sql = "SELECT $columns
|
||||
|
@ -603,9 +613,10 @@ class Tree {
|
|||
}
|
||||
}
|
||||
else {
|
||||
$columns = 'ta.id_agente AS id, ta.nombre AS name, ta.fired_count,
|
||||
ta.normal_count, ta.warning_count, ta.critical_count,
|
||||
ta.unknown_count, ta.notinit_count, ta.total_count';
|
||||
$columns = 'ta.id_agente AS id, ta.nombre AS name,
|
||||
ta.fired_count, ta.normal_count, ta.warning_count,
|
||||
ta.critical_count, ta.unknown_count, ta.notinit_count,
|
||||
ta.total_count, ta.quiet';
|
||||
$order_fields = 'ta.nombre ASC, ta.id_agente ASC';
|
||||
|
||||
$sql = "SELECT $columns
|
||||
|
@ -701,9 +712,10 @@ class Tree {
|
|||
}
|
||||
}
|
||||
else {
|
||||
$columns = 'ta.id_agente AS id, ta.nombre AS name, ta.fired_count,
|
||||
ta.normal_count, ta.warning_count, ta.critical_count,
|
||||
ta.unknown_count, ta.notinit_count, ta.total_count';
|
||||
$columns = 'ta.id_agente AS id, ta.nombre AS name,
|
||||
ta.fired_count, ta.normal_count, ta.warning_count,
|
||||
ta.critical_count, ta.unknown_count, ta.notinit_count,
|
||||
ta.total_count, ta.quiet';
|
||||
$order_fields = 'ta.nombre ASC, ta.id_agente ASC';
|
||||
|
||||
$sql = "SELECT $columns
|
||||
|
@ -802,9 +814,10 @@ class Tree {
|
|||
}
|
||||
}
|
||||
else {
|
||||
$columns = 'ta.id_agente AS id, ta.nombre AS name, ta.fired_count,
|
||||
ta.normal_count, ta.warning_count, ta.critical_count,
|
||||
ta.unknown_count, ta.notinit_count, ta.total_count';
|
||||
$columns = 'ta.id_agente AS id, ta.nombre AS name,
|
||||
ta.fired_count, ta.normal_count, ta.warning_count,
|
||||
ta.critical_count, ta.unknown_count, ta.notinit_count,
|
||||
ta.total_count, ta.quiet';
|
||||
$order_fields = 'ta.nombre ASC, ta.id_agente ASC';
|
||||
|
||||
$symbols = ' !"#$%&\'()*+,./:;<=>?@[\\]^{|}~';
|
||||
|
@ -880,29 +893,26 @@ class Tree {
|
|||
}
|
||||
break;
|
||||
default:
|
||||
$sql = $this->getSqlExtended($item_for_count, $type, $rootType, $parent, $rootID,
|
||||
$agent_search_filter, $agent_status_filter,
|
||||
$agents_join, $module_search_filter,
|
||||
$module_status_filter, $modules_join,
|
||||
$sql = $this->getSqlExtended($item_for_count, $type, $rootType, $parent, $rootID,
|
||||
$agent_search_filter, $agent_status_filter, $agents_join,
|
||||
$module_search_filter, $module_status_filter, $modules_join,
|
||||
$module_status_join);
|
||||
}
|
||||
|
||||
html_debug_print($sql, true);
|
||||
return $sql;
|
||||
}
|
||||
|
||||
// Override this method
|
||||
protected function getSqlExtended ($item_for_count, $type, $rootType, $parent, $rootID,
|
||||
$agent_search_filter, $agent_status_filter,
|
||||
$agents_join, $module_search_filter,
|
||||
$module_status_filter, $modules_join,
|
||||
protected function getSqlExtended ($item_for_count, $type, $rootType, $parent, $rootID,
|
||||
$agent_search_filter, $agent_status_filter, $agents_join,
|
||||
$module_search_filter, $module_status_filter, $modules_join,
|
||||
$module_status_join) {
|
||||
return false;
|
||||
}
|
||||
|
||||
protected function getItems ($item_for_count = false) {
|
||||
$sql = $this->getSql($item_for_count);
|
||||
|
||||
|
||||
if (empty($sql))
|
||||
return array();
|
||||
|
||||
|
@ -928,7 +938,7 @@ class Tree {
|
|||
return strcmp($a["name"], $b["name"]);
|
||||
}
|
||||
|
||||
protected function getGroupsChildren($groups, $parent_id, $server_id = false) {
|
||||
protected function getGroupsChildren($groups, $parent_id, $server = false) {
|
||||
$children = array();
|
||||
foreach ($groups as $key => $group) {
|
||||
unset($groups[$key]);
|
||||
|
@ -936,7 +946,7 @@ class Tree {
|
|||
if ((isset($group['parent']) && $group['parent'] == $parent_id)
|
||||
|| (isset($group['_parent_id_']) && $group['_parent_id_'] == $parent_id)) {
|
||||
|
||||
$children_aux = $this->getProcessedItem($group, $server_id, $groups);
|
||||
$children_aux = $this->getProcessedItem($group, $server, $groups);
|
||||
if (!empty($children_aux))
|
||||
$children[] = $children_aux;
|
||||
}
|
||||
|
@ -945,7 +955,7 @@ class Tree {
|
|||
return $children;
|
||||
}
|
||||
|
||||
protected function getProcessedItem ($item, $server_id = false, $items = array()) {
|
||||
protected function getProcessedItem ($item, $server = false, $items = array()) {
|
||||
$processed_item = array();
|
||||
$processed_item['id'] = $item['id'];
|
||||
$processed_item['name'] = $item['name'];
|
||||
|
@ -972,8 +982,8 @@ class Tree {
|
|||
$processed_item['icon'] = "without_group.png";
|
||||
}
|
||||
|
||||
if (defined ('METACONSOLE') && $server_id) {
|
||||
$processed_item['server_id'] = $server_id;
|
||||
if (defined("METACONSOLE") && !empty($server)) {
|
||||
$processed_item['serverID'] = $server['id'];
|
||||
}
|
||||
|
||||
$counters = array();
|
||||
|
@ -994,7 +1004,7 @@ class Tree {
|
|||
|
||||
if ($processed_item['type'] == 'group' && !empty($items)) {
|
||||
|
||||
$children = $this->getGroupsChildren($items, $item['id'], $server_id);
|
||||
$children = $this->getGroupsChildren($items, $item['id'], $server);
|
||||
if (!empty($children)) {
|
||||
$processed_item['children'] = $children;
|
||||
|
||||
|
@ -1030,9 +1040,11 @@ class Tree {
|
|||
|
||||
// The 'id' parameter will be stored as 'server_id' => 'id'
|
||||
$resultItem['id'] = array();
|
||||
$resultItem['id'][$item['server_id']] = $item['id'];
|
||||
$resultItem['id'][$item['serverID']] = $item['id'];
|
||||
$resultItem['rootID'] = array();
|
||||
$resultItem['rootID'][$item['server_id']] = $item['rootID'];
|
||||
$resultItem['rootID'][$item['serverID']] = $item['rootID'];
|
||||
$resultItem['serverID'] = array();
|
||||
$resultItem['serverID'][$item['serverID']] = $item['rootID'];
|
||||
|
||||
// Initialize counters if any of it don't exist
|
||||
if (!isset($resultItem['counters']))
|
||||
|
@ -1067,8 +1079,9 @@ class Tree {
|
|||
// Match with the name and type
|
||||
if ($item['name'] == $item2['name'] && $item['type'] == $item2['type']) {
|
||||
// Add the matched ids
|
||||
$resultItem['id'][$item2['server_id']] = $item2['id'];
|
||||
$resultItem['rootID'][$item2['server_id']] = $item2['rootID'];
|
||||
$resultItem['id'][$item2['serverID']] = $item2['id'];
|
||||
$resultItem['rootID'][$item2['serverID']] = $item2['rootID'];
|
||||
$resultItem['serverID'][$item2['serverID']] = $item2['rootID'];
|
||||
|
||||
// Add the matched counters
|
||||
if (isset($item2['counters']) && !empty($item2['counters'])) {
|
||||
|
@ -1109,7 +1122,7 @@ class Tree {
|
|||
return $mergedItems;
|
||||
}
|
||||
|
||||
protected function processModule (&$module) {
|
||||
protected function processModule (&$module, $server = false) {
|
||||
global $config;
|
||||
|
||||
$module['type'] = 'module';
|
||||
|
@ -1119,7 +1132,11 @@ class Tree {
|
|||
$module['server_type'] = (int) $module['id_modulo'];
|
||||
$module['status'] = $module['estado'];
|
||||
$module['value'] = $module['datos'];
|
||||
// $module['icon'] = modules_get_type_icon($module['id_tipo_modulo']);
|
||||
|
||||
if (defined("METACONSOLE") && !empty($server)) {
|
||||
$module['serverID'] = $server['id'];
|
||||
$module['serverName'] = $server['server_name'];
|
||||
}
|
||||
|
||||
if (!isset($module['value']))
|
||||
$module['value'] = modules_get_last_value($module['id']);
|
||||
|
@ -1179,28 +1196,51 @@ class Tree {
|
|||
// Link to the Module graph
|
||||
$graphType = return_graphtype($module['id']);
|
||||
$winHandle = dechex(crc32($module['id'] . $module['name']));
|
||||
|
||||
$moduleGraphURL = $config['homeurl'] .
|
||||
"/operation/agentes/stat_win.php?" .
|
||||
"type=$graphType&" .
|
||||
"period=86400&" .
|
||||
"id=" . $module['id'] . "&" .
|
||||
"label=" . rawurlencode(urlencode(base64_encode($module['name']))) . "&" .
|
||||
"refresh=600";
|
||||
|
||||
$module['moduleGraph'] = array(
|
||||
'url' => $moduleGraphURL,
|
||||
'handle' => $winHandle
|
||||
);
|
||||
}
|
||||
if (!defined('METACONSOLE')) {
|
||||
$moduleGraphURL = $config['homeurl'] .
|
||||
"/operation/agentes/stat_win.php?" .
|
||||
"type=$graphType&" .
|
||||
"period=86400&" .
|
||||
"id=" . $module['id'] . "&" .
|
||||
"label=" . rawurlencode(urlencode(base64_encode($module['name']))) . "&" .
|
||||
"refresh=600";
|
||||
}
|
||||
else if (!empty($server)) {
|
||||
$moduleGraphURL = ui_meta_get_url_console_child(
|
||||
$server, null, null, null, null,
|
||||
"operation/agentes/stat_win.php?" .
|
||||
"type=$graph_type&" .
|
||||
"period=86400&" .
|
||||
"id=" . $module["id"] . "&" .
|
||||
"label=" . rawurlencode(urlencode(base64_encode($module['name']))) . "&" .
|
||||
"refresh=600");
|
||||
}
|
||||
|
||||
protected function processModules (&$modules) {
|
||||
foreach ($modules as $iterator => $module) {
|
||||
$this->processModule($modules[$iterator]);
|
||||
if (!empty($moduleGraphURL)) {
|
||||
$module['moduleGraph'] = array(
|
||||
'url' => $moduleGraphURL,
|
||||
'handle' => $winHandle
|
||||
);
|
||||
}
|
||||
|
||||
// Alerts fired image
|
||||
$has_alerts = (bool) db_get_value('COUNT(DISTINCT(id_agent_module))', 'talert_template_modules', 'id_agent_module', $module['id']);
|
||||
|
||||
if ($has_alerts) {
|
||||
$module['alertsImageHTML'] = html_print_image("images/bell.png", true, array("title" => __('Module alerts')));
|
||||
}
|
||||
}
|
||||
|
||||
protected function processAgent (&$agent, $server_id = false) {
|
||||
|
||||
protected function processModules (&$modules, $server = false) {
|
||||
foreach ($modules as $iterator => $module) {
|
||||
$this->processModule($modules[$iterator], $server);
|
||||
}
|
||||
}
|
||||
|
||||
protected function processAgent (&$agent, $server = false) {
|
||||
global $config;
|
||||
|
||||
$agent['type'] = 'agent';
|
||||
$agent['id'] = (int) $agent['id'];
|
||||
$agent['name'] = $agent['name'];
|
||||
|
@ -1208,11 +1248,8 @@ class Tree {
|
|||
$agent['rootID'] = $this->rootID;
|
||||
$agent['rootType'] = $this->rootType;
|
||||
|
||||
$id = $agent['id'];
|
||||
if ($server_id) {
|
||||
$agent['id'] = array();
|
||||
$agent['id'][$server_id] = $id;
|
||||
}
|
||||
if (defined("METACONSOLE") && !empty($server))
|
||||
$agent['serverID'] = $server['id'];
|
||||
|
||||
// Counters
|
||||
if (empty($agent['counters'])) {
|
||||
|
@ -1221,37 +1258,37 @@ class Tree {
|
|||
if (isset($agent['unknown_count']))
|
||||
$agent['counters']['unknown'] = $agent['unknown_count'];
|
||||
else
|
||||
$agent['counters']['unknown'] = agents_monitor_unknown($id);
|
||||
$agent['counters']['unknown'] = agents_monitor_unknown($agent['id']);
|
||||
|
||||
if (isset($agent['critical_count']))
|
||||
$agent['counters']['critical'] = $agent['critical_count'];
|
||||
else
|
||||
$agent['counters']['critical'] = agents_monitor_critical($id);
|
||||
$agent['counters']['critical'] = agents_monitor_critical($agent['id']);
|
||||
|
||||
if (isset($agent['warning_count']))
|
||||
$agent['counters']['warning'] = $agent['warning_count'];
|
||||
else
|
||||
$agent['counters']['warning'] = agents_monitor_warning($id);
|
||||
$agent['counters']['warning'] = agents_monitor_warning($agent['id']);
|
||||
|
||||
if (isset($agent['notinit_count']))
|
||||
$agent['counters']['not_init'] = $agent['notinit_count'];
|
||||
else
|
||||
$agent['counters']['not_init'] = agents_monitor_notinit($id);
|
||||
$agent['counters']['not_init'] = agents_monitor_notinit($agent['id']);
|
||||
|
||||
if (isset($agent['normal_count']))
|
||||
$agent['counters']['ok'] = $agent['normal_count'];
|
||||
else
|
||||
$agent['counters']['ok'] = agents_monitor_ok($id);
|
||||
$agent['counters']['ok'] = agents_monitor_ok($agent['id']);
|
||||
|
||||
if (isset($agent['total_count']))
|
||||
$agent['counters']['total'] = $agent['total_count'];
|
||||
else
|
||||
$agent['counters']['total'] = agents_monitor_total($id);
|
||||
$agent['counters']['total'] = agents_monitor_total($agent['id']);
|
||||
|
||||
if (isset($agent['fired_count']))
|
||||
$agent['counters']['alerts'] = $agent['fired_count'];
|
||||
else
|
||||
$agent['counters']['alerts'] = agents_get_alerts_fired($id);
|
||||
$agent['counters']['alerts'] = agents_get_alerts_fired($agent['id']);
|
||||
}
|
||||
|
||||
// Status image
|
||||
|
@ -1265,8 +1302,12 @@ class Tree {
|
|||
// Alerts fired image
|
||||
$agent["alertImageHTML"] = agents_tree_view_alert_img_ball($agent['counters']['alerts']);
|
||||
|
||||
// Quiet image
|
||||
if (isset($agent['quiet']) && $agent['quiet'])
|
||||
$agent['quietImageHTML'] = html_print_image("/images/dot_green.disabled.png", true, array("title" => __('Quiet')));
|
||||
|
||||
// Status
|
||||
$agent['statusRaw'] = agents_get_status($id);
|
||||
$agent['statusRaw'] = agents_get_status($agent['id']);
|
||||
switch ($agent['statusRaw']) {
|
||||
case AGENT_STATUS_NORMAL:
|
||||
$agent['status'] = "ok";
|
||||
|
@ -1300,7 +1341,7 @@ class Tree {
|
|||
$agent['searchChildren'] = 0;
|
||||
|
||||
// if ($searchChildren)
|
||||
// $agent['children'] = $this->getModules($id, $modulesFilter);
|
||||
// $agent['children'] = $this->getModules($agent['id'], $modulesFilter);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -1317,10 +1358,10 @@ class Tree {
|
|||
}
|
||||
}
|
||||
|
||||
protected function processAgents (&$agents, $server_id = false) {
|
||||
protected function processAgents (&$agents, $server = false) {
|
||||
if (!empty($agents)) {
|
||||
foreach ($agents as $iterator => $agent) {
|
||||
$this->processAgent($agents[$iterator], $server_id);
|
||||
$this->processAgent($agents[$iterator], $server);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1383,23 +1424,21 @@ class Tree {
|
|||
$processed_items = $items;
|
||||
}
|
||||
else {
|
||||
$ids = $this->id;
|
||||
|
||||
$items = array();
|
||||
foreach ($ids as $serverID => $id) {
|
||||
$server = metaconsole_get_servers($serverID);
|
||||
if (metaconsole_connect($server) != NOERR)
|
||||
continue;
|
||||
db_clean_cache();
|
||||
|
||||
$this->id = $id;
|
||||
$newItems = $this->getItems();
|
||||
$this->processModules($newItems);
|
||||
$items = array_merge($items, $newItems);
|
||||
if ($this->serverID !== false) {
|
||||
|
||||
metaconsole_restore_db();
|
||||
$server = metaconsole_get_servers($this->serverID);
|
||||
if (metaconsole_connect($server) == NOERR) {
|
||||
db_clean_cache();
|
||||
|
||||
$newItems = $this->getItems();
|
||||
$this->processModules($newItems, $server);
|
||||
$items = array_merge($items, $newItems);
|
||||
|
||||
metaconsole_restore_db();
|
||||
}
|
||||
}
|
||||
$this->id = $ids;
|
||||
|
||||
if (!empty($items))
|
||||
usort($items, array("Tree", "cmpSortNames"));
|
||||
|
@ -1519,7 +1558,7 @@ class Tree {
|
|||
if (isset($item['_monitors_alerts_fired_']))
|
||||
$item['total_fired_count'] = $item['_monitors_alerts_fired_'];
|
||||
|
||||
$processed_items[] = $this->getProcessedItem($item, $server['id'], $items);
|
||||
$processed_items[] = $this->getProcessedItem($item, $server, $items);
|
||||
}
|
||||
}
|
||||
$unmerged_items += $processed_items;
|
||||
|
@ -1549,7 +1588,7 @@ class Tree {
|
|||
|
||||
$this->rootID = $rootID;
|
||||
$newItems = $this->getItems();
|
||||
$this->processAgents($newItems, $serverID);
|
||||
$this->processAgents($newItems, $server);
|
||||
$items = array_merge($items, $newItems);
|
||||
|
||||
metaconsole_restore_db();
|
||||
|
@ -1606,7 +1645,7 @@ class Tree {
|
|||
if (empty($item['parent'])) {
|
||||
|
||||
unset($items[$key]);
|
||||
$processed_items[] = $this->getProcessedItem($item, $server['id'], $items);
|
||||
$processed_items[] = $this->getProcessedItem($item, $server, $items);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1637,7 +1676,7 @@ class Tree {
|
|||
|
||||
$this->rootID = $rootID;
|
||||
$newItems = $this->getItems();
|
||||
$this->processAgents($newItems, $serverID);
|
||||
$this->processAgents($newItems, $server);
|
||||
$items = array_merge($items, $newItems);
|
||||
|
||||
metaconsole_restore_db();
|
||||
|
@ -1696,7 +1735,7 @@ class Tree {
|
|||
}
|
||||
}
|
||||
|
||||
$processed_item = $this->getProcessedItem($item, $server['id']);
|
||||
$processed_item = $this->getProcessedItem($item, $server);
|
||||
$processed_items[] = $processed_item;
|
||||
}
|
||||
$item_list = array_merge($item_list, $processed_items);
|
||||
|
@ -1726,7 +1765,7 @@ class Tree {
|
|||
|
||||
$this->rootID = $rootID;
|
||||
$newItems = $this->getItems();
|
||||
$this->processAgents($newItems, $serverID);
|
||||
$this->processAgents($newItems, $server);
|
||||
$items = array_merge($items, $newItems);
|
||||
|
||||
metaconsole_restore_db();
|
||||
|
@ -1814,7 +1853,7 @@ class Tree {
|
|||
'_articapandora_'.ord('!').'_pandoraartica_'),
|
||||
io_safe_output($item['name']));
|
||||
|
||||
$processed_item = $this->getProcessedItem($item, $server['id']);
|
||||
$processed_item = $this->getProcessedItem($item, $server);
|
||||
$processed_item['id'] = $name;
|
||||
$processed_item['rootID'] = $name;
|
||||
|
||||
|
@ -1847,7 +1886,7 @@ class Tree {
|
|||
|
||||
$this->rootID = $rootID;
|
||||
$newItems = $this->getItems();
|
||||
$this->processAgents($newItems, $serverID);
|
||||
$this->processAgents($newItems, $server);
|
||||
$items = array_merge($items, $newItems);
|
||||
|
||||
metaconsole_restore_db();
|
||||
|
@ -1906,7 +1945,7 @@ class Tree {
|
|||
}
|
||||
}
|
||||
|
||||
$processed_item = $this->getProcessedItem($item, $server['id']);
|
||||
$processed_item = $this->getProcessedItem($item, $server);
|
||||
$processed_items[] = $processed_item;
|
||||
}
|
||||
$item_list = array_merge($item_list, $processed_items);
|
||||
|
@ -1936,7 +1975,7 @@ class Tree {
|
|||
|
||||
$this->rootID = $rootID;
|
||||
$newItems = $this->getItems();
|
||||
$this->processAgents($newItems, $serverID);
|
||||
$this->processAgents($newItems, $server);
|
||||
$items = array_merge($items, $newItems);
|
||||
|
||||
metaconsole_restore_db();
|
||||
|
@ -1996,7 +2035,7 @@ class Tree {
|
|||
}
|
||||
}
|
||||
|
||||
$processed_item = $this->getProcessedItem($item, $server['id']);
|
||||
$processed_item = $this->getProcessedItem($item, $server);
|
||||
$processed_item['icon'] = $item['os_icon'];
|
||||
$processed_items[] = $processed_item;
|
||||
}
|
||||
|
@ -2027,7 +2066,7 @@ class Tree {
|
|||
|
||||
$this->rootID = $rootID;
|
||||
$newItems = $this->getItems();
|
||||
$this->processAgents($newItems, $serverID);
|
||||
$this->processAgents($newItems, $server);
|
||||
$items = array_merge($items, $newItems);
|
||||
|
||||
metaconsole_restore_db();
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
/**
|
||||
* Pandora build version and version
|
||||
*/
|
||||
$build_version = 'PC150129';
|
||||
$build_version = 'PC150202';
|
||||
$pandora_version = 'v6.0dev';
|
||||
|
||||
// Do not overwrite default timezone set if defined.
|
||||
|
|
|
@ -2230,9 +2230,14 @@ function print_audit_csv ($data) {
|
|||
header("Pragma: no-cache");
|
||||
header("Expires: 0");
|
||||
|
||||
echo __('User') . ';' . __('Action') . ';' . __('Date') . ';' . __('Source ID') . ';'. __('Comments') ."\n";
|
||||
foreach ($data as $line) {
|
||||
echo io_safe_output($line['id_usuario']) . ';' . io_safe_output($line['accion']) . ';' . $line['fecha'] . ';' . $line['ip_origen'] . ';'. io_safe_output($line['descripcion']). "\n";
|
||||
if ($data){
|
||||
echo __('User') . ';' . __('Action') . ';' . __('Date') . ';' . __('Source ID') . ';'. __('Comments') ."\n";
|
||||
foreach ($data as $line) {
|
||||
echo io_safe_output($line['id_usuario']) . ';' . io_safe_output($line['accion']) . ';' . $line['fecha'] . ';' . $line['ip_origen'] . ';'. io_safe_output($line['descripcion']). "\n";
|
||||
}
|
||||
}
|
||||
else{
|
||||
echo __('No data found to export');
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -2263,19 +2263,18 @@ function agents_get_network_interfaces ($agents = false, $agents_filter = false)
|
|||
modules_get_status($module_id, $db_status, $module_value, $status, $title);
|
||||
$status_image = ui_print_status_image($status, $title, true);
|
||||
|
||||
$ip_target = "";
|
||||
if (isset($module['ip_target']) && !empty($module['ip_target'])) {
|
||||
$ip_target = $module['ip_target'];
|
||||
}
|
||||
$ip_target = "--";
|
||||
// Trying to get something like an IP from the description
|
||||
else if (preg_match ("/\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}/", $module_description, $matches)
|
||||
if (preg_match ("/\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}/", $module_description, $matches)
|
||||
|| preg_match ("/(((?=(?>.*?(::))(?!.+\3)))\3?|([\dA-F]{1,4}(\3|:?)|\2))(?4){5}((?4){2}|(25[0-5]|
|
||||
(2[0-4]|1\d|[1-9])?\d)(\.(?7)){3})/i", $module_description, $matches)) {
|
||||
if ($matches[0]) {
|
||||
$ip_target = $matches[0];
|
||||
}
|
||||
(2[0-4]|1\d|[1-9])?\d)(\.(?7)){3})/i", $module_description, $matches) && $matches[0]) {
|
||||
|
||||
$ip_target = $matches[0];
|
||||
}
|
||||
$mac = "";
|
||||
// else if (isset($module['ip_target']) && !empty($module['ip_target'])) {
|
||||
// $ip_target = $module['ip_target'];
|
||||
// }
|
||||
$mac = "--";
|
||||
// Trying to get something like a mac from the description
|
||||
if (preg_match ("/([0-9a-f]{1,2}[\.:-]){5}([0-9a-f]{1,2})/i", $module_description, $matches)) {
|
||||
if ($matches[0]) {
|
||||
|
|
|
@ -1417,7 +1417,7 @@ function tags_checks_event_acl($id_user, $id_group, $access, $tags = array(), $c
|
|||
$group_ids = implode(',', $childrens_ids);
|
||||
}
|
||||
$sql = "SELECT id_usuario FROM tusuario_perfil
|
||||
WHERE id_usuario = '".$config["id_user"]."' AND tags = $tags_user
|
||||
WHERE id_usuario = '".$config["id_user"]."' AND tags = '$tags_user'
|
||||
AND id_perfil IN (SELECT id_perfil FROM tperfil WHERE ".get_acl_column($access)."=1)
|
||||
AND id_grupo IN ($group_ids)";
|
||||
$has_perm = db_get_value_sql ($sql);
|
||||
|
|
|
@ -55,55 +55,75 @@ function treeview_printModuleTable($id_module, $server_data = false) {
|
|||
return;
|
||||
}
|
||||
|
||||
echo '<div id="id_div3" width="450px">';
|
||||
echo '<table cellspacing="4" cellpadding="4" border="0" class="databox alternate" style="width:90%; min-width: 300px;">';
|
||||
$table = new StdClass();
|
||||
$table->width = "100%";
|
||||
$table->style = array();
|
||||
$table->style['title'] = 'font-weight: bold;';
|
||||
$table->head = array();
|
||||
$table->head[] = __('Module');
|
||||
$table->head_colspan[] = 2;
|
||||
$table->data = array();
|
||||
|
||||
//Module name
|
||||
echo '<tr><td class="datos"><b>'.__('Module name').'</b></td>';
|
||||
|
||||
if ($module["disabled"])
|
||||
$cellName = "<em>" . ui_print_truncate_text ($module["nombre"], GENERIC_SIZE_TEXT, true, true, true, '[…]',"text-transform: uppercase;") . ui_print_help_tip(__('Disabled'), true) . "<em>";
|
||||
else
|
||||
$cellName = ui_print_truncate_text ($module["nombre"], GENERIC_SIZE_TEXT, true, true, true, '[…]',"text-transform: uppercase;");
|
||||
|
||||
echo '<td class="datos"><b>'.$cellName.'</b></td>';
|
||||
$row = array();
|
||||
$row['title'] = __('Name');
|
||||
$row['data'] = "<b>".$cellName."</b>";
|
||||
$table->data['name'] = $row;
|
||||
|
||||
// Interval
|
||||
echo '<tr><td class="datos"><b>' . __('Interval') . '</b></td>';
|
||||
echo '<td class="datos" colspan="2">' . human_time_description_raw (modules_get_interval($module['id_agente_modulo']), true) . '</td></tr>';
|
||||
$row = array();
|
||||
$row['title'] = __('Interval');
|
||||
$row['data'] = human_time_description_raw (modules_get_interval($module['id_agente_modulo']), true);
|
||||
$table->data['interval'] = $row;
|
||||
|
||||
// Warning Min/Max
|
||||
echo '<tr><td class="datos"><b>' . __('Warning status') . '</b></td>';
|
||||
if (modules_is_string_type($module['id_tipo_modulo'])) {
|
||||
echo '<td class="datos" colspan="2">' . __('Str.') . ': ' . $module['str_warning'] . '</td></tr>';
|
||||
$warning_status_str = __('Str.') . ': ' . $module['str_warning'];
|
||||
}
|
||||
else {
|
||||
echo '<td class="datos" colspan="2">' . __('Min.') . ': ' . $module['min_warning'] . '<br>' . __('Max.') . ': ' . $module['max_warning'] . '</td></tr>';
|
||||
$warning_status_str = __('Min.') . ': ' . $module['min_warning'] . '<br>' . __('Max.') . ': ' . $module['max_warning'];
|
||||
}
|
||||
|
||||
$row = array();
|
||||
$row['title'] = __('Warning status');
|
||||
$row['data'] = $warning_status_str;
|
||||
$table->data['watning_status'] = $row;
|
||||
|
||||
// Critical Min/Max
|
||||
echo '<tr><td class="datos"><b>' . __('Critical status') . '</b></td>';
|
||||
if (modules_is_string_type($module['id_tipo_modulo'])) {
|
||||
echo '<td class="datos" colspan="2">' . __('Str.') . ': ' . $module['str_warning'] . '</td></tr>';
|
||||
$critical_status_str = __('Str.') . ': ' . $module['str_warning'];
|
||||
}
|
||||
else {
|
||||
echo '<td class="datos" colspan="2">' . __('Min.') . ': ' . $module['min_critical'] . '<br>' . __('Max.') . ': ' . $module['max_critical'] . '</td></tr>';
|
||||
$critical_status_str = __('Min.') . ': ' . $module['min_critical'] . '<br>' . __('Max.') . ': ' . $module['max_critical'];
|
||||
}
|
||||
$row = array();
|
||||
$row['title'] = __('Critical status');
|
||||
$row['data'] = $critical_status_str;
|
||||
$table->data['critical_status'] = $row;
|
||||
|
||||
// Module group
|
||||
echo '<tr><td class="datos2"><b>'.__('Module group').'</b></td>';
|
||||
echo '<td class="datos2" colspan="2">';
|
||||
$module_group = modules_get_modulegroup_name($module['id_module_group']);
|
||||
|
||||
|
||||
if ($module_group === false)
|
||||
echo __('Not assigned');
|
||||
$module_group = __('Not assigned');
|
||||
else
|
||||
echo __("$module_group");
|
||||
echo '</td></tr>';
|
||||
$module_group = __("$module_group");
|
||||
|
||||
$row = array();
|
||||
$row['title'] = __('Module group');
|
||||
$row['data'] = $module_group;
|
||||
$table->data['module_group'] = $row;
|
||||
|
||||
// Description
|
||||
echo '<tr><td class="datos"><b>'.__('Description').'</b></td>';
|
||||
echo '<td class="datos" colspan="2">'. ui_print_truncate_text ($module['descripcion'], 'description', true, true, true, '[…]') .'</td></tr>';
|
||||
$row = array();
|
||||
$row['title'] = __('Description');
|
||||
$row['data'] = ui_print_truncate_text ($module['descripcion'], 'description', true, true, true, '[…]');
|
||||
$table->data['description'] = $row;
|
||||
|
||||
// Tags
|
||||
$tags = tags_get_module_tags($module['id_agente_modulo']);
|
||||
|
@ -135,8 +155,10 @@ function treeview_printModuleTable($id_module, $server_data = false) {
|
|||
$tags = implode(', ' , $tags);
|
||||
}
|
||||
|
||||
echo '<tr><td class="datos"><b>'.__('Tags').'</b></td>';
|
||||
echo '<td class="datos" colspan="2">' . $tags . '</td></tr>';
|
||||
$row = array();
|
||||
$row['title'] = __('Tags');
|
||||
$row['data'] = $tags;
|
||||
$table->data['tags'] = $row;
|
||||
|
||||
// Data
|
||||
$last_data = db_get_row_filter ('tagente_estado', array('id_agente_modulo' => $module['id_agente_modulo'], 'order' => array('field' => 'id_agente_estado', 'order' => 'DESC')));
|
||||
|
@ -145,28 +167,28 @@ function treeview_printModuleTable($id_module, $server_data = false) {
|
|||
else
|
||||
$data = "<span title='" . $last_data["datos"] . "' style='white-space: nowrap;'>" . substr(io_safe_output($last_data['datos']),0,12) . "</span>";
|
||||
|
||||
echo '<tr><td class="datos"><b>'.__('Last data').'</b></td>';
|
||||
echo '<td class="datos" colspan="2">';
|
||||
|
||||
if (!empty($last_data['utimestamp'])) {
|
||||
echo $data;
|
||||
$last_data_str = $data;
|
||||
|
||||
if ($module['unit'] != '') {
|
||||
echo " ";
|
||||
echo '('.$module['unit'].')';
|
||||
$last_data_str .= " ";
|
||||
$last_data_str .= '('.$module['unit'].')';
|
||||
}
|
||||
|
||||
echo " ";
|
||||
html_print_image('images/clock2.png', false, array('title' => $last_data["timestamp"], 'width' => '18px'));
|
||||
$last_data_str .= " ";
|
||||
$last_data_str .= html_print_image('images/clock2.png', true, array('title' => $last_data["timestamp"], 'width' => '18px'));
|
||||
}
|
||||
else {
|
||||
echo '<i>' . __('No data') . '</i>';
|
||||
$last_data_str = '<i>' . __('No data') . '</i>';
|
||||
}
|
||||
|
||||
echo '</td></tr>';
|
||||
$row = array();
|
||||
$row['title'] = __('Last data');
|
||||
$row['data'] = $last_data_str;
|
||||
$table->data['last_data'] = $row;
|
||||
|
||||
//End of table
|
||||
echo '</table></div>';
|
||||
html_print_table($table);
|
||||
|
||||
$id_group = agents_get_agent_group($module['id_agente']);
|
||||
$group_name = db_get_value('nombre', 'tgrupo', 'id_grupo', $id_group);
|
||||
|
@ -174,10 +196,10 @@ function treeview_printModuleTable($id_module, $server_data = false) {
|
|||
|
||||
if (can_user_access_node () && check_acl ($config["id_user"], $id_group, 'AW')) {
|
||||
// Actions table
|
||||
echo '<div style="width:90%; text-align: right; min-width: 300px;">';
|
||||
echo '<form id="module_detail" method="post" action="' . $console_url . 'index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&id_agente=' . $module['id_agente'] . '&tab=module&edit_module=1&id_agent_module=' . $module['id_agente_modulo'] . $url_hash . '">';
|
||||
echo '<div style="width:100%; text-align: right; min-width: 300px;">';
|
||||
echo '<a target=_blank href="' . $console_url . 'index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&id_agente=' . $module['id_agente'] . '&tab=module&edit_module=1&id_agent_module=' . $module['id_agente_modulo'] . $url_hash . '">';
|
||||
html_print_submit_button (__('Go to module edition'), 'upd_button', false, 'class="sub config"');
|
||||
echo '</form>';
|
||||
echo '</a>';
|
||||
|
||||
echo '</div>';
|
||||
}
|
||||
|
@ -218,42 +240,53 @@ function treeview_printAlertsTable($id_module, $server_data = array()) {
|
|||
return;
|
||||
}
|
||||
|
||||
echo '<div id="id_div3" width="450px">';
|
||||
echo '<table cellspacing="4" cellpadding="4" border="0" class="databox alternate" style="width:90%; min-width: 300px;">';
|
||||
echo '<tr><th colspan=2 class="datos"><center>' . $module_name . '</center></th></tr>';
|
||||
|
||||
echo '<tr><th class="datos" style="background: #B3B3B3;"><b>'.__('Template').'</b></th>';
|
||||
echo '<th class="datos" style="background: #B3B3B3;"><b>'.__('Actions').'</b></th>';
|
||||
$table = new StdClass();
|
||||
$table->width = "100%";
|
||||
$table->style = array();
|
||||
$table->style['titles'] = 'font-weight: bold; background: #B3B3B3;';
|
||||
$table->head = array();
|
||||
$table->head[] = __('Alerts') . ": " . $module_name;
|
||||
$table->head_colspan[] = 2;
|
||||
$table->data = array();
|
||||
|
||||
$row = array();
|
||||
$row['template'] = __('Template');
|
||||
$row['actions'] = __('Actions');
|
||||
$table->data['titles'] = $row;
|
||||
|
||||
foreach($module_alerts as $module_alert) {
|
||||
//Template name
|
||||
echo '<tr>';
|
||||
$template_name = db_get_value('name','talert_templates','id',$module_alert['id_alert_template']);
|
||||
echo '<td class="datos">'.$template_name.'</td>';
|
||||
|
||||
$actions = alerts_get_alert_agent_module_actions($module_alert['id']);
|
||||
echo '<td class="datos">';
|
||||
|
||||
if (empty($actions)) {
|
||||
echo '<i>'.__('N/A').'</i>';
|
||||
$actions_list = '<i>'.__('N/A').'</i>';
|
||||
}
|
||||
else {
|
||||
echo '<ul>';
|
||||
foreach($actions as $act) {
|
||||
echo '<li>';
|
||||
echo $act['name'];
|
||||
echo '</li>';
|
||||
$actions_list = '<ul>';
|
||||
foreach($actions_list as $act) {
|
||||
$actions_list .= '<li>';
|
||||
$actions_list .= $act['name'];
|
||||
$actions_list .= '</li>';
|
||||
}
|
||||
echo '</ul>';
|
||||
$actions_list .= '</ul>';
|
||||
}
|
||||
echo '</td></tr>';
|
||||
|
||||
$row = array();
|
||||
$row['template'] = $template_name;
|
||||
$row['actions'] = $actions_list;
|
||||
$table->data['last_data'] = $row;
|
||||
}
|
||||
echo '</table>';
|
||||
|
||||
html_print_table($table);
|
||||
|
||||
if (can_user_access_node () && check_acl ($config["id_user"], $id_group, 'LW')) {
|
||||
// Actions table
|
||||
echo '<div style="width:90%; text-align: right; min-width: 300px;">';
|
||||
echo '<form id="agent_detail" method="post" action="' . $console_url . 'index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&tab=alert&search=1&module_name=' . $module_name . '&id_agente=' . $agent_id . $url_hash . '" target="_blank">';
|
||||
echo '<div style="width:100%; text-align: right; min-width: 300px;">';
|
||||
echo '<a target=_blank href="' . $console_url . 'index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&tab=alert&search=1&module_name=' . $module_name . '&id_agente=' . $agent_id . $url_hash . '" target="_blank">';
|
||||
html_print_submit_button (__('Go to alerts edition'), 'upd_button', false, 'class="sub search"');
|
||||
echo '</form>';
|
||||
echo '</a>';
|
||||
echo '</div>';
|
||||
}
|
||||
}
|
||||
|
@ -386,9 +419,9 @@ function treeview_printTable($id_agente, $server_data = array()) {
|
|||
|
||||
if (can_user_access_node () && check_acl ($config["id_user"], $agent["id_grupo"], "AW")) {
|
||||
$go_to_agent = '<div style="text-align: right;">';
|
||||
$go_to_agent .= '<form id="agent_detail" method="post" action="' . $console_url . 'index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&id_agente='.$id_agente.$url_hash.'">';
|
||||
$go_to_agent .= '<a target=_blank href="' . $console_url . 'index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&id_agente='.$id_agente.$url_hash.'">';
|
||||
$go_to_agent .= html_print_submit_button (__('Go to agent edition'), 'upd_button', false, 'class="sub config"', true);
|
||||
$go_to_agent .= '</form>';
|
||||
$go_to_agent .= '</a>';
|
||||
$go_to_agent .= '</div>';
|
||||
|
||||
$agent_table .= $go_to_agent;
|
||||
|
@ -488,6 +521,58 @@ function treeview_printTable($id_agente, $server_data = array()) {
|
|||
$events_graph .= '</div><br>';
|
||||
|
||||
ui_toggle($events_graph, __('Events (24h)'));
|
||||
|
||||
// Table network interfaces
|
||||
$network_interfaces_by_agents = agents_get_network_interfaces(array($agent));
|
||||
|
||||
$network_interfaces = array();
|
||||
if (!empty($network_interfaces_by_agents) && !empty($network_interfaces_by_agents[$id_agente])) {
|
||||
$network_interfaces = $network_interfaces_by_agents[$id_agente]['interfaces'];
|
||||
}
|
||||
|
||||
if (!empty($network_interfaces)) {
|
||||
$table = new stdClass();
|
||||
$table->id = 'agent_interface_info';
|
||||
$table->class = 'databox';
|
||||
$table->width = '100%';
|
||||
$table->style = array();
|
||||
$table->style['interface_status'] = 'width: 30px;';
|
||||
$table->style['interface_graph'] = 'width: 20px;';
|
||||
$table->head = array();
|
||||
$table->data = array();
|
||||
|
||||
foreach ($network_interfaces as $interface_name => $interface) {
|
||||
if (!empty($interface['traffic'])) {
|
||||
$params = array(
|
||||
'interface_name' => $interface_name,
|
||||
'agent_id' => $id_agente,
|
||||
'traffic_module_in' => $interface['traffic']['in'],
|
||||
'traffic_module_out' => $interface['traffic']['out']
|
||||
);
|
||||
$params_json = json_encode($params);
|
||||
$params_encoded = base64_encode($params_json);
|
||||
$win_handle = dechex(crc32($interface['status_module_id'].$interface_name));
|
||||
$graph_link = "<a href=\"javascript:winopeng('operation/agentes/interface_traffic_graph_win.php?params=$params_encoded','$win_handle')\">" .
|
||||
html_print_image("images/chart_curve.png", true, array("title" => __('Interface traffic'))) . "</a>";
|
||||
}
|
||||
else {
|
||||
$graph_link = "";
|
||||
}
|
||||
|
||||
$data = array();
|
||||
$data['interface_name'] = "<strong>" . $interface_name . "</strong>";
|
||||
$data['interface_status'] = $interface['status_image'];
|
||||
$data['interface_graph'] = $graph_link;
|
||||
$data['interface_ip'] = $interface['ip'];
|
||||
$data['interface_mac'] = $interface['mac'];
|
||||
$table->data[] = $data;
|
||||
}
|
||||
//End of table network interfaces
|
||||
$table_interfaces = html_print_table($table, true);
|
||||
$table_interfaces .= "<br>";
|
||||
|
||||
ui_toggle($table_interfaces, __('Interface information') . ' (SNMP)');
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -77,10 +77,10 @@ TreeController = {
|
|||
modules: "Total modules",
|
||||
none: "Total"
|
||||
},
|
||||
fired: {
|
||||
agents: "Alert fired",
|
||||
modules: "Alert fired",
|
||||
none: "Alert fired"
|
||||
alerts: {
|
||||
agents: "Alerts fired",
|
||||
modules: "Alerts fired",
|
||||
none: "Alerts fired"
|
||||
},
|
||||
critical: {
|
||||
agents: "Critical agents",
|
||||
|
@ -173,16 +173,16 @@ TreeController = {
|
|||
|
||||
$counters.append($totalCounter);
|
||||
|
||||
if (typeof counters.fired != 'undefined'
|
||||
&& counters.fired > 0) {
|
||||
if (typeof counters.alerts != 'undefined'
|
||||
&& counters.alerts > 0) {
|
||||
var $firedCounter = $("<div></div>");
|
||||
$firedCounter
|
||||
.addClass('tree-node-counter')
|
||||
.addClass('fired')
|
||||
.addClass('alerts')
|
||||
.addClass('orange')
|
||||
.html(counters.fired);
|
||||
.html(counters.alerts);
|
||||
|
||||
_processNodeCounterTitle($firedCounter, type, "fired");
|
||||
_processNodeCounterTitle($firedCounter, type, "alerts");
|
||||
|
||||
$counters
|
||||
.append(" : ")
|
||||
|
@ -311,6 +311,14 @@ TreeController = {
|
|||
$content.append(element.name);
|
||||
break;
|
||||
case 'agent':
|
||||
// Is quiet
|
||||
if (typeof element.quietImageHTML != 'undefined'
|
||||
&& element.quietImageHTML.length > 0) {
|
||||
var $quietImage = $(element.quietImageHTML);
|
||||
$quietImage.addClass("agent-quiet");
|
||||
|
||||
$content.append($quietImage);
|
||||
}
|
||||
// Status image
|
||||
if (typeof element.statusImageHTML != 'undefined'
|
||||
&& element.statusImageHTML.length > 0) {
|
||||
|
@ -361,14 +369,16 @@ TreeController = {
|
|||
winopeng(element.moduleGraph.url, element.moduleGraph.handle);
|
||||
}
|
||||
catch (error) {
|
||||
console.log(error);
|
||||
// console.log(error);
|
||||
}
|
||||
});
|
||||
|
||||
$content.append($graphImage);
|
||||
}
|
||||
|
||||
// Data pop-up
|
||||
if (typeof element.id != 'undefined'
|
||||
&& !isNaN(element.id)) {
|
||||
if (typeof element.id != 'undefined' && !isNaN(element.id)) {
|
||||
|
||||
var $dataImage = $('<img src="'+(controller.baseURL.length > 0 ? controller.baseURL : '')
|
||||
+'images/binary.png" /> ');
|
||||
$dataImage
|
||||
|
@ -377,19 +387,46 @@ TreeController = {
|
|||
e.preventDefault();
|
||||
|
||||
try {
|
||||
var serverName = element.serverName.length > 0 ? element.serverName : '';
|
||||
if ($("#module_details_window").length > 0)
|
||||
show_module_detail_dialog(element.id, '', '', 0, 86400);
|
||||
show_module_detail_dialog(element.id, '', serverName, 0, 86400);
|
||||
}
|
||||
catch (error) {
|
||||
console.log(error);
|
||||
// console.log(error);
|
||||
}
|
||||
});
|
||||
|
||||
$content.append($dataImage);
|
||||
}
|
||||
|
||||
$content
|
||||
.append($graphImage)
|
||||
.append($dataImage)
|
||||
.append(element.name);
|
||||
// Alerts
|
||||
if (typeof element.alertsImageHTML != 'undefined'
|
||||
&& element.alertsImageHTML.length > 0) {
|
||||
|
||||
var $alertsImage = $(element.alertsImageHTML);
|
||||
|
||||
$alertsImage
|
||||
.addClass("module-alerts")
|
||||
.click(function (e) {
|
||||
TreeNodeDetailController.getController().init({
|
||||
recipient: controller.detailRecipient,
|
||||
type: 'alert',
|
||||
id: element.id,
|
||||
serverID: element.serverID,
|
||||
baseURL: controller.baseURL,
|
||||
ajaxURL: controller.ajaxURL,
|
||||
ajaxPage: controller.ajaxPage
|
||||
});
|
||||
|
||||
// Avoid the execution of the module detail event
|
||||
e.stopPropagation();
|
||||
})
|
||||
.css('cursor', 'pointer');
|
||||
|
||||
$content.append($alertsImage);
|
||||
}
|
||||
|
||||
$content.append(element.name);
|
||||
break;
|
||||
case 'os':
|
||||
if (typeof element.icon != 'undefined' && element.icon.length > 0) {
|
||||
|
@ -419,16 +456,20 @@ TreeController = {
|
|||
|
||||
// If exist the detail container, show the data
|
||||
if (typeof controller.detailRecipient != 'undefined' && controller.detailRecipient.length > 0) {
|
||||
$content.click(function (e) {
|
||||
TreeNodeDetailController.getController().init({
|
||||
recipient: controller.detailRecipient,
|
||||
type: element.type,
|
||||
id: element.id,
|
||||
baseURL: controller.baseURL,
|
||||
ajaxURL: controller.ajaxURL,
|
||||
ajaxPage: controller.ajaxPage
|
||||
});
|
||||
});
|
||||
if (element.type == 'agent' || element.type == 'module') {
|
||||
$content.click(function (e) {
|
||||
TreeNodeDetailController.getController().init({
|
||||
recipient: controller.detailRecipient,
|
||||
type: element.type,
|
||||
id: element.id,
|
||||
serverID: element.serverID,
|
||||
baseURL: controller.baseURL,
|
||||
ajaxURL: controller.ajaxURL,
|
||||
ajaxPage: controller.ajaxPage
|
||||
});
|
||||
})
|
||||
.css('cursor', 'pointer');
|
||||
}
|
||||
}
|
||||
|
||||
$node
|
||||
|
@ -494,6 +535,7 @@ TreeController = {
|
|||
id: element.id,
|
||||
type: element.type,
|
||||
rootID: element.rootID,
|
||||
serverID: element.serverID,
|
||||
rootType: element.rootType,
|
||||
filter: controller.filter
|
||||
},
|
||||
|
@ -648,21 +690,23 @@ TreeNodeDetailController = {
|
|||
}
|
||||
},
|
||||
removeControllers: function () {
|
||||
if (TreeNodeDetailController.controllers.length > 0) {
|
||||
TreeNodeDetailController.controllers.forEach(function(elements, type) {
|
||||
if (elements.length > 0) {
|
||||
elements.forEach(function(element, id) {
|
||||
element.remove();
|
||||
});
|
||||
}
|
||||
try {
|
||||
$.each(TreeNodeDetailController.controllers, function(type, elements) {
|
||||
$.each(elements, function(id, element) {
|
||||
element.remove();
|
||||
});
|
||||
});
|
||||
}
|
||||
catch (error) {
|
||||
// console.log(error);
|
||||
}
|
||||
},
|
||||
getController: function () {
|
||||
var controller = {
|
||||
recipient: '',
|
||||
type: 'none',
|
||||
id: -1,
|
||||
serverID: -1,
|
||||
emptyMessage: "Empty",
|
||||
errorMessage: "Error",
|
||||
baseURL: "",
|
||||
|
@ -687,37 +731,36 @@ TreeNodeDetailController = {
|
|||
this.container = $("<div></div>");
|
||||
this.container
|
||||
.addClass("tree-element-detail")
|
||||
.addClass("tree-element-detail-closed")
|
||||
.append($label)
|
||||
.data('label', $label)
|
||||
.append($content)
|
||||
.data('content', $content)
|
||||
.hide();
|
||||
.data('content', $content);
|
||||
|
||||
$label.addClass('tree-element-detail-loading');
|
||||
$.ajax({
|
||||
url: this.ajaxURL,
|
||||
type: 'POST',
|
||||
dataType: 'json',
|
||||
dataType: 'html',
|
||||
async: true,
|
||||
data: {
|
||||
page: this.ajaxPage,
|
||||
getDetail: 1,
|
||||
type: this.type,
|
||||
id: this.id
|
||||
id: this.id,
|
||||
serverID: this.serverID
|
||||
},
|
||||
complete: function(xhr, textStatus) {
|
||||
$label.removeClass('tree-element-detail-loading');
|
||||
},
|
||||
success: function(data, textStatus, xhr) {
|
||||
if (data.success) {
|
||||
$label.addClass('tree-element-detail-loaded');
|
||||
$content.html(data.html);
|
||||
$label.addClass('tree-element-detail-loaded');
|
||||
$content.html(data);
|
||||
|
||||
controller.open();
|
||||
}
|
||||
else {
|
||||
$label.addClass('tree-element-detail-error');
|
||||
$content.html(controller.errorMessage);
|
||||
}
|
||||
// Add again the hover event to the 'force_callback' elements
|
||||
forced_title_callback();
|
||||
|
||||
controller.open();
|
||||
},
|
||||
error: function(xhr, textStatus, errorThrown) {
|
||||
$label.addClass('tree-element-detail-error');
|
||||
|
@ -726,16 +769,15 @@ TreeNodeDetailController = {
|
|||
});
|
||||
|
||||
this.recipient.append(this.container);
|
||||
this.open();
|
||||
},
|
||||
load: function () {
|
||||
this.reload();
|
||||
},
|
||||
toggle: function () {
|
||||
if (typeof this.container != 'undefined' && this.container.length > 0) {
|
||||
if (typeof this.container == 'undefined' || this.container.length <= 0) {
|
||||
return false;
|
||||
}
|
||||
if (this.container.isClosed) {
|
||||
if (this.container.hasClass("tree-element-detail-closed")) {
|
||||
this.open();
|
||||
}
|
||||
else {
|
||||
|
@ -743,21 +785,23 @@ TreeNodeDetailController = {
|
|||
}
|
||||
},
|
||||
open: function () {
|
||||
if (typeof this.container != 'undefined' && this.container.length > 0) {
|
||||
if (typeof this.container == 'undefined' || this.container.length <= 0) {
|
||||
return false;
|
||||
}
|
||||
if (this.container.isClosed) {
|
||||
this.container.data('content').slideLeft();
|
||||
this.container.isClosed = false;
|
||||
if (this.container.hasClass("tree-element-detail-closed")) {
|
||||
this.container
|
||||
.removeClass("tree-element-detail-closed")
|
||||
.data('content').show();
|
||||
}
|
||||
},
|
||||
close: function () {
|
||||
if (typeof this.container != 'undefined' && this.container.length > 0) {
|
||||
if (typeof this.container == 'undefined' || this.container.length <= 0) {
|
||||
return false;
|
||||
}
|
||||
if (!this.container.isClosed) {
|
||||
this.container.data('content').slideRight();
|
||||
this.container.isClosed = true;
|
||||
if (!this.container.hasClass("tree-element-detail-closed")) {
|
||||
this.container
|
||||
.addClass("tree-element-detail-closed")
|
||||
.data('content').hide();
|
||||
}
|
||||
},
|
||||
init: function (data) {
|
||||
|
@ -785,6 +829,9 @@ TreeNodeDetailController = {
|
|||
else {
|
||||
return false;
|
||||
}
|
||||
if (typeof data.serverID != 'undefined' && (data.serverID.length > 0 || !isNaN(data.serverID))) {
|
||||
this.serverID = data.serverID;
|
||||
}
|
||||
if (typeof data.emptyMessage != 'undefined' && data.emptyMessage.length > 0) {
|
||||
this.emptyMessage = data.emptyMessage;
|
||||
}
|
||||
|
@ -826,27 +873,29 @@ TreeNodeDetailController = {
|
|||
}
|
||||
},
|
||||
closeOther: function () {
|
||||
if (TreeNodeDetailController.controllers.length > 0) {
|
||||
TreeNodeDetailController.controllers.forEach(function(elements, type) {
|
||||
if (elements.length > 0) {
|
||||
elements.forEach(function(element, id) {
|
||||
if (this.type != type && this.id != id)
|
||||
element.close();
|
||||
}, this);
|
||||
}
|
||||
}, this);
|
||||
try {
|
||||
$.each(TreeNodeDetailController.controllers, function(type, elements) {
|
||||
$.each(elements, function(id, element) {
|
||||
if (controller.type != type && controller.id != id)
|
||||
element.close();
|
||||
});
|
||||
});
|
||||
}
|
||||
catch (error) {
|
||||
// console.log(error);
|
||||
}
|
||||
},
|
||||
removeOther: function () {
|
||||
if (TreeNodeDetailController.controllers.length > 0) {
|
||||
try {
|
||||
TreeNodeDetailController.controllers.forEach(function(elements, type) {
|
||||
if (elements.length > 0) {
|
||||
elements.forEach(function(element, id) {
|
||||
if (this.type != type && this.id != id)
|
||||
element.remove();
|
||||
}, this);
|
||||
}
|
||||
}, this);
|
||||
elements.forEach(function(element, id) {
|
||||
if (controller.type != type && controller.id != id)
|
||||
element.remove();
|
||||
});
|
||||
});
|
||||
}
|
||||
catch (error) {
|
||||
// console.log(error);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
|
||||
.tree-group {
|
||||
margin-left: 16px;
|
||||
padding-top: 4px;
|
||||
padding-top: 1px;
|
||||
}
|
||||
|
||||
.tree-node {
|
||||
|
@ -22,11 +22,16 @@
|
|||
background: 0 0;
|
||||
}
|
||||
.node-content {
|
||||
height: 21px;
|
||||
height: 16px;
|
||||
}
|
||||
|
||||
.node-content>img {
|
||||
position: relative;
|
||||
top: -2px;
|
||||
}
|
||||
|
||||
.node-content:hover {
|
||||
background-color: #9AB8DF;
|
||||
background-color: #FFF;
|
||||
|
||||
-moz-border-radius: 3px;
|
||||
-webkit-border-radius: 3px;
|
||||
|
@ -101,7 +106,9 @@
|
|||
.tree-node>.node-content>img.module-server-type,
|
||||
.tree-node>.node-content>img.agent-status,
|
||||
.tree-node>.node-content>img.agent-alerts-fired,
|
||||
.tree-node>.node-content>img.module-status {
|
||||
.tree-node>.node-content>img.agent-quiet,
|
||||
.tree-node>.node-content>img.module-status,
|
||||
.tree-node>.node-content>img.module-alerts {
|
||||
padding-right: 3px;
|
||||
}
|
||||
|
||||
|
@ -122,4 +129,43 @@
|
|||
font-weight: bold;
|
||||
font-size: 7pt;
|
||||
cursor: default;
|
||||
}
|
||||
}
|
||||
|
||||
div.tree-table {
|
||||
display: table;
|
||||
width: 98%;
|
||||
margin-top: 10px;
|
||||
}
|
||||
|
||||
div.tree-table-row {
|
||||
display: table-row;
|
||||
}
|
||||
|
||||
div.tree-table-cell {
|
||||
display: table-cell;
|
||||
vertical-align: top;
|
||||
}
|
||||
|
||||
div.tree-table-cell.tree-table-cell-tree {
|
||||
/*width: 70%;*/
|
||||
max-width: 600px;
|
||||
overflow-x: auto;
|
||||
overflow-y: hidden;
|
||||
}
|
||||
|
||||
div.tree-table-cell.tree-table-cell-detail {
|
||||
padding-left: 10px;
|
||||
width: 350px;
|
||||
}
|
||||
|
||||
div.tree-element-detail-closed {
|
||||
display: none;
|
||||
}
|
||||
|
||||
div#tree-controller-recipient {
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
div#tree-controller-detail-recipient {
|
||||
/*text-align: right;*/
|
||||
}
|
||||
|
|
|
@ -63,7 +63,7 @@
|
|||
<div style='height: 10px'>
|
||||
<?php
|
||||
$version = '6.0dev';
|
||||
$build = '150129';
|
||||
$build = '150202';
|
||||
$banner = "v$version Build $build";
|
||||
|
||||
error_reporting(0);
|
||||
|
|
|
@ -385,143 +385,59 @@ if ($last_incident != false) {
|
|||
|
||||
// START: TABLE INTERFACES
|
||||
|
||||
$columns = array(
|
||||
"id_agente_modulo",
|
||||
"nombre",
|
||||
"descripcion",
|
||||
"ip_target"
|
||||
);
|
||||
$filter = array(
|
||||
"id_agente" => $id_agente,
|
||||
"id_tipo_modulo" => (int)db_get_value("id_tipo", "ttipo_modulo", "nombre", "remote_snmp_proc"),
|
||||
"disabled" => 0
|
||||
);
|
||||
$modules = agents_get_modules($id_agente, $columns, $filter, true, false);
|
||||
$interfaces = array();
|
||||
$network_interfaces_by_agents = agents_get_network_interfaces(array($agent));
|
||||
|
||||
if (!empty($modules)) {
|
||||
foreach ($modules as $key => $module) {
|
||||
// Trying to get the interface name from the module name
|
||||
if (preg_match ("/_(.+)$/", (string)$module['nombre'], $matches)) {
|
||||
if ($matches[1]) {
|
||||
$interface_name = $matches[1];
|
||||
$interface_name_escaped = str_replace("/", "\/", $interface_name);
|
||||
|
||||
if (!isset($interfaces[$interface_name])
|
||||
|| (isset($interfaces[$interface_name])
|
||||
&& preg_match ("/^ifOperStatus_$interface_name_escaped$/i", (string)$module['nombre'], $matches))) {
|
||||
$interfaces[$interface_name] = $module;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
unset($modules);
|
||||
$network_interfaces = array();
|
||||
if (!empty($network_interfaces_by_agents) && !empty($network_interfaces_by_agents[$id_agente])) {
|
||||
$network_interfaces = $network_interfaces_by_agents[$id_agente]['interfaces'];
|
||||
}
|
||||
|
||||
if (!empty($network_interfaces)) {
|
||||
$table_interface = new stdClass();
|
||||
$table_interface->id = 'agent_interface_info';
|
||||
$table_interface->class = 'databox';
|
||||
$table_interface->width = '100%';
|
||||
$table_interface->style = array();
|
||||
$table_interface->style['interface_status'] = 'width: 30px;';
|
||||
$table_interface->style['interface_graph'] = 'width: 20px;';
|
||||
$table_interface->head = array();
|
||||
$options = array(
|
||||
"class" => "closed",
|
||||
"style" => "vertical-align:middle; cursor:pointer;");
|
||||
$table_interface->head[0] = html_print_image("images/go.png", true, $options) . " ";
|
||||
$table_interface->head[0] .= '<span style="vertical-align: middle;">' . __('Interface information') .' (SNMP)</span>';
|
||||
$table_interface->head_colspan = array();
|
||||
$table_interface->head_colspan[0] = 5;
|
||||
$table_interface->data = array();
|
||||
|
||||
if (!empty($interfaces)) {
|
||||
|
||||
$table_interface = new stdClass();
|
||||
$table_interface->id = 'agent_interface_info';
|
||||
$table_interface->class = 'databox';
|
||||
$table_interface->width = '100%';
|
||||
$table_interface->style = array();
|
||||
$table_interface->style['interface_status'] = 'width: 30px;';
|
||||
$table_interface->style['interface_graph'] = 'width: 20px;';
|
||||
$table_interface->head = array();
|
||||
$options = array(
|
||||
"class" => "closed",
|
||||
"style" => "vertical-align:middle; cursor:pointer;");
|
||||
$table_interface->head[0] = html_print_image("images/go.png", true, $options) . " ";
|
||||
$table_interface->head[0] .= '<span style="vertical-align: middle;">' . __('Interface information') .' (SNMP)</span>';
|
||||
$table_interface->head_colspan = array();
|
||||
$table_interface->head_colspan[0] = 5;
|
||||
$table_interface->data = array();
|
||||
|
||||
foreach ($interfaces as $interface_name => $module) {
|
||||
$interface_name_escaped = str_replace("/", "\/", $interface_name);
|
||||
|
||||
$module_id = $module['id_agente_modulo'];
|
||||
$db_status = modules_get_agentmodule_status($module_id);
|
||||
$module_value = modules_get_last_value ($module_id);
|
||||
modules_get_status($module_id, $db_status, $module_value, $status, $title);
|
||||
$status = ui_print_status_image($status, $title, true);
|
||||
|
||||
$ip_target = "--";
|
||||
// Trying to get something like an IP from the description
|
||||
if (preg_match ("/\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}/", (string)$module['descripcion'], $matches) ||
|
||||
preg_match ("/(((?=(?>.*?(::))(?!.+\3)))\3?|([\dA-F]{1,4}(\3|:?)|\2))(?4){5}((?4){2}|(25[0-5]|
|
||||
(2[0-4]|1\d|[1-9])?\d)(\.(?7)){3})/i", (string)$module['descripcion'], $matches)) {
|
||||
if ($matches[0]) {
|
||||
$ip_target = $matches[0];
|
||||
}
|
||||
}
|
||||
$mac = "--";
|
||||
// Trying to get something like a mac from the description
|
||||
if (preg_match ("/([0-9a-f]{1,2}[\.:-]){5}([0-9a-f]{1,2})/i", (string)$module['descripcion'], $matches)) {
|
||||
if ($matches[0]) {
|
||||
$mac = $matches[0];
|
||||
}
|
||||
}
|
||||
|
||||
// Get the ifInOctets and ifOutOctets modules of the interface
|
||||
$columns = array(
|
||||
"id_agente_modulo",
|
||||
"nombre"
|
||||
);
|
||||
$interface_traffic_modules = agents_get_modules($id_agente, $columns, "nombre LIKE 'if%Octets_$interface_name'");
|
||||
if (!empty($interface_traffic_modules) && count($interface_traffic_modules) >= 2) {
|
||||
$interface_traffic_modules_aux = array('in' => '', 'out' => '');
|
||||
foreach ($interface_traffic_modules as $interface_traffic_module) {
|
||||
$interface_name_escaped = str_replace("/", "\/", $interface_name);
|
||||
if (preg_match ("/^if(.+)Octets_$interface_name_escaped$/i", $interface_traffic_module['nombre'], $matches)) {
|
||||
if (strtolower($matches[1]) == 'in') {
|
||||
$interface_traffic_modules_aux['in'] = $interface_traffic_module['id_agente_modulo'];
|
||||
}
|
||||
elseif (strtolower($matches[1]) == 'out') {
|
||||
$interface_traffic_modules_aux['out'] = $interface_traffic_module['id_agente_modulo'];
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!empty($interface_traffic_modules_aux['in']) && !empty($interface_traffic_modules_aux['out'])) {
|
||||
$interface_traffic_modules = $interface_traffic_modules_aux;
|
||||
}
|
||||
else {
|
||||
$interface_traffic_modules = false;
|
||||
}
|
||||
}
|
||||
else {
|
||||
$interface_traffic_modules = false;
|
||||
}
|
||||
|
||||
if ($interface_traffic_modules != false) {
|
||||
$params = array(
|
||||
'interface_name' => $interface_name,
|
||||
'agent_id' => $id_agente,
|
||||
'traffic_module_in' => $interface_traffic_modules_aux['in'],
|
||||
'traffic_module_out' => $interface_traffic_modules_aux['out']
|
||||
);
|
||||
$params_json = json_encode($params);
|
||||
$params_encoded = base64_encode($params_json);
|
||||
$win_handle = dechex(crc32($module_id.$interface_name));
|
||||
$graph_link = "<a href=\"javascript:winopeng('operation/agentes/interface_traffic_graph_win.php?params=$params_encoded','$win_handle')\">" .
|
||||
html_print_image("images/chart_curve.png", true, array("title" => __('Interface traffic'))) . "</a>";
|
||||
}
|
||||
else {
|
||||
$graph_link = "";
|
||||
}
|
||||
|
||||
$data = array();
|
||||
$data['interface_name'] = "<strong>" . $interface_name . "</strong>";
|
||||
$data['interface_status'] = $status;
|
||||
$data['interface_graph'] = $graph_link;
|
||||
$data['interface_ip'] = $ip_target;
|
||||
$data['interface_mac'] = $mac;
|
||||
$table_interface->data[] = $data;
|
||||
foreach ($network_interfaces as $interface_name => $interface) {
|
||||
if (!empty($interface['traffic'])) {
|
||||
$params = array(
|
||||
'interface_name' => $interface_name,
|
||||
'agent_id' => $id_agente,
|
||||
'traffic_module_in' => $interface['traffic']['in'],
|
||||
'traffic_module_out' => $interface['traffic']['out']
|
||||
);
|
||||
$params_json = json_encode($params);
|
||||
$params_encoded = base64_encode($params_json);
|
||||
$win_handle = dechex(crc32($interface['status_module_id'].$interface_name));
|
||||
$graph_link = "<a href=\"javascript:winopeng('operation/agentes/interface_traffic_graph_win.php?params=$params_encoded','$win_handle')\">" .
|
||||
html_print_image("images/chart_curve.png", true, array("title" => __('Interface traffic'))) . "</a>";
|
||||
}
|
||||
else {
|
||||
$graph_link = "";
|
||||
}
|
||||
|
||||
$data = array();
|
||||
$data['interface_name'] = "<strong>" . $interface_name . "</strong>";
|
||||
$data['interface_status'] = $interface['status_image'];
|
||||
$data['interface_graph'] = $graph_link;
|
||||
$data['interface_ip'] = $interface['ip'];
|
||||
$data['interface_mac'] = $interface['mac'];
|
||||
$table_interface->data[] = $data;
|
||||
}
|
||||
|
||||
// This javascript piece of code is used to make expandible the body of the table
|
||||
?>
|
||||
?>
|
||||
<script type="text/javascript">
|
||||
$(document).ready (function () {
|
||||
$("#agent_interface_info").find("tbody").hide();
|
||||
|
@ -540,7 +456,7 @@ if (!empty($modules)) {
|
|||
.css('cursor', 'pointer');
|
||||
});
|
||||
</script>
|
||||
<?php
|
||||
<?php
|
||||
}
|
||||
|
||||
// END: TABLE INTERFACES
|
||||
|
|
|
@ -66,7 +66,7 @@ switch ($status) {
|
|||
}
|
||||
|
||||
if ($search != "") {
|
||||
$sql_post .= " AND (evento LIKE '%" . io_safe_input($search) . "%' OR id_evento LIKE '%$search%')";
|
||||
$sql_post .= ' AND (evento LIKE "%'. io_safe_input($search) . '%"'. ' OR id_evento LIKE "%$search%")';
|
||||
}
|
||||
|
||||
if ($event_type != "") {
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1,345 +0,0 @@
|
|||
<?php
|
||||
|
||||
// Pandora FMS - http://pandorafms.com
|
||||
// ==================================================
|
||||
// Copyright (c) 2005-2010 Artica Soluciones Tecnologicas
|
||||
// Please see http://pandorafms.org for full contribution list
|
||||
|
||||
// This program is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU Lesser General Public License
|
||||
// as published by the Free Software Foundation; 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.
|
||||
|
||||
global $config;
|
||||
|
||||
$tab = get_parameter('tab', 'group');
|
||||
$search_agent = get_parameter('searchAgent', '');
|
||||
$status_agent = get_parameter('statusAgent', AGENT_STATUS_ALL);
|
||||
$search_module = get_parameter('searchModule', '');
|
||||
$status_module = get_parameter('statusModule', -1);
|
||||
|
||||
|
||||
// ---------------------Tabs -------------------------------------------
|
||||
$enterpriseEnable = false;
|
||||
if (enterprise_include_once('include/functions_policies.php') !== ENTERPRISE_NOT_HOOK) {
|
||||
$enterpriseEnable = true;
|
||||
}
|
||||
|
||||
$url = 'index.php?' .
|
||||
'sec=estado&' .
|
||||
'sec2=operation/tree&' .
|
||||
'refr=0&' .
|
||||
'pure=' . (int)get_parameter('pure', 0) . '&' .
|
||||
'tab=%s';
|
||||
|
||||
$tabs = array();
|
||||
$tabs['os'] = array(
|
||||
'text' => "<a href='" . sprintf($url, "os") . "'>" .
|
||||
html_print_image("images/operating_system.png", true,
|
||||
array("title" => __('OS'))) . "</a>",
|
||||
'active' => ($tab == "os"));
|
||||
|
||||
$tabs['group'] = array(
|
||||
'text' => "<a href='" . sprintf($url, "group") . "'>" .
|
||||
html_print_image("images/group.png", true,
|
||||
array("title" => __('Groups'))) . "</a>",
|
||||
'active' => ($tab == "group"));
|
||||
|
||||
$tabs['module_group'] = array(
|
||||
'text' => "<a href='" . sprintf($url, "module_group") . "'>" .
|
||||
html_print_image("images/module_group.png", true,
|
||||
array("title" => __('Module groups'))) . "</a>",
|
||||
'active' => ($tab == "module_group"));
|
||||
|
||||
$tabs['module'] = array(
|
||||
'text' => "<a href='" . sprintf($url, "module") . "'>" .
|
||||
html_print_image("images/brick.png", true,
|
||||
array("title" => __('Modules'))) . "</a>",
|
||||
'active' => ($tab == "module"));
|
||||
|
||||
$tabs['tag'] = array(
|
||||
'text' => "<a href='" . sprintf($url, "tag") . "'>" .
|
||||
html_print_image("images/tag.png", true,
|
||||
array("title" => __('Tags'))) . "</a>",
|
||||
'active' => ($tab == "tag"));
|
||||
|
||||
if ($enterpriseEnable) {
|
||||
$tabs['policies'] = array(
|
||||
'text' => "<a href='" . sprintf($url, "policies") . "'>" .
|
||||
html_print_image("images/policies_mc.png", true,
|
||||
array("title" => __('Policies'))) . "</a>",
|
||||
'active' => ($tab == "policies"));
|
||||
}
|
||||
|
||||
$header_title = "";
|
||||
switch ($tab) {
|
||||
case 'os':
|
||||
$header_title =
|
||||
__('Tree view - Sort the agents by OS');
|
||||
break;
|
||||
case 'group':
|
||||
$header_title =
|
||||
__('Tree view - Sort the agents by groups');
|
||||
break;
|
||||
case 'module_group':
|
||||
$header_title =
|
||||
__('Tree view - Sort the agents by module groups');
|
||||
break;
|
||||
case 'module':
|
||||
$header_title =
|
||||
__('Tree view - Sort the agents by modules');
|
||||
break;
|
||||
case 'tag':
|
||||
$header_title =
|
||||
__('Tree view - Sort the agents by tags');
|
||||
break;
|
||||
}
|
||||
|
||||
ui_print_page_header(
|
||||
$header_title, "images/extensions.png", false, "", false, $tabs);
|
||||
// ---------------------Tabs -------------------------------------------
|
||||
|
||||
|
||||
// --------------------- form filter -----------------------------------
|
||||
$table = null;
|
||||
$table->width = "100%";
|
||||
$table->data = array();
|
||||
$table->rowspan = array();
|
||||
|
||||
// Agent filter
|
||||
$agent_status_arr = array();
|
||||
$agent_status_arr[AGENT_STATUS_ALL] = __('All'); //default
|
||||
$agent_status_arr[AGENT_STATUS_NORMAL] = __('Normal');
|
||||
$agent_status_arr[AGENT_STATUS_WARNING] = __('Warning');
|
||||
$agent_status_arr[AGENT_STATUS_CRITICAL] = __('Critical');
|
||||
$agent_status_arr[AGENT_STATUS_UNKNOWN] = __('Unknown');
|
||||
$agent_status_arr[AGENT_STATUS_NOT_INIT] = __('Not init');
|
||||
|
||||
$row = array();
|
||||
$row[] = __('Agent status');
|
||||
$row[] = html_print_select($agent_status_arr, "status_agent", $status_agent, '', '', 0, true);
|
||||
$row[] = __('Search agent');
|
||||
$row[] = html_print_input_text("search_agent", $search_agent, '', 40, 30, true);
|
||||
|
||||
// Button
|
||||
$row[] = html_print_submit_button(__('Filter'), "uptbutton", false, 'class="sub search"', true);
|
||||
$table->rowspan[][count($row)-1] = 2;
|
||||
|
||||
$table->data[] = $row;
|
||||
|
||||
// Module filter
|
||||
$module_status_arr = array();
|
||||
$module_status_arr[-1] = __('All'); //default
|
||||
$module_status_arr[AGENT_MODULE_STATUS_NORMAL] = __('Normal');
|
||||
$module_status_arr[AGENT_MODULE_STATUS_WARNING] = __('Warning');
|
||||
$module_status_arr[AGENT_MODULE_STATUS_CRITICAL_BAD] = __('Critical');
|
||||
$module_status_arr[AGENT_MODULE_STATUS_UNKNOWN] = __('Unknown');
|
||||
$module_status_arr[AGENT_MODULE_STATUS_NOT_INIT] = __('Not init');
|
||||
|
||||
$row = array();
|
||||
$row[] = __('Module status');
|
||||
$row[] = html_print_select($module_status_arr, "status_module", $status_module, '', '', 0, true);
|
||||
$row[] = __('Search module');
|
||||
$row[] = html_print_input_text("search_module", $search_module, '', 40, 30, true);
|
||||
|
||||
$table->data[] = $row;
|
||||
|
||||
echo '<form id="tree_search" method="post" action="index.php?sec=monitoring&sec2=operation/tree&refr=0&tab='.$tab.'&pure='.$config['pure'].'">';
|
||||
html_print_table($table);
|
||||
echo '</form>';
|
||||
|
||||
// --------------------- form filter -----------------------------------
|
||||
ui_include_time_picker();
|
||||
ui_require_jquery_file("ui.datepicker-" . get_user_language(), "include/javascript/i18n/");
|
||||
|
||||
ui_require_javascript_file("TreeController", "include/javascript/tree/");
|
||||
html_print_image('images/spinner.gif', false,
|
||||
array('class' => "loading_tree",
|
||||
'style' => 'display: none;'));
|
||||
echo "<div id='tree-controller-recipient' style='float: left;'>";
|
||||
echo "</div>";
|
||||
echo "<div id='tree-controller-detail-recipient' style='float: right;'>";
|
||||
echo "</div>";
|
||||
?>
|
||||
<script type="text/javascript">
|
||||
var treeController = TreeController.getController();
|
||||
|
||||
processTreeSearch();
|
||||
|
||||
$("form#tree_search").submit(function(e) {
|
||||
e.preventDefault();
|
||||
|
||||
processTreeSearch();
|
||||
});
|
||||
|
||||
function processTreeSearch () {
|
||||
// Clear the tree
|
||||
if (typeof treeController.recipient != 'undefined' && treeController.recipient.length > 0)
|
||||
treeController.recipient.empty();
|
||||
|
||||
$(".loading_tree").show();
|
||||
|
||||
var parameters = {};
|
||||
parameters['page'] = "include/ajax/tree.ajax";
|
||||
parameters['getChildren'] = 1;
|
||||
parameters['filter'] = {};
|
||||
parameters['type'] = "<?php echo $tab; ?>";
|
||||
parameters['filter']['searchAgent'] = $("input#text-search_agent").val();
|
||||
parameters['filter']['statusAgent'] = $("select#status_agent").val();
|
||||
parameters['filter']['searchModule'] = $("input#text-search_module").val();
|
||||
parameters['filter']['statusModule'] = $("select#status_module").val();
|
||||
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: "<?php echo ui_get_full_url('ajax.php', false, false, false); ?>",
|
||||
data: parameters,
|
||||
success: function(data) {
|
||||
if (data.success) {
|
||||
$(".loading_tree").hide();
|
||||
|
||||
treeController.init({
|
||||
recipient: $("div#tree-controller-recipient"),
|
||||
detailRecipient: $("div#tree-controller-detail-recipient"),
|
||||
page: page,
|
||||
tree: data.tree,
|
||||
baseURL: "<?php echo ui_get_full_url(false, false, false, false); ?>",
|
||||
ajaxURL: "<?php echo ui_get_full_url('ajax.php', false, false, false); ?>",
|
||||
filter: parameters['filter'],
|
||||
counterTitles: {
|
||||
total: {
|
||||
agents: "<?php echo __('Total agents'); ?>",
|
||||
modules: "<?php echo __('Total modules'); ?>",
|
||||
none: "<?php echo __('Total'); ?>"
|
||||
},
|
||||
fired: {
|
||||
agents: "<?php echo __('Fired alerts'); ?>",
|
||||
modules: "<?php echo __('Fired alerts'); ?>",
|
||||
none: "<?php echo __('Fired alerts'); ?>"
|
||||
},
|
||||
critical: {
|
||||
agents: "<?php echo __('Critical agents'); ?>",
|
||||
modules: "<?php echo __('Critical modules'); ?>",
|
||||
none: "<?php echo __('Critical'); ?>"
|
||||
},
|
||||
warning: {
|
||||
agents: "<?php echo __('Warning agents'); ?>",
|
||||
modules: "<?php echo __('Warning modules'); ?>",
|
||||
none: "<?php echo __('Warning'); ?>"
|
||||
},
|
||||
unknown: {
|
||||
agents: "<?php echo __('Unknown agents'); ?>",
|
||||
modules: "<?php echo __('Unknown modules'); ?>",
|
||||
none: "<?php echo __('Unknown'); ?>"
|
||||
},
|
||||
not_init: {
|
||||
agents: "<?php echo __('Not init agents'); ?>",
|
||||
modules: "<?php echo __('Not init modules'); ?>",
|
||||
none: "<?php echo __('Not init'); ?>"
|
||||
},
|
||||
ok: {
|
||||
agents: "<?php echo __('Normal agents'); ?>",
|
||||
modules: "<?php echo __('Normal modules'); ?>",
|
||||
none: "<?php echo __('Normal'); ?>"
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
dataType: "json"
|
||||
});
|
||||
}
|
||||
|
||||
// Show the modal window of an module
|
||||
var moduleDetailsWindow = $("<div></div>");
|
||||
moduleDetailsWindow
|
||||
.hide()
|
||||
.prop("id", "module_details_window")
|
||||
.appendTo('body');
|
||||
|
||||
function show_module_detail_dialog(module_id, id_agent, server_name, offset, period) {
|
||||
var params = {};
|
||||
|
||||
if (period == -1) {
|
||||
period = $('#period').val();
|
||||
params.selection_mode = $('input[name=selection_mode]:checked').val();
|
||||
params.date_from = $('#text-date_from').val();
|
||||
params.time_from = $('#text-time_from').val();
|
||||
params.date_to = $('#text-date_to').val();
|
||||
params.time_to = $('#text-time_to').val();
|
||||
}
|
||||
|
||||
params.page = "include/ajax/module";
|
||||
params.get_module_detail = 1;
|
||||
params.server_name = server_name;
|
||||
params.id_agent = id_agent;
|
||||
params.id_module = module_id;
|
||||
params.offset = offset;
|
||||
params.period = period;
|
||||
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: "<?php echo ui_get_full_url('ajax.php', false, false, false); ?>",
|
||||
data: params,
|
||||
dataType: "html",
|
||||
success: function(data) {
|
||||
$("#module_details_window").hide ()
|
||||
.empty ()
|
||||
.append (data)
|
||||
.dialog ({
|
||||
resizable: true,
|
||||
draggable: true,
|
||||
modal: true,
|
||||
overlay: {
|
||||
opacity: 0.5,
|
||||
background: "black"
|
||||
},
|
||||
width: 650,
|
||||
height: 500
|
||||
})
|
||||
.show ();
|
||||
refresh_pagination_callback(module_id, id_agent, server_name);
|
||||
datetime_picker_callback();
|
||||
forced_title_callback();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function datetime_picker_callback() {
|
||||
$("#text-time_from, #text-time_to").timepicker({
|
||||
showSecond: true,
|
||||
timeFormat: '<?php echo TIME_FORMAT_JS; ?>',
|
||||
timeOnlyTitle: '<?php echo __('Choose time');?>',
|
||||
timeText: '<?php echo __('Time');?>',
|
||||
hourText: '<?php echo __('Hour');?>',
|
||||
minuteText: '<?php echo __('Minute');?>',
|
||||
secondText: '<?php echo __('Second');?>',
|
||||
currentText: '<?php echo __('Now');?>',
|
||||
closeText: '<?php echo __('Close');?>'});
|
||||
|
||||
$.datepicker.setDefaults($.datepicker.regional[ "<?php echo get_user_language(); ?>"]);
|
||||
$("#text-date_from, #text-date_to").datepicker({dateFormat: "<?php echo DATE_FORMAT_JS; ?>"});
|
||||
|
||||
}
|
||||
|
||||
function refresh_pagination_callback (module_id, id_agent, server_name) {
|
||||
|
||||
$(".binary_dialog").click( function() {
|
||||
|
||||
var classes = $(this).attr('class');
|
||||
classes = classes.split(' ');
|
||||
var offset_class = classes[2];
|
||||
offset_class = offset_class.split('_');
|
||||
var offset = offset_class[1];
|
||||
|
||||
var period = $('#period').val();
|
||||
|
||||
show_module_detail_dialog(module_id, id_agent, server_name, offset, period);
|
||||
return false;
|
||||
});
|
||||
}
|
||||
|
||||
</script>
|
|
@ -3,7 +3,7 @@
|
|||
#
|
||||
%define name pandorafms_console
|
||||
%define version 6.0dev
|
||||
%define release 150129
|
||||
%define release 150202
|
||||
|
||||
# User and Group under which Apache is running
|
||||
%define httpd_name httpd
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
#
|
||||
%define name pandorafms_console
|
||||
%define version 6.0dev
|
||||
%define release 150129
|
||||
%define release 150202
|
||||
%define httpd_name httpd
|
||||
# User and Group under which Apache is running
|
||||
%define httpd_name apache2
|
||||
|
|
|
@ -38,7 +38,7 @@ INSERT INTO `tconfig` (`token`, `value`) VALUES
|
|||
('graph_res','5'),
|
||||
('step_compact','1'),
|
||||
('db_scheme_version','6.0dev'),
|
||||
('db_scheme_build','PD150129'),
|
||||
('db_scheme_build','PD150202'),
|
||||
('show_unknown','0'),
|
||||
('show_lastalerts','1'),
|
||||
('style','pandora'),
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
package: pandorafms-server
|
||||
Version: 6.0dev-150129
|
||||
Version: 6.0dev-150202
|
||||
Architecture: all
|
||||
Priority: optional
|
||||
Section: admin
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
|
||||
pandora_version="6.0dev-150129"
|
||||
pandora_version="6.0dev-150202"
|
||||
|
||||
package_cpan=0
|
||||
package_pandora=1
|
||||
|
|
|
@ -43,7 +43,7 @@ our @EXPORT = qw(
|
|||
|
||||
# version: Defines actual version of Pandora Server for this module only
|
||||
my $pandora_version = "6.0dev";
|
||||
my $pandora_build = "150129";
|
||||
my $pandora_build = "150202";
|
||||
our $VERSION = $pandora_version." ".$pandora_build;
|
||||
|
||||
# Setup hash
|
||||
|
|
|
@ -2005,6 +2005,7 @@ sub pandora_update_server ($$$$$$;$$) {
|
|||
$queue_size = 0 unless defined ($queue_size);
|
||||
|
||||
my $timestamp = strftime ("%Y-%m-%d %H:%M:%S", localtime());
|
||||
my $version = $pa_config->{'version'} . ' (P) ' . $pa_config->{'build'};
|
||||
|
||||
# First run
|
||||
if ($server_id == 0) {
|
||||
|
@ -2014,7 +2015,7 @@ sub pandora_update_server ($$$$$$;$$) {
|
|||
if (! defined ($server)) {
|
||||
$server_id = db_insert ($dbh, 'id_server', 'INSERT INTO tserver (name, server_type, description, version, threads, queued_modules)
|
||||
VALUES (?, ?, ?, ?, ?, ?)', $server_name, $server_type,
|
||||
'Autocreated at startup', $pa_config->{'version'} . ' (P) ' . $pa_config->{'build'}, $num_threads, $queue_size);
|
||||
'Autocreated at startup', $version, $num_threads, $queue_size);
|
||||
|
||||
$server = get_db_single_row ($dbh, 'SELECT status FROM tserver WHERE id_server = ?', $server_id);
|
||||
if (! defined ($server)) {
|
||||
|
@ -2023,15 +2024,14 @@ sub pandora_update_server ($$$$$$;$$) {
|
|||
}
|
||||
}
|
||||
|
||||
my $version = $pa_config->{'version'} . ' (P) ' . $pa_config->{'build'};
|
||||
db_do ($dbh, 'UPDATE tserver SET status = ?, keepalive = ?, master = ?, laststart = ?, version = ?, threads = ?, queued_modules = ?
|
||||
WHERE id_server = ?',
|
||||
1, $timestamp, $pa_config->{'pandora_master'}, $timestamp, $version, $num_threads, $queue_size, $server_id);
|
||||
return;
|
||||
}
|
||||
|
||||
db_do ($dbh, 'UPDATE tserver SET status = ?, keepalive = ?, master = ?, threads = ?, queued_modules = ?
|
||||
WHERE id_server = ?', $status, $timestamp, $pa_config->{'pandora_master'}, $num_threads, $queue_size, $server_id);
|
||||
db_do ($dbh, 'UPDATE tserver SET status = ?, keepalive = ?, master = ?, version = ?, threads = ?, queued_modules = ?
|
||||
WHERE id_server = ?', $status, $timestamp, $pa_config->{'pandora_master'}, $version, $num_threads, $queue_size, $server_id);
|
||||
}
|
||||
|
||||
##########################################################################
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
#
|
||||
%define name pandorafms_server
|
||||
%define version 6.0dev
|
||||
%define release 150129
|
||||
%define release 150202
|
||||
|
||||
Summary: Pandora FMS Server
|
||||
Name: %{name}
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
#
|
||||
%define name pandorafms_server
|
||||
%define version 6.0dev
|
||||
%define release 150129
|
||||
%define release 150202
|
||||
|
||||
Summary: Pandora FMS Server
|
||||
Name: %{name}
|
||||
|
|
|
@ -33,7 +33,7 @@ use PandoraFMS::Tools;
|
|||
use PandoraFMS::DB;
|
||||
|
||||
# version: define current version
|
||||
my $version = "6.0dev PS150129";
|
||||
my $version = "6.0dev PS150202";
|
||||
|
||||
# Pandora server configuration
|
||||
my %conf;
|
||||
|
|
|
@ -34,7 +34,7 @@ use Encode::Locale;
|
|||
Encode::Locale::decode_argv;
|
||||
|
||||
# version: define current version
|
||||
my $version = "6.0dev PS150129";
|
||||
my $version = "6.0dev PS150202";
|
||||
|
||||
# save program name for logging
|
||||
my $progname = basename($0);
|
||||
|
|
Loading…
Reference in New Issue