diff --git a/alerts.php b/alerts.php index 62f52eb904..827d5063e1 100755 --- a/alerts.php +++ b/alerts.php @@ -195,10 +195,12 @@ function RunFollowUp() { if ($n > $o) { $ret .= ' Worsens'; $state = 3; + $alert['details']['diff'] = array_diff($chk,$alert['details']['rule']); } - else if ($n < $o) { + elseif ($n < $o) { $ret .= ' Betters'; $state = 4; + $alert['details']['diff'] = array_diff($alert['details']['rule'],$chk); } if ($state > 0 && $n > 0) { @@ -370,15 +372,15 @@ function FormatAlertTpl($obj) { $s = strlen($msg); $x = $pos = -1; $buff = ''; - $if = $for = false; + $if = $for = $calc = false; while (++$x < $s) { if ($msg[$x] == '{' && $buff == '') { $buff .= $msg[$x]; } - else if ($buff == '{ ') { + elseif ($buff == '{ ') { $buff = ''; } - else if ($buff != '') { + elseif ($buff != '') { $buff .= $msg[$x]; } @@ -386,10 +388,14 @@ function FormatAlertTpl($obj) { $pos = $x; $if = true; } - else if ($buff == '{foreach') { + elseif ($buff == '{foreach') { $pos = $x; $for = true; } + elseif ($buff == '{calc') { + $pos = $x; + $calc = true; + } if ($pos != -1 && $msg[$x] == '}') { $orig = $buff; @@ -403,7 +409,7 @@ function FormatAlertTpl($obj) { ' ) { $ret .= "', ); } - else if ($for) { + elseif ($for) { $for = false; $o = 8; $native = array( @@ -411,6 +417,14 @@ function FormatAlertTpl($obj) { ' as $key=>$value) { $ret .= "', ); } + elseif ($calc) { + $calc = false; + $o = 5; + $native = array( + '"; $ret .= (float) (0+(', + ')); $ret .= "', + ); + } else { continue; } @@ -457,10 +471,10 @@ function DescribeAlert($alert) { if ($alert['state'] == 2) { $obj['title'] .= ' got acknowledged'; } - else if ($alert['state'] == 3) { + elseif ($alert['state'] == 3) { $obj['title'] .= ' got worse'; } - else if ($alert['state'] == 4) { + elseif ($alert['state'] == 4) { $obj['title'] .= ' got better'; } @@ -473,8 +487,12 @@ function DescribeAlert($alert) { } } } + $obj['elapsed'] = TimeFormat(time() - strtotime($alert['time_logged'])); + if( !empty($extra['diff']) ) { + $obj['diff'] = $extra['diff']; + } } - else if ($alert['state'] == 0) { + elseif ($alert['state'] == 0) { $id = dbFetchRow('SELECT alert_log.id,alert_log.time_logged,alert_log.details FROM alert_log WHERE alert_log.state != 2 && alert_log.state != 0 && alert_log.rule_id = ? && alert_log.device_id = ? && alert_log.id < ? ORDER BY id DESC LIMIT 1', array($alert['rule_id'], $alert['device_id'], $alert['id'])); if (empty($id['id'])) { return false; diff --git a/check-services.php b/check-services.php index e053126b22..a39171a3d7 100755 --- a/check-services.php +++ b/check-services.php @@ -48,13 +48,9 @@ foreach (dbFetchRows('SELECT * FROM `devices` AS D, `services` AS S WHERE S.devi if ($service_status != $status) { $update['service_changed'] = time(); } - else { - unset($updated); - } - - $update = array_merge(array('service_status' => $status, 'service_message' => $check, 'service_checked' => time()), $update); - dbUpdate($update, 'services', '`service_id` = ?', array($service['service_id'])); - unset($update); + $update = array_merge(array('service_status' => $status, 'service_message' => $check, 'service_checked' => time()), $update); + dbUpdate($update, 'services', '`service_id` = ?', array($service['service_id'])); + unset($update); } else { $status = '0'; diff --git a/daily.php b/daily.php index 7e42c4066d..238400ead1 100644 --- a/daily.php +++ b/daily.php @@ -22,28 +22,6 @@ if ($options['f'] === 'update') { exit(0); } - $innodb_buffer = innodb_buffer_check(); - if ($innodb_buffer['used'] > $innodb_buffer['size']) { - if (!empty($config['alert']['default_mail'])) { - $subject = $config['project_name'] . ' auto-update action required'; - $message = ' -Hi, - -We have just tried to update your installation but it looks like the InnoDB buffer size is too low. - -Because of this we have stopped the auto-update running to ensure your system is ok. - -You currently have a configured innodb_buffer_pool_size of ' . $innodb_buffer['size'] / 1024 / 1024 . ' MiB but is currently using ' . $innodb_buffer['used'] / 1024 / 1024 . ' MiB - -Take a look at https://dev.mysql.com/doc/refman/5.6/en/innodb-buffer-pool.html for further details. - -The ' . $config['project_name'] . ' team.'; - send_mail($config['alert']['default_mail'],$subject,$message,$html=false); - } - echo warn_innodb_buffer($innodb_buffer); - exit(2); - } - if ($config['update_channel'] == 'master') { exit(1); } diff --git a/doc/Extensions/Oxidized.md b/doc/Extensions/Oxidized.md index 9123c2ed80..da00b7df9e 100644 --- a/doc/Extensions/Oxidized.md +++ b/doc/Extensions/Oxidized.md @@ -62,7 +62,7 @@ $config['oxidized']['reload_nodes'] = TRUE; #### Using Groups -To return a group to Oxidized you can do this by matching a regex for either hostname or location. The order is hostname is matched first, if nothing is found then location is attempted. +To return a group to Oxidized you can do this by matching a regex for either hostname, os or location. The order is hostname is matched first, if nothing is found then os is tried and then location is attempted. The first match found will be used. To match on the device hostnames that contain 'lon-sw' or if the location contains 'London' then you would place the following within config.php: ```php @@ -70,6 +70,12 @@ $config['oxidized']['group']['hostname'][] = array('regex' => '/^lon-sw/', 'grou $config['oxidized']['group']['location'][] = array('regex' => '/london/', 'group' => 'london-switches'); ``` +To match on a device os of edgeos then please use the following: + +```php +$config['oxidized']['group']['os'][] = array('match' => 'edgeos', 'group' => 'wireless'); +``` + If you need to, you can specify credentials for groups by using the following in your Oxidized config: ```bash diff --git a/doc/Support/Configuration.md b/doc/Support/Configuration.md index 8070df0ce5..e7d305cf25 100644 --- a/doc/Support/Configuration.md +++ b/doc/Support/Configuration.md @@ -385,7 +385,7 @@ $config['location_map']['Under the Sink'] = "Under The Sink, The Office, London, ``` Regex Matching: ```php -$config['location_map']['/Sink/'] = "Under The Sink, The Office, London, UK"; +$config['location_map_regex']['/Sink/'] = "Under The Sink, The Office, London, UK"; ``` The above are examples, these will rewrite device snmp locations so you don't need to configure full location within snmp. diff --git a/html/includes/api_functions.inc.php b/html/includes/api_functions.inc.php index 8db6f28a4e..83ad9b5117 100644 --- a/html/includes/api_functions.inc.php +++ b/html/includes/api_functions.inc.php @@ -953,6 +953,14 @@ function list_oxidized() { break; } } + if (empty($device['group'])) { + foreach ($config['oxidized']['group']['os'] as $host_group) { + if ($host_group['match'] === $device['os']) { + $device['group'] = $host_group['group']; + break; + } + } + } if (empty($device['group'])) { foreach ($config['oxidized']['group']['location'] as $host_group) { if (preg_match($host_group['regex'].'i', $device['location'])) { diff --git a/html/includes/common/top-interfaces.inc.php b/html/includes/common/top-interfaces.inc.php index cb9e16720b..964ba5f9fd 100644 --- a/html/includes/common/top-interfaces.inc.php +++ b/html/includes/common/top-interfaces.inc.php @@ -103,7 +103,7 @@ else { $params = array('user' => $_SESSION['user_id'], 'lastpoll' => array($lastpoll_seconds), 'count' => array($interface_count), 'filter' => ($widget_settings['interface_filter']?:(int)1)); if (is_admin() || is_read()) { $query = ' - SELECT *, p.ifInOctets_rate + p.ifOutOctets_rate as total + SELECT p.*, devices.*, p.ifInOctets_rate + p.ifOutOctets_rate as total FROM ports as p INNER JOIN devices ON p.device_id = devices.device_id AND unix_timestamp() - p.poll_time <= :lastpoll @@ -115,7 +115,7 @@ else { } else { $query = ' - SELECT ports.*, devices.hostname, ports.ifInOctets_rate + ports.ifOutOctets_rate as total + SELECT ports.*, devices.*, ports.ifInOctets_rate + ports.ifOutOctets_rate as total FROM ports INNER JOIN devices ON ports.device_id = devices.device_id LEFT JOIN ports_perms ON ports.port_id = ports_perms.port_id diff --git a/html/includes/modal/new_bill.inc.php b/html/includes/modal/new_bill.inc.php new file mode 100644 index 0000000000..7cd4196016 --- /dev/null +++ b/html/includes/modal/new_bill.inc.php @@ -0,0 +1,67 @@ + + * + * This program is free software: you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation, either version 3 of the License, or (at your + * option) any later version. Please see LICENSE.txt at the top level of + * the source code distribution for details. + */ +if(is_admin() !== false) { + if (is_numeric($vars['port'])) { + $port = dbFetchRow('SELECT * FROM `ports` AS P, `devices` AS D WHERE `port_id` = ? AND D.device_id = P.device_id', array($vars['port'])); + } +?> + + + +$desc - ".date('r',$service['service_changed'])." + $checked "; diff --git a/html/pages/bill.inc.php b/html/pages/bill.inc.php index 1be3873542..a1677e86c1 100644 --- a/html/pages/bill.inc.php +++ b/html/pages/bill.inc.php @@ -60,92 +60,67 @@ if (bill_permitted($bill_id)) { AND D.device_id = P.device_id', array($bill_id) ); - - echo '

- Bill : '.$bill_data['bill_name'].'

'; - - print_optionbar_start(); - - echo "Bill » "; - + if (!$vars['view']) { $vars['view'] = 'quick'; } + + function print_port_list() { + global $ports; +?>
+
+

Billed Ports

+
+
+ +
+ on +
+ +
+
+ - if ($vars['view'] == 'quick') { - echo ""; +

+ +Bill » "; + $menu_options = array( + 'quick' => 'Quick Graphs', + 'accurate' => 'Accurate Graphs', + 'transfer' => 'Transfer Graphs', + 'history' => 'Historical Graphs' + ); + if($_SESSION['userlevel'] >= '10') + { + $menu_options['edit'] = 'Edit'; + $menu_options['delete'] = 'Delete'; + $menu_options['reset'] = 'Reset'; } - - echo 'Quick Graphs'; - if ($vars['view'] == 'quick') { - echo '
'; - } - - echo ' | '; - - if ($vars['view'] == 'accurate') { - echo ""; - } - - echo 'Accurate Graphs'; - if ($vars['view'] == 'accurate') { - echo ''; - } - - echo ' | '; - - if ($vars['view'] == 'transfer') { - echo ""; - } - - echo 'Transfer Graphs'; - if ($vars['view'] == 'transfer') { - echo ''; - } - - echo ' | '; - - if ($vars['view'] == 'history') { - echo ""; - } - - echo 'Historical Usage'; - if ($vars['view'] == 'history') { - echo ''; - } - - if ($_SESSION['userlevel'] >= '10') { - echo ' | '; - if ($vars['view'] == 'edit') { + $sep = ''; + foreach ($menu_options as $option => $text) { + echo $sep; + if ($vars['view'] == $option) { echo ""; } - echo 'Edit'; - if ($vars['view'] == 'edit') { + echo generate_link($text, $vars, array('view' => $option)); + if ($vars['view'] == $option) { echo ''; } - echo ' | '; - if ($vars['view'] == 'delete') { - echo ""; - } - - echo 'Delete'; - if ($vars['view'] == 'delete') { - echo ''; - } - - echo ' | '; - if ($vars['view'] == 'reset') { - echo ""; - } - - echo 'Reset'; - if ($vars['view'] == 'reset') { - echo ''; - } - }//end if - + $sep = ' | '; + } + echo '
Back to Bills
'; print_optionbar_end(); @@ -166,59 +141,71 @@ if (bill_permitted($bill_id)) { include 'pages/bill/transfer.inc.php'; } else if ($vars['view'] == 'quick' || $vars['view'] == 'accurate') { - echo '

Billed Ports

'; +?> - // Collected Earlier - foreach ($ports as $port) { - echo generate_port_link($port).' on '.generate_device_link($port).'
'; - } + +

Quota Bill

+ +

+ CDR / 95th Bill +

+ +Billing Period from to +

- echo '

Bill Summary

'; - - if ($bill_data['bill_type'] == 'quota') { +
+
+ +
+
+
+
+

+ Bill Summary +

+
+ + +Quota Bill'; - $percent = round((($total_data) / $bill_data['bill_quota'] * 100), 2); $unit = 'MB'; $total_data = round($total_data, 2); - echo 'Billing Period from '.$fromtext.' to '.$totext; - echo '
Transferred '.format_bytes_billing($total_data).' of '.format_bytes_billing($bill_data['bill_quota']).' ('.$percent.'%)'; - echo '
Average rate '.formatRates($rate_average); - $background = get_percentage_colours($percent); - - echo '

'.print_percentage_bar(350, 20, $percent, null, 'ffffff', $background['left'], $percent.'%', 'ffffff', $background['right']).'

'; - $type = '&ave=yes'; +?> + + +CDR / 95th Bill'; - $unit = 'kbps'; $cdr = $bill_data['bill_cdr']; $rate_95th = round($rate_95th, 2); - $percent = round((($rate_95th) / $cdr * 100), 2); - $type = '&95th=yes'; +?> + + - echo ''.$fromtext.' to '.$totext.' -
Measured '.format_si($rate_95th).'bps of '.format_si($cdr).'bps ('.$percent.'%) @ 95th %ile'; + + +
+ of + - Average rate + + of (95th%ile) + + +
+
+
+
- $background = get_percentage_colours($percent); - - echo '

'.print_percentage_bar(350, 20, $percent, null, 'ffffff', $background['left'], $percent.'%', 'ffffff', $background['right']).'

'; - - // echo("

Billing Period : " . $fromtext . " to " . $totext . "
- // " . $paidrate_text . "
- // " . $total_data . "MB transfered in the current billing cycle.
- // " . $rate_average . "Kbps Average during the current billing cycle.

- // " . $rate_95th . "Kbps @ 95th Percentile. (" . $dir_95th . ") (" . $bill_text . ") - // - //
"); - }//end if +"; $li = " - +?> +
+
+

Billing View

+
+ +
+ +
+
+

24 Hour View

+
+ +
-
- - - - - - From: - - - To: - - - -
- - "; - }//end if - - if ($_GET['all']) { - $ai = ''; - echo "

Entire Data View

$ai"; - } - else if ($_GET['custom']) { - $cg = ''; - echo "

Custom Graph

$cg"; - } - else { - echo "

Billing View

$bi"; - // echo("

Previous Bill View

$li"); - echo "

24 Hour View

$di"; - echo "

Monthly View

$mi"; - // echo("
Graph All Data (SLOW)"); - }//end if +
+
+

Monthly View

+
+ +
+ \ No newline at end of file diff --git a/html/pages/bill/addoreditbill.inc.php b/html/pages/bill/addoreditbill.inc.php new file mode 100644 index 0000000000..75e64ff201 --- /dev/null +++ b/html/pages/bill/addoreditbill.inc.php @@ -0,0 +1,89 @@ +
+ +
+ +
+
+
+ +
+ + +
+
+
+
+ +
+ +
+
+ +
+
+
+ +
+ +
+
+ +
+
+
+
+ +
+ +
+
+
+

Optional Information

+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ + \ No newline at end of file diff --git a/html/pages/bill/delete.inc.php b/html/pages/bill/delete.inc.php index 6a7d247b50..e02666b40d 100644 --- a/html/pages/bill/delete.inc.php +++ b/html/pages/bill/delete.inc.php @@ -10,8 +10,12 @@ } -

Delete Bill

-
+ +
+
+
+ +

Delete Bill

@@ -31,4 +35,8 @@
+
+
+
+ diff --git a/html/pages/bill/edit.inc.php b/html/pages/bill/edit.inc.php index 3fd69c3612..9c5a84dcab 100644 --- a/html/pages/bill/edit.inc.php +++ b/html/pages/bill/edit.inc.php @@ -60,240 +60,121 @@ ); } }//end if - ?> -
- - -

Bill Properties

-
-
-
- - +
+
+
+
+

Bill Properties

+
+
+ + + + +
+
+ +
+
+ +
-
-
-
- -
-
- -
-
- -
-
-
- - -
-
- - -
-
-
-

Optional Information

-
-
-
- - -
-
-
-
-
-
- - -
-
-
-
-
-
- - -
-
- - -
-

Billed Ports

-
-
- ", $devicebtn); - $devicebtn = str_replace("
',;", "
',", $devicebtn); - $portbtn = str_replace('interface-upup', 'btn', generate_port_link($port)); - $portbtn = str_replace('interface-updown', 'btn btn-warning', $portbtn); - $portbtn = str_replace('interface-downdown', 'btn btn-warning', $portbtn); - $portbtn = str_replace('interface-admindown', 'btn btn-warning disabled', $portbtn); - $portbtn = str_replace("overlib('", "overlib('
", $portbtn); - $portbtn = str_replace("
',;", "
',", $portbtn); - $portalias = (empty($port['ifAlias']) ? '' : ' - '.$port['ifAlias'].''); - $devicebtn = str_replace('">'.$port['hostname'], '" style="color: #000;"> '.$port['hostname'], $devicebtn); - $portbtn = str_replace('">'.strtolower($port['ifName']), '" style="color: #000;"> '.$port['ifName'].''.$portalias, $portbtn); - echo '
\n"; - echo " \n"; - echo ' \n"; - echo "
\n"; - echo "
\n"; - echo "
\n"; - echo ' '.$devicebtn."\n"; - echo ' '.$portbtn."\n"; - echo "
\n"; - echo "
\n"; - echo ' Remove Interface\n"; - echo "
\n"; - echo "
\n"; - } - - if (!$emptyCheck) { - echo "
\n"; - echo " There are no ports assigned to this bill\n"; - echo "
\n"; - } - } - ?>
- -
- - -
-

Add Port

-
-
-
- - +
+
+
+

Billed Ports

+
+
+
+ +
+ +
+ + + + + + + + + +
+ +
There are no ports assigned to this bill + + +
+ + +
+ +

Add Port

+ +
+ + + +
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+
-
-
-
- - -
-
- - +
diff --git a/html/pages/bill/history.inc.php b/html/pages/bill/history.inc.php index 6770271c82..95de8a76b2 100644 --- a/html/pages/bill/history.inc.php +++ b/html/pages/bill/history.inc.php @@ -9,9 +9,18 @@ $img['his'] = ''; +?> -echo $img['his']; +

Historical Usage

+
+
+

Monthly Usage

+
+ +
+ + 'yes')); $url = $PHP_SELF.'/bill/'.$bill_id.'/history/detail=all/'; -echo ' +echo '
+ - - - - - - - - - - + + + + + + + + + '; + + + + '; foreach (dbFetchRows('SELECT * FROM `bill_history` WHERE `bill_id` = ? ORDER BY `bill_datefrom` DESC LIMIT 24', array($bill_id)) as $history) { if (bill_permitted($history['bill_id'])) { @@ -68,7 +80,6 @@ foreach (dbFetchRows('SELECT * FROM `bill_history` WHERE `bill_id` = ? ORDER BY $total_data = format_number($history['traf_total'], $config['billing']['base']); $background = get_percentage_colours($percent); - $row_colour = ((!is_integer($i / 2)) ? $list_colour_a : $list_colour_b); if ($type == 'CDR') { $allowed = formatRates($history['bill_allowed']); @@ -91,7 +102,7 @@ foreach (dbFetchRows('SELECT * FROM `bill_history` WHERE `bill_id` = ? ORDER BY $url = generate_url($vars, array('detail' => $history['bill_hist_id'])); echo ' - + @@ -123,9 +134,8 @@ foreach (dbFetchRows('SELECT * FROM `bill_history` WHERE `bill_id` = ? ORDER BY '; } - - $i++; } //end if }//end foreach -echo '
PeriodTypeAllowedInboundOutboundTotal95th %ileOverusage + PeriodTypeAllowedInboundOutboundTotal95th %ileOverusage Show details Show all details - -
'.strftime('%Y-%m-%d', strtotime($datefrom)).' to '.strftime('%Y-%m-%d', strtotime($dateto))." $type
'; +echo ' +'; diff --git a/html/pages/bill/reset.inc.php b/html/pages/bill/reset.inc.php index 728963abdb..5dc2b18244 100644 --- a/html/pages/bill/reset.inc.php +++ b/html/pages/bill/reset.inc.php @@ -12,8 +12,10 @@ } -

Reset Bill

-
+
+
+
+

Reset Bill

@@ -39,4 +41,7 @@
+
+
+
\ No newline at end of file diff --git a/html/pages/bill/transfer.inc.php b/html/pages/bill/transfer.inc.php index 8898382943..bcbc60beef 100644 --- a/html/pages/bill/transfer.inc.php +++ b/html/pages/bill/transfer.inc.php @@ -30,12 +30,6 @@ $lastmonth = dbFetchCell('SELECT UNIX_TIMESTAMP(DATE_SUB(NOW(), INTERVAL 1 $yesterday = dbFetchCell('SELECT UNIX_TIMESTAMP(DATE_SUB(NOW(), INTERVAL 1 DAY))'); $rightnow = date(U); -echo '

Billed Ports

'; - -foreach ($ports as $port) { - echo generate_port_link($port).' on '.generate_device_link($port).'
'; -} - $cur_days = date('d', (strtotime('now') - strtotime($datefrom))); $total_days = date('d', (strtotime($dateto) - strtotime($datefrom))); @@ -81,65 +75,84 @@ function showPercent($per) { $background = get_percentage_colours($per); $right_background = $background['right']; $left_background = $background['left']; - $res = print_percentage_bar(350, 20, $per, null, 'ffffff', $left_background, $per.'%', 'ffffff', $right_background); + $res = print_percentage_bar(200, 20, $per, null, 'ffffff', $left_background, $per.'%', 'ffffff', $right_background); return $res; }//end showPercent() +?> -echo '

Bill Summary

'; -echo '

Quota Bill (Billing Period from '.$fromtext.' to '.$totext.')

'; -echo ''; -echo ' '; -echo ' '; -echo ' '; -echo ' '; -echo ' '; -echo ' '; -echo ' '; -echo ' '; -echo ' '; -echo ' '; -echo ' '; -echo ' '; -echo ' '; -echo ' '; -echo ' '; -echo ' '; -echo ' '; -echo ' '; +

Transfer Report

+Billing Period from to +

-echo ' '; -echo ' '; -echo ' '; -echo ' '; -echo ' '; -echo ' '; -echo ' '; -echo ' '; -echo ' '; -echo ' '; -echo ' '; -echo ' '; -echo ' '; -echo ' '; -echo ' '; -echo ' '; -echo ' '; -echo ' '; -if ($ousage['over'] > 0 && $bill_data['bill_type'] == 'quota') { - echo ' '; - echo ' '; - echo ' '; - echo ' '; - echo ' '; - echo ' '; - echo ' '; - echo ' '; -} +
+
+ +
+
+
+
+

+ Bill Summary +

+
+
BandwidthUsedAllowedAverageEstimated
Transferred:'.$total['data'].''.$total['allow'].''.$total['ave'].''.$total['est'].''.showPercent($total['per']).'
Inbound:'.$in['data'].''.$in['allow'].''.$in['ave'].''.$in['est'].''.showPercent($in['per']).'
Outbound:'.$out['data'].''.$out['allow'].''.$out['ave'].''.$out['est'].''.showPercent($out['per']).'
Already overusage:'.$ousage['data'].''.$ousage['allow'].''.$ousage['ave'].''.$ousage['est'].''.showPercent($ousage['per']).'
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 0 && $bill_data['bill_type'] == 'quota') { ?> + + + + + + + + + + + +
BandwidthUsedAllowedAverageEstimated
Transferred
Inbound
Outbound
Already overusage
+
+
+
-echo ''; + +"; +?> -echo "

Billing Period View

$bi"; -echo "

Rolling 24 Hour View

$di"; -echo "

Rolling Monthly View

$mi"; +
+
+

Billing Period View

+
+
+ +
+
+ +
+
+

Rolling 24 Hour View

+
+
+ +
+
+ +
+
+

Rolling Monthly View

+
+
+ +
+
\ No newline at end of file diff --git a/html/pages/bills.inc.php b/html/pages/bills.inc.php index f9fef2120c..759a0697d1 100644 --- a/html/pages/bills.inc.php +++ b/html/pages/bills.inc.php @@ -1,6 +1,13 @@ '; - if (is_numeric($bill_id) && is_numeric($_POST['port'])) { dbInsert(array('bill_id' => $bill_id, 'port_id' => $_POST['port']), 'bill_ports'); - $message .= $message_break.'Port '.mres($_POST['port']).' added!'; - $message_break .= '
'; } + + header('Location: /' . generate_url(array('page' => 'bill', 'bill_id' => $bill_id, 'view' => 'edit'))); + exit(); } $pagetitle[] = 'Billing'; @@ -86,171 +91,12 @@ if ($vars['view'] == 'history') { include 'pages/bills/search.inc.php'; include 'pages/bills/pmonth.inc.php'; } -else if ($vars['view'] == 'add') { - if (is_numeric($vars['port'])) { - $port = dbFetchRow('SELECT * FROM `ports` AS P, `devices` AS D WHERE `port_id` = ? AND D.device_id = P.device_id', array($vars['port'])); - } - -?> - -Bill » "; - if (!$vars['view']) { - $vars['view'] = 'add'; - } - - if ($_SESSION['userlevel'] >= '10') { - if ($vars['view'] == 'add') { - echo ""; - } - - echo 'Add'; - if ($vars['view'] == 'add') { - echo ''; - } - } - - echo ''; - print_optionbar_end(); -?> - -

Bill : Add Bill

- -
- - -'.$port['hostname'], '" style="color: #000;"> '.$port['hostname'], $devicebtn); - $devicebtn = str_replace("overlib('", "overlib('
", $devicebtn); - $devicebtn = str_replace("
',;", "
',", $devicebtn); - $portbtn = str_replace('">'.strtolower($port['ifName']), '" style="color: #000;"> '.$port['ifName'].''.$portalias, $portbtn); - $portbtn = str_replace("overlib('", "overlib('
", $portbtn); - $portbtn = str_replace("
',;", "
',", $portbtn); - echo "
\n"; - echo ' \n"; - echo " Ports\n"; - echo "
\n"; - echo "
\n"; - echo "
\n"; - echo ' '.$devicebtn."\n"; - echo ' '.$portbtn."\n"; - echo "
\n"; - echo "
\n"; - echo "
\n"; - echo "
\n"; - } -?> - -
- -
- -
-
-
-
-
- -
- CDR 95th - Quota -
-
-
-
-
-
-
- -
-
- -
-
-
-
- -
-
- -
- -
-
-
-
-

Optional Information

-
- -
- -
-
-
-
-
- -
- -
-
-
-
-
- -
- -
-
-
-
- -
- - - + include 'includes/modal/new_bill.inc.php'; +?> + + @@ -259,7 +105,9 @@ else { - "; + + + - - - - - - - - - - "; - - $i++; - } +?> + + + + + + + + + + + + +
Billing name TypeOverusage
'bill', 'bill_id' => $bill['bill_id']))."'>".$bill['bill_name'].'
'.strftime('%F', strtotime($datefrom)).' to '.strftime('%F', strtotime($dateto))."
$notes$type$allowed$used$overuse".print_percentage_bar(250, 20, $percent, null, 'ffffff', $background['left'], $percent.'%', 'ffffff', $background['right'])." 'bill', 'bill_id' => $bill['bill_id'], 'view' => 'edit'))."'>Edit Edit
+ 'bill', 'bill_id' => $bill['bill_id'])) ?>'> +
+ to +
+ = 10) { ?> + 'bill', 'bill_id' => $bill['bill_id'], 'view' => 'edit')) ?>'>Edit Edit + +
+ + +'; } diff --git a/html/pages/bills/search.inc.php b/html/pages/bills/search.inc.php index b4662ca602..ffa5f6e7f6 100644 --- a/html/pages/bills/search.inc.php +++ b/html/pages/bills/search.inc.php @@ -5,47 +5,39 @@ ?>
-
+
Bills -
-
-
-
-
-
-
-
-
- -
+ + +
Current Billing Period Current Billing Period'; + echo ' Current Billing Period'; } else { // FIXME - generate_url - echo 'Previous Billing Period Previous Billing Period'; + echo ' Previous Billing Period'; } ?> -
-
- Add Add Bill += 10) { ?> + +
diff --git a/html/pages/device/edit/device.inc.php b/html/pages/device/edit/device.inc.php index 0f395b032c..54f56d7311 100644 --- a/html/pages/device/edit/device.inc.php +++ b/html/pages/device/edit/device.inc.php @@ -5,7 +5,7 @@ if ($_POST['editing']) { $override_sysLocation_bool = mres($_POST['override_sysLocation']); if (isset($_POST['sysLocation'])) { - $override_sysLocation_string = mres($_POST['sysLocation']); + $override_sysLocation_string = $_POST['sysLocation']; } if ($device['override_sysLocation'] != $override_sysLocation_bool || $device['location'] != $override_sysLocation_string) { diff --git a/html/pages/device/latency.inc.php b/html/pages/device/latency.inc.php index bc3f962e4e..6f1211c373 100644 --- a/html/pages/device/latency.inc.php +++ b/html/pages/device/latency.inc.php @@ -49,6 +49,7 @@ if ($vars['view'] == 'incoming') { echo ''; $graph_array['type'] = 'device_smokeping_in_all'; + $graph_array['device'] = $device['device_id']; $graph_array['legend'] = no; echo ''; echo '

Aggregate

'; diff --git a/includes/alerts.inc.php b/includes/alerts.inc.php index 5fc0c734e4..6af9c1181d 100644 --- a/includes/alerts.inc.php +++ b/includes/alerts.inc.php @@ -37,7 +37,7 @@ function GenSQL($rule) { return false; } //Pretty-print rule to dissect easier - $pretty = array('*' => ' * ', '(' => ' ( ', ')' => ' ) ', '/' => ' / ', '&&' => ' && ', '||' => ' || ', 'DATE_SUB ( NOW ( )' => 'DATE_SUB( NOW()'); + $pretty = array('*' => '*', '(' => ' ( ', ')' => ' ) ', '/' => '/', '&&' => ' && ', '||' => ' || ', 'DATE_SUB ( NOW ( )' => 'DATE_SUB( NOW()'); $rule = str_replace(array_keys($pretty),$pretty,$rule); $tmp = explode(" ",$rule); $tables = array(); diff --git a/includes/alerts/transport.mail.php b/includes/alerts/transport.mail.php index 60837b300a..56608aa694 100644 --- a/includes/alerts/transport.mail.php +++ b/includes/alerts/transport.mail.php @@ -21,4 +21,4 @@ * @subpackage Alerts */ -return send_mail($obj['contacts'], $obj['title'], $obj['msg']); +return send_mail($obj['contacts'], $obj['title'], $obj['msg'], $opts['html'] ? true : false ); diff --git a/includes/discovery/functions.inc.php b/includes/discovery/functions.inc.php index 7845d70a39..6329886292 100644 --- a/includes/discovery/functions.inc.php +++ b/includes/discovery/functions.inc.php @@ -725,7 +725,7 @@ function avtech_add_sensor($device, $sensor) { global $valid; // set the id, must be unique - if ($sensor['id']) { + if (isset($sensor['id'])) { $id = $sensor['id']; } else { @@ -755,13 +755,13 @@ function avtech_add_sensor($device, $sensor) { d_echo('Sensor value: ' . $value . "\n"); // get the type - $type = $device['type'] ? $device['type'] : 'temperature'; + $type = $sensor['type'] ? $sensor['type'] : 'temperature'; d_echo('Sensor type: ' . $type . "\n"); // set the description if ($sensor['descr_oid']) { - $descr = snmp_get($device, $sensor['descr_oid'], '-OvQ'); + $descr = trim(snmp_get($device, $sensor['descr_oid'], '-OvQ'), '"'); } elseif ($sensor['descr']) { $descr = $sensor['descr']; diff --git a/includes/discovery/sensors/temperatures/avtech.inc.php b/includes/discovery/sensors/temperatures/avtech.inc.php index a9f907fc10..956fed49a4 100644 --- a/includes/discovery/sensors/temperatures/avtech.inc.php +++ b/includes/discovery/sensors/temperatures/avtech.inc.php @@ -8,21 +8,21 @@ if ($device['os'] == 'avtech') { $device_oid = '.1.3.6.1.4.1.20916.1.7.'; $internal = array( - 'id' => 1, + 'id' => 0, 'oid' => $device_oid.'1.1.1.1.0', 'descr_oid' => $device_oid.'1.1.2.0', ); avtech_add_sensor($device, $internal); $sen1 = array( - 'id' => 2, + 'id' => 1, 'oid' => $device_oid.'1.2.1.1.0', 'descr_oid' => $device_oid.'1.2.1.3.0', ); avtech_add_sensor($device, $sen1); $sen2 = array( - 'id' => 3, + 'id' => 2, 'oid' => $device_oid.'1.2.2.1.0', 'descr_oid' => $device_oid.'1.2.2.3.0', ); @@ -33,7 +33,7 @@ if ($device['os'] == 'avtech') { $device_oid = '.1.3.6.1.4.1.20916.1.1.'; $internal = array( - 'id' => 1, + 'id' => 0, 'oid' => $device_oid.'1.1.1.0', 'descr' => 'Internal', 'max_oid' => $device_oid.'3.1.0', @@ -42,7 +42,7 @@ if ($device['os'] == 'avtech') { avtech_add_sensor($device, $internal); $sen1 = array( - 'id' => 2, + 'id' => 1, 'oid' => $device_oid.'1.1.2.0', 'descr' => 'Sensor 1', 'max_oid' => $device_oid.'3.3.0', @@ -51,7 +51,7 @@ if ($device['os'] == 'avtech') { avtech_add_sensor($device, $sen1); $sen2 = array( - 'id' => 3, + 'id' => 2, 'oid' => $device_oid.'1.1.3.0', 'descr' => 'Sensor 2', 'max_oid' => $device_oid.'3.5.0', @@ -60,7 +60,7 @@ if ($device['os'] == 'avtech') { avtech_add_sensor($device, $sen2); $sen3 = array( - 'id' => 4, + 'id' => 3, 'oid' => $device_oid.'1.1.4.0', 'descr' => 'Sensor 3', 'max_oid' => $device_oid.'3.7.0', @@ -74,7 +74,7 @@ if ($device['os'] == 'avtech') { $divisor = 1; $internal = array( - 'id' => 1, + 'id' => 0, 'oid' => $device_oid.'1.1.1.2.0', 'descr_oid' => $device_oid.'1.1.2.1.0', 'divisor' => $divisor, @@ -82,7 +82,7 @@ if ($device['os'] == 'avtech') { avtech_add_sensor($device, $internal); $sen1 = array( - 'id' => 2, + 'id' => 1, 'oid' => $device_oid.'1.2.2.1.0', 'descr_oid' => $device_oid.'1.2.1.6.0', 'divisor' => $divisor, @@ -90,7 +90,7 @@ if ($device['os'] == 'avtech') { avtech_add_sensor($device, $sen1); $sen2 = array( - 'id' => 3, + 'id' => 2, 'oid' => $device_oid.'1.2.2.1.0', 'descr_oid' => $device_oid.'1.2.2.6.0', 'divisor' => $divisor, diff --git a/includes/discovery/sensors/temperatures/hpilo.inc.php b/includes/discovery/sensors/temperatures/hpilo.inc.php index ef50a10036..da180d003e 100644 --- a/includes/discovery/sensors/temperatures/hpilo.inc.php +++ b/includes/discovery/sensors/temperatures/hpilo.inc.php @@ -1,26 +1,28 @@ $item['title'],'body'=>$item['description'],'checksum'=>hash('sha512',$item['title'].$item['description'])); + $obj[] = array( + 'title'=>$item['title'], + 'body'=>$item['description'], + 'checksum'=>hash('sha512',$item['title'].$item['description']), + 'datetime'=>strftime('%F', strtotime($item['pubDate'])) + ); } return $obj; } @@ -92,7 +98,12 @@ function parse_atom($feed) { $feed['entry'] = array( $feed['entry'] ); } foreach ($feed['entry'] as $item) { - $obj[] = array('title'=>$item['title'],'body'=>$item['content'],'checksum'=>hash('sha512',$item['title'].$item['content'])); + $obj[] = array( + 'title'=>$item['title'], + 'body'=>$item['content'], + 'checksum'=>hash('sha512',$item['title'].$item['content']), + 'datetime'=>strftime('%F', strtotime($item['updated'])) + ); } return $obj; } diff --git a/validate.php b/validate.php index f16178d3b0..2ed6750061 100755 --- a/validate.php +++ b/validate.php @@ -139,7 +139,7 @@ if(strstr($strict_mode, 'STRICT_TRANS_TABLES')) { // Test for MySQL InnoDB buffer size $innodb_buffer = innodb_buffer_check(); if ($innodb_buffer['used'] > $innodb_buffer['size']) { - print_fail('Your Innodb buffer size is not big enough...'); + print_warn("Your Innodb buffer is full, consider increasing it's size"); echo warn_innodb_buffer($innodb_buffer); }