# # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU Library General Public License as published by # the Free Software Foundation; version 2 only # # 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 Library General Public License for more details. # # You should have received a copy of the GNU Library General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. # require_once('config.inc.php'); require_once('common.inc.php'); require_once('db_handler.inc.php'); // Initiate the databaseconnection $dbh = ''; init_db(); // The main interface/welcome screen if (!array_key_exists('action', $_REQUEST) OR (array_key_exists('action', $_REQUEST) && $_REQUEST['action'] == 'probe_select' && empty($_REQUEST['probe']))) { print(html_header($title = 'FlowMon '.$prog_vers.' - running on '.$_SERVER['HTTP_HOST'])); print(page_header($title = 'FlowMon overview')); print('

Network Flow Monitor

'); $num_flows = get_num_flows(); $num_systems = get_num_systems(); print('

Database Statistics

Number of reporting FlowProbes:'.get_num_probes().'
Number of archived Flows:'.$num_flows.'
Number of tracked Systems:'.$num_systems.'
First Flow occurence:'.strftime($date_fmt_str, get_oldest_flow_ts()).'
Most recent Flow occurence:'.strftime($date_fmt_str, get_newest_flow_ts()).'
Database Size:'.round((get_db_size() / 1024 / 1024), 2).' MB

'); $bytes = get_bytes(); $pkts = get_pkts(); print('

Network Statistics

Total Bytes tracked'.round((get_bytes() / 1024 / 1024), 2).' MB
Total Pakets tracked'.get_pkts().'
Average Paketsize'.@round(($bytes / $pkts), 0).' Bytes
Average Traffic per system'.@round(($bytes / $num_systems / 1024 / 1024), 2).' MB
Average Traffic per flow'.@round(($bytes / $num_flows / 1024 / 1024), 2).' MB

'); // print('
'); print('

Detailed traffic graphs

'); print('
'); print('
'); print('
'); print(html_footer()); // We have selected a probe, present with detailes form to get the chart parameters } else if (array_key_exists('action', $_REQUEST) && $_REQUEST['action'] == 'probe_select') { print(html_header($title = 'FlowMon '.$prog_vers.' - running on '.$_SERVER['HTTP_HOST'], $calendar = True)); print(page_header($title = 'FlowMon Chart Parameters')); print('

Statistics

Probe'.gethostbyaddr(htmlspecialchars($_REQUEST['probe'])).' ('.htmlspecialchars($_REQUEST['probe']).')
Start Date
Start Time
End Date
End Time
Chart Style

Chart Style
'); print(html_footer()); // We got everything needed to chart the requested data. // Do it! } else if (array_key_exists('action', $_REQUEST) && $_REQUEST['action'] == 'chart') { print(html_header($title = 'FlowMon '.$prog_vers.' - running on '.$_SERVER['HTTP_HOST'], $calendar = True)); print(page_header($title = 'FlowMon Traffic Chart')); // Initialize defaults which might not exist if (!@array_key_exists('style', $_REQUEST)) { $_REQUEST['style'] = 'Top Sources'; } if (!@array_key_exists('timeframe', $_REQUEST)) { $_REQUEST['timeframe'] = '3600'; } if (@$_REQUEST['rolling'] == 'on') { $_REQUEST['startdate'] = strftime('%Y-%m-%d', (time() - $_REQUEST['timeframe'])); $_REQUEST['starttime'] = strftime('%H:%M', (time() - $_REQUEST['timeframe'])); $_REQUEST['enddate'] = strftime('%Y-%m-%d'); $_REQUEST['endtime'] = strftime('%H:%M'); $starttime = strtotime($_REQUEST['startdate'].' '.$_REQUEST['starttime']); $endtime = strtotime($_REQUEST['enddate'].' '.$_REQUEST['endtime']); } else { // Sanitize user input $starttime = strtotime($_REQUEST['startdate'].' '.$_REQUEST['starttime']); $endtime = strtotime($_REQUEST['enddate'].' '.$_REQUEST['endtime']); } print(chartstyle_header($_REQUEST['startdate'], $_REQUEST['starttime'], $_REQUEST['enddate'], $_REQUEST['endtime'])); print('

Statistics

'); // Import the Chart-Plugin if (array_key_exists($_REQUEST['style'], $chart_styles)) { require_once('charts/'.$chart_styles[$_REQUEST['style']]); } if (!isvalid_probe($_REQUEST['probe'])) { die("Invalid Probe"); } // Do we want namelookups? if (@$_REQUEST['nslookup'] == 'on') { $nslookup = True; } else { $nslookup = False; } $file = chart_prepare($_REQUEST['probe'], $starttime, $endtime, $nslookup=$nslookup); print(''); print('
'); print(html_footer()); }