예제 #1
0
if ($what == 'all') {
    Web_indicator::set_off('Reload_policies');
    Web_indicator::set_off('Reload_sensors');
    Web_indicator::set_off('Reload_plugins');
    Web_indicator::set_off('Reload_directives');
    Web_indicator::set_off('Reload_servers');
} else {
    Web_indicator::set_off('Reload_' . $what);
}
// Reset main indicator if no more policy reload need
if (!Web_indicator::is_on('Reload_policies') && !Web_indicator::is_on('Reload_sensors') && !Web_indicator::is_on('Reload_plugins') && !Web_indicator::is_on('Reload_directives') && !Web_indicator::is_on('Reload_servers')) {
    Web_indicator::set_off('ReloadPolicy');
}
if ($what == 'tasks') {
    try {
        $frcon = new Frameworkd_socket();
        $frcon->write("control action=\"refresh_inventory_task\"\n");
    } catch (Exception $e) {
        $error = _('An error occurred while updating Agent cache...');
        echo ossim_error($error);
    }
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <script type="text/javascript" src="../js/jquery.min.js"></script>
    <link rel="stylesheet" type="text/css" href="../style/av_common.css?t=<?php 
echo Util::get_css_id();
?>
"/>
예제 #2
0
         exit;
     }
     foreach ($items as $k => $item) {
         $item = explode("###", $item);
         ossim_valid($item[1], OSS_PORT, 'illegal:' . _("Port"));
         if (!ossim_error()) {
             if ($item[2] == "nagios_ok") {
                 Host_services::set_nagios($conn, $ip, $item[1], 1);
             } else {
                 Host_services::set_nagios($conn, $ip, $item[1], 0);
             }
         } else {
             ossim_clean_error();
         }
     }
     $s = new Frameworkd_socket();
     if ($s->status) {
         if (!$s->write('nagios action="reload" "')) {
             echo _("Frameworkd couldn't recieve a nagios command");
         }
         $s->close();
     } else {
         echo _("Couldn't connect to frameworkd");
     }
     break;
 case "add":
     $sensor = null;
     $property_ref = POST('inv_prop_ref');
     $value = POST('inv_prop_value');
     $extra = POST('inv_prop_version');
     $extra = empty($extra) ? "None" : $extra;
예제 #3
0
function delete_nfsen($sensor, $nfsen_list = array())
{
    if (empty($nfsen_list)) {
        $nfsen_list = get_nfsen_sensors();
    }
    if (count($nfsen_list) <= 1) {
        $data['status'] = 'error';
        $data['data'] = _('You cannot delete this source, at least one Nfsen source is needed');
    } elseif ($nfsen_list[$sensor] != '') {
        unset($nfsen_list[$sensor]);
        set_nfsen_sensors($nfsen_list);
        nfsen_reset($nfsen_dir);
        // Talk to frameworkd
        try {
            $s = new Frameworkd_socket();
            $s->write('nfsen action="delsensor" sensorname="' . $sensor . '"');
            $data['status'] = 'success';
            $data['data'] = _('NFSEN sensor deleted successfully');
        } catch (Exception $e) {
            $data['status'] = 'error';
            $data['data'] = $e->getMessage();
        }
    }
    return $data;
}
예제 #4
0
파일: reload.php 프로젝트: jhbsz/ossimTest
        $conn = $db->connect();
        list($sensors, $all_hosts) = Host::get_ips_and_hostname($conn);
        $refresh = "refresh_asset_list list={";
        foreach ($all_hosts as $ip => $hostname) {
            $refresh .= "{$hostname}={$ip},";
        }
        $refresh = preg_replace("/,\$/", "}", $refresh);
        $error_code = $frcon->write($refresh);
        if (!$error_code) {
            echo _("An error has been found updating the Agent cache...<br>");
        }
        $db->close($conn);
    }
} else {
    if ($what == "sensors") {
        $frcon = new Frameworkd_socket();
        if (!$frcon->status) {
            echo gettext("Can't connect to frameworkd...<br>");
        } else {
            $error_code = $frcon->write("refresh_sensor_list");
            if (!$error_code) {
                echo _("An error has been found updating the Agent cache...<br>");
            }
        }
    }
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
  <link rel="stylesheet" type="text/css" href="../style/style.css"/>
예제 #5
0
            $sensor_name = strtoupper($sensor_id);
            $nfsen_sensors = get_nfsen_sensors();
            $used_ports = array();
            foreach ($nfsen_sensors as $sensor => $data) {
                $used_ports[$data['port']]++;
                // load used ports in configuration file
            }
            if ($used_ports[$port] == '') {
                $nfsen_sensors[$sensor_name]['port'] = $port;
                $nfsen_sensors[$sensor_name]['color'] = $color;
                $nfsen_sensors[$sensor_name]['type'] = $type;
                set_nfsen_sensors($nfsen_sensors);
                nfsen_reset();
                // Talk to frameworkd
                try {
                    $s = new Frameworkd_socket();
                    $s->write('nfsen action="addsensor" sensorname="' . $sensor_name . '" port="' . $port . '" type="netflow" color="' . $color . '"');
                    $admin_ip = Util::get_default_admin_ip();
                    $data['status'] = 'success';
                    $data['data'] = Util::js_entities(str_replace('IP', $admin_ip, str_replace('PORT', $port, _('You should now configure your Flows generator to send Flows to IP port PORT'))));
                } catch (Exception $e) {
                    $data['status'] = 'error';
                    $data['data'] = Util::js_entities($e->getMessage());
                }
            } else {
                $data['status'] = 'error';
                $data['data'] = Util::js_entities(_('The selected port is used by another sensor'));
            }
        }
        break;
}