mirror of
https://github.com/pandorafms/pandorafms.git
synced 2025-07-29 00:34:46 +02:00
2008-06-30 Esteban Sanchez <estebans@artica.es>
* include/functions_db.php: Renamed get_db_all_rows_sqlfree() to get_db_all_rows_sql(). Replaced all occurrences of old function name. * general/logon_ok.php, godmode/reporting/reporting_builder.php, operation/reporting/reporting_viewer.php, reporting/fgraph.php, include/functions_reporting.php: Replaced all occurrences ofget_db_all_rows_sqlfree() with get_db_all_rows_sql(). * include/config_process.php: Do not add a slash to attachment_store config variable. * include/functions.php: Style correction. * operation/agentes/estado_agente.php: Reduced one indentation level by using comprueba_login() propperly. * include/javascript/jquery.cluetip.js: Added to repository. jQuery plugin to add cute tips support. * images/darrowdown.gif, images/darrowright.gif, images/darrowup.gif, images/darrowleft.gif, images/wait.gif, include/styles/cluetip.css: Added to repository. Cute tips styling. * operation/agentes/networkmap.php: Added support to pretty tips to each node of the network map. Use a variable to define the name of Pandora FMS node (maybe it would be a nice idea to let the user configure it). Added an extra check for file existance when generating the graphic. Use pandora functions in some cases. Style correction. * operation/agentes/ver_agente.php: Added AJAX support to get the current status of an agent to suit in a tooltip. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@903 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
parent
079c147e8b
commit
33992fd9e9
@ -1,3 +1,37 @@
|
|||||||
|
2008-06-30 Esteban Sanchez <estebans@artica.es>
|
||||||
|
|
||||||
|
* include/functions_db.php: Renamed get_db_all_rows_sqlfree() to
|
||||||
|
get_db_all_rows_sql(). Replaced all occurrences of old function name.
|
||||||
|
|
||||||
|
* general/logon_ok.php, godmode/reporting/reporting_builder.php,
|
||||||
|
operation/reporting/reporting_viewer.php, reporting/fgraph.php,
|
||||||
|
include/functions_reporting.php: Replaced all occurrences
|
||||||
|
ofget_db_all_rows_sqlfree() with get_db_all_rows_sql().
|
||||||
|
|
||||||
|
* include/config_process.php: Do not add a slash to attachment_store
|
||||||
|
config variable.
|
||||||
|
|
||||||
|
* include/functions.php: Style correction.
|
||||||
|
|
||||||
|
* operation/agentes/estado_agente.php: Reduced one indentation level
|
||||||
|
by using comprueba_login() propperly.
|
||||||
|
|
||||||
|
* include/javascript/jquery.cluetip.js: Added to repository. jQuery
|
||||||
|
plugin to add cute tips support.
|
||||||
|
|
||||||
|
* images/darrowdown.gif, images/darrowright.gif, images/darrowup.gif,
|
||||||
|
images/darrowleft.gif, images/wait.gif, include/styles/cluetip.css:
|
||||||
|
Added to repository. Cute tips styling.
|
||||||
|
|
||||||
|
* operation/agentes/networkmap.php: Added support to pretty tips to
|
||||||
|
each node of the network map. Use a variable to define the name of
|
||||||
|
Pandora FMS node (maybe it would be a nice idea to let the user
|
||||||
|
configure it). Added an extra check for file existance when generating
|
||||||
|
the graphic. Use pandora functions in some cases. Style correction.
|
||||||
|
|
||||||
|
* operation/agentes/ver_agente.php: Added AJAX support to get the
|
||||||
|
current status of an agent to suit in a tooltip.
|
||||||
|
|
||||||
2008-06-27 Esteban Sanchez <estebans@artica.es>
|
2008-06-27 Esteban Sanchez <estebans@artica.es>
|
||||||
|
|
||||||
* include/functions_db.php: Renamed variable from spanish.
|
* include/functions_db.php: Renamed variable from spanish.
|
||||||
|
@ -175,7 +175,7 @@ $table->head[4] = lang_string ('comments');
|
|||||||
|
|
||||||
$sql = sprintf ('SELECT * FROM tsesion WHERE (TO_DAYS(fecha) > TO_DAYS(NOW()) - 7)
|
$sql = sprintf ('SELECT * FROM tsesion WHERE (TO_DAYS(fecha) > TO_DAYS(NOW()) - 7)
|
||||||
AND ID_usuario = "%s" ORDER BY fecha DESC LIMIT 5', $nick);
|
AND ID_usuario = "%s" ORDER BY fecha DESC LIMIT 5', $nick);
|
||||||
$sessions = get_db_all_rows_sqlfree ($sql);
|
$sessions = get_db_all_rows_sql ($sql);
|
||||||
foreach ($sessions as $session) {
|
foreach ($sessions as $session) {
|
||||||
$data = array ();
|
$data = array ();
|
||||||
|
|
||||||
|
@ -397,7 +397,7 @@ if ($edit_sla_report_content) {
|
|||||||
$modules = array ();
|
$modules = array ();
|
||||||
if ($id_agent) {
|
if ($id_agent) {
|
||||||
$sql = sprintf ('SELECT * FROM tagente_modulo WHERE id_agente = %d ORDER BY nombre', $id_agent);
|
$sql = sprintf ('SELECT * FROM tagente_modulo WHERE id_agente = %d ORDER BY nombre', $id_agent);
|
||||||
$modules = get_db_all_rows_sqlfree ($sql);
|
$modules = get_db_all_rows_sql ($sql);
|
||||||
}
|
}
|
||||||
$table->data[3][1] = print_select ($modules, 'id_module', 0, '', '--', 0, true);
|
$table->data[3][1] = print_select ($modules, 'id_module', 0, '', '--', 0, true);
|
||||||
|
|
||||||
@ -437,7 +437,7 @@ if ($edit_sla_report_content) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
$sql = sprintf ('SELECT * FROM treport_content WHERE id_report = %d ORDER BY `order`', $id_report);
|
$sql = sprintf ('SELECT * FROM treport_content WHERE id_report = %d ORDER BY `order`', $id_report);
|
||||||
$report_contents = get_db_all_rows_sqlfree ($sql);
|
$report_contents = get_db_all_rows_sql ($sql);
|
||||||
if (sizeof ($report_contents)) {
|
if (sizeof ($report_contents)) {
|
||||||
$first_id = $report_contents[0]['id_rc'];
|
$first_id = $report_contents[0]['id_rc'];
|
||||||
$last_id = $report_contents[sizeof ($report_contents) - 1]['id_rc'];
|
$last_id = $report_contents[sizeof ($report_contents) - 1]['id_rc'];
|
||||||
|
BIN
pandora_console/images/darrowdown.gif
Normal file
BIN
pandora_console/images/darrowdown.gif
Normal file
Binary file not shown.
After Width: | Height: | Size: 69 B |
BIN
pandora_console/images/darrowleft.gif
Normal file
BIN
pandora_console/images/darrowleft.gif
Normal file
Binary file not shown.
After Width: | Height: | Size: 76 B |
BIN
pandora_console/images/darrowright.gif
Normal file
BIN
pandora_console/images/darrowright.gif
Normal file
Binary file not shown.
After Width: | Height: | Size: 77 B |
BIN
pandora_console/images/darrowup.gif
Normal file
BIN
pandora_console/images/darrowup.gif
Normal file
Binary file not shown.
After Width: | Height: | Size: 69 B |
BIN
pandora_console/images/wait.gif
Normal file
BIN
pandora_console/images/wait.gif
Normal file
Binary file not shown.
After Width: | Height: | Size: 432 B |
@ -26,7 +26,7 @@ if (!isset($pandora_version))
|
|||||||
// This MUST be writtable by http server user, and should be in pandora root.
|
// This MUST be writtable by http server user, and should be in pandora root.
|
||||||
// By default, Pandora adds /attachment to this, so by default is the pandora console home dir
|
// By default, Pandora adds /attachment to this, so by default is the pandora console home dir
|
||||||
|
|
||||||
$config["attachment_store"]=$config["homedir"]."/attachment";
|
$config["attachment_store"]=$config["homedir"]."attachment";
|
||||||
|
|
||||||
// Default font used for graphics (a Free TrueType font included with Pandora FMS)
|
// Default font used for graphics (a Free TrueType font included with Pandora FMS)
|
||||||
$config["fontpath"] = $config["homedir"]."/reporting/FreeSans.ttf";
|
$config["fontpath"] = $config["homedir"]."/reporting/FreeSans.ttf";
|
||||||
|
@ -551,7 +551,7 @@ function human_time_description ($period) {
|
|||||||
*
|
*
|
||||||
* @return The current time minus the seconds given.
|
* @return The current time minus the seconds given.
|
||||||
*/
|
*/
|
||||||
function human_date_relative ( $seconds ) {
|
function human_date_relative ($seconds) {
|
||||||
$ahora=date("Y/m/d H:i:s");
|
$ahora=date("Y/m/d H:i:s");
|
||||||
$ahora_s = date("U");
|
$ahora_s = date("U");
|
||||||
$ayer = date ("Y/m/d H:i:s", $ahora_s - $seconds);
|
$ayer = date ("Y/m/d H:i:s", $ahora_s - $seconds);
|
||||||
|
@ -231,7 +231,7 @@ function get_agents_in_group ($id_group, $disabled = false) {
|
|||||||
$sql = sprintf ('SELECT * FROM tagente
|
$sql = sprintf ('SELECT * FROM tagente
|
||||||
WHERE id_grupo = %d AND disabled = 0',
|
WHERE id_grupo = %d AND disabled = 0',
|
||||||
$id_group);
|
$id_group);
|
||||||
return get_db_all_rows_sqlfree ($sql);
|
return get_db_all_rows_sql ($sql);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -257,7 +257,7 @@ function get_simple_alerts_in_agent ($id_agent) {
|
|||||||
FROM talerta_agente_modulo, tagente_modulo
|
FROM talerta_agente_modulo, tagente_modulo
|
||||||
WHERE talerta_agente_modulo.id_agente_modulo = tagente_modulo.id_agente_modulo
|
WHERE talerta_agente_modulo.id_agente_modulo = tagente_modulo.id_agente_modulo
|
||||||
AND tagente_modulo.id_agente = %d', $id_agent);
|
AND tagente_modulo.id_agente = %d', $id_agent);
|
||||||
return get_db_all_rows_sqlfree ($sql);
|
return get_db_all_rows_sql ($sql);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -1256,7 +1256,7 @@ function get_db_sql ($sql, $field = 0) {
|
|||||||
*
|
*
|
||||||
* @return A matrix with all the values returned from the SQL statement
|
* @return A matrix with all the values returned from the SQL statement
|
||||||
*/
|
*/
|
||||||
function get_db_all_rows_sqlfree ($sql) {
|
function get_db_all_rows_sql ($sql) {
|
||||||
global $config;
|
global $config;
|
||||||
$retval = array ();
|
$retval = array ();
|
||||||
$result = mysql_query ($sql);
|
$result = mysql_query ($sql);
|
||||||
@ -1280,7 +1280,7 @@ function get_db_all_rows_sqlfree ($sql) {
|
|||||||
* @return A matrix with all the values in the table
|
* @return A matrix with all the values in the table
|
||||||
*/
|
*/
|
||||||
function get_db_all_rows_in_table ($table) {
|
function get_db_all_rows_in_table ($table) {
|
||||||
return get_db_all_rows_sqlfree ('SELECT * FROM '.$table);
|
return get_db_all_rows_sql ('SELECT * FROM '.$table);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -1301,7 +1301,7 @@ function get_db_all_rows_field_filter ($table, $field, $condition) {
|
|||||||
$sql = sprintf ('SELECT * FROM %s WHERE %s = "%s"', $table, $field, $condition);
|
$sql = sprintf ('SELECT * FROM %s WHERE %s = "%s"', $table, $field, $condition);
|
||||||
}
|
}
|
||||||
|
|
||||||
return get_db_all_rows_sqlfree ($sql);
|
return get_db_all_rows_sql ($sql);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -1314,7 +1314,7 @@ function get_db_all_rows_field_filter ($table, $field, $condition) {
|
|||||||
* @return A matrix with all the values in the table that matches the condition in the field
|
* @return A matrix with all the values in the table that matches the condition in the field
|
||||||
*/
|
*/
|
||||||
function get_db_all_fields_in_table ($table, $field) {
|
function get_db_all_fields_in_table ($table, $field) {
|
||||||
return get_db_all_rows_sqlfree ('SELECT '.$field.' FROM '. $table);
|
return get_db_all_rows_sql ('SELECT '.$field.' FROM '. $table);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -1555,7 +1555,7 @@ function return_moduledata_sum_value ($id_agent_module, $period, $date = 0) {
|
|||||||
AND utimestamp > %d AND utimestamp <= %d
|
AND utimestamp > %d AND utimestamp <= %d
|
||||||
ORDER BY utimestamp ASC',
|
ORDER BY utimestamp ASC',
|
||||||
$id_agent_module, $datelimit, $date);
|
$id_agent_module, $datelimit, $date);
|
||||||
$datas = get_db_all_rows_sqlfree ($sql);
|
$datas = get_db_all_rows_sql ($sql);
|
||||||
|
|
||||||
/* Get also the previous data before the selected interval. */
|
/* Get also the previous data before the selected interval. */
|
||||||
$previous_data = get_previous_data ($id_agent_module, $datelimit);
|
$previous_data = get_previous_data ($id_agent_module, $datelimit);
|
||||||
|
@ -28,7 +28,7 @@ function return_module_SLA ($id_agent_module, $period, $min_value, $max_value, $
|
|||||||
AND utimestamp > %d AND utimestamp <= %d
|
AND utimestamp > %d AND utimestamp <= %d
|
||||||
ORDER BY utimestamp ASC',
|
ORDER BY utimestamp ASC',
|
||||||
$id_agent, $id_agent_module, $datelimit, $date);
|
$id_agent, $id_agent_module, $datelimit, $date);
|
||||||
$datas = get_db_all_rows_sqlfree ($sql);
|
$datas = get_db_all_rows_sql ($sql);
|
||||||
$last_data = "";
|
$last_data = "";
|
||||||
$total_badtime = 0;
|
$total_badtime = 0;
|
||||||
$interval_begin = 0;
|
$interval_begin = 0;
|
||||||
@ -352,7 +352,7 @@ function monitor_health_reporting ($id_group, $period = 0, $date = 0, $return =
|
|||||||
AND tagente.id_agente = tagente_modulo.id_agente
|
AND tagente.id_agente = tagente_modulo.id_agente
|
||||||
AND ttipo_modulo.nombre like "%%_proc"
|
AND ttipo_modulo.nombre like "%%_proc"
|
||||||
AND tagente.id_grupo = %d', $id_group);
|
AND tagente.id_grupo = %d', $id_group);
|
||||||
$monitors = get_db_all_rows_sqlfree ($sql);
|
$monitors = get_db_all_rows_sql ($sql);
|
||||||
if (sizeof ($monitors) == 0)
|
if (sizeof ($monitors) == 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
38
pandora_console/include/javascript/jquery.cluetip.js
Normal file
38
pandora_console/include/javascript/jquery.cluetip.js
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
/*
|
||||||
|
* jQuery clueTip plugin
|
||||||
|
* Version 0.9.8 (05/22/2008)
|
||||||
|
* @requires jQuery v1.1.4+
|
||||||
|
* @requires Dimensions plugin (for jQuery versions < 1.2.5)
|
||||||
|
*
|
||||||
|
* Dual licensed under the MIT and GPL licenses:
|
||||||
|
* http://www.opensource.org/licenses/mit-license.php
|
||||||
|
* http://www.gnu.org/licenses/gpl.html
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
;(function($){var $cluetip,$cluetipInner,$cluetipOuter,$cluetipTitle,$cluetipArrows,$dropShadow,imgCount;$.fn.cluetip=function(js,options){if(typeof js=='object'){options=js;js=null;}
|
||||||
|
return this.each(function(index){var $this=$(this);var opts=$.extend(false,{},$.fn.cluetip.defaults,options||{},$.metadata?$this.metadata():$.meta?$this.data():{});var cluetipContents=false;var cluezIndex=parseInt(opts.cluezIndex,10)-1;var isActive=false,closeOnDelay=0;if(!$('#cluetip').length){$cluetipInner=$('<div id="cluetip-inner"></div>');$cluetipTitle=$('<h3 id="cluetip-title"></h3>');$cluetipOuter=$('<div id="cluetip-outer"></div>').append($cluetipInner).prepend($cluetipTitle);$cluetip=$('<div id="cluetip"></div>').css({zIndex:opts.cluezIndex}).append($cluetipOuter).append('<div id="cluetip-extra"></div>')[insertionType](insertionElement).hide();$('<div id="cluetip-waitimage"></div>').css({position:'absolute',zIndex:cluezIndex-1}).insertBefore('#cluetip').hide();$cluetip.css({position:'absolute',zIndex:cluezIndex});$cluetipOuter.css({position:'relative',zIndex:cluezIndex+1});$cluetipArrows=$('<div id="cluetip-arrows" class="cluetip-arrows"></div>').css({zIndex:cluezIndex+1}).appendTo('#cluetip');}
|
||||||
|
var dropShadowSteps=(opts.dropShadow)?+opts.dropShadowSteps:0;if(!$dropShadow){$dropShadow=$([]);for(var i=0;i<dropShadowSteps;i++){$dropShadow=$dropShadow.add($('<div></div>').css({zIndex:cluezIndex-i-1,opacity:.1,top:1+i,left:1+i}));};$dropShadow.css({position:'absolute',backgroundColor:'#000'}).prependTo($cluetip);}
|
||||||
|
var tipAttribute=$this.attr(opts.attribute),ctClass=opts.cluetipClass;if(!tipAttribute&&!opts.splitTitle&&!js)return true;if(opts.local&&opts.hideLocal){$(tipAttribute+':first').hide();}
|
||||||
|
var tOffset=parseInt(opts.topOffset,10),lOffset=parseInt(opts.leftOffset,10);var tipHeight,wHeight;var defHeight=isNaN(parseInt(opts.height,10))?'auto':(/\D/g).test(opts.height)?opts.height:opts.height+'px';var sTop,linkTop,posY,tipY,mouseY,baseline;var tipInnerWidth=isNaN(parseInt(opts.width,10))?275:parseInt(opts.width,10);var tipWidth=tipInnerWidth+(parseInt($cluetip.css('paddingLeft'))||0)+(parseInt($cluetip.css('paddingRight'))||0)+dropShadowSteps;var linkWidth=this.offsetWidth;var linkLeft,posX,tipX,mouseX,winWidth;var tipParts;var tipTitle=(opts.attribute!='title')?$this.attr(opts.titleAttribute):'';if(opts.splitTitle){if(tipTitle==undefined){tipTitle='';}
|
||||||
|
tipParts=tipTitle.split(opts.splitTitle);tipTitle=tipParts.shift();}
|
||||||
|
var localContent;var activate=function(event){if(!opts.onActivate($this)){return false;}
|
||||||
|
isActive=true;$cluetip.removeClass().css({width:tipInnerWidth});if(tipAttribute==$this.attr('href')){$this.css('cursor',opts.cursor);}
|
||||||
|
$this.attr('title','');if(opts.hoverClass){$this.addClass(opts.hoverClass);}
|
||||||
|
linkTop=posY=$this.offset().top;linkLeft=$this.offset().left;mouseX=event.pageX;mouseY=event.pageY;if($this[0].tagName.toLowerCase()!='area'){sTop=$(document).scrollTop();winWidth=$(window).width();}
|
||||||
|
if(opts.positionBy=='fixed'){posX=linkWidth+linkLeft+lOffset;$cluetip.css({left:posX});}else{posX=(linkWidth>linkLeft&&linkLeft>tipWidth)||linkLeft+linkWidth+tipWidth+lOffset>winWidth?linkLeft-tipWidth-lOffset:linkWidth+linkLeft+lOffset;if($this[0].tagName.toLowerCase()=='area'||opts.positionBy=='mouse'||linkWidth+tipWidth>winWidth){if(mouseX+20+tipWidth>winWidth){$cluetip.addClass(' cluetip-'+ctClass);posX=(mouseX-tipWidth-lOffset)>=0?mouseX-tipWidth-lOffset-parseInt($cluetip.css('marginLeft'),10)+parseInt($cluetipInner.css('marginRight'),10):mouseX-(tipWidth/2);}else{posX=mouseX+lOffset;}}
|
||||||
|
var pY=posX<0?event.pageY+tOffset:event.pageY;$cluetip.css({left:(posX>0&&opts.positionBy!='bottomTop')?posX:(mouseX+(tipWidth/2)>winWidth)?winWidth/2-tipWidth/2:Math.max(mouseX-(tipWidth/2),0)});}
|
||||||
|
wHeight=$(window).height();if(js){$cluetipInner.html(js);cluetipShow(pY);}
|
||||||
|
else if(tipParts){var tpl=tipParts.length;for(var i=0;i<tpl;i++){if(i==0){$cluetipInner.html(tipParts[i]);}else{$cluetipInner.append('<div class="split-body">'+tipParts[i]+'</div>');}};cluetipShow(pY);}
|
||||||
|
else if(!opts.local&&tipAttribute.indexOf('#')!=0){if(cluetipContents&&opts.ajaxCache){$cluetipInner.html(cluetipContents);cluetipShow(pY);}
|
||||||
|
else{var ajaxSettings=opts.ajaxSettings;ajaxSettings.url=tipAttribute;ajaxSettings.beforeSend=function(){$cluetipOuter.children().empty();if(opts.waitImage){$('#cluetip-waitimage').css({top:mouseY+20,left:mouseX+20}).show();}};ajaxSettings.error=function(){if(isActive){$cluetipInner.html('<i>sorry, the contents could not be loaded</i>');}};ajaxSettings.success=function(data){cluetipContents=opts.ajaxProcess(data);if(isActive){$cluetipInner.html(cluetipContents);}};ajaxSettings.complete=function(){imgCount=$('#cluetip-inner img').length;if(imgCount&&!$.browser.opera){$('#cluetip-inner img').load(function(){imgCount--;if(imgCount<1){$('#cluetip-waitimage').hide();if(isActive)cluetipShow(pY);}});}else{$('#cluetip-waitimage').hide();if(isActive)cluetipShow(pY);}};$.ajax(ajaxSettings);}}else if(opts.local){var $localContent=$(tipAttribute+':first');var localCluetip=$.fn.wrapInner?$localContent.wrapInner('<div></div>').children().clone(true):$localContent.html();$.fn.wrapInner?$cluetipInner.empty().append(localCluetip):$cluetipInner.html(localCluetip);cluetipShow(pY);}};var cluetipShow=function(bpY){$cluetip.addClass('cluetip-'+ctClass);if(opts.truncate){var $truncloaded=$cluetipInner.text().slice(0,opts.truncate)+'...';$cluetipInner.html($truncloaded);}
|
||||||
|
function doNothing(){};tipTitle?$cluetipTitle.show().html(tipTitle):(opts.showTitle)?$cluetipTitle.show().html(' '):$cluetipTitle.hide();if(opts.sticky){var $closeLink=$('<div id="cluetip-close"><a href="#">'+opts.closeText+'</a></div>');(opts.closePosition=='bottom')?$closeLink.appendTo($cluetipInner):(opts.closePosition=='title')?$closeLink.prependTo($cluetipTitle):$closeLink.prependTo($cluetipInner);$closeLink.click(function(){cluetipClose();return false;});if(opts.mouseOutClose){if($.fn.hoverIntent&&opts.hoverIntent){$cluetip.hoverIntent({over:doNothing,timeout:opts.hoverIntent.timeout,out:function(){$closeLink.trigger('click');}});}else{$cluetip.hover(doNothing,function(){$closeLink.trigger('click');});}}else{$cluetip.unbind('mouseout');}}
|
||||||
|
var direction='';$cluetipOuter.css({overflow:defHeight=='auto'?'visible':'auto',height:defHeight});tipHeight=defHeight=='auto'?Math.max($cluetip.outerHeight(),$cluetip.height()):parseInt(defHeight,10);tipY=posY;baseline=sTop+wHeight;if(opts.positionBy=='fixed'){tipY=posY-opts.dropShadowSteps+tOffset;}else if((posX<mouseX&&Math.max(posX,0)+tipWidth>mouseX)||opts.positionBy=='bottomTop'){if(posY+tipHeight+tOffset>baseline&&mouseY-sTop>tipHeight+tOffset){tipY=mouseY-tipHeight-tOffset;direction='top';}else{tipY=mouseY+tOffset;direction='bottom';}}else if(posY+tipHeight+tOffset>baseline){tipY=(tipHeight>=wHeight)?sTop:baseline-tipHeight-tOffset;}else if($this.css('display')=='block'||$this[0].tagName.toLowerCase()=='area'||opts.positionBy=="mouse"){tipY=bpY-tOffset;}else{tipY=posY-opts.dropShadowSteps;}
|
||||||
|
if(direction==''){posX<linkLeft?direction='left':direction='right';}
|
||||||
|
$cluetip.css({top:tipY+'px'}).removeClass().addClass('clue-'+direction+'-'+ctClass).addClass(' cluetip-'+ctClass);if(opts.arrows){var bgY=(posY-tipY-opts.dropShadowSteps);$cluetipArrows.css({top:(/(left|right)/.test(direction)&&posX>=0&&bgY>0)?bgY+'px':/(left|right)/.test(direction)?0:''}).show();}else{$cluetipArrows.hide();}
|
||||||
|
$dropShadow.hide();$cluetip.hide()[opts.fx.open](opts.fx.open!='show'&&opts.fx.openSpeed);if(opts.dropShadow)$dropShadow.css({height:tipHeight,width:tipInnerWidth}).show();if($.fn.bgiframe){$cluetip.bgiframe();}
|
||||||
|
if(opts.delayedClose>0){closeOnDelay=setTimeout(cluetipClose,opts.delayedClose);}
|
||||||
|
opts.onShow($cluetip,$cluetipInner);};var inactivate=function(){isActive=false;$('#cluetip-waitimage').hide();if(!opts.sticky||(/click|toggle/).test(opts.activation)){cluetipClose();clearTimeout(closeOnDelay);};if(opts.hoverClass){$this.removeClass(opts.hoverClass);}
|
||||||
|
$('.cluetip-clicked').removeClass('cluetip-clicked');};var cluetipClose=function(){$cluetipOuter.parent().hide().removeClass().end().children().empty();if(tipTitle){$this.attr(opts.titleAttribute,tipTitle);}
|
||||||
|
$this.css('cursor','');if(opts.arrows)$cluetipArrows.css({top:''});};if((/click|toggle/).test(opts.activation)){$this.click(function(event){if($cluetip.is(':hidden')||!$this.is('.cluetip-clicked')){activate(event);$('.cluetip-clicked').removeClass('cluetip-clicked');$this.addClass('cluetip-clicked');}else{inactivate(event);}
|
||||||
|
this.blur();return false;});}else if(opts.activation=='focus'){$this.focus(function(event){activate(event);});$this.blur(function(event){inactivate(event);});}else{$this.click(function(){if($this.attr('href')&&$this.attr('href')==tipAttribute&&!opts.clickThrough){return false;}});var mouseTracks=function(evt){if(opts.tracking==true){var trackX=posX-evt.pageX;var trackY=tipY?tipY-evt.pageY:posY-evt.pageY;$this.mousemove(function(evt){$cluetip.css({left:evt.pageX+trackX,top:evt.pageY+trackY});});}};if($.fn.hoverIntent&&opts.hoverIntent){$this.mouseover(function(){$this.attr('title','');}).hoverIntent({sensitivity:opts.hoverIntent.sensitivity,interval:opts.hoverIntent.interval,over:function(event){activate(event);mouseTracks(event);},timeout:opts.hoverIntent.timeout,out:function(event){inactivate(event);$this.unbind('mousemove');}});}else{$this.hover(function(event){activate(event);mouseTracks(event);},function(event){inactivate(event);$this.unbind('mousemove');});}}});};$.fn.cluetip.defaults={width:275,height:'auto',cluezIndex:97,positionBy:'auto',topOffset:15,leftOffset:15,local:false,hideLocal:true,attribute:'rel',titleAttribute:'title',splitTitle:'',showTitle:true,cluetipClass:'default',hoverClass:'',waitImage:true,cursor:'help',arrows:false,dropShadow:true,dropShadowSteps:6,sticky:false,mouseOutClose:false,activation:'hover',clickThrough:false,tracking:false,delayedClose:0,closePosition:'top',closeText:'Close',truncate:0,fx:{open:'show',openSpeed:''},hoverIntent:{sensitivity:3,interval:50,timeout:0},onActivate:function(e){return true;},onShow:function(ct,c){},ajaxCache:true,ajaxProcess:function(data){data=data.replace(/<s(cript|tyle)(.|\s)*?\/s(cript|tyle)>/g,'').replace(/<(link|title)(.|\s)*?\/(link|title)>/g,'');return data;},ajaxSettings:{dataType:'html'},debug:false};var insertionType='appendTo',insertionElement='body';$.cluetip={};$.cluetip.setup=function(options){if(options&&options.insertionType&&(options.insertionType).match(/appendTo|prependTo|insertBefore|insertAfter/)){insertionType=options.insertionType;}
|
||||||
|
if(options&&options.insertionElement){insertionElement=options.insertionElement;}};})(jQuery);
|
97
pandora_console/include/styles/cluetip.css
Normal file
97
pandora_console/include/styles/cluetip.css
Normal file
@ -0,0 +1,97 @@
|
|||||||
|
/* global */
|
||||||
|
#cluetip-close img {
|
||||||
|
border: 0;
|
||||||
|
}
|
||||||
|
#cluetip-title {
|
||||||
|
overflow: hidden;
|
||||||
|
}
|
||||||
|
#cluetip-title #cluetip-close {
|
||||||
|
float: right;
|
||||||
|
position: relative;
|
||||||
|
}
|
||||||
|
#cluetip-waitimage {
|
||||||
|
width: 43px;
|
||||||
|
height: 11px;
|
||||||
|
position: absolute;
|
||||||
|
background-image: url(../../images/wait.gif);
|
||||||
|
}
|
||||||
|
.cluetip-arrows {
|
||||||
|
display: none;
|
||||||
|
position: absolute;
|
||||||
|
top: 0;
|
||||||
|
left: -11px;
|
||||||
|
height: 22px;
|
||||||
|
width: 11px;
|
||||||
|
background-repeat: no-repeat;
|
||||||
|
background-position: 0 0;
|
||||||
|
}
|
||||||
|
#cluetip-extra {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
/***************************************
|
||||||
|
=cluetipClass: 'default'
|
||||||
|
-------------------------------------- */
|
||||||
|
|
||||||
|
.cluetip-default {
|
||||||
|
background-color: #F5F5DC;
|
||||||
|
text-align: left;
|
||||||
|
}
|
||||||
|
.cluetip-default #cluetip-outer {
|
||||||
|
position: relative;
|
||||||
|
margin: 0;
|
||||||
|
background-color: #F5F5DC;
|
||||||
|
}
|
||||||
|
.cluetip-default h3 {
|
||||||
|
margin: 0 0 5px;
|
||||||
|
padding: 8px 10px 4px;
|
||||||
|
font-size: 1.1em;
|
||||||
|
font-weight: bold;
|
||||||
|
background-color: #E6E9CD;
|
||||||
|
}
|
||||||
|
.cluetip-default h3#cluetip-title {
|
||||||
|
display: none;
|
||||||
|
height: 0px;
|
||||||
|
margin: 0;
|
||||||
|
padding: 0;
|
||||||
|
}
|
||||||
|
.cluetip-default #cluetip-title a {
|
||||||
|
color: #d9d9c2;
|
||||||
|
font-size: 0.95em;
|
||||||
|
}
|
||||||
|
.cluetip-default #cluetip-inner {
|
||||||
|
padding: 10px;
|
||||||
|
}
|
||||||
|
.cluetip-default div#cluetip-close {
|
||||||
|
text-align: right;
|
||||||
|
margin: 0 5px 5px;
|
||||||
|
color: #900;
|
||||||
|
}
|
||||||
|
.cluetip-default ul {
|
||||||
|
text-align: left;
|
||||||
|
}
|
||||||
|
/* default arrows */
|
||||||
|
|
||||||
|
.clue-right-default .cluetip-arrows {
|
||||||
|
background-image: url(../../images/darrowleft.gif);
|
||||||
|
}
|
||||||
|
.clue-left-default .cluetip-arrows {
|
||||||
|
background-image: url(../../images/darrowright.gif);
|
||||||
|
left: 100%;
|
||||||
|
margin-right: -11px;
|
||||||
|
}
|
||||||
|
.clue-top-default .cluetip-arrows {
|
||||||
|
background-image: url(../../images/darrowdown.gif);
|
||||||
|
top: 100%;
|
||||||
|
left: 50%;
|
||||||
|
margin-left: -11px;
|
||||||
|
height: 11px;
|
||||||
|
width: 22px;
|
||||||
|
}
|
||||||
|
.clue-bottom-default .cluetip-arrows {
|
||||||
|
background-image: url(../../images/darrowup.gif);
|
||||||
|
top: -11px;
|
||||||
|
left: 50%;
|
||||||
|
margin-left: -11px;
|
||||||
|
height: 11px;
|
||||||
|
width: 22px;
|
||||||
|
}
|
@ -18,351 +18,345 @@
|
|||||||
// Load global vars
|
// Load global vars
|
||||||
require("include/config.php");
|
require("include/config.php");
|
||||||
|
|
||||||
if (comprueba_login() == 0) {
|
if (comprueba_login ()) {
|
||||||
if (give_acl($id_user, 0, "AR") == 0) {
|
|
||||||
audit_db($id_user,$REMOTE_ADDR, "ACL Violation","Trying to access agent main list view");
|
|
||||||
require ("general/noaccess.php");
|
|
||||||
exit;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Take some parameters (GET)
|
|
||||||
$offset = get_parameter ("offset", 0);
|
|
||||||
$group_id = get_parameter ("group_id", 0);
|
|
||||||
$ag_group = get_parameter ("ag_group", -1);
|
|
||||||
if (($ag_group == -1) && ($group_id != 0))
|
|
||||||
$ag_group = $group_id;
|
|
||||||
if (isset($_GET["ag_group_refresh"])){
|
|
||||||
$ag_group = $_GET["ag_group_refresh"];
|
|
||||||
}
|
|
||||||
$search = get_parameter ("search", "");
|
|
||||||
|
|
||||||
|
|
||||||
echo "<h2>".$lang_label["ag_title"]." > ".$lang_label["summary"]."</h2>";
|
|
||||||
|
|
||||||
// Show group selector (POST)
|
|
||||||
if (isset($_POST["ag_group"])){
|
|
||||||
$ag_group = $_POST["ag_group"];
|
|
||||||
echo "<form method='post'
|
|
||||||
action='index.php?sec=estado&sec2=operation/agentes/estado_agente
|
|
||||||
&refr=60&ag_group_refresh=".$ag_group."'>";
|
|
||||||
} else {
|
|
||||||
echo "<form method='post'
|
|
||||||
action='index.php?sec=estado&sec2=operation/agentes/estado_agente
|
|
||||||
&refr=60'>";
|
|
||||||
}
|
|
||||||
|
|
||||||
echo "<table cellpadding='4' cellspacing='4' class='databox'><tr>";
|
|
||||||
echo "<td valign='top'>".$lang_label["group"]."</td>";
|
|
||||||
echo "<td valign='top'>";
|
|
||||||
echo "<select name='ag_group' onChange='javascript:this.form.submit();'
|
|
||||||
class='w130'>";
|
|
||||||
|
|
||||||
if ( $ag_group > 1 ){
|
|
||||||
echo "<option value='".$ag_group."'>".dame_nombre_grupo($ag_group).
|
|
||||||
"</option>";
|
|
||||||
}
|
|
||||||
$mis_grupos=list_group ($id_user); //Print combo for groups and set an array with all groups
|
|
||||||
|
|
||||||
echo "</select>";
|
|
||||||
echo "<td valign='top'>
|
|
||||||
<noscript>
|
|
||||||
<input name='uptbutton' type='submit' class='sub'
|
|
||||||
value='".$lang_label["show"]."'>
|
|
||||||
</noscript>
|
|
||||||
</td></form><td valign='top'>";
|
|
||||||
|
|
||||||
echo $lang_label["free_text_search"];
|
|
||||||
echo "</td><td valign='top'>";
|
|
||||||
echo "<form method='post'
|
|
||||||
action='index.php?sec=estado&sec2=operation/agentes/estado_agente
|
|
||||||
&refr=60'>";
|
|
||||||
echo "<input type=text name='search' size='15'>";
|
|
||||||
echo "</td><td valign='top'>";
|
|
||||||
echo "<input name='srcbutton' type='submit' class='sub'
|
|
||||||
value='".$lang_label["search"]."'>";
|
|
||||||
echo "</form>";
|
|
||||||
echo "</td></table>";
|
|
||||||
|
|
||||||
|
|
||||||
if ($search != ""){
|
|
||||||
$search_sql = " AND nombre LIKE '%$search%' ";
|
|
||||||
} else {
|
|
||||||
$search_sql = "";
|
|
||||||
}
|
|
||||||
|
|
||||||
// Show only selected groups
|
|
||||||
if ($ag_group > 1){
|
|
||||||
$sql="SELECT * FROM tagente WHERE id_grupo=$ag_group
|
|
||||||
AND disabled = 0 $search_sql ORDER BY nombre LIMIT $offset, ".$config["block_size"];
|
|
||||||
$sql2="SELECT COUNT(id_agente) FROM tagente WHERE id_grupo=$ag_group
|
|
||||||
AND disabled = 0 $search_sql ORDER BY nombre";
|
|
||||||
|
|
||||||
// Not selected any specific group
|
|
||||||
} else {
|
|
||||||
// Is admin user ??
|
|
||||||
if (get_db_sql ("SELECT * FROM tusuario WHERE id_usuario ='$id_user'", "nivel") == 1){
|
|
||||||
$sql="SELECT * FROM tagente WHERE disabled = 0 $search_sql ORDER BY nombre, id_grupo LIMIT $offset, ".$config["block_size"];
|
|
||||||
$sql2="SELECT COUNT(id_agente) FROM tagente WHERE disabled = 0 $search_sql ORDER BY nombre, id_grupo";
|
|
||||||
|
|
||||||
// standard user
|
|
||||||
} else {
|
|
||||||
|
|
||||||
// User has explicit permission on group 1 ?
|
|
||||||
$all_group = get_db_sql ("SELECT COUNT(id_grupo) FROM tusuario_perfil WHERE id_usuario='$id_user' AND id_grupo = 1");
|
|
||||||
|
|
||||||
if ($all_group > 0){
|
|
||||||
$sql="SELECT * FROM tagente WHERE disabled = 0 $search_sql
|
|
||||||
ORDER BY nombre, id_grupo LIMIT $offset, ".$config["block_size"];
|
|
||||||
$sql2="SELECT COUNT(id_agente) FROM tagente WHERE disabled = 0 $search_sql
|
|
||||||
ORDER BY nombre, id_grupo";
|
|
||||||
} else {
|
|
||||||
$sql="SELECT * FROM tagente WHERE disabled = 0 $search_sql AND id_grupo IN (SELECT id_grupo FROM tusuario_perfil WHERE id_usuario='$id_user')
|
|
||||||
ORDER BY nombre, id_grupo LIMIT $offset,".$config["block_size"];
|
|
||||||
$sql2="SELECT COUNT(id_agente) FROM tagente WHERE disabled = 0 $search_sql AND id_grupo IN (SELECT id_grupo FROM tusuario_perfil WHERE id_usuario='$id_user') ORDER BY nombre, id_grupo";
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$result2=mysql_query($sql2);
|
|
||||||
$row2=mysql_fetch_array($result2);
|
|
||||||
$total_events = $row2[0];
|
|
||||||
// Prepare pagination
|
|
||||||
|
|
||||||
pagination ($total_events,
|
|
||||||
"index.php?sec=estado&sec2=operation/agentes/estado_agente&group_id=$ag_group&refr=60", $offset);
|
|
||||||
// Show data.
|
|
||||||
$result=mysql_query($sql);
|
|
||||||
if (mysql_num_rows($result)){
|
|
||||||
echo "<table cellpadding='4' cellspacing='4' width='700' class='databox' style='margin-top: 10px'>";
|
|
||||||
echo "<th>".$lang_label["agent"]."</th>";
|
|
||||||
echo "<th>".$lang_label["os"]."</th>";
|
|
||||||
echo "<th>".$lang_label["interval"]."</th>";
|
|
||||||
echo "<th>".$lang_label["group"]."</th>";
|
|
||||||
echo "<th>".$lang_label["modules"]."</th>";
|
|
||||||
echo "<th>".$lang_label["status"]."</th>";
|
|
||||||
echo "<th>".$lang_label["alerts"]."</th>";
|
|
||||||
echo "<th>".$lang_label["last_contact"]."</th>";
|
|
||||||
// For every agent defined in the agent table
|
|
||||||
$color = 1;
|
|
||||||
while ($row=mysql_fetch_array($result)){
|
|
||||||
$intervalo = $row["intervalo"]; // Interval in seconds
|
|
||||||
$id_agente = $row['id_agente'];
|
|
||||||
$nombre_agente = substr(strtoupper($row["nombre"]),0,18);
|
|
||||||
$direccion_agente =$row["direccion"];
|
|
||||||
$id_grupo=$row["id_grupo"];
|
|
||||||
$id_os = $row["id_os"];
|
|
||||||
$ultimo_contacto = $row["ultimo_contacto"];
|
|
||||||
$biginterval=$intervalo;
|
|
||||||
foreach ($mis_grupos as $migrupo){ //Verifiy if the group this agent begins is one of the user groups
|
|
||||||
if (($migrupo ==1) || ($id_grupo==$migrupo)){
|
|
||||||
$pertenece = 1;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
$pertenece = 0;
|
|
||||||
}
|
|
||||||
if ($pertenece == 1) { // Si el agente pertenece a uno de los grupos que el usuario puede visualizar
|
|
||||||
// Obtenemos la lista de todos los modulos de cada agente
|
|
||||||
$sql_t="SELECT * FROM tagente_estado, tagente_modulo
|
|
||||||
WHERE tagente_estado.id_agente_modulo = tagente_modulo.id_agente_modulo AND
|
|
||||||
tagente_modulo.disabled = 0
|
|
||||||
AND tagente_modulo.id_agente=".$id_agente;
|
|
||||||
$result_t=mysql_query($sql_t);
|
|
||||||
$estado_general = 0;
|
|
||||||
$numero_modulos = 0;
|
|
||||||
$numero_monitor = 0;
|
|
||||||
$est_timestamp = "";
|
|
||||||
$monitor_bad=0;
|
|
||||||
$monitor_ok = 0;
|
|
||||||
$monitor_down=0;
|
|
||||||
$numero_datamodules=0;
|
|
||||||
$estado_cambio=0;
|
|
||||||
$ahora=date("Y/m/d H:i:s");
|
|
||||||
// Calculate module/monitor totals for this agent
|
|
||||||
while ($row_t=mysql_fetch_array($result_t)){
|
|
||||||
$est_modulo = $row_t["estado"];
|
|
||||||
$ultimo_contacto_modulo = $row_t["timestamp"];
|
|
||||||
$module_interval = $row_t["module_interval"];
|
|
||||||
if ($module_interval > $biginterval)
|
|
||||||
$biginterval = $module_interval;
|
|
||||||
if ($module_interval !=0)
|
|
||||||
$intervalo_comp = $module_interval;
|
|
||||||
else
|
|
||||||
$intervalo_comp = $intervalo;
|
|
||||||
if ($ultimo_contacto <> "")
|
|
||||||
$seconds = strtotime($ahora) - strtotime($ultimo_contacto_modulo);
|
|
||||||
else
|
|
||||||
$seconds = -1;
|
|
||||||
|
|
||||||
# Defines if Agent is down (interval x 2 > time last contact
|
|
||||||
if ($seconds >= ($intervalo_comp*2)){ // If (intervalx2) secs. ago we don't get anything, show alert
|
|
||||||
if ($est_modulo != 100)
|
|
||||||
$numero_monitor++;
|
|
||||||
$monitor_down++;
|
|
||||||
}
|
|
||||||
elseif ($est_modulo != 100) { // estado=100 are data modules
|
|
||||||
$estado_general = $estado_general + $est_modulo;
|
|
||||||
$estado_cambio = $estado_cambio + $row_t["cambio"];
|
|
||||||
$numero_monitor ++;
|
|
||||||
if ($est_modulo != 0)
|
|
||||||
$monitor_bad++;
|
|
||||||
else
|
|
||||||
$monitor_ok++;
|
|
||||||
} elseif ($est_modulo == 100){ // Data modules
|
|
||||||
$numero_datamodules++;
|
|
||||||
}
|
|
||||||
$numero_modulos++;
|
|
||||||
}
|
|
||||||
// Color change for each line (1.2 beta2)
|
|
||||||
if ($color == 1){
|
|
||||||
$tdcolor = "datos";
|
|
||||||
$color = 0;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
$tdcolor = "datos2";
|
|
||||||
$color = 1;
|
|
||||||
}
|
|
||||||
echo "<tr>";
|
|
||||||
echo "<td class='$tdcolor'>";
|
|
||||||
if (give_acl($id_user, $id_grupo, "AW")==1){
|
|
||||||
echo "<a href='index.php?sec=gagente&
|
|
||||||
sec2=godmode/agentes/configurar_agente&
|
|
||||||
id_agente=".$id_agente."'>
|
|
||||||
<img src='images/setup.png' border=0 width=16></a>";
|
|
||||||
}
|
|
||||||
echo " <a href='index.php?sec=estado&
|
|
||||||
sec2=operation/agentes/ver_agente&id_agente=".$id_agente."'>
|
|
||||||
<b>".$nombre_agente."</b></a></td>";
|
|
||||||
|
|
||||||
// Show SO icon :)
|
|
||||||
echo "<td class='$tdcolor' align='center'>
|
|
||||||
<img border=0 src='images/".dame_so_icon($id_os)."'
|
|
||||||
alt='".dame_so_name($id_os)."'></td>";
|
|
||||||
// If there are a module interval bigger than agent interval
|
|
||||||
if ($biginterval > $intervalo) {
|
|
||||||
echo "<td class='$tdcolor'>
|
|
||||||
<span class='green'>".$biginterval."</span></td>";
|
|
||||||
} else {
|
|
||||||
echo "<td class='$tdcolor'>".$intervalo."</td>";
|
|
||||||
}
|
|
||||||
|
|
||||||
// Show GROUP icon
|
|
||||||
echo '<td class="'.$tdcolor.'" align="center">
|
|
||||||
<img src="images/groups_small/'.show_icon_group($id_grupo).'.png" title="'.dame_grupo($id_grupo).'">';
|
|
||||||
echo '</td>';
|
|
||||||
|
|
||||||
|
|
||||||
echo "<td class='$tdcolor'> ".
|
|
||||||
$numero_modulos." <b>/</b> ".$numero_monitor;
|
|
||||||
if ($monitor_bad <> 0) {
|
|
||||||
echo " <b>/</b> <span class='red'>".$monitor_bad."</span>";
|
|
||||||
}
|
|
||||||
if ($monitor_down <> 0){
|
|
||||||
echo " <b>/</b> <span class='grey'>".$monitor_down."</span>";
|
|
||||||
}
|
|
||||||
echo "</td>";
|
|
||||||
/*
|
|
||||||
if ($numero_monitor <> 0){
|
|
||||||
if ($estado_general <> 0){
|
|
||||||
if ($estado_cambio == 0){
|
|
||||||
// RED
|
|
||||||
echo "<td class='$tdcolor' align='center' style='background: #ff1d21'>";
|
|
||||||
} else {
|
|
||||||
// Yellow
|
|
||||||
echo "<td class='$tdcolor' align='center' style='background: #ffe100'>";
|
|
||||||
}
|
|
||||||
} elseif ($monitor_ok > 0) {
|
|
||||||
// Green
|
|
||||||
echo "<td class='$tdcolor' align='center' style='background: #5fff1b'>";
|
|
||||||
}
|
|
||||||
elseif ($numero_datamodules > 0) {
|
|
||||||
// Grey #1
|
|
||||||
echo "<td class='$tdcolor' align='center' style='background: #d5d5d5'>";
|
|
||||||
}
|
|
||||||
elseif ($monitor_down > 0) {
|
|
||||||
// Grey - Red
|
|
||||||
echo "<td class='$tdcolor' align='center' style='background: #d5b3b3'>";
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
// Blue
|
|
||||||
echo "<td class='$tdcolor' align='center' style='background: #4485d5'>";
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
echo "<td class='$tdcolor' align='center'>";
|
|
||||||
if ($numero_monitor <> 0){
|
|
||||||
if ($estado_general <> 0){
|
|
||||||
if ($estado_cambio == 0){
|
|
||||||
echo "<img src='images/pixel_red.png' width=40 height=18 title='".$lang_label["red_light"]."'>";
|
|
||||||
} else {
|
|
||||||
echo "<img src='images/pixel_yellow.png' width=40 height=18 title='".$lang_label["yellow_light"]."'>";
|
|
||||||
}
|
|
||||||
} elseif ($monitor_ok > 0) {
|
|
||||||
echo "<img src='images/pixel_green.png' width=40 height=18 title='".$lang_label["green_light"]."'>";
|
|
||||||
}
|
|
||||||
elseif ($numero_datamodules > 0) {
|
|
||||||
echo "<img src='images/pixel_gray.png' width=40 height=18 title='".$lang_label["no_light"]."'>";
|
|
||||||
}
|
|
||||||
elseif ($monitor_down > 0) {
|
|
||||||
echo "<img src='images/pixel_fucsia.png' width=40 height=18 title='".$lang_label["broken_light"]."'>";
|
|
||||||
}
|
|
||||||
} else
|
|
||||||
echo "<img src='images/pixel_blue.png' width=40 height=18 title='".$lang_label["blue_light"]."'>";
|
|
||||||
|
|
||||||
// checks if an alert was fired recently
|
|
||||||
echo "<td class='$tdcolor' align='center'>";
|
|
||||||
if (give_disabled_group($id_grupo) == 1)
|
|
||||||
echo "<img src='images/pixel_gray.png' width=20 height=9>";
|
|
||||||
else {
|
|
||||||
if (check_alert_fired($id_agente) == 1)
|
|
||||||
echo "<img src='images/pixel_red.png' width=20 height=9 title='".$lang_label["fired"]."'>";
|
|
||||||
else
|
|
||||||
echo "<img src='images/pixel_green.png' width=20 height=9 title='".$lang_label["not_fired"]."'>";
|
|
||||||
}
|
|
||||||
echo "</td>";
|
|
||||||
echo "<td class='$tdcolor'>";
|
|
||||||
if ( $ultimo_contacto == "0000-00-00 00:00:00"){
|
|
||||||
echo $lang_label["never"];
|
|
||||||
} else {
|
|
||||||
$ultima = strtotime($ultimo_contacto);
|
|
||||||
$ahora = strtotime("now");
|
|
||||||
$diferencia = $ahora - $ultima;
|
|
||||||
if ( $diferencia > ($biginterval*2))
|
|
||||||
echo "<font color='#ff0000'>";
|
|
||||||
|
|
||||||
echo human_time_comparation($ultimo_contacto);
|
|
||||||
/*
|
|
||||||
if ($biginterval > 0){
|
|
||||||
$percentil = round($diferencia/(($biginterval*2) / 100));
|
|
||||||
} else {
|
|
||||||
$percentil = -1;
|
|
||||||
}
|
|
||||||
echo "<a href='#' class='info2'>
|
|
||||||
<img src='reporting/fgraph.php?tipo=progress&percent=".
|
|
||||||
$percentil."&height=18&width=80' border='0'>
|
|
||||||
<span>$ultimo_contacto</span></a>";*/
|
|
||||||
}
|
|
||||||
|
|
||||||
} // If pertenece/belongs to group
|
|
||||||
}
|
|
||||||
echo "<tr>";
|
|
||||||
echo "</table><br>";
|
|
||||||
require "bulbs.php";
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
echo '</table><br><div class="nf">'.$lang_label["no_agent"].'</div>';
|
|
||||||
$id_user = $_SESSION["id_usuario"];
|
|
||||||
if ( (give_acl($id_user, 0, "LM")==1) OR (give_acl($id_user, 0, "AW")==1 ) OR (give_acl($id_user, 0, "PM")==1) OR (give_acl($id_user, 0, "DM")==1) OR (give_acl($id_user, 0, "UM")==1 )){
|
|
||||||
echo " <form method='post' action='index.php?sec=gagente&
|
|
||||||
sec2=godmode/agentes/configurar_agente&create_agent=1'><input type='submit' class='sub next' name='crt'
|
|
||||||
value='".$lang_label["create_agent"]."'></form>";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
} else {
|
|
||||||
audit_db($id_user,$REMOTE_ADDR, "ACL Violation","Trying to access Agent view");
|
audit_db($id_user,$REMOTE_ADDR, "ACL Violation","Trying to access Agent view");
|
||||||
require ("general/noaccess.php");
|
require ("general/noaccess.php");
|
||||||
|
}
|
||||||
|
if (give_acl($id_user, 0, "AR") == 0) {
|
||||||
|
audit_db($id_user,$REMOTE_ADDR, "ACL Violation","Trying to access agent main list view");
|
||||||
|
require ("general/noaccess.php");
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Take some parameters (GET)
|
||||||
|
$offset = get_parameter ("offset", 0);
|
||||||
|
$group_id = get_parameter ("group_id", 0);
|
||||||
|
$ag_group = get_parameter ("ag_group", -1);
|
||||||
|
if (($ag_group == -1) && ($group_id != 0))
|
||||||
|
$ag_group = $group_id;
|
||||||
|
if (isset($_GET["ag_group_refresh"])){
|
||||||
|
$ag_group = $_GET["ag_group_refresh"];
|
||||||
|
}
|
||||||
|
$search = get_parameter ("search", "");
|
||||||
|
|
||||||
|
echo "<h2>".$lang_label["ag_title"]." > ".$lang_label["summary"]."</h2>";
|
||||||
|
|
||||||
|
// Show group selector (POST)
|
||||||
|
if (isset($_POST["ag_group"])){
|
||||||
|
$ag_group = $_POST["ag_group"];
|
||||||
|
echo "<form method='post'
|
||||||
|
action='index.php?sec=estado&sec2=operation/agentes/estado_agente
|
||||||
|
&refr=60&ag_group_refresh=".$ag_group."'>";
|
||||||
|
} else {
|
||||||
|
echo "<form method='post'
|
||||||
|
action='index.php?sec=estado&sec2=operation/agentes/estado_agente
|
||||||
|
&refr=60'>";
|
||||||
|
}
|
||||||
|
|
||||||
|
echo "<table cellpadding='4' cellspacing='4' class='databox'><tr>";
|
||||||
|
echo "<td valign='top'>".$lang_label["group"]."</td>";
|
||||||
|
echo "<td valign='top'>";
|
||||||
|
echo "<select name='ag_group' onChange='javascript:this.form.submit();'
|
||||||
|
class='w130'>";
|
||||||
|
|
||||||
|
if ($ag_group > 1){
|
||||||
|
echo "<option value='".$ag_group."'>".dame_nombre_grupo($ag_group).
|
||||||
|
"</option>";
|
||||||
|
}
|
||||||
|
$mis_grupos=list_group ($id_user); //Print combo for groups and set an array with all groups
|
||||||
|
|
||||||
|
echo "</select>";
|
||||||
|
echo "<td valign='top'>
|
||||||
|
<noscript>
|
||||||
|
<input name='uptbutton' type='submit' class='sub'
|
||||||
|
value='".$lang_label["show"]."'>
|
||||||
|
</noscript>
|
||||||
|
</td></form><td valign='top'>";
|
||||||
|
|
||||||
|
echo $lang_label["free_text_search"];
|
||||||
|
echo "</td><td valign='top'>";
|
||||||
|
echo "<form method='post' action='index.php?sec=estado&sec2=operation/agentes/estado_agente&refr=60'>";
|
||||||
|
echo "<input type=text name='search' size='15'>";
|
||||||
|
echo "</td><td valign='top'>";
|
||||||
|
echo "<input name='srcbutton' type='submit' class='sub'
|
||||||
|
value='".$lang_label["search"]."'>";
|
||||||
|
echo "</form>";
|
||||||
|
echo "</td></table>";
|
||||||
|
|
||||||
|
|
||||||
|
if ($search != ""){
|
||||||
|
$search_sql = " AND nombre LIKE '%$search%' ";
|
||||||
|
} else {
|
||||||
|
$search_sql = "";
|
||||||
|
}
|
||||||
|
|
||||||
|
// Show only selected groups
|
||||||
|
if ($ag_group > 1){
|
||||||
|
$sql="SELECT * FROM tagente WHERE id_grupo=$ag_group
|
||||||
|
AND disabled = 0 $search_sql ORDER BY nombre LIMIT $offset, ".$config["block_size"];
|
||||||
|
$sql2="SELECT COUNT(id_agente) FROM tagente WHERE id_grupo=$ag_group
|
||||||
|
AND disabled = 0 $search_sql ORDER BY nombre";
|
||||||
|
|
||||||
|
// Not selected any specific group
|
||||||
|
} else {
|
||||||
|
// Is admin user ??
|
||||||
|
if (get_db_sql ("SELECT * FROM tusuario WHERE id_usuario ='$id_user'", "nivel") == 1){
|
||||||
|
$sql="SELECT * FROM tagente WHERE disabled = 0 $search_sql ORDER BY nombre, id_grupo LIMIT $offset, ".$config["block_size"];
|
||||||
|
$sql2="SELECT COUNT(id_agente) FROM tagente WHERE disabled = 0 $search_sql ORDER BY nombre, id_grupo";
|
||||||
|
|
||||||
|
// standard user
|
||||||
|
} else {
|
||||||
|
|
||||||
|
// User has explicit permission on group 1 ?
|
||||||
|
$all_group = get_db_sql ("SELECT COUNT(id_grupo) FROM tusuario_perfil WHERE id_usuario='$id_user' AND id_grupo = 1");
|
||||||
|
|
||||||
|
if ($all_group > 0){
|
||||||
|
$sql="SELECT * FROM tagente WHERE disabled = 0 $search_sql
|
||||||
|
ORDER BY nombre, id_grupo LIMIT $offset, ".$config["block_size"];
|
||||||
|
$sql2="SELECT COUNT(id_agente) FROM tagente WHERE disabled = 0 $search_sql
|
||||||
|
ORDER BY nombre, id_grupo";
|
||||||
|
} else {
|
||||||
|
$sql="SELECT * FROM tagente WHERE disabled = 0 $search_sql AND id_grupo IN (SELECT id_grupo FROM tusuario_perfil WHERE id_usuario='$id_user')
|
||||||
|
ORDER BY nombre, id_grupo LIMIT $offset,".$config["block_size"];
|
||||||
|
$sql2="SELECT COUNT(id_agente) FROM tagente WHERE disabled = 0 $search_sql AND id_grupo IN (SELECT id_grupo FROM tusuario_perfil WHERE id_usuario='$id_user') ORDER BY nombre, id_grupo";
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$result2=mysql_query($sql2);
|
||||||
|
$row2=mysql_fetch_array($result2);
|
||||||
|
$total_events = $row2[0];
|
||||||
|
// Prepare pagination
|
||||||
|
|
||||||
|
pagination ($total_events,
|
||||||
|
"index.php?sec=estado&sec2=operation/agentes/estado_agente&group_id=$ag_group&refr=60", $offset);
|
||||||
|
// Show data.
|
||||||
|
$result=mysql_query($sql);
|
||||||
|
if (mysql_num_rows($result)){
|
||||||
|
echo "<table cellpadding='4' cellspacing='4' width='700' class='databox' style='margin-top: 10px'>";
|
||||||
|
echo "<th>".$lang_label["agent"]."</th>";
|
||||||
|
echo "<th>".$lang_label["os"]."</th>";
|
||||||
|
echo "<th>".$lang_label["interval"]."</th>";
|
||||||
|
echo "<th>".$lang_label["group"]."</th>";
|
||||||
|
echo "<th>".$lang_label["modules"]."</th>";
|
||||||
|
echo "<th>".$lang_label["status"]."</th>";
|
||||||
|
echo "<th>".$lang_label["alerts"]."</th>";
|
||||||
|
echo "<th>".$lang_label["last_contact"]."</th>";
|
||||||
|
// For every agent defined in the agent table
|
||||||
|
$color = 1;
|
||||||
|
while ($row=mysql_fetch_array($result)){
|
||||||
|
$intervalo = $row["intervalo"]; // Interval in seconds
|
||||||
|
$id_agente = $row['id_agente'];
|
||||||
|
$nombre_agente = substr(strtoupper($row["nombre"]),0,18);
|
||||||
|
$direccion_agente =$row["direccion"];
|
||||||
|
$id_grupo=$row["id_grupo"];
|
||||||
|
$id_os = $row["id_os"];
|
||||||
|
$ultimo_contacto = $row["ultimo_contacto"];
|
||||||
|
$biginterval=$intervalo;
|
||||||
|
foreach ($mis_grupos as $migrupo){ //Verifiy if the group this agent begins is one of the user groups
|
||||||
|
if (($migrupo ==1) || ($id_grupo==$migrupo)){
|
||||||
|
$pertenece = 1;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
$pertenece = 0;
|
||||||
|
}
|
||||||
|
if ($pertenece == 1) { // Si el agente pertenece a uno de los grupos que el usuario puede visualizar
|
||||||
|
// Obtenemos la lista de todos los modulos de cada agente
|
||||||
|
$sql_t="SELECT * FROM tagente_estado, tagente_modulo
|
||||||
|
WHERE tagente_estado.id_agente_modulo = tagente_modulo.id_agente_modulo AND
|
||||||
|
tagente_modulo.disabled = 0
|
||||||
|
AND tagente_modulo.id_agente=".$id_agente;
|
||||||
|
$result_t=mysql_query($sql_t);
|
||||||
|
$estado_general = 0;
|
||||||
|
$numero_modulos = 0;
|
||||||
|
$numero_monitor = 0;
|
||||||
|
$est_timestamp = "";
|
||||||
|
$monitor_bad=0;
|
||||||
|
$monitor_ok = 0;
|
||||||
|
$monitor_down=0;
|
||||||
|
$numero_datamodules=0;
|
||||||
|
$estado_cambio=0;
|
||||||
|
$ahora=date("Y/m/d H:i:s");
|
||||||
|
// Calculate module/monitor totals for this agent
|
||||||
|
while ($row_t=mysql_fetch_array($result_t)){
|
||||||
|
$est_modulo = $row_t["estado"];
|
||||||
|
$ultimo_contacto_modulo = $row_t["timestamp"];
|
||||||
|
$module_interval = $row_t["module_interval"];
|
||||||
|
if ($module_interval > $biginterval)
|
||||||
|
$biginterval = $module_interval;
|
||||||
|
if ($module_interval !=0)
|
||||||
|
$intervalo_comp = $module_interval;
|
||||||
|
else
|
||||||
|
$intervalo_comp = $intervalo;
|
||||||
|
if ($ultimo_contacto <> "")
|
||||||
|
$seconds = strtotime($ahora) - strtotime($ultimo_contacto_modulo);
|
||||||
|
else
|
||||||
|
$seconds = -1;
|
||||||
|
|
||||||
|
# Defines if Agent is down (interval x 2 > time last contact
|
||||||
|
if ($seconds >= ($intervalo_comp*2)){ // If (intervalx2) secs. ago we don't get anything, show alert
|
||||||
|
if ($est_modulo != 100)
|
||||||
|
$numero_monitor++;
|
||||||
|
$monitor_down++;
|
||||||
|
}
|
||||||
|
elseif ($est_modulo != 100) { // estado=100 are data modules
|
||||||
|
$estado_general = $estado_general + $est_modulo;
|
||||||
|
$estado_cambio = $estado_cambio + $row_t["cambio"];
|
||||||
|
$numero_monitor ++;
|
||||||
|
if ($est_modulo != 0)
|
||||||
|
$monitor_bad++;
|
||||||
|
else
|
||||||
|
$monitor_ok++;
|
||||||
|
} elseif ($est_modulo == 100){ // Data modules
|
||||||
|
$numero_datamodules++;
|
||||||
|
}
|
||||||
|
$numero_modulos++;
|
||||||
|
}
|
||||||
|
// Color change for each line (1.2 beta2)
|
||||||
|
if ($color == 1){
|
||||||
|
$tdcolor = "datos";
|
||||||
|
$color = 0;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$tdcolor = "datos2";
|
||||||
|
$color = 1;
|
||||||
|
}
|
||||||
|
echo "<tr>";
|
||||||
|
echo "<td class='$tdcolor'>";
|
||||||
|
if (give_acl($id_user, $id_grupo, "AW")==1){
|
||||||
|
echo "<a href='index.php?sec=gagente&
|
||||||
|
sec2=godmode/agentes/configurar_agente&
|
||||||
|
id_agente=".$id_agente."'>
|
||||||
|
<img src='images/setup.png' border=0 width=16></a>";
|
||||||
|
}
|
||||||
|
echo " <a href='index.php?sec=estado&
|
||||||
|
sec2=operation/agentes/ver_agente&id_agente=".$id_agente."'>
|
||||||
|
<b>".$nombre_agente."</b></a></td>";
|
||||||
|
|
||||||
|
// Show SO icon :)
|
||||||
|
echo "<td class='$tdcolor' align='center'>
|
||||||
|
<img border=0 src='images/".dame_so_icon($id_os)."'
|
||||||
|
alt='".dame_so_name($id_os)."'></td>";
|
||||||
|
// If there are a module interval bigger than agent interval
|
||||||
|
if ($biginterval > $intervalo) {
|
||||||
|
echo "<td class='$tdcolor'>
|
||||||
|
<span class='green'>".$biginterval."</span></td>";
|
||||||
|
} else {
|
||||||
|
echo "<td class='$tdcolor'>".$intervalo."</td>";
|
||||||
|
}
|
||||||
|
|
||||||
|
// Show GROUP icon
|
||||||
|
echo '<td class="'.$tdcolor.'" align="center">
|
||||||
|
<img src="images/groups_small/'.show_icon_group($id_grupo).'.png" title="'.dame_grupo($id_grupo).'">';
|
||||||
|
echo '</td>';
|
||||||
|
|
||||||
|
|
||||||
|
echo "<td class='$tdcolor'> ".
|
||||||
|
$numero_modulos." <b>/</b> ".$numero_monitor;
|
||||||
|
if ($monitor_bad <> 0) {
|
||||||
|
echo " <b>/</b> <span class='red'>".$monitor_bad."</span>";
|
||||||
|
}
|
||||||
|
if ($monitor_down <> 0){
|
||||||
|
echo " <b>/</b> <span class='grey'>".$monitor_down."</span>";
|
||||||
|
}
|
||||||
|
echo "</td>";
|
||||||
|
/*
|
||||||
|
if ($numero_monitor <> 0){
|
||||||
|
if ($estado_general <> 0){
|
||||||
|
if ($estado_cambio == 0){
|
||||||
|
// RED
|
||||||
|
echo "<td class='$tdcolor' align='center' style='background: #ff1d21'>";
|
||||||
|
} else {
|
||||||
|
// Yellow
|
||||||
|
echo "<td class='$tdcolor' align='center' style='background: #ffe100'>";
|
||||||
|
}
|
||||||
|
} elseif ($monitor_ok > 0) {
|
||||||
|
// Green
|
||||||
|
echo "<td class='$tdcolor' align='center' style='background: #5fff1b'>";
|
||||||
|
}
|
||||||
|
elseif ($numero_datamodules > 0) {
|
||||||
|
// Grey #1
|
||||||
|
echo "<td class='$tdcolor' align='center' style='background: #d5d5d5'>";
|
||||||
|
}
|
||||||
|
elseif ($monitor_down > 0) {
|
||||||
|
// Grey - Red
|
||||||
|
echo "<td class='$tdcolor' align='center' style='background: #d5b3b3'>";
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// Blue
|
||||||
|
echo "<td class='$tdcolor' align='center' style='background: #4485d5'>";
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
|
echo "<td class='$tdcolor' align='center'>";
|
||||||
|
if ($numero_monitor <> 0){
|
||||||
|
if ($estado_general <> 0){
|
||||||
|
if ($estado_cambio == 0){
|
||||||
|
echo "<img src='images/pixel_red.png' width=40 height=18 title='".$lang_label["red_light"]."'>";
|
||||||
|
} else {
|
||||||
|
echo "<img src='images/pixel_yellow.png' width=40 height=18 title='".$lang_label["yellow_light"]."'>";
|
||||||
|
}
|
||||||
|
} elseif ($monitor_ok > 0) {
|
||||||
|
echo "<img src='images/pixel_green.png' width=40 height=18 title='".$lang_label["green_light"]."'>";
|
||||||
|
}
|
||||||
|
elseif ($numero_datamodules > 0) {
|
||||||
|
echo "<img src='images/pixel_gray.png' width=40 height=18 title='".$lang_label["no_light"]."'>";
|
||||||
|
}
|
||||||
|
elseif ($monitor_down > 0) {
|
||||||
|
echo "<img src='images/pixel_fucsia.png' width=40 height=18 title='".$lang_label["broken_light"]."'>";
|
||||||
|
}
|
||||||
|
} else
|
||||||
|
echo "<img src='images/pixel_blue.png' width=40 height=18 title='".$lang_label["blue_light"]."'>";
|
||||||
|
|
||||||
|
// checks if an alert was fired recently
|
||||||
|
echo "<td class='$tdcolor' align='center'>";
|
||||||
|
if (give_disabled_group($id_grupo) == 1)
|
||||||
|
echo "<img src='images/pixel_gray.png' width=20 height=9>";
|
||||||
|
else {
|
||||||
|
if (check_alert_fired($id_agente) == 1)
|
||||||
|
echo "<img src='images/pixel_red.png' width=20 height=9 title='".$lang_label["fired"]."'>";
|
||||||
|
else
|
||||||
|
echo "<img src='images/pixel_green.png' width=20 height=9 title='".$lang_label["not_fired"]."'>";
|
||||||
|
}
|
||||||
|
echo "</td>";
|
||||||
|
echo "<td class='$tdcolor'>";
|
||||||
|
if ( $ultimo_contacto == "0000-00-00 00:00:00"){
|
||||||
|
echo $lang_label["never"];
|
||||||
|
} else {
|
||||||
|
$ultima = strtotime($ultimo_contacto);
|
||||||
|
$ahora = strtotime("now");
|
||||||
|
$diferencia = $ahora - $ultima;
|
||||||
|
if ( $diferencia > ($biginterval*2))
|
||||||
|
echo "<font color='#ff0000'>";
|
||||||
|
|
||||||
|
echo human_time_comparation($ultimo_contacto);
|
||||||
|
/*
|
||||||
|
if ($biginterval > 0){
|
||||||
|
$percentil = round($diferencia/(($biginterval*2) / 100));
|
||||||
|
} else {
|
||||||
|
$percentil = -1;
|
||||||
|
}
|
||||||
|
echo "<a href='#' class='info2'>
|
||||||
|
<img src='reporting/fgraph.php?tipo=progress&percent=".
|
||||||
|
$percentil."&height=18&width=80' border='0'>
|
||||||
|
<span>$ultimo_contacto</span></a>";*/
|
||||||
|
}
|
||||||
|
|
||||||
|
} // If pertenece/belongs to group
|
||||||
|
}
|
||||||
|
echo "<tr>";
|
||||||
|
echo "</table><br>";
|
||||||
|
require "bulbs.php";
|
||||||
|
} else {
|
||||||
|
echo '</table><br><div class="nf">'.$lang_label["no_agent"].'</div>';
|
||||||
|
$id_user = $_SESSION["id_usuario"];
|
||||||
|
if ( (give_acl($id_user, 0, "LM")==1) OR (give_acl($id_user, 0, "AW")==1 ) OR (give_acl($id_user, 0, "PM")==1) OR (give_acl($id_user, 0, "DM")==1) OR (give_acl($id_user, 0, "UM")==1 )){
|
||||||
|
echo " <form method='post' action='index.php?sec=gagente&
|
||||||
|
sec2=godmode/agentes/configurar_agente&create_agent=1'><input type='submit' class='sub next' name='crt'
|
||||||
|
value='".$lang_label["create_agent"]."'></form>";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
@ -15,13 +15,17 @@
|
|||||||
// Load global vars
|
// Load global vars
|
||||||
require("include/config.php");
|
require("include/config.php");
|
||||||
|
|
||||||
|
$pandora_name = 'Pandora FMS';
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
// DOT related functions
|
// DOT related functions
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
// Generate a dot graph definition for graphviz
|
// Generate a dot graph definition for graphviz
|
||||||
function generate_dot( $simple = 0) {
|
function generate_dot ($simple = 0) {
|
||||||
global $config;
|
global $config;
|
||||||
|
global $pandora_name;
|
||||||
|
|
||||||
$group_id = -1;
|
$group_id = -1;
|
||||||
$parents = array();
|
$parents = array();
|
||||||
$orphans = array();
|
$orphans = array();
|
||||||
@ -63,7 +67,7 @@ function generate_dot( $simple = 0) {
|
|||||||
|
|
||||||
// Create a central node if orphan nodes exist
|
// Create a central node if orphan nodes exist
|
||||||
if (count($orphans) > 0) {
|
if (count($orphans) > 0) {
|
||||||
$graph .= create_pandora_node ('Pandora FMS');
|
$graph .= create_pandora_node ($pandora_name);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Define edges
|
// Define edges
|
||||||
@ -83,85 +87,83 @@ function generate_dot( $simple = 0) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Returns an edge definition
|
// Returns an edge definition
|
||||||
function create_edge($head, $tail) {
|
function create_edge ($head, $tail) {
|
||||||
|
|
||||||
$edge = $head . ' -- ' . $tail . '[color="#BDBDBD", headclip=false, tailclip=false];';
|
$edge = $head . ' -- ' . $tail . '[color="#BDBDBD", headclip=false, tailclip=false];';
|
||||||
return $edge;
|
return $edge;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Returns a node definition
|
// Returns a node definition
|
||||||
function create_node($agent, $simple = 0) {
|
function create_node ($agent, $simple = 0) {
|
||||||
$bad_modules = mysql_query('SELECT estado FROM tagente_estado AS e,
|
$sql = sprintf ('SELECT COUNT(*) FROM tagente_estado,
|
||||||
tagente_modulo AS m
|
tagente_modulo
|
||||||
WHERE m.id_agente=' . $agent['id_agente'] .
|
WHERE tagente_modulo.id_agente = %d
|
||||||
' AND m.id_tipo_modulo in (2, 6, 9, 18, 21, 100)
|
AND tagente_modulo.id_tipo_modulo in (2, 6, 9, 18, 21, 100)
|
||||||
AND e.id_agente_modulo = m.id_agente_modulo
|
AND tagente_estado.id_agente_modulo = tagente_modulo.id_agente_modulo
|
||||||
AND m.disabled = 0
|
AND tagente_modulo.disabled = 0
|
||||||
AND e.estado = 1');
|
AND tagente_estado.estado = 1', $agent['id_agente']);
|
||||||
|
$bad_modules = get_db_sql ($sql);
|
||||||
|
|
||||||
// Set node status
|
// Set node status
|
||||||
if (mysql_num_rows($bad_modules) > 0) {
|
if ($bad_modules) {
|
||||||
$status_color = '#FF1D1D';
|
$status_color = '#FF1D1D';
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
$status_color = '#8DFF1D';
|
$status_color = '#8DFF1D';
|
||||||
}
|
}
|
||||||
|
|
||||||
// Short name
|
// Short name
|
||||||
$name = strtolower($agent["nombre"]);
|
$name = strtolower ($agent["nombre"]);
|
||||||
if (strlen($name) > 12)
|
if (strlen($name) > 12)
|
||||||
$name = substr($name,0,12);
|
$name = substr($name,0,12);
|
||||||
|
|
||||||
if ($simple == 0){
|
if ($simple == 0){
|
||||||
// Set node icon
|
// Set node icon
|
||||||
if (file_exists('images/networkmap/' . $agent['id_os'] . '.png')) {
|
if (file_exists('images/networkmap/' . $agent['id_os'] . '.png')) {
|
||||||
$img_node = 'images/networkmap/' . $agent['id_os'] . '.png';
|
$img_node = 'images/networkmap/' . $agent['id_os'] . '.png';
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
$img_node = 'images/networkmap/0.png';
|
$img_node = 'images/networkmap/0.png';
|
||||||
}
|
}
|
||||||
|
|
||||||
$node = $agent['id_agente'] . ' [ color="' . $status_color . '", fontsize=9, style="filled", fixedsize=true, width=0.40, height=0.40, label=<<TABLE CELLPADDING="0" CELLSPACING="0" BORDER="0">
|
$node = $agent['id_agente'] . ' [ color="' . $status_color . '", fontsize=9, style="filled", fixedsize=true, width=0.40, height=0.40, label=<<TABLE CELLPADDING="0" CELLSPACING="0" BORDER="0">
|
||||||
<TR><TD><IMG SRC="' . $img_node . '"/></TD></TR>
|
<TR><TD><IMG SRC="' . $img_node . '"/></TD></TR>
|
||||||
<TR><TD color="green">' . $name . '</TD></TR></TABLE>>,
|
<TR><TD color="green">' . $name . '</TD></TR></TABLE>>,
|
||||||
shape="ellipse", tooltip="' . $agent["nombre"] . ' (' . $agent['direccion'] . ')", URL="'
|
shape="ellipse", URL="index.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente='.$agent['id_agente'].'",
|
||||||
. 'index.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente='
|
tooltip="ajax.php?page=operation/agentes/ver_agente&get_agent_status_tooltip=1&id_agent='
|
||||||
. $agent['id_agente'] . '"];';
|
. $agent['id_agente'].'"];';
|
||||||
} else {
|
} else {
|
||||||
$node = $agent['id_agente'] . ' [ color="' . $status_color . '", fontsize=7, style="filled", fixedsize=true, width=0.20, height=0.20, label="", URL="'
|
$node = $agent['id_agente'] . ' [ color="' . $status_color . '", fontsize=7, style="filled", fixedsize=true, width=0.20, height=0.20, label="",
|
||||||
. 'index.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente='
|
tooltip="ajax.php?page=operation/agentes/ver_agente&
|
||||||
. $agent['id_agente'] . '"];';
|
get_agent_status_tooltip=1&id_agent='.$agent['id_agente'].'"];';
|
||||||
}
|
}
|
||||||
return $node;
|
return $node;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Returns the definition of the central module
|
// Returns the definition of the central module
|
||||||
function create_pandora_node($name) {
|
function create_pandora_node ($name) {
|
||||||
$node = '0 [ color="#364D1F", fontsize=10, style="filled", fixedsize=true, width=0.8, height=0.6, label=<<TABLE BORDER="0">
|
$node = '0 [ color="#364D1F", fontsize=10, style="filled", fixedsize=true, width=0.8, height=0.6, label=<<TABLE BORDER="0">
|
||||||
<TR><TD><IMG SRC="images/networkmap/pandora_node.png"/></TD></TR>
|
<TR><TD><IMG SRC="images/networkmap/pandora_node.png"/></TD></TR>
|
||||||
<TR><TD BGCOLOR="white">' . $name . '</TD></TR></TABLE>>,
|
<TR><TD BGCOLOR="white">' . $name . '</TD></TR></TABLE>>,
|
||||||
shape="ellipse", tooltip="' . $name . '", URL="index.php?sec=estado&sec2=operation/agentes/estado_grupo" ];';
|
shape="ellipse", tooltip="' . $name . '", URL="index.php?sec=estado&sec2=operation/agentes/estado_grupo" ];';
|
||||||
|
|
||||||
return $node;
|
return $node;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Opens a group definition
|
// Opens a group definition
|
||||||
function open_group($id) {
|
function open_group ($id) {
|
||||||
$img = 'images/' . dame_grupo_icono($id) . '.png';
|
$img = 'images/' . dame_grupo_icono($id) . '.png';
|
||||||
$name = dame_nombre_grupo($id);
|
$name = dame_nombre_grupo($id);
|
||||||
|
|
||||||
$group = 'subgraph cluster_' . $id .
|
$group = 'subgraph cluster_' . $id .
|
||||||
' { style=filled; color=darkolivegreen3; label=<<TABLE BORDER="0">
|
' { style=filled; color=darkolivegreen3; label=<<TABLE BORDER="0">
|
||||||
<TR><TD><IMG SRC="' . $img . '"/></TD><TD>' . $name . '</TD></TR>
|
<TR><TD><IMG SRC="' . $img . '"/></TD><TD>' . $name . '</TD></TR>
|
||||||
</TABLE>>; tooltip="' . $name . '";
|
</TABLE>>; tooltip="' . $name . '";
|
||||||
URL="index.php?sec=estado&sec2=operation/agentes/estado_agente&group_id='
|
URL="index.php?sec=estado&sec2=operation/agentes/estado_agente&group_id='
|
||||||
. $id . '";';
|
. $id . '";';
|
||||||
|
|
||||||
return $group;
|
return $group;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Closes a group definition
|
// Closes a group definition
|
||||||
function close_group() {
|
function close_group () {
|
||||||
return '}';
|
return '}';
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -187,48 +189,47 @@ function open_graph() {
|
|||||||
}
|
}
|
||||||
$size = $size_x . ',' . $size_y;
|
$size = $size_x . ',' . $size_y;
|
||||||
|
|
||||||
// BEWARE: graphwiz DONT use single ('), you need double (")
|
// BEWARE: graphwiz DONT use single ('), you need double (")
|
||||||
$head = "graph networkmap {
|
$head = "graph networkmap {
|
||||||
labeljust=l;
|
labeljust=l;
|
||||||
margin=0;
|
margin=0;
|
||||||
ranksep=\"$ranksep\";
|
ranksep=\"$ranksep\";
|
||||||
outputorder=edgesfirst;
|
outputorder=edgesfirst;
|
||||||
overlap=\"$overlap\";
|
overlap=\"$overlap\";
|
||||||
ratio=fill;
|
ratio=fill;
|
||||||
root=0;
|
root=0;
|
||||||
size=\"$size\";
|
size=\"$size\";
|
||||||
";
|
";
|
||||||
|
|
||||||
return $head;
|
return $head;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Closes a graph definition
|
// Closes a graph definition
|
||||||
function close_graph() {
|
function close_graph() {
|
||||||
return '}';
|
return '}';
|
||||||
}
|
}
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
|
||||||
// General purpose functions
|
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
|
||||||
|
|
||||||
// Returns the filter used to achieve the desired layout
|
// Returns the filter used to achieve the desired layout
|
||||||
function set_filter() {
|
function set_filter() {
|
||||||
global $layout;
|
global $layout;
|
||||||
|
|
||||||
switch($layout) {
|
switch($layout) {
|
||||||
case 'flat': return 'dot';
|
case 'flat':
|
||||||
case 'radial': return 'twopi';
|
return 'dot';
|
||||||
case 'circular': return 'circo';
|
case 'radial':
|
||||||
case 'spring1': return 'neato';
|
return 'twopi';
|
||||||
case 'spring2': return 'fdp';
|
case 'circular':
|
||||||
default: return 'twopi';
|
return 'circo';
|
||||||
|
case 'spring1':
|
||||||
|
return 'neato';
|
||||||
|
case 'spring2':
|
||||||
|
return 'fdp';
|
||||||
|
default:
|
||||||
|
return 'twopi';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
/* Main code */
|
||||||
// Main code
|
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
|
||||||
|
|
||||||
// Load variables
|
// Load variables
|
||||||
$layout = (string) get_parameter ('layout');
|
$layout = (string) get_parameter ('layout');
|
||||||
$nooverlap = (boolean) get_parameter ('nooverlap');
|
$nooverlap = (boolean) get_parameter ('nooverlap');
|
||||||
@ -247,29 +248,26 @@ if (comprueba_login() != 0) {
|
|||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((give_acl($id_user, 0, "AR") != 1 ) AND (dame_admin($id_user) !=1 )) {
|
if ((give_acl($id_user, 0, "AR") != 1 ) && (dame_admin($id_user) !=1 )) {
|
||||||
audit_db($id_user, $REMOTE_ADDR, "ACL Violation", "Trying to access node graph builder");
|
audit_db($id_user, $REMOTE_ADDR, "ACL Violation", "Trying to access node graph builder");
|
||||||
include("general/noaccess.php");
|
include("general/noaccess.php");
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
echo '<h2>' . $lang_label['ag_title'] . ' > ' . lang_string("Network Map") . ' ';
|
echo '<h2>' . $lang_label['ag_title'].' > '.lang_string("Network Map").' ';
|
||||||
if ($pure == 1) {
|
if ($pure == 1) {
|
||||||
echo '<a href="index.php?sec=estado&sec2=operation/agentes/networkmap&pure=0"><img src="images/monitor.png" title="' . lang_string('Normal screen') . '"></a>';
|
echo '<a href="index.php?sec=estado&sec2=operation/agentes/networkmap&pure=0"><img src="images/monitor.png" title="' . lang_string('Normal screen') . '"></a>';
|
||||||
}
|
} else {
|
||||||
else {
|
echo '<a href="index.php?sec=estado&sec2=operation/agentes/networkmap&pure=1"><img src="images/monitor.png" title="' . lang_string('Full screen') . '"></a>';
|
||||||
echo '<a href="index.php?sec=estado&sec2=operation/agentes/networkmap&pure=1"><img src="images/monitor.png" title="' . lang_string('Full screen') . '"></a>';
|
|
||||||
}
|
}
|
||||||
echo '</h2>';
|
echo '</h2>';
|
||||||
|
|
||||||
// Layout selection
|
// Layout selection
|
||||||
$layout_array = array (
|
$layout_array = array ('radial' => 'radial',
|
||||||
'radial' => 'radial',
|
'circular' => 'circular',
|
||||||
'circular' => 'circular',
|
'spring1' => 'spring 1',
|
||||||
'spring1' => 'spring 1',
|
'spring2' => 'spring 2',
|
||||||
'spring2' => 'spring 2',
|
'flat' => 'flat');
|
||||||
'flat' => 'flat',
|
|
||||||
);
|
|
||||||
|
|
||||||
echo '<form name="input" action="index.php?sec=estado&sec2=operation/agentes/networkmap&pure=' . $pure . '" method="post">';
|
echo '<form name="input" action="index.php?sec=estado&sec2=operation/agentes/networkmap&pure=' . $pure . '" method="post">';
|
||||||
echo '<table cellpadding="4" cellspacing="4" class="databox">';
|
echo '<table cellpadding="4" cellspacing="4" class="databox">';
|
||||||
@ -294,7 +292,7 @@ if ($pure == "1") {
|
|||||||
'1.6' => 'x3',
|
'1.6' => 'x3',
|
||||||
'2' => 'x4',
|
'2' => 'x4',
|
||||||
'2.5' => 'x5',
|
'2.5' => 'x5',
|
||||||
'5' => 'x10',
|
'5' => 'x10',
|
||||||
);
|
);
|
||||||
|
|
||||||
echo '<td valign="top">' . lang_string('Zoom') . ' ';
|
echo '<td valign="top">' . lang_string('Zoom') . ' ';
|
||||||
@ -305,7 +303,7 @@ if ($pure == "1") {
|
|||||||
//echo ' Display groups <input type="checkbox" name="group" value="group" class="chk"/>';
|
//echo ' Display groups <input type="checkbox" name="group" value="group" class="chk"/>';
|
||||||
echo '<td>';
|
echo '<td>';
|
||||||
echo '<input name="updbutton" type="submit" class="sub upd" value="'.
|
echo '<input name="updbutton" type="submit" class="sub upd" value="'.
|
||||||
$lang_label["update"] . '">';
|
$lang_label["update"] . '">';
|
||||||
echo '</td>';
|
echo '</td>';
|
||||||
echo '</table>';
|
echo '</table>';
|
||||||
echo '</form>';
|
echo '</form>';
|
||||||
@ -316,18 +314,35 @@ $filter = set_filter();
|
|||||||
// Generate dot file
|
// Generate dot file
|
||||||
$graph = generate_dot($simple);
|
$graph = generate_dot($simple);
|
||||||
|
|
||||||
//DEBUG
|
|
||||||
//$fh = fopen("networkmap.dot", 'w') or die("can't open file");
|
|
||||||
//fwrite($fh, $graph);
|
|
||||||
//fclose($fh);
|
|
||||||
|
|
||||||
// Generate image and map
|
// Generate image and map
|
||||||
$cmd = "echo " . escapeshellarg($graph) .
|
$cmd = "echo " . escapeshellarg($graph) .
|
||||||
" | $filter -Tcmapx -o".$config["attachment_store"]."/networkmap.map -Tpng -o".$config["attachment_store"]."/networkmap.png";
|
" | $filter -Tcmapx -o".$config["attachment_store"]."/networkmap.map -Tpng -o".$config["attachment_store"]."/networkmap.png";
|
||||||
|
|
||||||
if (system($cmd) !== false) {
|
$result = system ($cmd);
|
||||||
|
|
||||||
|
if ($result !== false) {
|
||||||
|
if (! file_exists ($config["attachment_store"]."/networkmap.map")) {
|
||||||
|
echo '<h2 class="err">'.lang_string ('Map could not be generated').'</h2>';
|
||||||
|
echo $result;
|
||||||
|
return;
|
||||||
|
}
|
||||||
echo '<img src="attachment/networkmap.png" usemap="#networkmap"/>';
|
echo '<img src="attachment/networkmap.png" usemap="#networkmap"/>';
|
||||||
include $config["attachment_store"]."/networkmap.map";
|
include $config["attachment_store"]."/networkmap.map";
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|
||||||
|
<link rel="stylesheet" href="include/styles/cluetip.css" type="text/css" />
|
||||||
|
<script type="text/javascript" src="include/javascript/jquery.js"></script>
|
||||||
|
<script type="text/javascript" src="include/javascript/jquery.js"></script>
|
||||||
|
<script type="text/javascript" src="include/javascript/jquery.cluetip.js"></script>
|
||||||
|
|
||||||
|
<script language="javascript" type="text/javascript">
|
||||||
|
$(document).ready (function () {
|
||||||
|
$("area[title!='<?=$pandora_name?>']").cluetip ({
|
||||||
|
arrows: true,
|
||||||
|
attribute: 'title',
|
||||||
|
cluetipClass: 'default',
|
||||||
|
fx: { open: 'fadeIn', openSpeed: 'slow' },
|
||||||
|
});
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
@ -22,6 +22,7 @@ require("include/config.php");
|
|||||||
if (defined ('AJAX')) {
|
if (defined ('AJAX')) {
|
||||||
$get_agent_json = (bool) get_parameter ('get_agent_json');
|
$get_agent_json = (bool) get_parameter ('get_agent_json');
|
||||||
$get_agent_modules_json = (bool) get_parameter ('get_agent_modules_json');
|
$get_agent_modules_json = (bool) get_parameter ('get_agent_modules_json');
|
||||||
|
$get_agent_status_tooltip = (bool) get_parameter ("get_agent_status_tooltip");
|
||||||
|
|
||||||
if ($get_agent_json) {
|
if ($get_agent_json) {
|
||||||
$id_agent = (int) get_parameter ('id_agent');
|
$id_agent = (int) get_parameter ('id_agent');
|
||||||
@ -38,6 +39,52 @@ if (defined ('AJAX')) {
|
|||||||
echo json_encode ($agent_modules);
|
echo json_encode ($agent_modules);
|
||||||
exit ();
|
exit ();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($get_agent_status_tooltip) {
|
||||||
|
$id_agent = (int) get_parameter ('id_agent');
|
||||||
|
$agent = get_db_row ('tagente', 'id_agente', $id_agent);
|
||||||
|
echo '<h3>'.$agent['nombre'].'</h3>';
|
||||||
|
echo '<strong>'.lang_string ('IP').':</strong> '.$agent['direccion'].'<br />';
|
||||||
|
echo '<strong>'.lang_string ('Last contact').':</strong> '.$agent['ultimo_contacto'].'<br />';
|
||||||
|
echo '<strong>'.lang_string ('Last remote contact').':</strong> '.$agent['ultimo_contacto_remoto'].'<br />';
|
||||||
|
echo '<strong>'.lang_string ('Group').':</strong> ';
|
||||||
|
echo '<img src="images/groups_small/'.dame_grupo_icono ($agent['id_grupo']).'.png" /> ';
|
||||||
|
echo dame_nombre_grupo ($agent['id_grupo']).'<br />';
|
||||||
|
|
||||||
|
$sql = sprintf ('SELECT tagente_modulo.descripcion, tagente_modulo.nombre
|
||||||
|
FROM tagente_estado, tagente_modulo
|
||||||
|
WHERE tagente_modulo.id_agente = %d
|
||||||
|
AND tagente_modulo.id_tipo_modulo in (2, 6, 9, 18, 21, 100)
|
||||||
|
AND tagente_estado.id_agente_modulo = tagente_modulo.id_agente_modulo
|
||||||
|
AND tagente_modulo.disabled = 0
|
||||||
|
AND tagente_estado.estado = 1', $id_agent);
|
||||||
|
$bad_modules = get_db_all_rows_sql ($sql);
|
||||||
|
$sql = sprintf ('SELECT COUNT(*)
|
||||||
|
FROM tagente_modulo
|
||||||
|
WHERE id_agente = %d
|
||||||
|
AND id_tipo_modulo in (2, 6, 9, 18, 21, 100)', $id_agent);
|
||||||
|
$total_modules = get_db_sql ($sql);
|
||||||
|
echo '<strong>'.lang_string ('Monitors down').':</strong> '.sizeof ($bad_modules).' / '.$total_modules;
|
||||||
|
if (sizeof ($bad_modules)) {
|
||||||
|
echo '<ul>';
|
||||||
|
foreach ($bad_modules as $module) {
|
||||||
|
echo '<li>';
|
||||||
|
if ($module['descripcion'] != '')
|
||||||
|
$name = $module['descripcion'];
|
||||||
|
else
|
||||||
|
$name = $module['nombre'];
|
||||||
|
echo substr ($name, 0, 25);
|
||||||
|
if (strlen ($name) > 25)
|
||||||
|
echo '(...)';
|
||||||
|
echo '</li>';
|
||||||
|
}
|
||||||
|
echo '</ul>';
|
||||||
|
}
|
||||||
|
echo '<br />';
|
||||||
|
|
||||||
|
exit ();
|
||||||
|
}
|
||||||
|
|
||||||
exit ();
|
exit ();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -121,7 +121,7 @@ $table->rowclasses = array ();
|
|||||||
|
|
||||||
$group_name = dame_grupo ($report['id_group']);
|
$group_name = dame_grupo ($report['id_group']);
|
||||||
$sql = sprintf ('SELECT * FROM treport_content WHERE id_report = %d ORDER BY `order`', $id_report);
|
$sql = sprintf ('SELECT * FROM treport_content WHERE id_report = %d ORDER BY `order`', $id_report);
|
||||||
$contents = get_db_all_rows_sqlfree ($sql);
|
$contents = get_db_all_rows_sql ($sql);
|
||||||
foreach ($contents as $content) {
|
foreach ($contents as $content) {
|
||||||
$table->data = array ();
|
$table->data = array ();
|
||||||
|
|
||||||
|
@ -435,7 +435,7 @@ function grafico_modulo_sparse ($id_agente_modulo, $periodo, $show_event,
|
|||||||
if ($show_event){
|
if ($show_event){
|
||||||
// If we want to show events in graphs
|
// If we want to show events in graphs
|
||||||
$sql = sprintf ('SELECT utimestamp FROM tevento WHERE id_agente = %d AND utimestamp > %d', $id_agente, $fechatope);
|
$sql = sprintf ('SELECT utimestamp FROM tevento WHERE id_agente = %d AND utimestamp > %d', $id_agente, $fechatope);
|
||||||
$eventos = get_db_all_rows_sqlfree ($sql);
|
$eventos = get_db_all_rows_sql ($sql);
|
||||||
foreach ($eventos as $row) {
|
foreach ($eventos as $row) {
|
||||||
$utimestamp = $row[0];
|
$utimestamp = $row[0];
|
||||||
for ($i = 0; $i <= $resolution; $i++) {
|
for ($i = 0; $i <= $resolution; $i++) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user