2008-07-02 Esteban Sanchez <estebans@artica.es>

* include/functions_html.php: Fixed a typo in print_table() that was
        causing to show nothing on IE.

        * include/styles/pandora.css: Rollback to #909 since it was not
        working properly in IE. Need more discusion.

        * include/styles/pandora_width.css: Added to repository. Testing style
        to have porcentual widths.

        * operation/agentes/estado_grupo.php: Rewritten to make the code
        cleaner and a bit smarter. Future work will be required to make the
        tooltips or the table better.

        * reporting/stat_win.php: Replaced include with require_once to
        speed up the code parsing, besides it was not working with the
        includes.



git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@931 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
Esteban Sanchez 2008-07-03 15:13:14 +00:00
parent 83ba482bd1
commit 89c0602b58
6 changed files with 1012 additions and 269 deletions

View File

@ -1,3 +1,22 @@
2008-07-02 Esteban Sanchez <estebans@artica.es>
* include/functions_html.php: Fixed a typo in print_table() that was
causing to show nothing on IE.
* include/styles/pandora.css: Rollback to #909 since it was not
working properly in IE. Need more discusion.
* include/styles/pandora_width.css: Added to repository. Testing style
to have porcentual widths.
* operation/agentes/estado_grupo.php: Rewritten to make the code
cleaner and a bit smarter. Future work will be required to make the
tooltips or the table better.
* reporting/stat_win.php: Replaced include with require_once to
speed up the code parsing, besides it was not working with the
includes.
2008-07-02 Esteban Sanchez <estebans@artica.es>
* godmode/reporting/reporting_builder.php: Removed extra "#" in

View File

@ -325,7 +325,7 @@ function print_table ($table, $return = false) {
$output .= '<table width="'.$table->width.'" ';
$output .= " cellpadding=\"$table->cellpadding\" cellspacing=\"$table->cellspacing\" ";
$output .= " border=\"$table->border\" 'class=\"$table->class\" id=\"$tableid\" >\n";
$output .= " border=\"$table->border\" class=\"$table->class\" id=\"$tableid\" >\n";
$countcols = 0;
if (!empty ($table->head)) {

View File

@ -176,7 +176,7 @@ div#db_ftxt {
}
div#container {
margin: 0 auto;
width: 95%;
width: 960px;
text-align: left;
border-left: solid 2px #000;
border-right: solid 2px #000;
@ -184,21 +184,25 @@ div#container {
margin-top: 5px;
}
div#page {
width: 960px;
background: #fff;
clear: both;
border-bottom: solid 5px #786;
border-top: solid 5px #786;
background: #FFF;
}
div#main {
width: 780px;
min-height: 500px;
float: both;
float: right;
padding-left: 0px;
padding-top: 0px;
padding-bottom: 20px;
margin-left: 180px;
margin-bottom: 25px;
background-color: #fefefe;
background-image: url(../../images/backgrounds/background4.jpg);
background-image: url(../../images/backgrounds/background4.jpg);
margin-top: 0px;
margin-left: 0px;
margin-right: 0px;
}
div#menu {
@ -210,6 +214,7 @@ div#page>div#menu {
}
div#head {
font-size: 8pt;
width: 960px;
height: 60px;
background: url(../../images/header.jpg);
border-bottom: solid 2px #555;
@ -221,6 +226,7 @@ div#foot {
padding-bottom: 5px;
text-align: center;
background: #000;
width: 960px;
clear: both;
}
#ver {
@ -441,22 +447,22 @@ div.title_line {
width: 762px;
}
#menu_tab_frame {
background: #D84437;
width: 100%;
min-height: 22px;
padding-left: 0x;
margin-left: -25px;
float:right;
border-bottom: 1px solid #778866;
background: #D84437;
width: 805px;
min-height: 22px;
padding-left: 0x;
margin-left: -25px;
float:left;
border-bottom: 1px solid #778866;
}
#menu_tab_frame_view {
background: #66AA44;
width: 100%;
min-height: 22px;
padding-left: 0x;
margin-left: -25px;
float:right;
border-bottom: 1px solid #778866;
background: #66AA44;
width: 805px;
min-height: 22px;
padding-left: 0x;
margin-left: -25px;
float:left;
border-bottom: 1px solid #778866;
}

View File

@ -0,0 +1,721 @@
/*
// Pandora FMS - the Free monitoring system
// ========================================
// Copyright (c) 2004-2007 Sancho Lerena, slerena@gmail.com
// Main PHP/SQL code development and project architecture and management
// Copyright (c) 2004-2007 Raul Mateos Martin, raulofpandora@gmail.com
// CSS and some PHP additions
// Copyright (c) 2006-2007 Jonathan Barajas, jonathan.barajas[AT]gmail[DOT]com
// Javascript Active Console code.
// Copyright (c) 2006 Jose Navarro <contacto@indiseg.net>
// Additions to Pandora FMS 1.2 graph code and new XML reporting template management
// Copyright (c) 2005-2007 Artica Soluciones Tecnologicas, info@artica.es
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation; 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.
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
@import url(op.css);
@import url(god.css);
@import url(link.css);
@import url(tip.css);
* {
font-family: verdana, sans-serif;
font-size: 8pt;
}
body {
text-align: center;
}
input, textarea {
border: 1px solid #ddd;
font: verdana, sans-serif;
font-size: 8pt;
}
textarea {
padding: 5px;
height: 100px;
font-family: verdana, sans-serif;
font-size: 8pt;
}
textarea.conf_editor {
padding: 5px;
width: 650;
height: 350;
font-family: verdana, sans-serif;
font-size: 8pt;
}
input {
padding: 2px 3px 4px 3px;
}
input.button {
margin: 0;
font: bold, Arial, Sans-serif;
border: 1px solid #ccc;
background: #fff;
padding: 2px 3px;
margin: 10px 15px;
}
select {
padding: 0px;
border:1px solid #ddd;
font-family: verdana, sans-serif;
font-size: 8pt;
}
checkbox {
padding: 4px;
border:1px solid #eee;
}
h1, h2, h3, h4 {
font: bold 1em Arial, Sans-serif;
text-transform: uppercase;
color: #786;
padding-bottom: 4px;
padding-top: 7px;
}
h1 {
font-size: 16px;
}
h2 {
font-size: 15px;
}
h3 {
font-size: 14px;
}
h4 {
margin-bottom: 2px;
padding-bottom: 0px;
padding-top: 5px;
font-size: 13px;
color: #000;
}
a {
color: #486787;
text-decoration: none;
}
a:hover {
color: #003a3a;
text-decoration: underline;
}
a.white_bold {
color: #eee;
text-decoration: none;
font-weight: bold;
}
a.white_grey_bold {
color: #999;
text-decoration: none;
font-weight: bold;
}
a.white {
color: #eee;
text-decoration: none;
}
p.center {
text-align: center;
}
h1#log {
font-size: 18px;
margin-bottom: 0px;
color: #000;
}
h1#log_f {
color: #f00;
border-bottom: 1px solid #f00;
padding-bottom: 3px;
}
div#login {
margin: 0 auto;
margin-top: 200px;
width: 460px;
border-left: solid 1px #000;
border-top: solid 1px #000;
border-bottom: solid 2px #000;
border-right: solid 2px #000
}
div#login_in, #login_f {
margin: 0 auto;
width: 400px;
}
div#login_f {
margin-top: 10px;
margin-bottom: 25px;
}
div#noaccess {
width: 350px;
padding-left: 40px;
}
div#activity{
padding-top: 18px;
padding-bottom: 18px;
}
div#noa {
float: right;
padding-right: 50px;
margin-top: 25px;
}
div#db_f {
text-align: justify;
margin: auto;
padding: 0.5em;
width: 55em;
margin-top: 3em;
}
div#db_ftxt {
float: right;
padding-top: 10px;
}
div#container {
margin: 0 auto;
width: 95%;
text-align: left;
border-left: solid 2px #000;
border-right: solid 2px #000;
border-top: solid 2px #000;
margin-top: 5px;
}
div#page {
background: #fff;
clear: both;
border-bottom: solid 5px #786;
border-top: solid 5px #786;
background: #FFF;
}
div#main {
width: auto;
min-height: 800px;
float: both;
padding-left: 0px;
padding-top: 0px;
padding-bottom: 20px;
margin-left: 180px;
background-color: #fefefe;
background-image: url(../../images/backgrounds/background4.jpg);
}
div#menu {
width: 155px;
float: left;
}
div#page>div#menu {
width: 157px;
}
div#head {
font-size: 8pt;
height: 60px;
background: url(../../images/header.jpg);
border-bottom: solid 2px #555;
}
div#foot {
font-size: 7pt;
margin-top: solid 2px #000;
padding-top: 5px;
padding-bottom: 5px;
text-align: center;
background: #000;
clear: both;
}
#ver {
margin-bottom: 25px;
}
#ip {
margin-top: 10px;
margin-bottom: 5px;
}
label {
display: block;
float: left;
padding-top: 4px;
}
th > label {
padding-top: 7px;
}
input:hover {
background-color: #d4dccd;
}
input.chk {margin-right: 0px;
border: 0px none;
height: 14px;
}
input.datos {
background-color: #f5f5f5;
}
input.datos_readonly {
background-color: #050505;
}
input.login {
border-color: #786;
background-color: #f5f5f5;
margin: 2px 0 8px;
width: 90px;
}
input.sub {
font-weight: bold;
border-bottom-color: #708090;
border-right-color: #708090;
-moz-border-radius: 5%;
font-size: 8pt;
}
input.next {
padding-right: 21px;
background: #e5e5e5 url(../../images/go.png) no-repeat right 2px;
}
input.upd {
padding-right: 21px;
background: #e5e5e5 url(../../images/upd.png) no-repeat right 3px;
}
input.wand {
padding-right: 21px;
background: #e5e5e5 url(../../images/wand.png) no-repeat right 3px;
}
input.delete {
padding-right: 21px;
background: #e5e5e5 url(../../images/cross.png) no-repeat right 3px;
}
input.search {
padding-right: 21px;
background: #e5e5e5 url(../../images/zoom.png) no-repeat right 3px;
}
input.copy {
padding-right: 21px;
background: #e5e5e5 url(../../images/copy.png) no-repeat right 3px;
}
input.ok {
padding-right: 21px;
background: #e5e5e5 url(../../images/ok.png) no-repeat right 3px;
}
table, img {
border: 0px;
}
th {
color: #fff;
background-color: #786;
}
td.datos, td.datost, td.datosb , td.datos_id, td.datosf9 {
background-color: #f9f9f9;
}
td.datos2, td.datos2t, td.datos2b, td.datos2_id , td.datos2f9 {
background-color: #efefef;
}
td.datos3 {
background-color: #d4ddc6;
}
td.datos_id {
color: #1a313a;
}
td.datos_jus, td.datos2_jus {
text-align: justify;
}
.bg { /* op menu */
background-color: #786;
}
.bg2 { /* main page */
background-color: #d84437;
}
.bg3 { /* godmode */
background-color: #d84437;
}
.bg4 { /* links */
background-color: #5385bf;
}
.bg, .bg2, .bg3, .bg4 {
position: relative;
height: 20px;
width: 100%;
}
.f10, #ip {
font-size: 7pt;
text-align: center;
}
.f9, .f9i, .f9b, td.f9, td.f9i, td.datosf9, td.datos2f9 {
font-size: 6.5pt;
}
.f9i, .redi {
font-style: italic;
}
.jus {
text-align: justify;
width: 700px;
}
.tit {
padding-top: 3px;
}
.tit, .titb {
font-weight: bold;
color: #fff;
text-align: center;
}
.suc {
color: #5a8629;
background: url(../../images/suc.png) no-repeat 1px;
padding: 4px 1px 6px 30px;
}
.error {
background: url(../../images/err.png) no-repeat;
padding: 4px 1px 6px 30px;
}
.red , .redb, .redi, .error {
color: #f00;
}
.sep {
margin-left: 30px;
border-bottom: 1px solid #708090;
width: 100%;
}
.green {
color: #5a8629;
}
.greenb {
color: #00aa00;
}
.grey {
color: #808080;
font-weight: bold;
}
.redb, .greenb, td.datos_id, td.datos2_id, f9b {
font-weight: bold;
}
.p10 {
padding-top: 1px;
padding-bottom: 0px;
}
.p21 {
padding-top: 2px;
padding-bottom: 1px;
}
.w120 {
width: 120px;
}
.w130, #table-agent-configuration select {
width: 130px;
}
.w135 {
width: 135px;
}
.w155, #table_layout_data select {
width: 155px;
}
.top, .top_red, .bgt, td.datost, td.datos2t {
vertical-align: top;
}
.top_red {
background: #ff0000;
}
.bot, .titb, td.datosb {
vertical-align: bottom;
}
.msg {
margin-top: 15px;
text-align: justify;
}
ul.mn {
list-style: none;
padding: 0px 0px 0px 0px;
margin: 0px 0px 0px 0px;
line-height: 24px;
}
.gr {
font-size: 10pt;
font-weight: bold;
}
a.mn, .gr {
font-family: Arial, Verdana, sans-serif, Helvetica;
}
div.nf {
background: url(../../images/info.png) no-repeat;
color: #ac4444;
margin-left: 7px;
padding: 2px 1px 6px 25px;
}
div.title_line {
background-color: #4e682c;
height: 5px;
width: 762px;
}
#menu_tab_frame {
background: #D84437;
min-height: 22px;
padding-left: 0px;
float:right;
border-bottom: 1px solid #778866;
}
#menu_tab_frame_view {
background: #66AA44;
min-height: 22px;
padding-left: 0px;
float:right;
border-bottom: 1px solid #778866;
}
#menu_tab .mn, #menu_tab ul, #menu_tab .mn ul {
padding: 0px;
list-style: none;
margin: 0px;
}
#menu_tab .mn li {
float: right;
position: relative;
}
#menu_tab li a, #menu_tab li.nomn a {
background: #d4ddc6;
padding: 2px 10px 2px 10px;
color: #333;
border-left: 2px solid #778866;
font-weight: bold;
line-height: 18px;
}
#menu_tab li.nomn_high a {
background: #799E48;
color: #fff;
padding: 2px 10px 2px 10px;
border-left: 2px solid #778866;
font-weight: bold;
line-height: 18px;
}
#menu_tab .mn li a {
display: block;
text-decoration: none;
}
#menu_tab li.nomn:hover a, li.nomn:hover_high a
#menu_tab li:hover ul a:hover {
background: #799E48;
color: #fff;
}
#menu_tab li:hover a {
background: #b2b08a url("../images/arrow.png") no-repeat right 3px;
}
#menu_tab li:hover ul a, #menu_tab .mn ul {
background: #db6351;
border-top: none;
}
/* TAB TITLE */
#menu_tab_left .mn, #menu_tab_left ul, #menu_tab_left .mn ul {
padding: 0px 0px 0px 0px;
list-style: none;
margin: 0px 0px 0px 2px;
}
#menu_tab_left .mn li {
float: left;
position: relative;
}
#menu_tab_left li a {
background: #d84437;
padding: 2px 10px 2px 10px;
color: #fff;
font-weight: bold;
line-height: 18px;
}
#menu_tab_left .mn li a {
display: block;
text-decoration: none;
}
#menu_tab_left li.view a {
background: #6a4;
padding: 2px 10px 2px 10px;
color: #fff;
font-weight: bold;
line-height: 18px;
}
span.users {
background: url(../../images/group.png) no-repeat;
}
span.agents {
background: url(../../images/bricks.png) no-repeat;
}
span.data {
background: url(../../images/data.png) no-repeat;
}
span.alerts {
background: url(../../images/bell.png) no-repeat;
}
span.time {
background: url(../../images/hourglass.png) no-repeat;
}
span.net {
background: url(../../images/network.png) no-repeat;
}
span.master {
background: url(../../images/master.png) no-repeat;
}
span.wmi {
background: url(../../images/wmi.png) no-repeat;
}
span.prediction {
background: url(../../images/chart_bar.png) no-repeat;
}
span.plugin {
background: url(../../images/plugin.png) no-repeat;
}
span.export {
background: url(../../images/database_refresh.png) no-repeat;
}
span.snmp {
background: url(../../images/snmp.png) no-repeat;
}
span.binary {
background: url(../../images/binary.png) no-repeat;
}
span.recon {
background: url(../../images/recon.png) no-repeat;
}
span.rmess {
background: url(../../images/email_open.png) no-repeat;
}
span.nrmess {
background: url(../../images/email.png) no-repeat;
}
/* This kind of span do not have any sense, should be replaced on PHP code
by a real img in code. They are not useful because insert too much margin around
(for example, not valid to use in the table of server view */
span.users, span.agents, span.data, span.alerts, span.time, span.net,
span.master, span.snmp, span.binary, span.recon, span.wmi, span.prediction,
span.plugin, span.plugin, span.export {
margin-left: 4px;
margin-top: 10px;
padding: 4px 8px 12px 30px;
display: block;
}
span.rmess, span.nrmess {
margin-left: 14px;
padding: 1px 0px 10px 30px;
display: block;
}
/* New styles for data box */
.databox, .databox_color, .databox_frame {
margin-bottom: 15px;
margin-top: 5px;
margin-left: 0px;
border: 1px solid #f2f2f2;
}
.databox {
background-color: #fafafa;
}
.databox_color {
border-left: 4px solid #786;
}
#head_l {
float: left;
margin: 0;
padding: 0;
}
#head_r {
float: right;
text-align: right;
margin-right: 10px;
padding-top: 10px;
}
#head_m {
position: absolute;
padding-top: 6px;
padding-left: 200px;
}
span#logo_text1 {
font: bolder 3em Arial, Sans-serif;
letter-spacing: -2px;
color: #eee;
}
span#logo_text2 {
font: 3em Arial, Sans-serif;
letter-spacing: -2px;
color: #aaa;
}
.bb0 {
border-bottom: 0px;
}
.bt0 {
border-top: 0px;
}
.action-buttons {
text-align: right;
}
#table-add-item select, #table-add-sla select {
width: 180px;
}
td.datos_green, td.datos_greenf9 {
background-color: #C7EAD5;
padding: 5px 5px 5px 5px;
}
td.datos_red, td.datos_redf9 {
background-color: #FFC0B5;
padding: 5px 5px 5px 5px;
}
td.datos_yellow, td.datos_yellowf9 {
background-color: #F4FFBF;
padding: 5px 5px 5px 5px;
}
td.datos_blue, td.datos_bluef9 {
background-color: #CDE2EA;
padding: 5px 5px 5px 5px;
}
td.datos_grey, td.datos_greyf9 {
background-color: #DCDCDC;
padding: 5px 5px 5px 5px;
}
td.datos_greyf9, td.datos_bluef9, td.datos_greenf9, td.datos_redf9, td.datos_yellowf9 {
font-size: 6.5pt;
}
div#main_pure {
background-color: #fefefe;
text-align: left;
margin-bottom: 25px;
margin-top: 10px;
margin-left: 10px;
margin-right: 10px;
}
#table-agent-configuration radio {
margin-right: 40px;
}
.ui-draggable {
cursor:move;
}
#layout_trash_drop {
float: right;
width: 300px;
height: 180px;
background: #fff url("../../images/trash.png") no-repeat bottom left;
}
#layout_trash_drop div {
display: block;
}
#layout_editor_drop {
float: left;
width: 300px;
}
.agent_reporting {
margin: 5px;
padding: 5px;
}
.report_table, .agent_reporting {
border: #CCC outset 3px;
}
.img_help {
cursor: help;
}

View File

@ -15,261 +15,258 @@
// along with this program; if not, write to the Free Software
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
// Load global vars
require("include/config.php");
// Load global vars
require ("include/config.php");
if (! isset($config["show_lastalerts"]))
$config["show_lastalerts"]=1;
if (! isset($config["show_lastalerts"]))
$config["show_lastalerts"] = 1;
if (give_acl ($id_user, 0, "AR") != 1) {
audit_db ($id_user, $REMOTE_ADDR, "ACL Violation",
"Trying to access Agent view (Grouped)");
require ("general/noaccess.php");
exit;
if (give_acl ($id_user, 0, "AR") != 1) {
audit_db ($id_user, $REMOTE_ADDR, "ACL Violation",
"Trying to access Agent view (Grouped)");
require ("general/noaccess.php");
exit;
}
echo "<h2>".$lang_label["ag_title"]." &gt; ".$lang_label["group_view"]."</h2>";
// Update network modules for this group
// Check for Network FLAG change request
if (isset ($_GET["update_netgroup"])) {
if (give_acl ($id_user, $_GET["update_netgroup"], "AW") == 1) {
$sql = "SELECT * FROM tagente WHERE id_grupo = ".
$_GET["update_netgroup"];
$result = mysql_query ($sql);
while ($row = mysql_fetch_array ($result)) {
$id_agente = $row["id_agente"];
$query2 ="UPDATE tagente_modulo SET flag=1
WHERE id_agente = ".$id_agente;
$res = mysql_query ($query2);
}
}
echo "<h2>".$lang_label["ag_title"]." &gt; ".$lang_label["group_view"]."</h2>";
}
// Get group list that user has access
$mis_grupos = list_group2 ($id_user);
// Get group list that user has access
$groups = get_user_groups ($id_user);
$groups_info = array ();
$total_agents = 0;
$ahora = date("Y/m/d H:i:s");
$ahora_sec = strtotime($ahora);
// Prepare data to show
// For each valid group for this user, take data from agent and modules
foreach ($groups as $id_group => $group_name) {
$sql = sprintf ("SELECT COUNT(id_agente)
FROM tagente
WHERE id_grupo = %d AND disabled = 0",
$id_group);
$agents = get_db_sql ($sql);
if ($agents == 0)
continue;
// Update network modules for this group
// Check for Network FLAG change request
if (isset ($_GET["update_netgroup"])) {
if (give_acl ($id_user, $_GET["update_netgroup"], "AW") == 1) {
$sql = "SELECT * FROM tagente WHERE id_grupo = ".
$_GET["update_netgroup"];
$result = mysql_query ($sql);
while ($row = mysql_fetch_array ($result)) {
$id_agente = $row["id_agente"];
$query2 ="UPDATE tagente_modulo SET flag=1
WHERE id_agente = ".$id_agente;
$res = mysql_query ($query2);
$total_agents += $agents;
$group_info = array ('agent' => 0,
'ok' => 0,
'bad' => 0,
'alerts' => 0,
'down' => 0,
'icon' => dame_grupo_icono ($id_group),
'id_group' => $id_group,
'name' => $group_name);
// SQL Join to get monitor status for agents belong this group
$sql = sprintf ("SELECT tagente_estado.datos, tagente_estado.current_interval
FROM tagente, tagente_estado, tagente_modulo
WHERE tagente.disabled = 0 AND tagente.id_grupo = %d
AND tagente.id_agente = tagente_estado.id_agente AND tagente_estado.estado != 100
AND tagente_estado.id_agente_modulo = tagente_modulo.id_agente_modulo
AND tagente_modulo.disabled = 0
AND tagente_estado.utimestamp != 0",
$id_group);
$result = mysql_query ($sql);
while ($module = mysql_fetch_array ($result)) {
if ($config["show_unknown"] > 0){
if ($seconds >= ($module['current_interval'] * 2)) {
$group_info["down"]++;
}
} elseif ($module['datos'] != 0) {
$group_info["ok"]++;
} else {
$group_info["bad"]++;
}
}
$contador_grupo = 0;
$contador_agente = 0;
$array_index = 0;
$ahora=date("Y/m/d H:i:s");
$ahora_sec = strtotime($ahora);
// Prepare data to show
// For each valid group for this user, take data from agent and modules
foreach ($mis_grupos as $migrupo) {
if (($migrupo != "") && ($migrupo != 1)) {
$existen_agentes = 0;
$grupo[$array_index]["agent"] = 0;
$grupo[$array_index]["ok"] = 0;
$grupo[$array_index]["bad"] = 0;
$grupo[$array_index]["alerts"] = 0;
$grupo[$array_index]["down"] = 0;
$grupo[$array_index]["icon"] = dame_grupo_icono ($migrupo);
$grupo[$array_index]["id_grupo"] = $migrupo;
$grupo[$array_index]["group"] = dame_nombre_grupo ($migrupo);
$sql0 = "SELECT COUNT(id_agente) FROM tagente WHERE id_grupo = $migrupo AND disabled = 0";
$result0 = mysql_query ($sql0);
$row0 = mysql_fetch_array ($result0);
$contador_agente = $contador_agente + $row0[0];
$grupo[$array_index]["agent"] = $row0[0];
if ($row0[0] > 0)
$existen_agentes = 1;
// SQL Join to get monitor status for agents belong this group
$sql1 = "SELECT
tagente.id_agente, tagente_estado.estado, tagente_estado.datos, tagente_estado.current_interval,
tagente_estado.utimestamp, tagente_estado.id_agente_modulo
FROM tagente, tagente_estado, tagente_modulo
WHERE tagente.disabled = 0 AND tagente.id_grupo = $migrupo AND
tagente.id_agente = tagente_estado.id_agente AND tagente_estado.estado != 100 AND
tagente_estado.id_agente_modulo = tagente_modulo.id_agente_modulo AND
tagente_modulo.disabled = 0 AND
tagente_estado.utimestamp != 0";
if ($result1 = mysql_query ($sql1)){
while ($row1 = mysql_fetch_array ($result1)) {
$id_agente = $row1[0];
$estado = $row1[1];
$datos = $row1[2];
$module_interval = $row1[3];
$seconds = $ahora_sec - $row1[4];
$id_agente_modulo = $row1[5];
if ($config["show_unknown"] > 0){
if ($seconds >= ($module_interval*2)){
$grupo[$array_index]["down"]++;
}
} elseif ($datos != 0) {
$grupo[$array_index]["ok"]++;
} else {
$grupo[$array_index]["bad"]++;
}
}
}
if ($config["show_lastalerts"] == 1){
// How many alerts has been fired recently for this group:
// SQL Join to get alert status for agents belong this group
$sql1 = "SELECT SUM(talerta_agente_modulo.times_fired)
FROM tagente_modulo, talerta_agente_modulo, tagente WHERE tagente.disabled = 0 AND tagente.id_grupo = $migrupo AND tagente.id_agente = tagente_modulo.id_agente AND talerta_agente_modulo.id_agente_modulo = tagente_modulo.id_agente_modulo";
if ($result1 = mysql_query ($sql1)){
$row1 = mysql_fetch_array ($result1);
$grupo[$array_index]["alerts"] = $row1[0];
}
}
if ($existen_agentes == 1){
$array_index++;
}
}
if ($config["show_lastalerts"] == 1) {
// How many alerts has been fired recently for this group:
// SQL Join to get alert status for agents belong this group
$sql = sprintf ("SELECT SUM(talerta_agente_modulo.times_fired)
FROM tagente_modulo, talerta_agente_modulo, tagente
WHERE tagente.disabled = 0
AND tagente.id_grupo = %d
AND tagente.id_agente = tagente_modulo.id_agente
AND talerta_agente_modulo.id_agente_modulo = tagente_modulo.id_agente_modulo",
$id_group);
$group_info["alerts"] = get_db_sql ($sql);
}
// Draw data
if ($contador_agente != 0) {
$ancho = ceil(sqrt($array_index+1));
$real_count =0;
echo "<table cellpadding=10 cellspacing=10 border=0>";
for ($table=0; $table < $ancho; $table++) {
echo "<tr class='bot'>";
for ($table_row=0; $table_row < $ancho; $table_row++) {
if ($real_count < $array_index) {
$group_name = $grupo[$real_count]["group"];
$icono_grupo = $grupo[$real_count]["icon"];
$icono_type = "";
if ($grupo[$real_count]["bad"] > 0) {
$icono_type = $icono_type."
<img src='images/dot_red.png' alt=''>";
}
if ($grupo[$real_count]["ok"] > 0) {
$icono_type = $icono_type."
<img src='images/dot_green.png' alt=''>";
}
// Show yellow light if there are recent alerts fired for this group
if ($grupo[$real_count]["alerts"] > 0 ){
$icono_type=$icono_type."
<img src='images/dot_yellow.png' alt=''>";
}
array_push ($groups_info, $group_info);
}
// Show grey light if there are agent down for this group
if ($grupo[$real_count]["down"] > 0 ){
$icono_type=$icono_type."
<img src='images/dot_white.png' alt=''>";
}
// Show red flag is group has disabled alert system
if (give_disabled_group($grupo[$real_count]["id_grupo"]) == 1)
$icono_type = $icono_type."&nbsp;
<img src='images/flag_red.png' alt='".$lang_label["disabled"]."'>";
// By default green border
$celda = "<td class='top' style='border: 5px solid #aeff21;' width='100'>";
// Grey border if agent down
if ($config["show_unknown"] > 0){
if ($grupo[$real_count]["down"] > 0)
$celda = "<td class='top' style='border: 5px solid #aabbaa;' width='100'>";
}
// Yellow border if agents with alerts
if ($grupo[$real_count]["alerts"] > 0)
$celda = "<td class='top' style='border: 5px solid #ffea00;' width='100'>";
// Red border if agents bad
if ($grupo[$real_count]["bad"] > 0)
$celda = "<td class='top' style='border: 5px solid #ff0000;' width='100'>";
// Orange if alerts and down modules
if (($grupo[$real_count]["bad"] > 0) && ($grupo[$real_count]["alerts"] > 0))
$celda = "<td class='top' style='border: 5px solid #ffbb00;' width='100'>";
$celda .= "<a href='index.php?sec=estado&amp;
sec2=operation/agentes/estado_agente&amp;
refr=60&amp;
group_id=".$grupo[$real_count]["id_grupo"]."'
class='info'>";
// Add group icon
$celda .= "<img class='top'
src='images/groups_small/".$icono_grupo.".png' height='32' width='32' alt=''>";
// Add float info table
$celda .= "
<span>
<table cellspacing='2' cellpadding='0'
style='margin-left:2px;'>
<tr><th colspan='2' width='91'>".
$lang_label["agents"].": </th></tr>
<tr><td colspan='2' class='datos' align='center'><b>".
$grupo[$real_count]["agent"]."</b></td></tr>
</table>
<table cellspacing='2' cellpadding='0'
style='margin-left:2px'>
<tr>
<th colspan='2' width='90'>".
ucfirst($lang_label["monitors"]).":</th>
</tr>
<tr>
<td class='datos'>
<img src='images/b_green.png' align='top' alt='' >
".$lang_label["ok"].": </td>
<td class='datos'>
<font class='greenb'>".$grupo[$real_count]["ok"]."</font>
</td>
</tr>
<tr>
<td class='datos'>
<img src='images/b_red.png' align='top' alt=''>
".$lang_label["fail"].": </td>
<td class='datos'><font class='redb'>".
$grupo[$real_count]["bad"]."</font></td>
</tr>";
if ($config["show_unknown"] > 0){
$celda .= "
<tr>
<td class='datos'>
<img src='images/b_white.png' align='top' alt=''>
".$lang_label["down"].": </td>
<td class='datos'><font class='redb'>".
$grupo[$real_count]["down"]."</font></td></tr>";
}
if ($config["show_lastalerts"] == 1)
$celda .= "<tr>
<td class='datos'>
<img src='images/b_yellow.png' align='top' alt=''>
".$lang_label["alerts"].": </td>
<td class='datos'><font class='grey'>".
$grupo[$real_count]["alerts"]."</font></td>
</tr>";
$celda .= "</table></span></a>";
// Render network exec module button, only when this group is writtable by user
if (give_acl ($id_user, $grupo[$real_count]["id_grupo"], "AW") == 1) {
$celda .= "&nbsp;<a href='index.php?
sec=estado&
sec2=operation/agentes/estado_grupo&
update_netgroup=".$grupo[$real_count]["id_grupo"]."'>
<img src='images/target.png'></a>";
}
$celda .= "<br><br>".
$icono_type."<br><br>
<span class='gr'>".$group_name."</span>";
echo $celda;
}
$real_count++;
}
echo "</tr>";
}
echo "</table>";
} else {
echo "<div class='nf'>".$lang_label["no_group_def"]."</div>";
$id_user = $_SESSION["id_usuario"];
if ($total_agents == 0) {
echo "<div class='nf'>".$lang_label["no_group_def"]."</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 "&nbsp;<form method='post' action='index.php?sec=gagente&sec2=godmode/groups/configure_group&create_g=1'><input type='submit' class='sub next' name='crt'
echo "&nbsp;<form method='post' action='index.php?sec=gagente&sec2=godmode/groups/configure_group&create_g=1'><input type='submit' class='sub next' name='crt'
value='".$lang_label["create_group"]."'></form>";
}
return;
}
$group_size = sizeof ($groups_info);
$ancho = ceil (sqrt ($group_size + 1));
$real_count = 0;
echo "<table cellpadding=10 cellspacing=10 border=0>";
for ($table = 0; $table < $ancho; $table++) {
if ($real_count >= $group_size) {
continue;
}
echo "<tr class='bot'>";
//foreach ($groups_info as $group) {
for ($table_row = 0; $table_row < $ancho; $table_row++) {
if ($real_count >= $group_size) {
continue;
}
$group_info = $groups_info[$real_count];
$group_name = $group_info["name"];
$icono_grupo = $group_info["icon"];
$icono_type = "";
if ($group_info["bad"] > 0) {
$icono_type .= '<img src="images/dot_red.png"
title="'.lang_string ('modules_bad').'">';
}
if ($group_info["ok"] > 0) {
$icono_type .= '<img src="images/dot_green.png"
title="'.lang_string ('modules_ok').'">';
}
// Show yellow light if there are recent alerts fired for this group
if ($group_info["alerts"] > 0 ) {
$icono_type .= '<img src="images/dot_yellow.png"
title="'.lang_string ('alerts_fired').'">';
}
// Show grey light if there are agent down for this group
if ($group_info["down"] > 0 ) {
$icono_type .= '<img src="images/dot_white.png"
title="'.lang_string ('agents_down').'">';
}
// Show red flag is group has disabled alert system
if (give_disabled_group ($group_info["id_group"])) {
$icono_type .= '<img src="images/flag_red.png"
title="'.lang_string ('disabled_alerts').'">';
}
// By default green border
$celda = "<td class='top' style='border: 5px solid #aeff21;' width='100'>";
// Grey border if agent down
if ($config["show_unknown"] > 0) {
if ($group_info["down"] > 0)
$celda = "<td class='top' style='border: 5px solid #aabbaa;' width='100'>";
}
// Yellow border if agents with alerts
if ($group_info["alerts"] > 0)
$celda = "<td class='top' style='border: 5px solid #ffea00;' width='100'>";
// Red border if agents bad
if ($group_info["bad"] > 0)
$celda = "<td class='top' style='border: 5px solid #ff0000;' width='100'>";
// Orange if alerts and down modules
if (($group_info["bad"] > 0) && ($group_info["alerts"] > 0))
$celda = "<td class='top' style='border: 5px solid #ffbb00;' width='100'>";
$celda .= "<a href='index.php?sec=estado&amp;
sec2=operation/agentes/estado_agente&amp;
refr=60&amp;
group_id=".$group_info["id_group"]."'
class='info'>";
// Add group icon
$celda .= "<img class='top'
src='images/groups_small/".$icono_grupo.".png' height='32' width='32' alt=''>";
// Add float info table
$celda .= "
<span>
<table cellspacing='2' cellpadding='0'
style='margin-left:2px;'>
<tr><th colspan='2' width='91'>".
$lang_label["agents"].": </th></tr>
<tr><td colspan='2' class='datos' align='center'><b>".
$group_info["agent"]."</b></td></tr>
</table>
<table cellspacing='2' cellpadding='0'
style='margin-left:2px'>
<tr>
<th colspan='2' width='90'>".
ucfirst ($lang_label["monitors"]).":</th>
</tr>
<tr>
<td class='datos'>
<img src='images/b_green.png' align='top' alt='' >
".$lang_label["ok"].": </td>
<td class='datos'>
<font class='greenb'>".$group_info["ok"]."</font>
</td>
</tr>
<tr>
<td class='datos'>
<img src='images/b_red.png' align='top' alt=''>
".$lang_label["fail"].": </td>
<td class='datos'><font class='redb'>".
$group_info["bad"]."</font></td>
</tr>";
if ($config["show_unknown"] > 0){
$celda .= "
<tr>
<td class='datos'>
<img src='images/b_white.png' align='top' alt=''>
".$lang_label["down"].": </td>
<td class='datos'><font class='redb'>".
$group_info["down"]."</font></td></tr>";
}
if ($config["show_lastalerts"] == 1)
$celda .= "<tr>
<td class='datos'>
<img src='images/b_yellow.png' align='top' alt=''>
".$lang_label["alerts"].": </td>
<td class='datos'><font class='grey'>".
$group_info["alerts"]."</font></td>
</tr>";
$celda .= "</table></span></a>";
// Render network exec module button, only when this group is writtable by user
if (give_acl ($id_user, $group_info["id_group"], "AW") == 1) {
$celda .= "&nbsp;<a href='index.php?
sec=estado&
sec2=operation/agentes/estado_grupo&
update_netgroup=".$group_info["id_group"]."'>
<img src='images/target.png'></a>";
}
$celda .= "<br><br>".
$icono_type."<br><br>
<span class='gr'>".$group_name."</span>";
echo $celda;
$real_count++;
}
echo "</tr>";
}
echo "</table>";
?>

View File

@ -21,15 +21,15 @@
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
// Global & session management
include ('../include/config.php');
require_once ('../include/config.php');
if (!isset($_SESSION["id_user"])){
session_start();
session_write_close();
}
include ('../include/functions.php');
include ('../include/functions_db.php');
include ('../include/languages/language_'.$config['language'].'.php');
require_once ('../include/functions.php');
require_once ('../include/functions_db.php');
require_once ('../include/languages/language_'.$config['language'].'.php');
// Access control
if (comprueba_login() != 0) {