# # 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. # Copyright 2004, 2005 Red Hat, Inc. # # AUTHOR: Andreas Thienemann # 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')); print('

Statistics

'); // Import the Chart-Plugin if (array_key_exists($_REQUEST['style'], $chart_styles)) { require_once('charts/'.$chart_styles[$_REQUEST['style']]); } // Sanitize user input $starttime = strtotime($_REQUEST['startdate'].' '.$_REQUEST['starttime']); $endtime = strtotime($_REQUEST['enddate'].' '.$_REQUEST['endtime']); if (!isvalid_probe($_REQUEST['probe'])) { die("Invalid Probe"); } $file = chart_prepare($_REQUEST['probe'], $starttime, $endtime); print(''); print('
'); print(html_footer()); // Rolling chart requested } else if (array_key_exists('action', $_REQUEST) && $_REQUEST['action'] == 'rollingchart') { print(html_header($title = 'FlowMon '.$prog_vers.' - running on '.$_SERVER['HTTP_HOST'], $calendar = False, $refresh = 300)); print(page_header($title = 'FlowMon Rolling Traffic Chart')); print('

Rolling Statistics (updated every 5min)

'); // Import the Chart-Plugin if (array_key_exists($_REQUEST['style'], $chart_styles)) { require_once('charts/'.$chart_styles[$_REQUEST['style']]); } // Sanitize user input if (!isvalid_probe($_REQUEST['probe'])) { die("Invalid Probe"); } $file = chart_prepare($_REQUEST['probe'], False, False, $_REQUEST['timeframe']); print(''); print('
'); print(html_footer()); }