2009-05-02 Sancho Lerena <slerena@artica.es>
* extensions/dbmanager.php: Fixed problems with quotes. * operation/agentes/status_monitor.php: Used module_interval insted deprecated tagente_estado.current_interval. * operation/agentes/estado_grupo.php: Same as above. * operation/agentes/estado_monitores.php: same as above. * godmode/agentes/module_manager.php: Uses new server_type field instead old server fields. * godmode/agentes/configurar_agente.php: Added tab in godmode/edit agent to go to a filtered list view per groups from the agent edit view. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@1671 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
parent
be912e000e
commit
fa1440731f
|
@ -1,3 +1,20 @@
|
|||
2009-05-02 Sancho Lerena <slerena@artica.es>
|
||||
|
||||
* extensions/dbmanager.php: Fixed problems with quotes.
|
||||
|
||||
* operation/agentes/status_monitor.php: Used module_interval insted deprecated
|
||||
tagente_estado.current_interval.
|
||||
|
||||
* operation/agentes/estado_grupo.php: Same as above.
|
||||
|
||||
* operation/agentes/estado_monitores.php: same as above.
|
||||
|
||||
* godmode/agentes/module_manager.php: Uses new server_type field instead old
|
||||
server fields.
|
||||
|
||||
* godmode/agentes/configurar_agente.php: Added tab in godmode/edit agent
|
||||
to go to a filtered list view per groups from the agent edit view.
|
||||
|
||||
2009-05-01 Sancho Lerena <slerena@artica.es>
|
||||
|
||||
* extensions/dbmanager*: New extensions to interface with Pandora database
|
||||
|
|
|
@ -16,7 +16,61 @@
|
|||
// along with this program; if not, write to the Free Software
|
||||
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
|
||||
/* You can safely delete this file */
|
||||
|
||||
function string_decompose ($mystring){
|
||||
|
||||
$output = "";
|
||||
for ($a=0; $a < strlen($mystring); $a++){
|
||||
$output .= substr($mystring, $a, 1)."|";
|
||||
// $output .= ord(substr($mystring, $a, 1)).":".substr($mystring, $a, 1)."|";
|
||||
// $output .= ord(substr($mystring, $a, 1))."|";
|
||||
}
|
||||
return $output;
|
||||
}
|
||||
|
||||
function dbmanager_query ($sql, $rettype = "affected_rows") {
|
||||
global $config;
|
||||
|
||||
$retval = array();
|
||||
|
||||
if ($sql == '')
|
||||
return false;
|
||||
|
||||
// This following two lines are for real clean the string coming from the PHP
|
||||
// because add ' for single quote and " for the double, you cannot
|
||||
// see with a simple echo and mysql reject it, so dont forget to do this.
|
||||
|
||||
$sql = unsafe_string ($sql);
|
||||
$sql = htmlspecialchars_decode ($sql, ENT_QUOTES );
|
||||
|
||||
$result = mysql_query ($sql);
|
||||
if ($result === false) {
|
||||
$backtrace = debug_backtrace ();
|
||||
$error = sprintf ('%s (\'%s\') in <strong>%s</strong> on line %d',
|
||||
mysql_error (), $sql, $backtrace[0]['file'], $backtrace[0]['line']);
|
||||
set_error_handler ('sql_error_handler');
|
||||
trigger_error ($error);
|
||||
restore_error_handler ();
|
||||
return false;
|
||||
} elseif ($result === true) {
|
||||
if ($rettype == "insert_id") {
|
||||
return mysql_insert_id ();
|
||||
} elseif ($rettype == "info") {
|
||||
return mysql_info ();
|
||||
}
|
||||
return mysql_affected_rows (); //This happens in case the statement was executed but didn't need a resource
|
||||
} else {
|
||||
while ($row = mysql_fetch_array ($result)) {
|
||||
array_push ($retval, $row);
|
||||
}
|
||||
mysql_free_result ($result);
|
||||
}
|
||||
if (! empty ($retval))
|
||||
return $retval;
|
||||
//Return false, check with === or !==
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
function dbmgr_extension_main () {
|
||||
|
||||
|
@ -34,19 +88,18 @@ function dbmgr_extension_main () {
|
|||
echo "<br><br>";
|
||||
echo "<form method='post' action=''>";
|
||||
echo "<textarea class='dbmanager' name='sqlcode'>";
|
||||
echo $sqlcode;
|
||||
echo unsafe_string ($sqlcode);
|
||||
echo "</textarea>";
|
||||
echo "<br><br>";
|
||||
print_submit_button ('SQL Exec');
|
||||
//echo "<input type='submit' class='next' value='SQL Exec'>";
|
||||
print_submit_button (__('Execute SQL'), '', false, 'class="sub next"',false);
|
||||
echo "</form>";
|
||||
|
||||
// Processing SQL Code
|
||||
if ($sqlcode != ""){
|
||||
echo "<br>";
|
||||
echo "<hr>";
|
||||
echo "<br";
|
||||
$result = process_sql ($sqlcode);
|
||||
echo "<br>";
|
||||
$result = dbmanager_query ($sqlcode);
|
||||
if (!is_array($result)){
|
||||
echo "<b>Result: <b>".$result;
|
||||
}
|
||||
|
|
|
@ -216,6 +216,11 @@ if ($id_agente) {
|
|||
|
||||
enterprise_hook ('inventory_tab');
|
||||
|
||||
echo '<li class="'.($tab == "template" ? 'nomn_high' : 'nomn').'">';
|
||||
echo '<a href="http://farscape.artica.es/pandora_console/index.php?sec=gagente&sec2=godmode/agentes/modificar_agente&ag_group='.$group.'">';
|
||||
print_image ("images/god4.png", false, $img_style);
|
||||
echo ' '.__('Group').'</a></li>';
|
||||
|
||||
echo "</ul></div></div>";
|
||||
|
||||
// Make some space between tabs and title
|
||||
|
|
|
@ -31,10 +31,11 @@ echo "<tr><td class='datos'>";
|
|||
|
||||
// Check if there is at least one server of each type available to assign that
|
||||
// kind of modules. If not, do not show server type in combo
|
||||
$network_available = get_db_value ("network_server", "tserver", "network_server", "1");
|
||||
$wmi_available = get_db_value ("wmi_server", "tserver", "wmi_server", "1");
|
||||
$plugin_available = get_db_value ("plugin_server", "tserver", "plugin_server", "1");
|
||||
$prediction_available = get_db_value ("prediction_server", "tserver", "prediction_server", "1");
|
||||
|
||||
$network_available = get_db_sql ("SELECT count(*) from tserver where server_type = 2");
|
||||
$wmi_available = get_db_sql ("SELECT count(*) from tserver where server_type = 6");
|
||||
$plugin_available = get_db_sql ("SELECT count(*) from tserver where server_type = 4");
|
||||
$prediction_available = get_db_sql ("SELECT count(*) from tserver where server_type = 5");
|
||||
|
||||
// Development mode to use all servers
|
||||
if ($develop_bypass) {
|
||||
|
|
|
@ -75,7 +75,7 @@ foreach ($groups as $id_group => $group_name) {
|
|||
'name' => $group_name);
|
||||
|
||||
// SQL Join to get monitor status for agents belong this group
|
||||
$sql = sprintf ("SELECT tagente_estado.estado, tagente_estado.current_interval,
|
||||
$sql = sprintf ("SELECT tagente_estado.estado, tagente_modulo.module_interval,
|
||||
tagente_estado.utimestamp, tagente_modulo.id_tipo_modulo
|
||||
FROM tagente, tagente_estado, tagente_modulo
|
||||
WHERE tagente.disabled = 0
|
||||
|
@ -90,7 +90,7 @@ foreach ($groups as $id_group => $group_name) {
|
|||
$modules = array ();
|
||||
foreach ($modules as $module) {
|
||||
$seconds = $now - $module['utimestamp'];
|
||||
if ($seconds >= ($module['current_interval'] * 2)) {
|
||||
if ($seconds >= ($module['module_interval'] * 2)) {
|
||||
if ($module['id_tipo_modulo'] < 21) // Avoiding ASYNC and Keepalive
|
||||
$group_info['down']++;
|
||||
} elseif ($module['estado'] == 2) {
|
||||
|
|
|
@ -107,7 +107,7 @@ foreach ($modules as $module) {
|
|||
}
|
||||
|
||||
$seconds = get_system_time () - $module["utimestamp"];
|
||||
if ($module['id_tipo_modulo'] < 21 && $module["current_interval"] > 0 && $module["utimestamp"] > 0 && $seconds >= ($module["current_interval"] * 2)) {
|
||||
if ($module['id_tipo_modulo'] < 21 && $module["module_interval"] > 0 && $module["utimestamp"] > 0 && $seconds >= ($module["module_interval"] * 2)) {
|
||||
$data[6] = '<span class="redb">';
|
||||
} else {
|
||||
$data[6] = '<span>';
|
||||
|
|
|
@ -243,7 +243,7 @@ foreach ($result as $row) {
|
|||
$seconds = get_system_time () - $row["utimestamp"];
|
||||
|
||||
|
||||
if ($seconds >= ($row["agent_interval"] * 2)) {
|
||||
if ($seconds >= ($row["module_interval"] * 2)) {
|
||||
$option = array ("html_attr" => 'class="redb"');
|
||||
} else {
|
||||
$option = array ();
|
||||
|
|
Loading…
Reference in New Issue