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> 2008-07-02 Esteban Sanchez <estebans@artica.es>
* godmode/reporting/reporting_builder.php: Removed extra "#" in * 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 .= '<table width="'.$table->width.'" ';
$output .= " cellpadding=\"$table->cellpadding\" cellspacing=\"$table->cellspacing\" "; $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; $countcols = 0;
if (!empty ($table->head)) { if (!empty ($table->head)) {

View File

@ -176,7 +176,7 @@ div#db_ftxt {
} }
div#container { div#container {
margin: 0 auto; margin: 0 auto;
width: 95%; width: 960px;
text-align: left; text-align: left;
border-left: solid 2px #000; border-left: solid 2px #000;
border-right: solid 2px #000; border-right: solid 2px #000;
@ -184,21 +184,25 @@ div#container {
margin-top: 5px; margin-top: 5px;
} }
div#page { div#page {
width: 960px;
background: #fff; background: #fff;
clear: both; clear: both;
border-bottom: solid 5px #786; border-bottom: solid 5px #786;
border-top: solid 5px #786; border-top: solid 5px #786;
background: #FFF;
} }
div#main { div#main {
width: 780px;
min-height: 500px; min-height: 500px;
float: both; float: right;
padding-left: 0px; padding-left: 0px;
padding-top: 0px; padding-top: 0px;
padding-bottom: 20px; padding-bottom: 20px;
margin-left: 180px; margin-bottom: 25px;
background-color: #fefefe; 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 { div#menu {
@ -210,6 +214,7 @@ div#page>div#menu {
} }
div#head { div#head {
font-size: 8pt; font-size: 8pt;
width: 960px;
height: 60px; height: 60px;
background: url(../../images/header.jpg); background: url(../../images/header.jpg);
border-bottom: solid 2px #555; border-bottom: solid 2px #555;
@ -221,6 +226,7 @@ div#foot {
padding-bottom: 5px; padding-bottom: 5px;
text-align: center; text-align: center;
background: #000; background: #000;
width: 960px;
clear: both; clear: both;
} }
#ver { #ver {
@ -442,20 +448,20 @@ div.title_line {
} }
#menu_tab_frame { #menu_tab_frame {
background: #D84437; background: #D84437;
width: 100%; width: 805px;
min-height: 22px; min-height: 22px;
padding-left: 0x; padding-left: 0x;
margin-left: -25px; margin-left: -25px;
float:right; float:left;
border-bottom: 1px solid #778866; border-bottom: 1px solid #778866;
} }
#menu_tab_frame_view { #menu_tab_frame_view {
background: #66AA44; background: #66AA44;
width: 100%; width: 805px;
min-height: 22px; min-height: 22px;
padding-left: 0x; padding-left: 0x;
margin-left: -25px; margin-left: -25px;
float:right; float:left;
border-bottom: 1px solid #778866; 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,26 +15,23 @@
// along with this program; if not, write to the Free Software // along with this program; if not, write to the Free Software
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
// Load global vars // Load global vars
require("include/config.php"); require ("include/config.php");
if (! isset($config["show_lastalerts"])) if (! isset($config["show_lastalerts"]))
$config["show_lastalerts"]=1; $config["show_lastalerts"] = 1;
if (give_acl ($id_user, 0, "AR") != 1) { if (give_acl ($id_user, 0, "AR") != 1) {
audit_db ($id_user, $REMOTE_ADDR, "ACL Violation", audit_db ($id_user, $REMOTE_ADDR, "ACL Violation",
"Trying to access Agent view (Grouped)"); "Trying to access Agent view (Grouped)");
require ("general/noaccess.php"); require ("general/noaccess.php");
exit; exit;
} }
echo "<h2>".$lang_label["ag_title"]." &gt; ".$lang_label["group_view"]."</h2>"; echo "<h2>".$lang_label["ag_title"]." &gt; ".$lang_label["group_view"]."</h2>";
// Get group list that user has access // Update network modules for this group
$mis_grupos = list_group2 ($id_user); // Check for Network FLAG change request
if (isset ($_GET["update_netgroup"])) {
// 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) { if (give_acl ($id_user, $_GET["update_netgroup"], "AW") == 1) {
$sql = "SELECT * FROM tagente WHERE id_grupo = ". $sql = "SELECT * FROM tagente WHERE id_grupo = ".
$_GET["update_netgroup"]; $_GET["update_netgroup"];
@ -46,149 +43,157 @@
$res = mysql_query ($query2); $res = mysql_query ($query2);
} }
} }
} }
$contador_grupo = 0; // Get group list that user has access
$contador_agente = 0; $groups = get_user_groups ($id_user);
$array_index = 0; $groups_info = array ();
$ahora=date("Y/m/d H:i:s"); $total_agents = 0;
$ahora_sec = strtotime($ahora); $ahora = date("Y/m/d H:i:s");
// Prepare data to show $ahora_sec = strtotime($ahora);
// For each valid group for this user, take data from agent and modules // Prepare data to show
foreach ($mis_grupos as $migrupo) { // For each valid group for this user, take data from agent and modules
if (($migrupo != "") && ($migrupo != 1)) { foreach ($groups as $id_group => $group_name) {
$existen_agentes = 0; $sql = sprintf ("SELECT COUNT(id_agente)
$grupo[$array_index]["agent"] = 0; FROM tagente
$grupo[$array_index]["ok"] = 0; WHERE id_grupo = %d AND disabled = 0",
$grupo[$array_index]["bad"] = 0; $id_group);
$grupo[$array_index]["alerts"] = 0; $agents = get_db_sql ($sql);
$grupo[$array_index]["down"] = 0; if ($agents == 0)
$grupo[$array_index]["icon"] = dame_grupo_icono ($migrupo); continue;
$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"; $total_agents += $agents;
$result0 = mysql_query ($sql0); $group_info = array ('agent' => 0,
$row0 = mysql_fetch_array ($result0); 'ok' => 0,
$contador_agente = $contador_agente + $row0[0]; 'bad' => 0,
$grupo[$array_index]["agent"] = $row0[0]; 'alerts' => 0,
if ($row0[0] > 0) 'down' => 0,
$existen_agentes = 1; '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 Join to get monitor status for agents belong this group
$sql1 = "SELECT $sql = sprintf ("SELECT tagente_estado.datos, tagente_estado.current_interval
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 FROM tagente, tagente_estado, tagente_modulo
WHERE tagente.disabled = 0 AND tagente.id_grupo = $migrupo AND WHERE tagente.disabled = 0 AND tagente.id_grupo = %d
tagente.id_agente = tagente_estado.id_agente AND tagente_estado.estado != 100 AND AND tagente.id_agente = tagente_estado.id_agente AND tagente_estado.estado != 100
tagente_estado.id_agente_modulo = tagente_modulo.id_agente_modulo AND AND tagente_estado.id_agente_modulo = tagente_modulo.id_agente_modulo
tagente_modulo.disabled = 0 AND AND tagente_modulo.disabled = 0
tagente_estado.utimestamp != 0"; AND tagente_estado.utimestamp != 0",
$id_group);
if ($result1 = mysql_query ($sql1)){ $result = mysql_query ($sql);
while ($row1 = mysql_fetch_array ($result1)) { while ($module = mysql_fetch_array ($result)) {
$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 ($config["show_unknown"] > 0){
if ($seconds >= ($module_interval*2)){ if ($seconds >= ($module['current_interval'] * 2)) {
$grupo[$array_index]["down"]++; $group_info["down"]++;
} }
} elseif ($datos != 0) { } elseif ($module['datos'] != 0) {
$grupo[$array_index]["ok"]++; $group_info["ok"]++;
} else { } else {
$grupo[$array_index]["bad"]++; $group_info["bad"]++;
}
} }
} }
if ($config["show_lastalerts"] == 1){ if ($config["show_lastalerts"] == 1) {
// How many alerts has been fired recently for this group: // How many alerts has been fired recently for this group:
// SQL Join to get alert status for agents belong this group // SQL Join to get alert status for agents belong this group
$sql1 = "SELECT SUM(talerta_agente_modulo.times_fired) $sql = sprintf ("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"; FROM tagente_modulo, talerta_agente_modulo, tagente
if ($result1 = mysql_query ($sql1)){ WHERE tagente.disabled = 0
$row1 = mysql_fetch_array ($result1); AND tagente.id_grupo = %d
$grupo[$array_index]["alerts"] = $row1[0]; 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);
} }
if ($existen_agentes == 1){ array_push ($groups_info, $group_info);
$array_index++; }
}
}
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'
value='".$lang_label["create_group"]."'></form>";
} }
return;
}
// Draw data $group_size = sizeof ($groups_info);
if ($contador_agente != 0) { $ancho = ceil (sqrt ($group_size + 1));
$ancho = ceil(sqrt($array_index+1)); $real_count = 0;
$real_count =0;
echo "<table cellpadding=10 cellspacing=10 border=0>"; echo "<table cellpadding=10 cellspacing=10 border=0>";
for ($table=0; $table < $ancho; $table++) { for ($table = 0; $table < $ancho; $table++) {
if ($real_count >= $group_size) {
continue;
}
echo "<tr class='bot'>"; echo "<tr class='bot'>";
for ($table_row=0; $table_row < $ancho; $table_row++) {
if ($real_count < $array_index) { //foreach ($groups_info as $group) {
$group_name = $grupo[$real_count]["group"]; for ($table_row = 0; $table_row < $ancho; $table_row++) {
$icono_grupo = $grupo[$real_count]["icon"]; if ($real_count >= $group_size) {
continue;
}
$group_info = $groups_info[$real_count];
$group_name = $group_info["name"];
$icono_grupo = $group_info["icon"];
$icono_type = ""; $icono_type = "";
if ($grupo[$real_count]["bad"] > 0) { if ($group_info["bad"] > 0) {
$icono_type = $icono_type." $icono_type .= '<img src="images/dot_red.png"
<img src='images/dot_red.png' alt=''>"; title="'.lang_string ('modules_bad').'">';
} }
if ($grupo[$real_count]["ok"] > 0) {
$icono_type = $icono_type." if ($group_info["ok"] > 0) {
<img src='images/dot_green.png' alt=''>"; $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 // Show yellow light if there are recent alerts fired for this group
if ($grupo[$real_count]["alerts"] > 0 ){ if ($group_info["alerts"] > 0 ) {
$icono_type=$icono_type." $icono_type .= '<img src="images/dot_yellow.png"
<img src='images/dot_yellow.png' alt=''>"; title="'.lang_string ('alerts_fired').'">';
} }
// Show grey light if there are agent down for this group // Show grey light if there are agent down for this group
if ($grupo[$real_count]["down"] > 0 ){ if ($group_info["down"] > 0 ) {
$icono_type=$icono_type." $icono_type .= '<img src="images/dot_white.png"
<img src='images/dot_white.png' alt=''>"; title="'.lang_string ('agents_down').'">';
} }
// Show red flag is group has disabled alert system // Show red flag is group has disabled alert system
if (give_disabled_group($grupo[$real_count]["id_grupo"]) == 1) if (give_disabled_group ($group_info["id_group"])) {
$icono_type = $icono_type."&nbsp; $icono_type .= '<img src="images/flag_red.png"
<img src='images/flag_red.png' alt='".$lang_label["disabled"]."'>"; title="'.lang_string ('disabled_alerts').'">';
}
// By default green border // By default green border
$celda = "<td class='top' style='border: 5px solid #aeff21;' width='100'>"; $celda = "<td class='top' style='border: 5px solid #aeff21;' width='100'>";
// Grey border if agent down // Grey border if agent down
if ($config["show_unknown"] > 0){ if ($config["show_unknown"] > 0) {
if ($grupo[$real_count]["down"] > 0) if ($group_info["down"] > 0)
$celda = "<td class='top' style='border: 5px solid #aabbaa;' width='100'>"; $celda = "<td class='top' style='border: 5px solid #aabbaa;' width='100'>";
} }
// Yellow border if agents with alerts // Yellow border if agents with alerts
if ($grupo[$real_count]["alerts"] > 0) if ($group_info["alerts"] > 0)
$celda = "<td class='top' style='border: 5px solid #ffea00;' width='100'>"; $celda = "<td class='top' style='border: 5px solid #ffea00;' width='100'>";
// Red border if agents bad // Red border if agents bad
if ($grupo[$real_count]["bad"] > 0) if ($group_info["bad"] > 0)
$celda = "<td class='top' style='border: 5px solid #ff0000;' width='100'>"; $celda = "<td class='top' style='border: 5px solid #ff0000;' width='100'>";
// Orange if alerts and down modules // Orange if alerts and down modules
if (($grupo[$real_count]["bad"] > 0) && ($grupo[$real_count]["alerts"] > 0)) if (($group_info["bad"] > 0) && ($group_info["alerts"] > 0))
$celda = "<td class='top' style='border: 5px solid #ffbb00;' width='100'>"; $celda = "<td class='top' style='border: 5px solid #ffbb00;' width='100'>";
$celda .= "<a href='index.php?sec=estado&amp; $celda .= "<a href='index.php?sec=estado&amp;
sec2=operation/agentes/estado_agente&amp; sec2=operation/agentes/estado_agente&amp;
refr=60&amp; refr=60&amp;
group_id=".$grupo[$real_count]["id_grupo"]."' group_id=".$group_info["id_group"]."'
class='info'>"; class='info'>";
// Add group icon // Add group icon
@ -203,20 +208,20 @@
<tr><th colspan='2' width='91'>". <tr><th colspan='2' width='91'>".
$lang_label["agents"].": </th></tr> $lang_label["agents"].": </th></tr>
<tr><td colspan='2' class='datos' align='center'><b>". <tr><td colspan='2' class='datos' align='center'><b>".
$grupo[$real_count]["agent"]."</b></td></tr> $group_info["agent"]."</b></td></tr>
</table> </table>
<table cellspacing='2' cellpadding='0' <table cellspacing='2' cellpadding='0'
style='margin-left:2px'> style='margin-left:2px'>
<tr> <tr>
<th colspan='2' width='90'>". <th colspan='2' width='90'>".
ucfirst($lang_label["monitors"]).":</th> ucfirst ($lang_label["monitors"]).":</th>
</tr> </tr>
<tr> <tr>
<td class='datos'> <td class='datos'>
<img src='images/b_green.png' align='top' alt='' > <img src='images/b_green.png' align='top' alt='' >
".$lang_label["ok"].": </td> ".$lang_label["ok"].": </td>
<td class='datos'> <td class='datos'>
<font class='greenb'>".$grupo[$real_count]["ok"]."</font> <font class='greenb'>".$group_info["ok"]."</font>
</td> </td>
</tr> </tr>
<tr> <tr>
@ -224,7 +229,7 @@
<img src='images/b_red.png' align='top' alt=''> <img src='images/b_red.png' align='top' alt=''>
".$lang_label["fail"].": </td> ".$lang_label["fail"].": </td>
<td class='datos'><font class='redb'>". <td class='datos'><font class='redb'>".
$grupo[$real_count]["bad"]."</font></td> $group_info["bad"]."</font></td>
</tr>"; </tr>";
if ($config["show_unknown"] > 0){ if ($config["show_unknown"] > 0){
$celda .= " $celda .= "
@ -233,7 +238,7 @@
<img src='images/b_white.png' align='top' alt=''> <img src='images/b_white.png' align='top' alt=''>
".$lang_label["down"].": </td> ".$lang_label["down"].": </td>
<td class='datos'><font class='redb'>". <td class='datos'><font class='redb'>".
$grupo[$real_count]["down"]."</font></td></tr>"; $group_info["down"]."</font></td></tr>";
} }
if ($config["show_lastalerts"] == 1) if ($config["show_lastalerts"] == 1)
$celda .= "<tr> $celda .= "<tr>
@ -241,35 +246,27 @@
<img src='images/b_yellow.png' align='top' alt=''> <img src='images/b_yellow.png' align='top' alt=''>
".$lang_label["alerts"].": </td> ".$lang_label["alerts"].": </td>
<td class='datos'><font class='grey'>". <td class='datos'><font class='grey'>".
$grupo[$real_count]["alerts"]."</font></td> $group_info["alerts"]."</font></td>
</tr>"; </tr>";
$celda .= "</table></span></a>"; $celda .= "</table></span></a>";
// Render network exec module button, only when this group is writtable by user // 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) { if (give_acl ($id_user, $group_info["id_group"], "AW") == 1) {
$celda .= "&nbsp;<a href='index.php? $celda .= "&nbsp;<a href='index.php?
sec=estado& sec=estado&
sec2=operation/agentes/estado_grupo& sec2=operation/agentes/estado_grupo&
update_netgroup=".$grupo[$real_count]["id_grupo"]."'> update_netgroup=".$group_info["id_group"]."'>
<img src='images/target.png'></a>"; <img src='images/target.png'></a>";
} }
$celda .= "<br><br>". $celda .= "<br><br>".
$icono_type."<br><br> $icono_type."<br><br>
<span class='gr'>".$group_name."</span>"; <span class='gr'>".$group_name."</span>";
echo $celda; echo $celda;
}
$real_count++; $real_count++;
} }
echo "</tr>"; echo "</tr>";
} }
echo "</table>"; echo "</table>";
} else {
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'
value='".$lang_label["create_group"]."'></form>";
}
}
?> ?>

View File

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