function plugin_activity($conn, $data)
{
    $asset_id = $data['asset'];
    ossim_valid($asset_id, OSS_HEX, 'illegal:' . _("ASSET"));
    check_ossim_error();
    $active_plugin = array();
    $total_plugins = 0;
    try {
        $sensors = Asset_host_sensors::get_sensors_by_id($conn, $asset_id);
        $client = new Alienvault_client();
        foreach ($sensors as $sensor_id => $s_data) {
            $plugins = $client->sensor(Util::uuid_format($sensor_id))->get_plugins_by_assets();
            $plugins = @json_decode($plugins, TRUE);
            if ($plugins['status'] == 'success') {
                if (array_key_exists($asset_id, $plugins['data']['plugins'])) {
                    $plugins = $plugins['data']['plugins'][$asset_id];
                    foreach ($plugins as $pdata) {
                        $active = Asset_host_devices::check_device_connectivity($conn, $asset_id, $pdata['plugin_id'], $sensor_id, TRUE);
                        if ($active) {
                            $row_id = md5($asset_id . $pdata['cpe'] . $sensor_id);
                            $active_plugin[$row_id] = TRUE;
                        }
                        $total_plugins++;
                    }
                }
            }
        }
    } catch (Exception $e) {
        //nothing here
    }
    $response['error'] = FALSE;
    $response['data']['plugins'] = $active_plugin;
    $response['data']['total_p'] = $total_plugins;
    return $response;
}
    echo json_encode($response);
    exit;
}
$db = new ossim_db();
$conn = $db->connect();
// Get plugins by asset using Alienvault API
$total = 0;
$data = array();
$plugins = array();
try {
    $sensors = Asset_host_sensors::get_sensors_by_id($conn, $asset_id);
    //Show column 'Sensor' when there are two sensors or more
    $num_sensors = count($sensors);
    $client = new Alienvault_client();
    foreach ($sensors as $sensor_id => $s_data) {
        $plugins = $client->sensor(Util::uuid_format($sensor_id))->get_plugins_by_assets();
        $plugins = @json_decode($plugins, TRUE);
        if ($plugins['status'] == 'success') {
            if (array_key_exists($asset_id, $plugins['data']['plugins'])) {
                $plugins = $plugins['data']['plugins'][$asset_id];
                foreach ($plugins as $plugin_name => $pdata) {
                    $total++;
                    if (!empty($search_str)) {
                        $aux_search_str = '/' . strtolower($search_str) . '/';
                        $aux_cpe = strtolower($pdata['cpe']);
                        if (!preg_match($aux_search_str, $aux_cpe)) {
                            continue;
                        }
                    }
                    $vmv = Software::get_vmv_by_cpe($conn, $pdata['cpe']);
                    if (!empty($s_data)) {