2012-02-01 11:57:43 +01:00
|
|
|
<?php
|
|
|
|
|
|
|
|
// Pandora FMS - http://pandorafms.com
|
|
|
|
// ==================================================
|
|
|
|
// Copyright (c) 2005-2011 Artica Soluciones Tecnologicas
|
|
|
|
// Please see http://pandorafms.org for full contribution list
|
|
|
|
|
|
|
|
// 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.
|
|
|
|
|
|
|
|
$shortcut_state = db_get_value_filter('shortcut', 'tusuario', array('id_user' => $config['id_user']));
|
|
|
|
|
|
|
|
// If shortcut bar is disabled return to index.php
|
|
|
|
if ($shortcut_state == 0)
|
|
|
|
return;
|
|
|
|
|
|
|
|
if (is_ajax()) {
|
|
|
|
require_once("include/functions_events.php");
|
|
|
|
|
|
|
|
|
|
|
|
$update_shortcut_state = get_parameter('update_shortcut_state', 0);
|
|
|
|
$get_critical_events = get_parameter('get_critical_events', 0);
|
|
|
|
$get_opened_incidents = get_parameter('get_opened_incidents', 0);
|
|
|
|
|
|
|
|
// Update if shortcut is visible or hidden
|
|
|
|
if ($update_shortcut_state){
|
|
|
|
$value = get_parameter('value', 0);
|
|
|
|
db_process_sql_update('tusuario', array('shortcut' => $value), array('id_user' => $config['id_user']));
|
|
|
|
}
|
|
|
|
|
|
|
|
// Get critical events (realtime update)
|
|
|
|
if ($get_critical_events){
|
|
|
|
$own_info = get_user_info ($config['id_user']);
|
|
|
|
|
|
|
|
if ($own_info['is_admin'] || check_acl ($config['id_user'], 0, "PM"))
|
2012-02-08 14:04:18 +01:00
|
|
|
$own_groups = array_keys(users_get_groups($config['id_user'], "IR"));
|
2012-02-01 11:57:43 +01:00
|
|
|
else
|
2012-02-08 14:04:18 +01:00
|
|
|
$own_groups = array_keys(users_get_groups($config['id_user'], "IR", false));
|
2012-02-01 11:57:43 +01:00
|
|
|
|
|
|
|
// Get events in the last 8 hours
|
|
|
|
$shortcut_events_update = events_get_group_events($own_groups, 28800, time());
|
|
|
|
if ($shortcut_events_update == false)
|
|
|
|
$shortcut_events_update = array();
|
2012-02-01 13:27:33 +01:00
|
|
|
|
2012-02-01 11:57:43 +01:00
|
|
|
$critical_events_update = 0;
|
|
|
|
foreach($shortcut_events_update as $event_update){
|
|
|
|
if ($event_update['criticity'] == 4 and $event_update['estado'] == 0){
|
2012-02-01 13:27:33 +01:00
|
|
|
$critical_events_update++;
|
2012-02-01 11:57:43 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
echo $critical_events_update;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Select only opened incidents
|
|
|
|
if ($get_opened_incidents){
|
|
|
|
$own_info = get_user_info ($config['id_user']);
|
|
|
|
|
|
|
|
if ($own_info['is_admin'] || check_acl ($config['id_user'], 0, "PM"))
|
2012-02-08 14:04:18 +01:00
|
|
|
$own_groups = array_keys(users_get_groups($config['id_user'], "IR"));
|
2012-02-01 11:57:43 +01:00
|
|
|
else
|
2012-02-08 14:04:18 +01:00
|
|
|
$own_groups = array_keys(users_get_groups($config['id_user'], "IR", false));
|
2012-02-01 11:57:43 +01:00
|
|
|
|
|
|
|
$sql = "SELECT count(*) total_incidents FROM tincidencia WHERE
|
|
|
|
id_grupo IN (".implode (",",array_keys ($own_groups)).") AND estado IN (0)
|
|
|
|
ORDER BY actualizacion";
|
|
|
|
|
2012-02-02 15:27:23 +01:00
|
|
|
|
|
|
|
if (!empty($own_groups)){
|
|
|
|
$result_incidents_update = db_get_all_rows_sql ($sql);
|
|
|
|
}
|
|
|
|
else{
|
|
|
|
$result_incidents_update = false;
|
|
|
|
}
|
2012-02-01 11:57:43 +01:00
|
|
|
|
|
|
|
if ($result_incidents_update === false)
|
|
|
|
$shortcut_incidents = 0;
|
|
|
|
else
|
|
|
|
$shortcut_incidents = $result_incidents_update[0]['total_incidents'];
|
|
|
|
|
|
|
|
echo $shortcut_incidents;
|
|
|
|
}
|
|
|
|
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if ($shortcut_state == 2){
|
|
|
|
echo "<div id='shortcut_button' style='position: fixed; overflow: hidden; bottom: 0px; left: 0px; width: 185px; height: 40px; background-color: #FFFFFF; border: 1px solid #808080; border-top-left-radius: 10px; border-top-right-radius: 10px;'>";
|
2012-02-28 12:48:45 +01:00
|
|
|
}
|
|
|
|
else{
|
2012-02-01 11:57:43 +01:00
|
|
|
echo "<div id='shortcut_button' style='position: fixed; overflow: hidden; bottom: 0px; left: 0px; width: 185px; height: 0px; background-color: #FFFFFF; border: 1px solid #808080; border-top-left-radius: 10px; border-top-right-radius: 10px;'>";
|
|
|
|
}
|
|
|
|
html_print_image("images/pandora_textlogo.png", false, array("title" => __("Press here to activate shortcut bar")));
|
|
|
|
echo "</div>";
|
|
|
|
if ($shortcut_state == 2){
|
|
|
|
echo "<div id='shotcut_bar' style='position: fixed; overflow:hidden; bottom: 0px; left: 0px; width:100%; height: 20px; background-color:#DCDCDC; border: 1px solid #808080;'>";
|
2012-02-28 12:48:45 +01:00
|
|
|
}
|
|
|
|
else {
|
2012-02-01 11:57:43 +01:00
|
|
|
echo "<div id='shotcut_bar' style='position: fixed; overflow:hidden; bottom: 0px; left: 0px; width:100%; height: 0px; background-color:#DCDCDC; border: 1px solid #808080;'>";
|
|
|
|
}
|
|
|
|
|
|
|
|
echo " ";
|
2012-02-08 14:04:18 +01:00
|
|
|
$own_info = get_user_info ($config['id_user']);
|
|
|
|
|
|
|
|
// If user is admin can see all groups
|
|
|
|
if ($own_info['is_admin'] || check_acl ($config['id_user'], 0, "PM")){
|
|
|
|
echo "<a href='index.php?sec=estado&sec2=operation/agentes/alerts_status&refr=120&filter=fired&free_search=&filter_button=Filter'>";
|
|
|
|
}
|
|
|
|
else{
|
|
|
|
$own_groups = array_keys(users_get_groups($config['id_user'], "AR", false));
|
|
|
|
if (!empty($own_groups)){
|
|
|
|
$alerts_group = array_shift($own_groups);
|
|
|
|
echo "<a href='index.php?sec=estado&sec2=operation/agentes/alerts_status&refr=120&filter=fired&free_search=&ag_group=$alerts_group&filter_button=Filter'>";
|
|
|
|
}
|
|
|
|
}
|
2012-02-02 13:00:30 +01:00
|
|
|
html_print_image("images/bell.png", false, array("title" => __("Alerts fired"), "style" => "margin-bottom: -5px;"));
|
2012-02-01 11:57:43 +01:00
|
|
|
echo " ";
|
|
|
|
|
|
|
|
// Calculate alerts fired
|
|
|
|
$data_reporting = reporting_get_group_stats();
|
|
|
|
|
|
|
|
echo "<span id='shortcut_alerts_fired' style='font-size: 9pt; color:#696969; font-weight: bold;' title='" . __('Alerts fired') . "'>" . $data_reporting['monitor_alerts_fired'] . "</span>";
|
2012-02-08 14:04:18 +01:00
|
|
|
if (!empty($own_groups)){
|
|
|
|
echo "</a>";
|
|
|
|
}
|
2012-02-01 11:57:43 +01:00
|
|
|
echo " ";
|
2012-02-08 14:04:18 +01:00
|
|
|
|
|
|
|
$own_info = get_user_info ($config['id_user']);
|
|
|
|
|
|
|
|
// If user is admin can see all groups
|
|
|
|
if ($own_info['is_admin'] || check_acl ($config['id_user'], 0, "PM")){
|
|
|
|
echo "<a href='index.php?sec=eventos&sec2=operation/events/events&status=3&severity=4&event_view_hr=8&ev_group=0&group_rep=1&filter_only_alert=-1'>";
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
$own_groups = array_keys(users_get_groups($config['id_user'], "IR", false));
|
|
|
|
if (!empty($own_groups)){
|
|
|
|
$events_group = array_shift($own_groups);
|
|
|
|
echo "<a href='index.php?sec=eventos&sec2=operation/events/events&status=3&severity=4&event_view_hr=8&ev_group=0&group_rep=1&ev_group=$events_group&filter_only_alert=-1'>";
|
|
|
|
}
|
|
|
|
}
|
2012-02-02 13:00:30 +01:00
|
|
|
html_print_image("images/lightning_go.png", false, array("title" => __("Critical events"), "style" => "margin-bottom: -5px;"));
|
2012-02-01 11:57:43 +01:00
|
|
|
echo " ";
|
|
|
|
|
|
|
|
// Calculate critical events (not validated)
|
|
|
|
$own_info = get_user_info ($config['id_user']);
|
|
|
|
|
|
|
|
if ($own_info['is_admin'] || check_acl ($config['id_user'], 0, "PM"))
|
2012-02-08 14:04:18 +01:00
|
|
|
$own_groups = array_keys(users_get_groups($config['id_user'], "IR"));
|
2012-02-01 11:57:43 +01:00
|
|
|
else
|
2012-02-08 14:04:18 +01:00
|
|
|
$own_groups = array_keys(users_get_groups($config['id_user'], "IR", false));
|
2012-02-01 11:57:43 +01:00
|
|
|
|
|
|
|
// Get events in the last 8 hours
|
|
|
|
$shortcut_events = events_get_group_events($own_groups, 28800, time());
|
|
|
|
if ($shortcut_events == false)
|
|
|
|
$shortcut_events = array();
|
|
|
|
|
|
|
|
$critical_events = 0;
|
|
|
|
foreach($shortcut_events as $event){
|
|
|
|
if ($event['criticity'] == 4 and $event['estado'] == 0){
|
|
|
|
$critical_events++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
echo "<span id='shortcut_critical_events' style='font-size: 9pt; color:#696969; font-weight: bold;' title='" . __('Critical events') . "'>" . $critical_events . "</span>";
|
|
|
|
echo "</a>";
|
|
|
|
echo " ";
|
|
|
|
// Calculate opened incidents (id integria incidents are not enabled)
|
|
|
|
if ($config['integria_enabled'] == 0){
|
|
|
|
echo "<a href='index.php?sec=incidencias&sec2=operation/incidents/incident&estado=0'>";
|
2012-02-02 13:00:30 +01:00
|
|
|
html_print_image("images/book_edit.png", false, array("title" => __("Incidents opened"), "style" => "margin-bottom: -5px;"));
|
2012-03-05 Miguel de Dios <miguel.dedios@artica.es>
* extensions/update_manager/main.php, general/shortcut_bar.php,
godmode/reporting/reporting_builder.item_editor.php,
godmode/reporting/reporting_builder.php,
godmode/reporting/reporting_builder.preview.php, include/functions_api.php,
include/functions_html.php, include/htmlawed.php, include/pchart_graph.php,
operation/events/events_list.php, operation/netflow/nf_live_view.php:
cleaned source code style.
* godmode/menu.php, godmode/agentes/manage_config_remote.php: removed the
enterprise feature that have been wrong for years.
* general/header.php: changed to load the jquery-ui and jquery javascript
library to last version.
* extensions/insert_data.php, extensions/snmp_explorer.php,
godmode/agentes/agent_manager.php, include/ajax/agent.php,
include/javascript/pandora.js, operation/agentes/exportdata.php,
operation/events/events.php: changed the unknow plugin autocomplete for
the autocomple from jquery-ui.
* include/functions_ui.php: cleaned source code style and into the function
"ui_process_page_head" added the blacklist hardwrote for to use old jquery.
* include/styles/jquery-ui-1.8.17.custom.css,
include/javascript/jquery-1.7.1.min.js,
include/javascript/jquery.jquery-ui-1.8.17.custom.min.js: added the last
version of Jquery and Jquery-ui.
Merge from the branch "pandora_4.0"
* godmode/reporting/visual_console_builder.constans.php,
godmode/reporting/visual_console_builder.editor.js,
godmode/reporting/visual_console_builder.editor.php,
include/functions_visual_map.php,
include/ajax/visual_console_builder.ajax.php,
include/javascript/pandora_visual_console.js: changed the unknow
plugin autocomplete for the autocomple from jquery-ui and added function to
paint a Bubble Chart (http://en.wikipedia.org/wiki/Bubble_chart) with the
name "progress_bubble".
* images/percentile_item.disabled.png, images/percentile_item.png: added
images for button of percentile item (new item in visual map).
* include/styles/pandora.css: added the style for the new button percentile
item.
* include/functions_graph.php, include/graphs/fgraph.php,
include/graphs/functions_gd.php: cleaned source code style, and added the
params to set text and color in the function "progress_bar" and added
function to paint a Bubble Chart (http://en.wikipedia.org/wiki/Bubble_chart)
with the name "progress_bubble".
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@5693 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2012-03-05 18:56:56 +01:00
|
|
|
echo " ";
|
2012-02-01 11:57:43 +01:00
|
|
|
// Select only opened incidents
|
|
|
|
$sql = "SELECT count(*) total_incidents FROM tincidencia WHERE
|
|
|
|
id_grupo IN (".implode (",",array_keys ($own_groups)).") AND estado IN (0)
|
|
|
|
ORDER BY actualizacion";
|
|
|
|
|
2012-02-02 15:27:23 +01:00
|
|
|
if (!empty($own_groups)){
|
|
|
|
$result_incidents = db_get_all_rows_sql ($sql);
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
$result_incidents = false;
|
|
|
|
}
|
2012-02-01 11:57:43 +01:00
|
|
|
|
|
|
|
if ($result_incidents === false)
|
|
|
|
$shortcut_incidents = 0;
|
|
|
|
else
|
|
|
|
$shortcut_incidents = $result_incidents[0]['total_incidents'];
|
|
|
|
|
|
|
|
|
|
|
|
echo "<span id='shortcut_incidents_opened' style='font-size: 9pt; color:#696969; font-weight: bold;' title='" . __('Incidents opened') . "'>" . $shortcut_incidents . "</span>";
|
|
|
|
echo "</a>";
|
|
|
|
echo " ";
|
|
|
|
}
|
|
|
|
echo " ";
|
|
|
|
echo "<span style='font-size: 9pt; color:#696969; font-weight: bold;'>|</span>";
|
|
|
|
echo " ";
|
|
|
|
echo " ";
|
|
|
|
|
|
|
|
echo "<a href='index.php?sec=reporting&sec2=operation/reporting/custom_reporting'>";
|
2012-02-02 13:00:30 +01:00
|
|
|
html_print_image("images/reporting.png", false, array("title" => __("View reports"), "style" => "margin-bottom: -5px;"));
|
2012-02-01 11:57:43 +01:00
|
|
|
echo "</a>";
|
|
|
|
|
|
|
|
echo " ";
|
|
|
|
|
|
|
|
echo "<a href='index.php?sec=messages&sec2=operation/messages/message'>";
|
2012-02-02 13:00:30 +01:00
|
|
|
html_print_image("images/email.png", false, array("title" => __("Create new message"), "style" => "margin-bottom: -5px;"));
|
2012-02-01 11:57:43 +01:00
|
|
|
echo "</a>";
|
|
|
|
|
|
|
|
// Login in Console and shortcut bar is disabled
|
|
|
|
// This will show and hide the shortcut value in Javascript code
|
|
|
|
if (isset($_POST['nick']) and $shortcut_state != 2){
|
|
|
|
html_print_input_hidden("login_console", 1);
|
2012-02-28 12:48:45 +01:00
|
|
|
}
|
|
|
|
else {
|
2012-02-01 11:57:43 +01:00
|
|
|
html_print_input_hidden("login_console", 0);
|
|
|
|
}
|
|
|
|
|
|
|
|
html_print_input_hidden("shortcut_id_user", $config['id_user']);
|
|
|
|
echo "</div>";
|
|
|
|
|
|
|
|
?>
|
|
|
|
|
|
|
|
<script type='text/javascript'>
|
|
|
|
$(function() {
|
|
|
|
if ($('#hidden-login_console').val() == 1){
|
|
|
|
$('#shotcut_bar').css({height: 0}).animate({ height: '20' }, 900);
|
|
|
|
$('#shortcut_button').css({height: 22}).animate({ height: '40' }, 900);
|
|
|
|
$('#shotcut_bar').css({height: 20}).animate({ height: '0' }, 900);
|
|
|
|
$('#shortcut_button').css({height:40}).animate({ height: '22' }, 900);
|
2012-02-28 12:48:45 +01:00
|
|
|
}
|
|
|
|
else {
|
2012-02-01 11:57:43 +01:00
|
|
|
if ($('#shotcut_bar').css('height') == '0px'){
|
|
|
|
$('#shotcut_bar').css('height', '0px');
|
|
|
|
$('#shortcut_button').css('height', '22px');
|
2012-02-28 12:48:45 +01:00
|
|
|
}
|
|
|
|
else{
|
2012-02-01 11:57:43 +01:00
|
|
|
$('#shotcut_bar').css('height', '20px');
|
|
|
|
$('#shortcut_button').css('height', '40px');
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
$('#shortcut_button').click (function () {
|
|
|
|
if ($('#shotcut_bar').css('height') == '0px'){
|
|
|
|
$('#shotcut_bar').css({height: 0}).animate({ height: '20' }, 900);
|
|
|
|
$('#shortcut_button').css({height: 22}).animate({ height: '40' }, 900);
|
|
|
|
jQuery.post ("ajax.php",
|
|
|
|
{"page" : "general/shortcut_bar",
|
|
|
|
"update_shortcut_state": 1,
|
|
|
|
"value": 2
|
|
|
|
},
|
|
|
|
function (data) {
|
|
|
|
}
|
|
|
|
);
|
2012-02-28 12:48:45 +01:00
|
|
|
}
|
|
|
|
else {
|
2012-02-01 11:57:43 +01:00
|
|
|
$('#shotcut_bar').css({height: 20}).animate({ height: '0' }, 900);
|
|
|
|
$('#shortcut_button').css({height: 40}).animate({ height: '22' }, 900);
|
|
|
|
jQuery.post ("ajax.php",
|
|
|
|
{"page" : "general/shortcut_bar",
|
|
|
|
"update_shortcut_state": 1,
|
|
|
|
"value": 1
|
|
|
|
},
|
|
|
|
function (data) {
|
|
|
|
}
|
|
|
|
);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
var id_user = $('#hidden-shortcut_id_user').val();
|
|
|
|
function shortcut_check_alerts() {
|
|
|
|
jQuery.post ("ajax.php",
|
|
|
|
{"page" : "operation/agentes/alerts_status",
|
|
|
|
"get_alert_fired": 1
|
|
|
|
},
|
|
|
|
function (data) {
|
|
|
|
$('#shortcut_alerts_fired').text(data);
|
|
|
|
}
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
function shortcut_check_events() {
|
|
|
|
jQuery.post ("ajax.php",
|
|
|
|
{"page" : "general/shortcut_bar",
|
|
|
|
"get_critical_events": 1
|
|
|
|
},
|
|
|
|
function (data) {
|
|
|
|
$('#shortcut_critical_events').text(data);
|
|
|
|
}
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
function shortcut_check_incidents() {
|
|
|
|
jQuery.post ("ajax.php",
|
|
|
|
{"page" : "general/shortcut_bar",
|
|
|
|
"get_opened_incidents": 1
|
|
|
|
},
|
|
|
|
function (data) {
|
|
|
|
$('#shortcut_incidents_opened').text(data);
|
|
|
|
}
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
$(document).ready (function () {
|
|
|
|
setInterval("shortcut_check_alerts()", (10 * 1000)); //10 seconds between ajax request
|
|
|
|
setInterval("shortcut_check_events()", (10 * 1000)); //10 seconds between ajax request
|
|
|
|
setInterval("shortcut_check_incidents()", (10 * 1000)); //10 seconds between ajax request
|
|
|
|
});
|
|
|
|
</script>
|