コード例 #1
0
if ($type == "event" && is_array($SS_TopEvents) && count($SS_TopEvents) > 0) {
    $list = $SS_TopEvents;
} elseif ($type == "alarm" && is_array($SA_TopAlarms) && count($SA_TopAlarms) > 0) {
    $list = $SA_TopAlarms;
} else {
    $list = $security_report->Events($limit, $type, $date_from, $date_to);
}
$data_pie = array();
$legend = $data = array();
foreach ($list as $key => $l) {
    if ($key >= 10) {
        // ponemos un límite de resultados para la gráfica
        break;
    }
    $data_pie[$l[1]] = SecurityReport::Truncate($l[0], 60);
    $legend[] = Util::signaturefilter(SecurityReport::Truncate($l[0], 60));
    $data[] = $l[1];
}
$total = array_sum($data);
$labels = array();
$tlabels = array();
$zero = $one = $two = 0;
foreach ($data as $value) {
    if (round($value / $total, 2) * 100 == 0) {
        // 0%
        $zero++;
    } else {
        if (round($value / $total, 2) * 100 == 1) {
            // 1%
            $one++;
        } else {
コード例 #2
0
ファイル: mobile.php プロジェクト: jhbsz/ossimTest
</td></tr>
				
				<tr>
				<td style="height:106px" align="center">
					<div id="graph4" style="text-align:center;margin:0px;height:104px;width:98%"></div>
				</td>
				</tr>

					<script language="javascript" type="text/javascript">
						$( function () {
					        $.plot($("#graph4"), [
								<?php 
    $i = 0;
    foreach ($list4 as $l) {
        $event = Util::signaturefilter($l[0]);
        $short_event = SecurityReport::Truncate($event, 30);
        $occurrences = number_format($l[1], 0, ",", ".");
        $label = str_replace("'", "\\'", "[<b>{$occurrences}</b>] {$short_event}");
        //if (strlen($label)>31) $label = substr($label, 0, 30)."..";
        ?>
									<?php 
        echo $i++ == 0 ? "" : ",";
        ?>
{ label: '<?php 
        echo $label;
        ?>
',  data: <?php 
        echo $l[1];
        ?>
}
								<?php 
コード例 #3
0
ファイル: sec_report.php プロジェクト: jhbsz/ossimTest
function event_max_occurrences($date_from, $date_to)
{
    global $NUM_HOSTS;
    global $security_report;
    global $report_type;
    /* ossim framework conf */
    $conf = $GLOBALS["CONF"];
    $acid_link = $conf->get_conf("acid_link");
    $ossim_link = $conf->get_conf("ossim_link");
    $acid_prefix = $conf->get_conf("event_viewer");
    $report_graph_type = $conf->get_conf("report_graph_type");
    ?>
        <table align="center" width="100%" cellpadding="0" cellspacing="0" class="noborder">
            <tr><td class="headerpr">
        <?php 
    if ($report_type == "alarm") {
        ?>
        <?php 
        echo _("Top");
        ?>
 <?php 
        echo "{$NUM_HOSTS} " . _("Alarms");
        ?>
        <?php 
    } else {
        ?>
        <?php 
        echo _("Top");
        ?>
 <?php 
        echo "{$NUM_HOSTS} " . _("Events");
        ?>
        <?php 
    }
    ?>
            </td></tr>
        </table>
        <table align="center" width="100%">
          <tr>
            <?php 
    if ($report_type == "alarm") {
        ?>
            <th> <?php 
        echo gettext("Alarm");
        ?>
 </th>
            <?php 
    } else {
        ?>
            <th> <?php 
        echo gettext("Event");
        ?>
 </th>
            <?php 
    }
    ?>
            <th> <?php 
    echo gettext("Occurrences");
    ?>
 </th>
          </tr>
<?php 
    $list = $security_report->Events($NUM_HOSTS, $report_type, $date_from, $date_to);
    foreach ($list as $l) {
        $event = $l[0];
        $short_event = SecurityReport::Truncate($event, 60);
        $occurrences = number_format($l[1], 0, ",", ".");
        ?>
          <tr>
             <?php 
        if ($report_type == "alarm") {
            $link = "{$ossim_link}/control_panel/alarm_console.php";
        } else {
            $link = "{$acid_link}/" . $acid_prefix . "_qry_main.php?new=1&" . "sig[0]==&" . "sig[1]=" . urlencode($event) . "&" . "sig[2]==&" . "submit=Query+DB&" . "num_result_rows=-1&" . "sort_order=time_d";
        }
        ?>
            <td style="text-align:left;"><a href="<?php 
        echo $link;
        ?>
"><?php 
        echo Util::signaturefilter($short_event);
        ?>
</a></td>
            <td><?php 
        echo $occurrences;
        ?>
</td>
          </tr>
<?php 
    }
    ?>
        <tr>
          <td colspan="2" class="nobborder" height="348" valign="top"><center>
            <br/>
<?php 
    if ($report_graph_type == "applets") {
        jgraph_nbevents_graph();
    } else {
        ?>
<iframe src="graphs/events_received_graph.php?hosts=<?php 
        echo $NUM_HOSTS;
        ?>
&type=<?php 
        echo $report_type;
        ?>
&date_from=<?php 
        echo urlencode($date_from);
        ?>
&date_to=<?php 
        echo urlencode($date_to);
        ?>
" alt="<?php 
        echo _("events graph");
        ?>
"
        frameborder="0" style="margin:0px;padding:0px;width:430px;height:430px;border: 0px solid rgb(170, 170, 170);text-align:center"> </iframe><?php 
        /*
        ?>
                    <img src="graphs/events_received_graph.php?hosts=<?php
                echo $NUM_HOSTS
        ?>&type=<?php
                echo $report_type ?>&date_from=<?=urlencode($date_from)?>&date_to=<?=urlencode($date_to)?>" alt="events graph"/>
        <?php*/
    }
    ?>
          </center></td>
        <tr/>
        </table>
<?php 
}
コード例 #4
0
ファイル: menu.php プロジェクト: jhbsz/ossimTest
                    ?>
<option 
<?php 
                    if (!$interface && $s_int->get_main() == 1) {
                        echo "SELECTED";
                    } elseif ($interface == $s_int->get_interface()) {
                        echo "SELECTED";
                    }
                    ?>
 value="<?php 
                    echo $s_int->get_interface();
                    ?>
">
<?php 
                    $interface_name = $s_int->get_name() != "" ? $s_int->get_name() : $s_int->get_interface();
                    echo SecurityReport::Truncate($interface_name, 30, "...");
                    ?>
</option>
<?php 
                }
            } else {
                echo "<option value=''>- " . _("No interfaces found") . " -";
            }
        }
    }
    if (!$sflag) {
        echo "<option value=''>- " . _("No interfaces found") . " -";
    }
} else {
    echo "<option value=''>- " . _("No interfaces found") . " -";
}