Ejemplo n.º 1
0
/**
 * This function calculates status of systems with profile sensor enabled
 *
 * @param object $conn  DataBase access object
 *
 * @return array
 */
function calc_sensors_status($conn)
{
    // Getting system list
    $avc_list = Av_center::get_avc_list($conn);
    $total = 0;
    $up_sensors = array();
    $down_sensors = array();
    // Getting DOWN systems
    $filters = array('level' => 'error', 'message_id' => Util::uuid_format('00000000000000000000000000010011'));
    $pagination = array('page' => 1, 'page_rows' => count($avc_list['data']));
    $status = new System_notifications();
    list($notification_list, $total_notifications) = $status->get_status_messages($filters, $pagination);
    if ($total_notifications > 0) {
        $down_systems = array();
        foreach ($notification_list as $notification) {
            $down_systems[$notification['component_id']] = 1;
        }
    }
    //Calculating UP and DOWN sensors
    if (is_array($avc_list['data']) && !empty($avc_list['data'])) {
        foreach ($avc_list['data'] as $avc_data) {
            if (preg_match('/sensor/i', $avc_data['profile'])) {
                if (isset($down_systems[Util::uuid_format($avc_data['system_id'])])) {
                    $down_sensors[$avc_data['sensor_id']] = 1;
                } else {
                    $up_sensors[$avc_data['sensor_id']] = 1;
                }
            }
        }
    }
    $up = count($up_sensors);
    $down = count($down_sensors);
    $total = $up + $down;
    return array($total, $up, $down);
}
Ejemplo n.º 2
0
        $conn = $db->connect();
        $avc_tree = new Avc_tree($conn, $type);
        $db->close();
        if ($avc_tree->is_valid_order($type) == FALSE) {
            $t_load_error = utf8_encode(_('Load error'));
            echo '{"title" : "<span>' . $t_load_error . '</span>", "icon" : "", "addClass" : "bold_red dynatree-statusnode-error",  "key" : "error",  "noLink" : true}';
            exit;
        }
    }
    $avc_tree = $_SESSION['tree_object'];
    session_write_close();
    echo $avc_tree->get_branch($key, $page);
} elseif (POST('action') == 'display_avc') {
    $db = new ossim_db();
    $conn = $db->connect();
    $avc_list = Av_center::get_avc_list($conn);
    $db->close();
    if ($avc_list['status'] == 'error') {
        echo "error###" . _("Error retrieving Alienvault Component");
        exit;
    }
    echo "success###";
    ?>
        <div id='avc_list_container'>
            <div id='header_avc_list'>
                <div id='l_hal'><?php 
    echo _('Alienvault Components Information');
    ?>
</div>
                <div id='r_hal'></div>
                <div id='c_hal'><div id='c_hal_content'></div></div>
Ejemplo n.º 3
0
/**
 * @param object $conn  DataBase access object
 *
 * @return array
 */
function calc_sensors_status($conn)
{
    // Get component list
    $avc_list = Av_center::get_avc_list($conn);
    $total = count($avc_list['data']);
    $up = $total;
    $down = 0;
    // Get notifications list
    $filters = array('level' => 'notification', 'message_id' => 11);
    $pagination = array('page' => 1, 'page_rows' => $total);
    $status = new System_status();
    list($notification_list, $total_notifications) = $status->get_status_messages($filters, $pagination);
    if ($total_notifications > 0) {
        $notification_components = array();
        foreach ($notification_list as $notification) {
            $notification_components[$notification['component_id']] = 1;
        }
        foreach ($avc_list['data'] as $avc_data) {
            if (preg_match('/sensor/i', $avc_data['profile'])) {
                if (isset($notification_components[Util::uuid_format($avc_data['system_id'])])) {
                    $down++;
                    $up--;
                }
            }
        }
    }
    return array($total, $up, $down);
}