2009-10-21 Miguel de Dios <miguel.dedios@artica.es>
* include/functions_ui.php: add param "style" in the function "print_agent_name" for set the css style in the agent name return html string. Add in the "format_alert_row" the features: show icon policy from enterprise and css grey disabled alert. *include/functions_agents.php: add in the function "get_agent_alerts_simple" and the function "get_agent_alerts_compound" the search "filter" param posibility "all_enabled". * operation/agentes/alerts_status, godmode/alerts/alert_list.php: add the show rows of disabled alert, and add the select the "all (enabled)" (by default show only alerts enabled). And add the icon of policy in the enterprise version. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@2048 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
parent
cf2542f0f5
commit
89cbfc5e76
|
@ -1,3 +1,18 @@
|
|||
2009-10-21 Miguel de Dios <miguel.dedios@artica.es>
|
||||
|
||||
* include/functions_ui.php: add param "style" in the function
|
||||
"print_agent_name" for set the css style in the agent name return html
|
||||
string.
|
||||
Add in the "format_alert_row" the features: show icon policy from
|
||||
enterprise and css grey disabled alert.
|
||||
*include/functions_agents.php: add in the function "get_agent_alerts_simple"
|
||||
and the function "get_agent_alerts_compound" the search "filter" param
|
||||
posibility "all_enabled".
|
||||
* operation/agentes/alerts_status, godmode/alerts/alert_list.php: add the
|
||||
show rows of disabled alert, and add the select the "all (enabled)" (by
|
||||
default show only alerts enabled). And add the icon of policy in the
|
||||
enterprise version.
|
||||
|
||||
2009-10-21 Miguel de Dios <miguel.dedios@artica.es>
|
||||
|
||||
* include/functions_events.php: tiny fix, the icon for event not validate
|
||||
|
|
|
@ -313,7 +313,7 @@ $table->class = 'alert_list';
|
|||
$table->width = '90%';
|
||||
$table->size = array ();
|
||||
$table->head = array ();
|
||||
$table->head[0] = '';
|
||||
$table->head[0] = "<span title='" . __('Enabled / Disabled') . "'>" . __('E/D') . "</span>";
|
||||
if (! $id_agente) {
|
||||
$table->style = array ();
|
||||
$table->style[1] = 'font-weight: bold';
|
||||
|
@ -343,12 +343,18 @@ if ($isFunctionPolicies !== ENTERPRISE_NOT_HOOK) {
|
|||
}
|
||||
$table->head[5] = __('Actions');
|
||||
$table->head[6] = '';
|
||||
|
||||
$table->data = array ();
|
||||
|
||||
$rowPair = true;
|
||||
$iterator = 0;
|
||||
|
||||
foreach ($simple_alerts as $alert) {
|
||||
if ($alert['disabled']) {
|
||||
$table->rowstyle[$iterator] = 'font-style: italic; color: #aaaaaa;';
|
||||
$table->style[$iterator][1] = 'font-style: italic; color: #aaaaaa;';
|
||||
}
|
||||
|
||||
if ($rowPair)
|
||||
$table->rowclass[$iterator] = 'rowPair';
|
||||
else
|
||||
|
@ -373,8 +379,13 @@ foreach ($simple_alerts as $alert) {
|
|||
if (! $id_agente) {
|
||||
$id_agent = get_agentmodule_agent ($alert['id_agent_module']);
|
||||
$data[1] = '<a href="index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&tab=main&id_agente='.$id_agent.'">';
|
||||
if ($alert['disabled'])
|
||||
$data[1] .= '<span style="font-style: italic; color: #aaaaaa;">';
|
||||
$data[1] .= get_agent_name ($id_agent);
|
||||
if ($alert['disabled'])
|
||||
$data[1] .= '</span>';
|
||||
$data[1] .= '</a>';
|
||||
|
||||
}
|
||||
$data[2] = get_agentmodule_name ($alert['id_agent_module']);
|
||||
$data[3] = ' <a class="template_details"
|
||||
|
@ -385,11 +396,11 @@ foreach ($simple_alerts as $alert) {
|
|||
if ($isFunctionPolicies !== ENTERPRISE_NOT_HOOK) {
|
||||
$policyInfo = isAlertInPolicy($alert['id_agent_module'], $alert['id_alert_template'], false);
|
||||
if ($policyInfo === false)
|
||||
$data[1] = '';
|
||||
$data[4] = '';
|
||||
else {
|
||||
$img = 'images/policies.png';
|
||||
|
||||
$data[1] = '<a href="?sec=gpolicies&sec2=enterprise/godmode/policies/policies&id=' . $policyInfo['id_policy'] . '">' .
|
||||
$data[4] = '<a href="?sec=gpolicies&sec2=enterprise/godmode/policies/policies&id=' . $policyInfo['id_policy'] . '">' .
|
||||
print_image($img,true, array('title' => $policyInfo['name_policy'])) .
|
||||
'</a>';
|
||||
}
|
||||
|
@ -399,7 +410,10 @@ foreach ($simple_alerts as $alert) {
|
|||
$data[5] = '<ul class="action_list">';
|
||||
foreach ($actions as $action_id => $action) {
|
||||
$data[5] .= '<li><div>';
|
||||
$data[5] .= '<span class="action_name">';
|
||||
if ($alert['disabled'])
|
||||
$data[5] .= '<span class="action_name" style="font-style: italic; color: #aaaaaa;">';
|
||||
else
|
||||
$data[5] .= '<span class="action_name">';
|
||||
$data[5] .= $action['name'];
|
||||
$data[5] .= ' <em>(';
|
||||
if ($action['fires_min'] == $action['fires_max']) {
|
||||
|
@ -431,7 +445,10 @@ foreach ($simple_alerts as $alert) {
|
|||
|
||||
$data[5] .= '<a class="add_action" id="add-action-'.$alert['id'].'" href="#">';
|
||||
$data[5] .= print_image ('images/add.png', true);
|
||||
$data[5] .= ' '.__('Add action');
|
||||
if ($alert['disabled'])
|
||||
$data[5] .= ' '. '<span style="font-style: italic; color: #aaaaaa;">' .__('Add action') . '</span>';
|
||||
else
|
||||
$data[5] .= ' ' . __('Add action');
|
||||
$data[5] .= '</a>';
|
||||
|
||||
$data[6] = '<form class="delete_alert_form" method="post" style="display: inline;">';
|
||||
|
|
|
@ -117,6 +117,9 @@ function get_agent_alerts_simple ($id_agent = false, $filter = '', $options = fa
|
|||
case "disabled":
|
||||
$filter = ' AND disabled = 1';
|
||||
break;
|
||||
case 'all_enabled':
|
||||
$filter = ' AND disabled = 0';
|
||||
break;
|
||||
default:
|
||||
$filter = '';
|
||||
}
|
||||
|
@ -171,6 +174,9 @@ function get_agent_alerts_compound ($id_agent = false, $filter = '', $options =
|
|||
case "disabled":
|
||||
$filter = ' AND disabled = 1';
|
||||
break;
|
||||
case 'all_enabled':
|
||||
$filter = ' AND disabled = 0';
|
||||
break;
|
||||
default:
|
||||
$filter = '';
|
||||
}
|
||||
|
|
|
@ -251,12 +251,13 @@ function print_os_icon ($id_os, $name = true, $return = false) {
|
|||
* @param int Agent id
|
||||
* @param bool Whether to return the string or echo it too
|
||||
* @param int Now uses styles to accomplish this
|
||||
* @param string Style of name in css.
|
||||
*
|
||||
* @return string HTML with agent name and link
|
||||
*/
|
||||
function print_agent_name ($id_agent, $return = false, $cutoff = 0) {
|
||||
function print_agent_name ($id_agent, $return = false, $cutoff = 0, $style = '') {
|
||||
$agent_name = (string) get_agent_name ($id_agent);
|
||||
$output = '<a href="index.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente='.$id_agent.'" title="'.$agent_name.'"><b>'.$agent_name.'</b></a>';
|
||||
$output = '<a style="' . $style . '" href="index.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente='.$id_agent.'" title="'.$agent_name.'"><b>'.$agent_name.'</b></a>';
|
||||
|
||||
//TODO: Add a pretty javascript (using jQuery) popup-box with agent details
|
||||
|
||||
|
@ -278,48 +279,97 @@ function print_agent_name ($id_agent, $return = false, $cutoff = 0) {
|
|||
*/
|
||||
function format_alert_row ($alert, $compound = false, $agent = true, $url = '') {
|
||||
require_once ("include/functions_alerts.php");
|
||||
$isFunctionPolicies = enterprise_include_once ('include/functions_policies.php');
|
||||
|
||||
if ($isFunctionPolicies !== ENTERPRISE_NOT_HOOK)
|
||||
$index = array('policy' => 0, 'force_execution' => 1, 'agent_name' => 2, 'module_name' => 2,
|
||||
'description' => 3, 'template' => 3, 'last_fired' => 4, 'status' => 5,
|
||||
'validate' => 6);
|
||||
else
|
||||
$index = array('force_execution' => 0, 'agent_name' => 1, 'module_name' => 1,
|
||||
'description' => 2, 'template' => 2, 'last_fired' => 3, 'status' => 4,
|
||||
'validate' => 5);
|
||||
|
||||
if ($alert['disabled']) {
|
||||
$disabledHtmlStart = '<span style="font-style: italic; color: #aaaaaa;">';
|
||||
$disabledHtmlEnd = '</span>';
|
||||
$styleDisabled = "font-style: italic; color: #aaaaaa;";
|
||||
}
|
||||
else {
|
||||
$disabledHtmlStart = '';
|
||||
$disabledHtmlEnd = '';
|
||||
$styleDisabled = "";
|
||||
}
|
||||
|
||||
if (empty ($alert))
|
||||
return array ("", "", "", "", "", "", "");
|
||||
{
|
||||
if ($isFunctionPolicies !== ENTERPRISE_NOT_HOOK)
|
||||
return array ("", "", "", "", "", "", "", "");
|
||||
else
|
||||
return array ("", "", "", "", "", "", "");
|
||||
}
|
||||
|
||||
// Get agent id
|
||||
if ($compound) {
|
||||
$id_agent = $alert['id_agent'];
|
||||
$description = $alert['description'];
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
$id_agent = get_agentmodule_agent ($alert['id_agent_module']);
|
||||
$template = get_alert_template ($alert['id_alert_template']);
|
||||
$description = $template['name'];
|
||||
}
|
||||
$data = array ();
|
||||
|
||||
if (($isFunctionPolicies !== ENTERPRISE_NOT_HOOK) && (!$compound)) {
|
||||
$policyInfo = isAlertInPolicy($alert['id_agent_module'], $alert['id_alert_template'], false);
|
||||
if ($policyInfo === false)
|
||||
$data[$index['policy']] = '';
|
||||
else {
|
||||
$img = 'images/policies.png';
|
||||
|
||||
$data[$index['policy']] = '<a href="?sec=gpolicies&sec2=enterprise/godmode/policies/policies&id=' . $policyInfo['id_policy'] . '">' .
|
||||
print_image($img,true, array('title' => $policyInfo['name_policy'])) .
|
||||
'</a>';
|
||||
}
|
||||
}
|
||||
else if (($isFunctionPolicies !== ENTERPRISE_NOT_HOOK) && ($compound))
|
||||
$data[$index['policy']] = '';
|
||||
|
||||
// Force alert execution
|
||||
$data[0] = '';
|
||||
$data[$index['force_execution']] = '';
|
||||
if (! $compound) {
|
||||
if ($alert["force_execution"] == 0) {
|
||||
$data[0] = '<a href="'.$url.'&id_alert='.$alert["id"].'&force_execution=1&refr=60"><img src="images/target.png" ></a>';
|
||||
} else {
|
||||
$data[0] = '<a href="'.$url.'&id_alert='.$alert["id"].'&refr=60"><img src="images/refresh.png" /></a>';
|
||||
$data[$index['force_execution']] =
|
||||
'<a href="'.$url.'&id_alert='.$alert["id"].'&force_execution=1&refr=60"><img src="images/target.png" ></a>';
|
||||
}
|
||||
else {
|
||||
$data[$index['force_execution']] =
|
||||
'<a href="'.$url.'&id_alert='.$alert["id"].'&refr=60"><img src="images/refresh.png" /></a>';
|
||||
}
|
||||
}
|
||||
|
||||
$data[$index['agent_name']] = $disabledHtmlStart;
|
||||
if ($compound) {
|
||||
$data[1] = print_agent_name ($id_agent, true, 20);
|
||||
} elseif ($agent == 0) {
|
||||
$data[1] = mb_substr (get_agentmodule_name ($alert["id_agent_module"]), 0, 20);
|
||||
} else {
|
||||
$data[1] = print_agent_name (get_agentmodule_agent ($alert["id_agent_module"]), true, 20);
|
||||
$data[$index['agent_name']] .= print_agent_name ($id_agent, true, 20, $styleDisabled);
|
||||
}
|
||||
elseif ($agent == 0) {
|
||||
$data[$index['module_name']] .= mb_substr (get_agentmodule_name ($alert["id_agent_module"]), 0, 20);
|
||||
}
|
||||
else {
|
||||
$data[$index['agent_name']] .= print_agent_name (get_agentmodule_agent ($alert["id_agent_module"]), true, 20, $styleDisabled);
|
||||
}
|
||||
$data[$index['agent_name']] .= $disabledHtmlEnd;
|
||||
|
||||
$data[2] = '';
|
||||
$data[$index['description']] = '';
|
||||
if (! $compound) {
|
||||
$data[2] .= '<a class="template_details" href="ajax.php?page=godmode/alerts/alert_templates&get_template_tooltip=1&id_template='.$template['id'].'">';
|
||||
$data[2] .= print_image ('images/zoom.png', true);
|
||||
$data[2] .= '</a> ';
|
||||
$data[$index['template']] .= '<a class="template_details" href="ajax.php?page=godmode/alerts/alert_templates&get_template_tooltip=1&id_template='.$template['id'].'">';
|
||||
$data[$index['template']] .= print_image ('images/zoom.png', true);
|
||||
$data[$index['template']] .= '</a> ';
|
||||
}
|
||||
$data[2] .= mb_substr (safe_input ($description), 0, 35);
|
||||
$data[$index['description']] .= $disabledHtmlStart . mb_substr (safe_input ($description), 0, 35) . $disabledHtmlEnd;
|
||||
|
||||
$data[3] = print_timestamp ($alert["last_fired"], true);
|
||||
$data[$index['last_fired']] = $disabledHtmlStart . print_timestamp ($alert["last_fired"], true) . $disabledHtmlEnd;
|
||||
|
||||
|
||||
$status = STATUS_ALERT_NOT_FIRED;
|
||||
|
@ -336,13 +386,14 @@ function format_alert_row ($alert, $compound = false, $agent = true, $url = '')
|
|||
$title = __('Alert not fired');
|
||||
}
|
||||
|
||||
$data[4] = print_status_image($status, $title, true);
|
||||
$data[$index['status']] = print_status_image($status, $title, true);
|
||||
|
||||
|
||||
if ($compound) {
|
||||
$data[5] = print_checkbox ("validate_compound[]", $alert["id"], false, true);
|
||||
} else {
|
||||
$data[5] = print_checkbox ("validate[]", $alert["id"], false, true);
|
||||
$data[$index['validate']] = print_checkbox ("validate_compound[]", $alert["id"], false, true);
|
||||
}
|
||||
else {
|
||||
$data[$index['validate']] = print_checkbox ("validate[]", $alert["id"], false, true);
|
||||
}
|
||||
|
||||
return $data;
|
||||
|
|
|
@ -17,8 +17,9 @@
|
|||
check_login ();
|
||||
|
||||
require_once ("include/functions_agents.php");
|
||||
$isFunctionPolicies = enterprise_include_once ('include/functions_policies.php');
|
||||
|
||||
$filter = get_parameter ("filter", "all");
|
||||
$filter = get_parameter ("filter", "undefined");
|
||||
$offset = (int) get_parameter_get ("offset", 0);
|
||||
$id_group = (int) get_parameter ("ag_group", 1); //1 is the All group (selects all groups)
|
||||
|
||||
|
@ -73,7 +74,14 @@ if (isset ($_GET["id_agente"])) {
|
|||
$alerts_combined = get_agent_alerts_compound ($id_agent, $filter);
|
||||
$print_agent = false;
|
||||
$inside_main = 1;
|
||||
} else {
|
||||
|
||||
if ($filter == "undefined")
|
||||
$filter = "all";
|
||||
}
|
||||
else {
|
||||
if ($filter == "undefined")
|
||||
$filter = "all_enabled";
|
||||
|
||||
if (!give_acl ($config["id_user"], 0, "AR")) {
|
||||
audit_db ($config["id_user"], $config["remote_addr"], "ACL Violation","Trying to access alert view");
|
||||
require ("general/noaccess.php");
|
||||
|
@ -128,6 +136,7 @@ if ($print_agent) {
|
|||
'javascript:this.form.submit();', '', '', true);
|
||||
|
||||
$alert_status_filter = array();
|
||||
$alert_status_filter['all_enabled'] = __('All (Enabled)');
|
||||
$alert_status_filter['all'] = __('All');
|
||||
$alert_status_filter['fired'] = __('Fired');
|
||||
$alert_status_filter['notfired'] = __('Not fired');
|
||||
|
@ -141,30 +150,69 @@ echo '</form>';
|
|||
|
||||
$table->width = '90%';
|
||||
$table->class = "databox";
|
||||
|
||||
$table->size = array ();
|
||||
$table->size[0] = '20px';
|
||||
$table->size[1] = '25%';
|
||||
$table->size[2] = '50%';
|
||||
$table->size[3] = '25%';
|
||||
$table->size[4] = '20px';
|
||||
$table->size[5] = '60px';
|
||||
if ($isFunctionPolicies !== ENTERPRISE_NOT_HOOK) {
|
||||
$table->size[0] = '20px';
|
||||
$table->size[1] = '20px';
|
||||
$table->size[2] = '25%';
|
||||
$table->size[3] = '50%';
|
||||
$table->size[4] = '25%';
|
||||
$table->size[5] = '20px';
|
||||
$table->size[6] = '60px';
|
||||
}
|
||||
else
|
||||
{
|
||||
$table->size[0] = '20px';
|
||||
$table->size[1] = '25%';
|
||||
$table->size[2] = '50%';
|
||||
$table->size[3] = '25%';
|
||||
$table->size[4] = '20px';
|
||||
$table->size[5] = '60px';
|
||||
}
|
||||
|
||||
$table->head = array ();
|
||||
$table->head[0] = '';
|
||||
$table->head[1] = ''; //Placeholder for name
|
||||
$table->head[2] = __('Template');
|
||||
$table->head[3] = __('Last fired');
|
||||
$table->head[4] = __('Status');
|
||||
$table->head[5] = __('Validate');
|
||||
if ($isFunctionPolicies !== ENTERPRISE_NOT_HOOK) {
|
||||
$table->head[0] = "<span title='" . __('Policy') . "'>" . __('P.') . "</span>";
|
||||
$table->head[1] = "<span title='" . __('Force execution') . "'>" . __('F.') . "</span>";
|
||||
$table->head[2] = ''; //Placeholder for name
|
||||
$table->head[3] = __('Template');
|
||||
$table->head[4] = __('Last fired');
|
||||
$table->head[5] = __('Status');
|
||||
$table->head[6] = __('Validate');
|
||||
}
|
||||
else
|
||||
{
|
||||
$table->head[0] = "<span title='" . __('Force execution') . "'>" . __('F.') . "</span>";
|
||||
$table->head[1] = ''; //Placeholder for name
|
||||
$table->head[2] = __('Template');
|
||||
$table->head[3] = __('Last fired');
|
||||
$table->head[4] = __('Status');
|
||||
$table->head[5] = __('Validate');
|
||||
}
|
||||
$table->title = __('Single alerts');
|
||||
|
||||
if ($print_agent == 0) {
|
||||
$table->head[1] = __('Module');
|
||||
} else {
|
||||
$table->head[1] = __('Agent');
|
||||
if ($isFunctionPolicies !== ENTERPRISE_NOT_HOOK)
|
||||
$table->head[2] = __('Module');
|
||||
else
|
||||
$table->head[1] = __('Module');
|
||||
}
|
||||
else {
|
||||
if ($isFunctionPolicies !== ENTERPRISE_NOT_HOOK)
|
||||
$table->head[2] = __('Agent');
|
||||
else
|
||||
$table->head[1] = __('Agent');
|
||||
}
|
||||
$table->align = array ();
|
||||
$table->align[4] = 'center';
|
||||
$table->align[5] = 'center';
|
||||
if ($isFunctionPolicies !== ENTERPRISE_NOT_HOOK) {
|
||||
$table->align[5] = 'center';
|
||||
$table->align[6] = 'center';
|
||||
}
|
||||
else {
|
||||
$table->align[4] = 'center';
|
||||
$table->align[5] = 'center';
|
||||
}
|
||||
$table->data = array ();
|
||||
|
||||
$total = 0;
|
||||
|
@ -198,8 +246,18 @@ if (!empty ($table->data)) {
|
|||
}
|
||||
|
||||
$table->title = __('Compound alerts');
|
||||
$table->head[1] = __('Agent');
|
||||
$table->head[2] = __('Description');
|
||||
if ($isFunctionPolicies !== ENTERPRISE_NOT_HOOK) {
|
||||
$table->head[0] = '';
|
||||
$table->head[1] = '';
|
||||
$table->head[2] = __('Agent');
|
||||
$table->head[3] = __('Description');
|
||||
}
|
||||
else
|
||||
{
|
||||
$table->head[0] = '';
|
||||
$table->head[1] = __('Agent');
|
||||
$table->head[2] = __('Description');
|
||||
}
|
||||
$table->data = array ();
|
||||
|
||||
$combined_total = 0;
|
||||
|
|
Loading…
Reference in New Issue