diff --git a/AUTHORS.md b/AUTHORS.md index fec1d61546..9c8a165823 100644 --- a/AUTHORS.md +++ b/AUTHORS.md @@ -98,6 +98,7 @@ LibreNMS contributors: - Michael Nguyen (mnguyen1289) - Casey Schoonover (cschoonover91) - Chris A. Evans (thecityofguanyu) +- Rainer Schüler (rschueler) [1]: http://observium.org/ "Observium web site" Observium was written by: diff --git a/doc/API/API-Docs.md b/doc/API/API-Docs.md index b23339ee84..55e28c5db8 100644 --- a/doc/API/API-Docs.md +++ b/doc/API/API-Docs.md @@ -30,6 +30,7 @@ - [`get_devices_by_group`](#api-route-get_devices_by_group) - [`routing`](#api-routing) - [`list_bgp`](#api-route-1) + - [`list_ipsec`](#list_ipsec) - [`switching`](#api-switching) - [`get_vlans`](#api-route-4) - [`alerts`](#api-alerts) @@ -866,6 +867,43 @@ Output: } ``` +### Function: `list_ipsec` [`top`](#top) + +List the current IPSec tunnels which are active. + +Route: /api/v0/routing/ipsec/data/:hostname + +- hostname can be either the device hostname or id + +Input: + + - + +Example: +```curl +curl -H 'X-Auth-Token: YOURAPITOKENHERE' https://librenms.org/api/v0/routing/ipsec/data/localhost +``` + +Output: +```text +{ + "status": "ok", + "err-msg": "", + "count": 0, + "ipsec": [ + "tunnel_id": "1", + "device_id": "1", + "peer_port": "0", + "peer_addr": "127.0.0.1", + "local_addr": "127.0.0.2", + "local_port": "0", + "tunnel_name": "", + "tunnel_status": "active" + ] +} +``` +> Please note, this will only show active VPN sessions not all configured. + ## `Switching` [`top`](#top) ### Function: `get_vlans` [`top`](#top) diff --git a/doc/Support/Discovery Support.md b/doc/Support/Discovery Support.md index acba7527d5..3fad51b0a0 100644 --- a/doc/Support/Discovery Support.md +++ b/doc/Support/Discovery Support.md @@ -44,6 +44,7 @@ $config['discovery_modules']['processors'] = 1; $config['discovery_modules']['mempools'] = 1; $config['discovery_modules']['ipv4-addresses'] = 1; $config['discovery_modules']['ipv6-addresses'] = 1; +$config['discovery_modules']['route'] = 0; $config['discovery_modules']['sensors'] = 1; $config['discovery_modules']['storage'] = 1; $config['discovery_modules']['hr-device'] = 1; @@ -84,6 +85,8 @@ $config['discovery_modules']['charge'] = 1; `ipv6-addresses`: IPv6 Address detection +`route`: Route detection + `sensors`: Sensor detection such as Temperature, Humidity, Voltages + More `storage`: Storage detection for hard disks diff --git a/html/ajax_dash.php b/html/ajax_dash.php index 0ffc580679..6b268f889b 100644 --- a/html/ajax_dash.php +++ b/html/ajax_dash.php @@ -35,6 +35,7 @@ if ($type == 'placeholder') { elseif (is_file('includes/common/'.$type.'.inc.php')) { $results_limit = 10; + $typeahead_limit = $config['webui']['global_search_result_limit']; $no_form = true; $title = ucfirst($type); $unique_id = str_replace(array("-","."),"_",uniqid($type,true)); diff --git a/html/api_v0.php b/html/api_v0.php index 3ca6dc0ad4..021cbb327c 100644 --- a/html/api_v0.php +++ b/html/api_v0.php @@ -128,6 +128,19 @@ $app->group( } ); // End Inventory + // Routing section + $app->group( + '/routing', + function () use ($app) { + $app->group( + '/ipsec', + function () use ($app) { + $app->get('/data/:hostname', 'authToken', 'list_ipsec')->name('list_ipsec'); + } + ); + } + ); + // End Routing } ); $app->get('/v0', 'authToken', 'show_endpoints'); diff --git a/html/images/os/viprinux.png b/html/images/os/viprinux.png new file mode 100644 index 0000000000..0ea9ba6ffd Binary files /dev/null and b/html/images/os/viprinux.png differ diff --git a/html/includes/api_functions.inc.php b/html/includes/api_functions.inc.php index 9a26298909..a3131c5472 100644 --- a/html/includes/api_functions.inc.php +++ b/html/includes/api_functions.inc.php @@ -1288,3 +1288,33 @@ function get_devices_by_group() { echo _json_encode($output); } + +function list_ipsec() { + $app = \Slim\Slim::getInstance(); + $router = $app->router()->getCurrentRoute()->getParams(); + $status = 'error'; + $code = 404; + $message = ''; + $hostname = $router['hostname']; + // use hostname as device_id if it's all digits + $device_id = ctype_digit($hostname) ? $hostname : getidbyname($hostname); + if (!is_numeric($device_id)) { + $message = "No valid hostname or device ID provided"; + } + else { + $ipsec = dbFetchRows("SELECT `D`.`hostname`, `I`.* FROM `ipsec_tunnels` AS `I`, `devices` AS `D` WHERE `I`.`device_id`=? AND `D`.`device_id` = `I`.`device_id`", array($device_id)); + $total = count($ipsec); + $status = 'ok'; + $code = 200; + } + + $output = array( + 'status' => $status, + 'err-msg' => $message, + 'count' => $total, + 'ipsec' => $ipsec, + ); + $app->response->setStatus($code); + $app->response->headers->set('Content-Type', 'application/json'); + echo _json_encode($output); +} diff --git a/html/includes/common/device-summary-horiz.inc.php b/html/includes/common/device-summary-horiz.inc.php index 75d110a375..47ddd4a7ea 100644 --- a/html/includes/common/device-summary-horiz.inc.php +++ b/html/includes/common/device-summary-horiz.inc.php @@ -40,8 +40,8 @@ $temp_output .= ' Services '.$services['count'].' - '.$services['up'].' - '.$services['down'].' + '.$services['up'].' + '.$services['down'].' '.$services['ignored'].' '.$services['disabled'].' '.($config['summary_errors'] ? '-' : '').' diff --git a/html/includes/common/device-summary-vert.inc.php b/html/includes/common/device-summary-vert.inc.php index 647a036302..5f32137966 100644 --- a/html/includes/common/device-summary-vert.inc.php +++ b/html/includes/common/device-summary-vert.inc.php @@ -31,7 +31,7 @@ $temp_output .= ' if ($config['show_services']) { $temp_output .= ' - '. $services['up'] .' + '. $services['up'] .' '; } @@ -47,7 +47,7 @@ $temp_output .= ' if ($config['show_services']) { $temp_output .= ' - '. $services['down'] .' + '. $services['down'] .' '; } diff --git a/html/includes/common/generic-graph.inc.php b/html/includes/common/generic-graph.inc.php index 038154e5c0..022fb0585c 100644 --- a/html/includes/common/generic-graph.inc.php +++ b/html/includes/common/generic-graph.inc.php @@ -204,6 +204,7 @@ function '.$unique_id.'() { }, { source: '.$unique_id.'_device.ttAdapter(), + limit: '.$typeahead_limit.', async: false, templates: { header: "
 Devices
", @@ -240,6 +241,7 @@ function '.$unique_id.'() { }, { source: '.$unique_id.'_port.ttAdapter(), + limit: '.$typeahead_limit.', async: false, templates: { header: "
 Ports
", @@ -275,6 +277,7 @@ function '.$unique_id.'() { }, { source: '.$unique_id.'_application.ttAdapter(), + limit: '.$typeahead_limit.', async: false, templates: { header: "
 Applications
", @@ -312,6 +315,7 @@ function '.$unique_id.'() { }, { source: '.$unique_id.'_munin.ttAdapter(), + limit: '.$typeahead_limit.', async: false, templates: { header: "
 Munin
", @@ -346,6 +350,7 @@ function '.$unique_id.'() { }, { source: '.$unique_id.'_bill.ttAdapter(), + limit: '.$typeahead_limit.', async: false, templates: { header: "
 Bill
", @@ -432,3 +437,4 @@ else { $common_output[] = ''; } + diff --git a/html/includes/graphs/application/shoutcast_multi_bits.inc.php b/html/includes/graphs/application/shoutcast_multi_bits.inc.php index a54d6b8d5a..06f1585109 100644 --- a/html/includes/graphs/application/shoutcast_multi_bits.inc.php +++ b/html/includes/graphs/application/shoutcast_multi_bits.inc.php @@ -27,7 +27,7 @@ $i = 0; if ($handle = opendir($rrddir)) { while (false !== ($file = readdir($handle))) { if ($file != '.' && $file != '..') { - if (eregi('app-shoutcast-'.$app['app_id'], $file)) { + if (stripos($file, 'app-shoutcast-'.$app['app_id']) != false) { array_push($files, $file); } } @@ -35,8 +35,8 @@ if ($handle = opendir($rrddir)) { } foreach ($files as $id => $file) { - $hostname = eregi_replace('app-shoutcast-'.$app['app_id'].'-', '', $file); - $hostname = eregi_replace('.rrd', '', $hostname); + $hostname = str_ireplace('app-shoutcast-'.$app['app_id'].'-', '', $file); + $hostname = str_ireplace('.rrd', '', $hostname); list($host, $port) = explode('_', $hostname, 2); $rrd_filenames[] = $rrddir.'/'.$file; $rrd_list[$i]['filename'] = $rrddir.'/'.$file; diff --git a/html/includes/graphs/application/shoutcast_multi_stats.inc.php b/html/includes/graphs/application/shoutcast_multi_stats.inc.php index a6618207e2..2e2819e84b 100644 --- a/html/includes/graphs/application/shoutcast_multi_stats.inc.php +++ b/html/includes/graphs/application/shoutcast_multi_stats.inc.php @@ -15,7 +15,7 @@ $x = 0; if ($handle = opendir($rrddir)) { while (false !== ($file = readdir($handle))) { if ($file != '.' && $file != '..') { - if (eregi('app-shoutcast-'.$app['app_id'], $file)) { + if (stripos($file, 'app-shoutcast-'.$app['app_id']) !== false) { array_push($files, $file); } } @@ -23,8 +23,8 @@ if ($handle = opendir($rrddir)) { } foreach ($files as $id => $file) { - $hostname = eregi_replace('app-shoutcast-'.$app['app_id'].'-', '', $file); - $hostname = eregi_replace('.rrd', '', $hostname); + $hostname = str_ireplace('app-shoutcast-'.$app['app_id'].'-', '', $file); + $hostname = str_ireplace('.rrd', '', $hostname); list($host, $port) = explode('_', $hostname, 2); $rrd_filenames[] = $rrddir.'/'.$file; $rrd_list[$i]['filename'] = $rrddir.'/'.$file; diff --git a/html/includes/print-menubar.php b/html/includes/print-menubar.php index afc91e645f..1ccdb32d9c 100644 --- a/html/includes/print-menubar.php +++ b/html/includes/print-menubar.php @@ -3,8 +3,9 @@ require $config['install_dir'].'/includes/object-cache.inc.php'; // FIXME - this could do with some performance improvements, i think. possible rearranging some tables and setting flags at poller time (nothing changes outside of then anyways) -$service_status = get_service_status(); -$if_alerts = dbFetchCell("SELECT COUNT(port_id) FROM `ports` WHERE `ifOperStatus` = 'down' AND `ifAdminStatus` = 'up' AND `ignore` = '0'"); +$service_status = get_service_status(); +$typeahead_limit = $config['webui']['global_search_result_limit']; +$if_alerts = dbFetchCell("SELECT COUNT(port_id) FROM `ports` WHERE `ifOperStatus` = 'down' AND `ifAdminStatus` = 'up' AND `ignore` = '0'"); if ($_SESSION['userlevel'] >= 5) { $links['count'] = dbFetchCell("SELECT COUNT(*) FROM `links`"); @@ -717,6 +718,7 @@ $('#gsearch').typeahead({ }, { source: devices.ttAdapter(), + limit: '', async: true, display: 'name', valueKey: 'name', @@ -727,6 +729,7 @@ $('#gsearch').typeahead({ }, { source: ports.ttAdapter(), + limit: '', async: true, display: 'name', valueKey: 'name', @@ -737,6 +740,7 @@ $('#gsearch').typeahead({ }, { source: bgp.ttAdapter(), + limit: '', async: true, display: 'name', valueKey: 'name', @@ -749,3 +753,4 @@ $('#gsearch').bind('typeahead:open', function(ev, suggestion) { $('#gsearch').addClass('search-box'); }); + diff --git a/html/pages/device/apps/shoutcast.inc.php b/html/pages/device/apps/shoutcast.inc.php index f2aadc7f18..f9278c650b 100644 --- a/html/pages/device/apps/shoutcast.inc.php +++ b/html/pages/device/apps/shoutcast.inc.php @@ -10,7 +10,7 @@ $files = array(); if ($handle = opendir($rrddir)) { while (false !== ($file = readdir($handle))) { if ($file != '.' && $file != '..') { - if (eregi('app-shoutcast-'.$app['app_id'], $file)) { + if (stripos($file, 'app-shoutcast-'.$app['app_id']) !== false) { array_push($files, $file); } } @@ -45,8 +45,8 @@ if (isset($total) && $total === true) { } foreach ($files as $id => $file) { - $hostname = eregi_replace('app-shoutcast-'.$app['app_id'].'-', '', $file); - $hostname = eregi_replace('.rrd', '', $hostname); + $hostname = str_ireplace('app-shoutcast-'.$app['app_id'].'-', '', $file); + $hostname = str_ireplace('.rrd', '', $hostname); list($host, $port) = explode('_', $hostname, 2); $graphs = array( 'shoutcast_bits' => 'Traffic Statistics - '.$host.' (Port: '.$port.')', diff --git a/html/pages/device/overview.inc.php b/html/pages/device/overview.inc.php index 278960e766..60bbee5610 100644 --- a/html/pages/device/overview.inc.php +++ b/html/pages/device/overview.inc.php @@ -10,7 +10,7 @@ $ports['disabled'] = dbFetchCell("SELECT COUNT(*) FROM `ports` WHERE device_id = $services = get_service_status($device['device_id']); $services['total'] = array_sum($services); -if ($services[0]) { +if ($services[2]) { $services_colour = $warn_colour_a; } else { diff --git a/html/pages/device/overview/generic/sensor.inc.php b/html/pages/device/overview/generic/sensor.inc.php index a2d8720bcd..f086825624 100644 --- a/html/pages/device/overview/generic/sensor.inc.php +++ b/html/pages/device/overview/generic/sensor.inc.php @@ -1,9 +1,11 @@ - - - + + + diff --git a/html/pages/front/map.php b/html/pages/front/map.php index e2b6b1e7ce..162c898218 100644 --- a/html/pages/front/map.php +++ b/html/pages/front/map.php @@ -157,7 +157,7 @@ echo ' //From default.php - This code is not part of above license. if ($config['enable_syslog']) { $sql = "SELECT *, DATE_FORMAT(timestamp, '".$config['dateformat']['mysql']['compact']."') AS date from syslog ORDER BY seq DESC LIMIT 20"; -$query = mysql_query($sql); + echo('
@@ -196,8 +196,6 @@ echo('
P.device_id AND P.user_id = " . $_SESSION['user_id'] . " ORDER BY `datetime` DESC LIMIT 0,15"; } - $data = mysql_query($query); - echo('
diff --git a/includes/caches/services.inc.php b/includes/caches/services.inc.php index 5024058841..65fa421b4a 100644 --- a/includes/caches/services.inc.php +++ b/includes/caches/services.inc.php @@ -2,8 +2,8 @@ if ($_SESSION['userlevel'] >= 5) { $data['count'] = array( 'query' => 'SELECT COUNT(*) FROM services'); - $data['up'] = array( 'query' => "SELECT COUNT(*) FROM services WHERE `service_ignore` = '0' AND `service_disabled` = '0' AND `service_status` = '1'"); - $data['down'] = array( 'query' => "SELECT COUNT(*) FROM services WHERE `service_ignore` = '0' AND `service_disabled` = '0' AND `service_status` = '0'"); + $data['up'] = array( 'query' => "SELECT COUNT(*) FROM services WHERE `service_ignore` = '0' AND `service_disabled` = '0' AND `service_status` = '0'"); + $data['down'] = array( 'query' => "SELECT COUNT(*) FROM services WHERE `service_ignore` = '0' AND `service_disabled` = '0' AND `service_status` = '2'"); $data['ignored'] = array( 'query' => "SELECT COUNT(*) FROM services WHERE `service_ignore` = '1' AND `service_disabled` = '0'"); $data['disabled'] = array( 'query' => "SELECT COUNT(*) FROM services WHERE `service_disabled` = '1'"); } @@ -14,12 +14,12 @@ else { ); $data['up'] = array( - 'query' => "SELECT COUNT(*) FROM services AS S, devices AS D, devices_perms AS P WHERE P.`user_id` = ? AND P.`device_id` = D.`device_id` AND S.`device_id` = D.`device_id` AND S.`service_ignore` = '0' AND S.`service_disabled` = '0' AND S.`service_status` = '1'", + 'query' => "SELECT COUNT(*) FROM services AS S, devices AS D, devices_perms AS P WHERE P.`user_id` = ? AND P.`device_id` = D.`device_id` AND S.`device_id` = D.`device_id` AND S.`service_ignore` = '0' AND S.`service_disabled` = '0' AND S.`service_status` = '0'", 'params' => array($_SESSION['user_id']), ); $data['down'] = array( - 'query' => "SELECT COUNT(*) FROM services AS S, devices AS D, devices_perms AS P WHERE P.`user_id` = ? AND P.`device_id` = D.`device_id` AND S.`device_id` = D.`device_id` AND S.`service_ignore` = '0' AND S.`service_disabled` = '0' AND S.`service_status` = '0'", + 'query' => "SELECT COUNT(*) FROM services AS S, devices AS D, devices_perms AS P WHERE P.`user_id` = ? AND P.`device_id` = D.`device_id` AND S.`device_id` = D.`device_id` AND S.`service_ignore` = '0' AND S.`service_disabled` = '0' AND S.`service_status` = '2'", 'params' => array($_SESSION['user_id']), ); diff --git a/includes/common.php b/includes/common.php index 36f2a5dc2d..a1a7ab38d5 100644 --- a/includes/common.php +++ b/includes/common.php @@ -699,8 +699,8 @@ function get_smokeping_files($device) { if ($handle = opendir($smokeping_dir)) { while (false !== ($file = readdir($handle))) { if ($file != '.' && $file != '..') { - if (eregi('.rrd', $file)) { - if (eregi('~', $file)) { + if (stripos($file, '.rrd') !== false) { + if (strpos($file, '~') !== false) { list($target,$slave) = explode('~', str_replace('.rrd', '', $file)); $target = str_replace('_', '.', $target); $smokeping_files['in'][$target][$slave] = $file; diff --git a/includes/defaults.inc.php b/includes/defaults.inc.php index c99bfd6f63..b1650a5660 100644 --- a/includes/defaults.inc.php +++ b/includes/defaults.inc.php @@ -439,7 +439,7 @@ $config['enable_pseudowires'] = 1; $config['enable_vrfs'] = 1; // Enable VRFs $config['enable_vrf_lite_cisco'] = 1; -// Enable VRF lite cisco +// Enable routes for VRF lite cisco $config['enable_printers'] = 0; // Enable Printer support $config['enable_sla'] = 0; @@ -728,6 +728,7 @@ $config['discovery_modules']['mempools'] = 1; $config['discovery_modules']['cisco-vrf-lite'] = 1; $config['discovery_modules']['ipv4-addresses'] = 1; $config['discovery_modules']['ipv6-addresses'] = 1; +$config['discovery_modules']['route'] = 0; $config['discovery_modules']['sensors'] = 1; $config['discovery_modules']['storage'] = 1; $config['discovery_modules']['hr-device'] = 1; @@ -871,3 +872,4 @@ $config['ignore_unmapable_port'] = False; // InfluxDB default configuration $config['influxdb']['timeout'] = 0; $config['influxdb']['verifySSL'] = false; + diff --git a/includes/definitions.inc.php b/includes/definitions.inc.php index 27bebfa550..e3aa214fc9 100644 --- a/includes/definitions.inc.php +++ b/includes/definitions.inc.php @@ -95,6 +95,16 @@ $config['os'][$os]['over'][1]['text'] = 'Processor Usage'; $config['os'][$os]['over'][2]['graph'] = 'device_ucd_memory'; $config['os'][$os]['over'][2]['text'] = 'Memory Usage'; +$os = 'viprinux'; +$config['os'][$os]['text'] = 'Viprinux'; +$config['os'][$os]['type'] = 'network'; +$config['os'][$os]['icon'] = 'viprinux'; +$config['os'][$os]['ifname'] = 1; +$config['os'][$os]['over'][0]['graph'] = 'device_bits'; +$config['os'][$os]['over'][0]['text'] = 'Device Traffic'; +$config['os'][$os]['over'][1]['graph'] = 'device_processor'; +$config['os'][$os]['over'][1]['text'] = 'Processor Usage'; + $os = 'edgeos'; $config['os'][$os]['text'] = 'EdgeOS'; $config['os'][$os]['type'] = 'network'; diff --git a/includes/discovery/mempools/ironware-dyn.inc.php b/includes/discovery/mempools/ironware-dyn.inc.php index 97934dc724..8f8966ef04 100644 --- a/includes/discovery/mempools/ironware-dyn.inc.php +++ b/includes/discovery/mempools/ironware-dyn.inc.php @@ -1,11 +1,45 @@ $entry) { + + d_echo($index.' '.$entry['snAgentBrdMainBrdDescription'].' -> '.$entry['snAgentBrdMemoryUtil100thPercent']."\n"); + + $usage_oid = '.1.3.6.1.4.1.1991.1.1.2.2.1.1.28.'.$index; + $descr = $entry['snAgentBrdMainBrdDescription']; + $usage = ($entry['snAgentBrdMemoryUtil100thPercent'] / 100); + if (!strstr($descr, 'No') && !strstr($usage, 'No') && $descr != '') { + discover_mempool($valid_mempool, $device, $index, 'ironware-dyn', $descr, '1', null, null); + } //end_if + } //end_foreach + } //end_if + } //end_else +} //end_if + + - if (is_numeric($percent)) { - discover_mempool($valid_mempool, $device, 0, 'ironware-dyn', 'Dynamic Memory', '1', null, null); - } -} diff --git a/includes/discovery/os/poweralert.inc.php b/includes/discovery/os/poweralert.inc.php index fd4a4e1bcd..14c328ad69 100644 --- a/includes/discovery/os/poweralert.inc.php +++ b/includes/discovery/os/poweralert.inc.php @@ -1,7 +1,7 @@ and Mathieu Millet + * 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. + * + * 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 General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . */ + + +//This file is a litle diferent, because the route depend of the vrf, not of the context, +//like the others, so if i use the context, you will have the same information n time the context how have the same VRF +global $debug; + + +$ids = array(); + +// For the moment only will be cisco and the version 3 +if ($device['os_group'] == "cisco") { + + echo ("ROUTE : "); + //RFC1213-MIB + $mib = "RFC1213-MIB"; + //IpRouteEntry + $vrfs_lite_cisco = array(); + + if (key_exists('vrf_lite_cisco', $device) && (count($device['vrf_lite_cisco']) != 0)) { + + //i will only get one context of vrf, read the begin of this file + foreach ($device['vrf_lite_cisco'] as $vrf_lite) { + if (!key_exists($vrf_lite['vrf_name'], $vrfs_lite_cisco)) { + $vrfs_lite_cisco[$vrf_lite['vrf_name']] = $vrf_lite; + } + } + } + else { + $vrfs_lite_cisco = array(array('context_name' => null)); + } + + $tableRoute = array(); + + foreach ($vrfs_lite_cisco as $vrf_lite) { + $device['context_name'] = $vrf_lite['context_name']; + + ////////////////ipRouteDest////////////////// + $oid = '.1.3.6.1.2.1.4.21.1.1'; + $resultHelp = snmp_walk($device, $oid, "-Osqn", $mib, NULL); + $resultHelp = trim($resultHelp); + $resultHelp = str_replace("$oid.", "", $resultHelp); + + foreach (explode("\n", $resultHelp) as $ipRouteDest) { + list($ip, $value) = explode(" ", $ipRouteDest); + $tableRoute[$ip]['ipRouteDest'] = $value; + } + + /////////////////ipRouteIfIndex////////////// + $oid = '.1.3.6.1.2.1.4.21.1.2'; + $resultHelp = snmp_walk($device, $oid, "-Osqn", $mib, NULL); + $resultHelp = trim($resultHelp); + $resultHelp = str_replace("$oid.", "", $resultHelp); + + foreach (explode("\n", $resultHelp) as $ipRouteIfIndex) { + list($ip, $value) = explode(" ", $ipRouteIfIndex); + $tableRoute[$ip]['ipRouteIfIndex'] = $value; + } + + ///////////////ipRouteMetric1/////////////// + $oid = '.1.3.6.1.2.1.4.21.1.3'; + $resultHelp = snmp_walk($device, $oid, "-Osqn", $mib, NULL); + $resultHelp = trim($resultHelp); + $resultHelp = str_replace("$oid.", "", $resultHelp); + + foreach (explode("\n", $resultHelp) as $ipRouteMetric) { + list($ip, $value) = explode(" ", $ipRouteMetric); + $tableRoute[$ip]['ipRouteMetric'] = $value; + } + + ////////////ipRouteNextHop////////////////// + $oid = '.1.3.6.1.2.1.4.21.1.7'; + $resultHelp = snmp_walk($device, $oid, "-Osqn", $mib, NULL); + $resultHelp = trim($resultHelp); + $resultHelp = str_replace("$oid.", "", $resultHelp); + foreach (explode("\n", $resultHelp) as $ipRouteNextHop) { + list($ip, $value) = explode(" ", $ipRouteNextHop); + $tableRoute[$ip]['ipRouteNextHop'] = $value; + } + + ////////////ipRouteType///////////////////// + $oid = '.1.3.6.1.2.1.4.21.1.8'; + $resultHelp = snmp_walk($device, $oid, "-Osqn", $mib, NULL); + $resultHelp = trim($resultHelp); + $resultHelp = str_replace("$oid.", "", $resultHelp); + + foreach (explode("\n", $resultHelp) as $ipRouteType) { + list($ip, $value) = explode(" ", $ipRouteType); + $tableRoute[$ip]['ipRouteType'] = $value; + } + + ///////////ipRouteProto////////////////////// + $oid = '.1.3.6.1.2.1.4.21.1.9'; + $resultHelp = snmp_walk($device, $oid, "-Osqn", $mib, NULL); + $resultHelp = trim($resultHelp); + $resultHelp = str_replace("$oid.", "", $resultHelp); + + + foreach (explode("\n", $resultHelp) as $ipRouteProto) { + list($ip, $value) = explode(" ", $ipRouteProto); + $tableRoute[$ip]['ipRouteProto'] = $value; + } + + /* + ///////////ipRouteAge////////////////////// + $oid = '.1.3.6.1.2.1.4.21.1.10'; + $resultHelp = snmp_walk($device, $oid, "-Osqn", $mib, NULL); + $resultHelp = str_replace("$oid.", "", $resultHelp); + + foreach (explode("\n", $resultHelp) as $ipRouteAge) { + list($ip,$value)=explode(" ",$ipRouteAge); + $tableRoute[$ip]['ipRouteAge']=$value; + } */ + + ///////////ipRouteMask////////////////////// + $oid = '.1.3.6.1.2.1.4.21.1.11'; + $resultHelp = snmp_walk($device, $oid, "-Osqn -Ln", $mib, NULL); + $resultHelp = trim($resultHelp); + $resultHelp = str_replace("$oid.", "", $resultHelp); + + foreach (explode("\n", $resultHelp) as $ipRouteMask) { + list($ip, $value) = explode(" ", $ipRouteMask); + $tableRoute[$ip]['ipRouteMask'] = $value; + } + + if ($debug) { + echo 'Table routage'; + var_dump($tableRoute); + } + + foreach ($tableRoute as $ipRoute) { + if (empty($ipRoute['ipRouteDest']) || $ipRoute['ipRouteDest'] == '') { + continue; + } + + $oldRouteRow = dbFetchRow('select * from route where device_id = ? AND ipRouteDest = ? AND context_name = ?', array($device['device_id'], $ipRoute['ipRouteDest'], $device['context_name'])); + if (!empty($oldRouteRow)) { + unset($oldRouteRow['discoveredAt']); + $changeRoute = array(); + foreach ($ipRoute as $key => $value) { + if ($oldRouteRow[$key] != $value) { + $changeRoute[$key] = $value; + } + } + if (!empty($changeRoute)) { + dbUpdate($changeRoute, 'route', 'device_id = ? and ipRouteDest = ? and context_name = ?', array($device['device_id'], $ipRoute['ipRouteDest'], $device['context_name'])); + } + } else { + + $toInsert = array_merge($ipRoute, array('device_id' => $device['device_id'], 'context_name' => $device['context_name'], 'discoveredAt' => time())); + dbInsert($toInsert, 'route'); + } + } + // unset($tableRoute); + } + + unset($vrfs_lite_cisco); +} diff --git a/includes/discovery/sensors/states/netonix.inc.php b/includes/discovery/sensors/states/netonix.inc.php new file mode 100644 index 0000000000..093e43b5be --- /dev/null +++ b/includes/discovery/sensors/states/netonix.inc.php @@ -0,0 +1,59 @@ + + * 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 ($device['os'] == 'netonix') { + + $temp = snmpwalk_cache_multi_oid($device, '.1.3.6.1.4.1.46242.5.1.2', array()); + $cur_oid = '.1.3.6.1.4.1.'; + + if (is_array($temp)) { + //Create State Index + $state_name = 'netonixPoeStatus'; + $state_index_id = create_state_index($state_name); + + $states_ids = array( + 'Off' => 1, + '24V' => 2, + '48V' => 3 + ); + + //Create State Translation + if ($state_index_id !== null) { + $states = array( + array($state_index_id,'Off',0,1,-1) , + array($state_index_id,'24V',0,2,0) , + array($state_index_id,'48V',0,3,1) , + ); + foreach($states as $value){ + $insert = array( + 'state_index_id' => $value[0], + 'state_descr' => $value[1], + 'state_draw_graph' => $value[2], + 'state_value' => $value[3], + 'state_generic_value' => $value[4] + ); + dbInsert($insert, 'state_translations'); + } + } + + foreach ($temp as $index => $entry) { + $id = substr($index, strrpos($index, '.')+1); + $descr = 'Port ' . $id . ' PoE'; + $current = $states_ids[$entry['enterprises']]; + //Discover Sensors + discover_sensor($valid['sensor'], 'state', $device, $cur_oid.$index, $id, $state_name, $descr, '1', '1', null, null, null, null, $current); + + //Create Sensor To State Index + create_sensor_to_state_index($device, $state_name, $id); + } + } +} diff --git a/includes/discovery/sensors/temperatures/dnos.inc.php b/includes/discovery/sensors/temperatures/dnos.inc.php new file mode 100644 index 0000000000..827e42056b --- /dev/null +++ b/includes/discovery/sensors/temperatures/dnos.inc.php @@ -0,0 +1,22 @@ + $t) { + $t = explode(' ',$t); + $oid = $t[0]; + $val = $t[1]; + + if (substr($oid, -1) == '1') { + // This code will only pull CPU temp for each stack member, but there is no reason why the additional values couldn't be graphed + $counter = $counter + 1; + discover_sensor($valid['sensor'], 'temperature', $device, $oid, $counter, 'dnos', + 'Unit '.$counter.' CPU temperature', '1', '1', null, null, null, null, $val); + } + } +} diff --git a/includes/polling/functions.inc.php b/includes/polling/functions.inc.php index e743495625..a34ba514e9 100644 --- a/includes/polling/functions.inc.php +++ b/includes/polling/functions.inc.php @@ -44,6 +44,13 @@ function poll_sensor($device, $class, $unit) { } else if ($class == 'state') { $sensor_value = trim(str_replace('"', '', snmp_walk($device, $sensor['sensor_oid'], '-Oevq', 'SNMPv2-MIB'))); + if (!is_numeric($sensor_value)) { + $state_value = dbFetchCell('SELECT `state_value` FROM `state_translations` LEFT JOIN `sensors_to_state_indexes` ON `state_translations`.`state_index_id` = `sensors_to_state_indexes`.`state_index_id` WHERE `sensors_to_state_indexes`.`sensor_id` = ? AND `state_translations`.`state_descr` LIKE ?', array($sensor['sensor_id'], $sensor_value)); + d_echo('State value of ' . $sensor_value . ' is ' . $state_value . "\n"); + if (is_numeric($state_value)) { + $sensor_value = $state_value; + } + } } else if ($class == 'signal') { $currentOS = $device['os']; diff --git a/includes/polling/mempools/ironware-dyn.inc.php b/includes/polling/mempools/ironware-dyn.inc.php index ed315eff8f..c3dea7b688 100644 --- a/includes/polling/mempools/ironware-dyn.inc.php +++ b/includes/polling/mempools/ironware-dyn.inc.php @@ -1,7 +1,36 @@ 0) { edit_service($update,$service['service_id']); } diff --git a/irc.php b/irc.php index 21d2b7260b..c1f4b7aefc 100755 --- a/irc.php +++ b/irc.php @@ -416,7 +416,7 @@ class ircbot { private function chkdb() { if (!is_resource($this->sql)) { - if (($this->sql = mysql_connect($this->config['db_host'], $this->config['db_user'], $this->config['db_pass'])) != false && mysql_select_db($this->config['db_name'])) { + if (($this->sql = mysqli_connect($this->config['db_host'], $this->config['db_user'], $this->config['db_pass'])) != false && mysqli_select_db($this->sql, $this->config['db_name'])) { return true; } else { diff --git a/mibs/VIPRINET-MIB b/mibs/VIPRINET-MIB new file mode 100644 index 0000000000..3e2e7102f6 --- /dev/null +++ b/mibs/VIPRINET-MIB @@ -0,0 +1,831 @@ +VIPRINET-MIB DEFINITIONS ::= BEGIN + +IMPORTS + MODULE-IDENTITY, OBJECT-TYPE, Integer32, Counter32, enterprises, TimeTicks + FROM SNMPv2-SMI + DisplayString + FROM SNMPv2-TC + OBJECT-GROUP, MODULE-COMPLIANCE + FROM SNMPv2-CONF +; + +viprinet MODULE-IDENTITY + LAST-UPDATED "201509281620Z" -- 28 September 2015 + ORGANIZATION "Viprinet" + CONTACT-INFO "Viprinet" + DESCRIPTION "This MIB complements the ViprinetMIB." + REVISION "201509281620Z" -- 28 September 2015 + DESCRIPTION "Seventh revision." + ::= { enterprises 35424 } + +vpnRouter OBJECT IDENTIFIER ::= { viprinet 1 } + +vpnRouterInfo OBJECT IDENTIFIER ::= { vpnRouter 1 } +vpnRouterHealth OBJECT IDENTIFIER ::= { vpnRouter 2 } +vpnRouterFans OBJECT IDENTIFIER ::= { vpnRouter 3 } +vpnRouterInterfaces OBJECT IDENTIFIER ::= { vpnRouter 4 } +vpnRouterTunnels OBJECT IDENTIFIER ::= { vpnRouter 5 } +vpnRouterTunnelChannels OBJECT IDENTIFIER ::= { vpnRouter 6 } + + +vpnRouterName OBJECT-TYPE + SYNTAX OCTET STRING (SIZE (64)) + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "A short descriptive name of the router." + ::= { vpnRouterInfo 1 } + +vpnRouterSerial OBJECT-TYPE + SYNTAX OCTET STRING (SIZE (19)) + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "Serial number of this router." + ::= { vpnRouterInfo 2 } + +vpnRouterModel OBJECT-TYPE + SYNTAX OCTET STRING (SIZE (6)) + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "Router Model" + ::= { vpnRouterInfo 3 } + +vpnRouterFirmware OBJECT-TYPE + SYNTAX OCTET STRING (SIZE (22)) + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "Firmware Version currently running on this router." + ::= { vpnRouterInfo 4 } + +vpnRouterMode OBJECT-TYPE + SYNTAX Integer32 (0..3) + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "Current mode that the router is running in. Possible values are: + 0 - Node + 1 - Hub + 2 - Hub running as HotSpare + 3 - Hotspare-Hub replacing another router" + ::= { vpnRouterInfo 5 } + +vpnRouteruptime OBJECT-TYPE + SYNTAX TimeTicks + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "Elapsed time since the router has booted." + ::= { vpnRouterInfo 6 } + +vpnRouterFirmwareStatus OBJECT-TYPE + SYNTAX Integer32 (0..4) + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "Current Status of the Update System. Possible values are: + 0 - Idle / No new firmware available + 1 - Updates Available + 2 - Checking for Updates + 3 - Downloading Update + 4 - Installing Update" + ::= { vpnRouterInfo 7 } + + +vpnRouterCPULoad OBJECT-TYPE + SYNTAX OCTET STRING (SIZE (3)) + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "Load average on this router" + ::= { vpnRouterHealth 1 } + +vpnRouterMemoryUsage OBJECT-TYPE + SYNTAX Integer32 + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "Current total memory usage (in KByte)." + ::= { vpnRouterHealth 2 } + +vpnRouterSystemTemperature OBJECT-TYPE + SYNTAX Integer32(0..65535) + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "Current system temperature (in degree Celsius)." + ::= { vpnRouterHealth 3 } + +vpnRouterCPUTemperature OBJECT-TYPE + SYNTAX Integer32(0..65535) + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "Current CPU temperature (in degree Celsius)" + ::= { vpnRouterHealth 4 } + +vpnRouterPowerSupplyFailure OBJECT-TYPE + SYNTAX Integer32(0..1) + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "Information about the PSU + Possible Values are: + 0 = no failure + 1 = a single PSU is out of order" + ::= { vpnRouterHealth 5 } + +vpnRouterFanCount OBJECT-TYPE + SYNTAX Integer32 + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "Number of Fans." + ::= { vpnRouterFans 1 } + +vpnRouterFanTable OBJECT-TYPE + SYNTAX SEQUENCE OF VpnRouterFanEntry + MAX-ACCESS not-accessible + STATUS current + DESCRIPTION + "The table holding information to each fan." + ::= { vpnRouterFans 2 } + +vpnRouterFanEntry OBJECT-TYPE + SYNTAX VpnRouterFanEntry + MAX-ACCESS not-accessible + STATUS current + DESCRIPTION + "The entry associated with each fan." + INDEX {vpnRouterFanIndex} + ::= { vpnRouterFanTable 1 } + +VpnRouterFanEntry ::= SEQUENCE { + vpnRouterFanIndex Integer32, + vpnRouterFanAdminStatus Integer32, + vpnRouterFanOperativeStatus Integer32, + vpnRouterFanRPM Integer32 +} + +vpnRouterFanIndex OBJECT-TYPE + SYNTAX Integer32(0..65535) + MAX-ACCESS not-accessible + STATUS current + DESCRIPTION + "ID-Number of the fan" + ::= { vpnRouterFanEntry 1 } + +vpnRouterFanAdminStatus OBJECT-TYPE + SYNTAX Integer32(0..1) + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "Desired state of this Fan + Possible Values: + 0 = off + 1 = on" + ::= { vpnRouterFanEntry 2 } + +vpnRouterFanOperativeStatus OBJECT-TYPE + SYNTAX Integer32(0..2) + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "Operative status of this fan + 0 = Disabled + 1 = OK + 2 = Faulty" + ::= { vpnRouterFanEntry 3 } + +vpnRouterFanRPM OBJECT-TYPE + SYNTAX Integer32(0..65535) + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "Current RPM of this fan. Note that not all models supply this info." + ::= { vpnRouterFanEntry 4 } + +vpnRouterInterfaceCount OBJECT-TYPE + SYNTAX Integer32 + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "Number of Interfaces." + ::= { vpnRouterInterfaces 1 } + +vpnRouterInterfaceTable OBJECT-TYPE + SYNTAX SEQUENCE OF VpnRouterInterfaceEntry + MAX-ACCESS not-accessible + STATUS current + DESCRIPTION + "The table holding information to each interface." + ::= { vpnRouterInterfaces 2 } + +vpnRouterInterfaceEntry OBJECT-TYPE + SYNTAX VpnRouterInterfaceEntry + MAX-ACCESS not-accessible + STATUS current + DESCRIPTION + "The entry associated with each interface." + INDEX {vpnRouterInterfaceIndex} + ::= { vpnRouterInterfaceTable 1 } + +VpnRouterInterfaceEntry ::= SEQUENCE { + vpnRouterInterfaceIndex Integer32, + vpnRouterInterfaceName DisplayString, + vpnRouterInterfaceAdminStatus Integer32, + vpnRouterInterfaceOperativeStatus Integer32, + vpnRouterInterfaceBandwidthToWan Integer32, + vpnRouterInterfaceBandwidthFromWan Integer32, + vpnRouterInterfaceTrafficUp Counter32, + vpnRouterInterfaceTrafficDown Counter32, + vpnRouterInterfaceSignalStrength Integer32, + vpnRouterInterfaceServiceType DisplayString, + vpnRouterInterfaceServiceStatus DisplayString, + vpnRouterInterfaceRoaming Integer32, + vpnRouterInterfaceServiceStatus DisplayString, + vpnRouterInterfaceNetworkName DisplayString, + vpnRouterInterfaceBandInfo DisplayString, + vpnRouterInterfaceIMSI DisplayString, + vpnRouterInterfaceIMEI DisplayString, + vpnRouterInterfacePINStatus DisplayString, + vpnRouterInterfaceRFBand Integer32, + vpnRouterInterfaceRFChannel Integer32, + vpnRouterInterfaceSyncrateUpstream Counter32, + vpnRouterInterfaceSyncrateDownstream Counter32 +} + +vpnRouterInterfaceIndex OBJECT-TYPE + SYNTAX Integer32(0..65535) + MAX-ACCESS not-accessible + STATUS current + DESCRIPTION + "ID-Number of the interface." + ::= { vpnRouterInterfaceEntry 1 } + +vpnRouterInterfaceName OBJECT-TYPE + SYNTAX DisplayString + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "A short descriptive name of the interface" + ::= { vpnRouterInterfaceEntry 2 } + +vpnRouterInterfaceAdminStatus OBJECT-TYPE + SYNTAX Integer32(0..1) + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "Desired state of the interface. + possible values: 0 = disconnected, 1 = connected" + ::= { vpnRouterInterfaceEntry 3 } + +vpnRouterInterfaceOperativeStatus OBJECT-TYPE + SYNTAX Integer32(0..3) + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "Current state of the interface. + possible values: + 0 = disconnected, + 1 = connected, + 2 = connecting, + 3 = disconnecting" + ::= { vpnRouterInterfaceEntry 4 } + +vpnRouterInterfaceBandwidthToWan OBJECT-TYPE + SYNTAX Integer32 + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "Theoretical maximum upstream (in KBit). Might be illusional." + ::= { vpnRouterInterfaceEntry 5 } + +vpnRouterInterfaceBandwidthFromWan OBJECT-TYPE + SYNTAX Integer32 + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "Theoretical maximum downstream (in KBit)." + ::= { vpnRouterInterfaceEntry 6 } + +vpnRouterInterfaceTrafficUp OBJECT-TYPE + SYNTAX Counter32 + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "Total upstream traffic made (in Byte) since router boot." + ::= { vpnRouterInterfaceEntry 7 } + +vpnRouterInterfaceTrafficDown OBJECT-TYPE + SYNTAX Counter32 + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "Total downstream traffic made (in Byte) since router boot." + ::= { vpnRouterInterfaceEntry 8 } + +vpnRouterInterfaceSignalStrength OBJECT-TYPE + SYNTAX Integer32 + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "Signal Strength (in percent)." + ::= { vpnRouterInterfaceEntry 9 } + +vpnRouterInterfaceServiceType OBJECT-TYPE + SYNTAX DisplayString + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "Interface Service Type." + ::= { vpnRouterInterfaceEntry 10 } + +vpnRouterInterfaceServiceStatus OBJECT-TYPE + SYNTAX DisplayString + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "Service Status." + ::= { vpnRouterInterfaceEntry 11 } + +vpnRouterInterfaceRoaming OBJECT-TYPE + SYNTAX Integer32(0..1) + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "Interface Roaming. + possible values: + 0 = off, + 1 = on" + ::= { vpnRouterInterfaceEntry 12 } + +vpnRouterInterfaceNetworkName OBJECT-TYPE + SYNTAX DisplayString + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "Interface Network Name." + ::= { vpnRouterInterfaceEntry 13 } + +vpnRouterInterfaceBandInfo OBJECT-TYPE + SYNTAX DisplayString + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "Interface Band Info." + ::= { vpnRouterInterfaceEntry 14 } + +vpnRouterInterfaceIMSI OBJECT-TYPE + SYNTAX DisplayString + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "Interface IMSI." + ::= { vpnRouterInterfaceEntry 15 } + +vpnRouterInterfaceIMEI OBJECT-TYPE + SYNTAX DisplayString + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "Interface IMEI." + ::= { vpnRouterInterfaceEntry 16 } + +vpnRouterInterfacePINStatus OBJECT-TYPE + SYNTAX DisplayString + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "Interface PIN Status." + ::= { vpnRouterInterfaceEntry 17 } + +vpnRouterInterfaceRFBand OBJECT-TYPE + SYNTAX Integer32 + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "Interface RF Band." + ::= { vpnRouterInterfaceEntry 18 } + +vpnRouterInterfaceRFChannel OBJECT-TYPE + SYNTAX Integer32 + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "Interface RF Channel." + ::= { vpnRouterInterfaceEntry 19 } + +vpnRouterInterfaceSyncrateUpstream OBJECT-TYPE + SYNTAX Counter32 + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "Interface Syncrate Upstream." + ::= { vpnRouterInterfaceEntry 20 } + +vpnRouterInterfaceSyncrateDownstream OBJECT-TYPE + SYNTAX Counter32 + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "Interface Syncrate Downstream." + ::= { vpnRouterInterfaceEntry 21 } + +vpnRouterTunnelCount OBJECT-TYPE + SYNTAX Integer32 + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "Number of Tunnels." + ::= { vpnRouterTunnels 1 } + +vpnRouterTunnelTable OBJECT-TYPE + SYNTAX SEQUENCE OF VpnRouterTunnelEntry + MAX-ACCESS not-accessible + STATUS current + DESCRIPTION + "The table holding information to each tunnel." + ::= { vpnRouterTunnels 2 } + +vpnRouterTunnelEntry OBJECT-TYPE + SYNTAX VpnRouterTunnelEntry + MAX-ACCESS not-accessible + STATUS current + DESCRIPTION + "The entry associated with each tunnel." + INDEX {vpnRouterTunnelIndex} + ::= { vpnRouterTunnelTable 1 } + +VpnRouterTunnelEntry ::= SEQUENCE { + vpnRouterTunnelIndex Integer32, + vpnRouterTunnelName DisplayString, + vpnRouterTunnelAdminStatus Integer32, + vpnRouterTunnelOperativeStatus Integer32, + vpnRouterTunnelCumulatedBandwidthToWan Integer32, + vpnRouterTunnelCumulatedBandwidthFromWan Integer32, + vpnRouterTunnelCurrentCumulatedBandwidthToWan Integer32, + vpnRouterTunnelCurrentCumulatedBandwidthFromWan Integer32, + vpnRouterTunnelTrafficUp Counter32, + vpnRouterTunnelTrafficDown Counter32, + vpnRouterTunnelRemoteRouterSerial DisplayString +} + +vpnRouterTunnelIndex OBJECT-TYPE + SYNTAX Integer32(0..65535) + MAX-ACCESS not-accessible + STATUS current + DESCRIPTION + "ID-Number of the tunnel." + ::= { vpnRouterTunnelEntry 1 } + +vpnRouterTunnelName OBJECT-TYPE + SYNTAX DisplayString + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "Name of VPN tunnel" + ::= { vpnRouterTunnelEntry 2 } + +vpnRouterTunnelAdminStatus OBJECT-TYPE + SYNTAX Integer32(0..1) + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "Desired state of the tunnel. + possible values: 0 = disconnected, 1 = connected" + ::= { vpnRouterTunnelEntry 3 } + +vpnRouterTunnelOperativeStatus OBJECT-TYPE + SYNTAX Integer32(0..1) + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "Current state of the tunnel. + possible values: + 0 = disconnected, + 1 = connected" + ::= { vpnRouterTunnelEntry 4 } + +vpnRouterTunnelCumulatedBandwidthToWan OBJECT-TYPE + SYNTAX Integer32 + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "Theoretical maximum cumulated downstream (in KBit), considering all active channels." + ::= { vpnRouterTunnelEntry 5 } + +vpnRouterTunnelCumulatedBandwidthFromWan OBJECT-TYPE + SYNTAX Integer32 + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "Theoretical maximum cumulated upstream (in KBit), considering all active channels." + ::= { vpnRouterTunnelEntry 6 } + +vpnRouterTunnelCurrentCumulatedBandwidthToWan OBJECT-TYPE + SYNTAX Integer32 + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "Current cumulated upstream (in KBit)." + ::= { vpnRouterTunnelEntry 7 } + +vpnRouterTunnelCurrentCumulatedBandwidthFromWan OBJECT-TYPE + SYNTAX Integer32 + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "Current cumulated downstream (in KBit)." + ::= { vpnRouterTunnelEntry 8 } + +vpnRouterTunnelTrafficUp OBJECT-TYPE + SYNTAX Counter32 + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "Total upstream traffic made (in Byte) since router boot." + ::= { vpnRouterTunnelEntry 9 } + +vpnRouterTunnelTrafficDown OBJECT-TYPE + SYNTAX Counter32 + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "Total downstream traffic made (in Byte) since router boot." + ::= { vpnRouterTunnelEntry 10 } + +vpnRouterTunnelRemoteRouterSerial OBJECT-TYPE + SYNTAX DisplayString + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "Serial of the remote router." + ::= { vpnRouterTunnelEntry 11 } + +vpnRouterTunnelChannelCount OBJECT-TYPE + SYNTAX Integer32 + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "Number of TunnelChannel." + ::= { vpnRouterTunnelChannels 1 } + +vpnRouterTunnelChannelTable OBJECT-TYPE + SYNTAX SEQUENCE OF VpnRouterTunnelChannelEntry + MAX-ACCESS not-accessible + STATUS current + DESCRIPTION + "The table holding information to each tunnelchannel." + ::= { vpnRouterTunnelChannels 2 } + +vpnRouterTunnelChannelEntry OBJECT-TYPE + SYNTAX VpnRouterTunnelChannelEntry + MAX-ACCESS not-accessible + STATUS current + DESCRIPTION + "The entry associated with each tunnelchannel." + INDEX {vpnRouterTunnelChannelIndex} + ::= { vpnRouterTunnelChannelTable 1 } + +VpnRouterTunnelChannelEntry ::= SEQUENCE { + vpnRouterTunnelChannelIndex Integer32, + vpnRouterTunnelChannelName DisplayString, + vpnRouterTunnelChannelAdminStatus Integer32, + vpnRouterTunnelChannelOperativeStatus Integer32, + vpnRouterTunnelChannelMaxBandwidthToWan Integer32, + vpnRouterTunnelChannelMaxBandwidthFromWan Integer32, + vpnRouterTunnelChannelCurrentBandwidthToWan Integer32, + vpnRouterTunnelChannelCurrentBandwidthFromWan Integer32, + vpnRouterTunnelChannelTrafficUp Counter32, + vpnRouterTunnelChannelTrafficDown Counter32, + vpnRouterTunnelChannelReferencedTunnel Integer32, + vpnRouterTunnelChannelIsBackup Integer32, + vpnRouterTunnelChannelModuleSlot Integer32, + vpnRouterTunnelChannelPacketLoss Integer32, + vpnRouterTunnelChannelLinkStability Integer32 +} + +vpnRouterTunnelChannelIndex OBJECT-TYPE + SYNTAX Integer32(0..65535) + MAX-ACCESS not-accessible + STATUS current + DESCRIPTION + "ID-Number of the tunnelchannel." + ::= { vpnRouterTunnelChannelEntry 1 } + +vpnRouterTunnelChannelName OBJECT-TYPE + SYNTAX DisplayString + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "Name of tunnelchannel. It will be in the form tunnel.tunnelname" + ::= { vpnRouterTunnelChannelEntry 2 } + +vpnRouterTunnelChannelAdminStatus OBJECT-TYPE + SYNTAX Integer32(0..1) + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "Desired state of the tunnelchannel. + possible values: 0 = disconnected, 1 = connected" + ::= { vpnRouterTunnelChannelEntry 3 } + +vpnRouterTunnelChannelOperativeStatus OBJECT-TYPE + SYNTAX Integer32(0..8) + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "Current state of the tunnelchannel. + possible values: + 0 = disconnected, + 1 = connected, + 2 = connecting, + 3 = disconnecting, + 4 = connectedpingtest, + 5 = connectedpingtestwait, + 6 = connectedtooslow, + 7 = connectedstalled, + 8 = error" + ::= { vpnRouterTunnelChannelEntry 4 } + +vpnRouterTunnelChannelMaxBandwidthToWan OBJECT-TYPE + SYNTAX Integer32 + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "Maximum possible bandwidth to WAN (in KBit/sec)." + ::= { vpnRouterTunnelChannelEntry 5 } + +vpnRouterTunnelChannelMaxBandwidthFromWan OBJECT-TYPE + SYNTAX Integer32 + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "Maximum possible bandwidth from WAN (in KBit/sec)." + ::= { vpnRouterTunnelChannelEntry 6 } + +vpnRouterTunnelChannelCurrentBandwidthToWan OBJECT-TYPE + SYNTAX Integer32 + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "Current bandwidth to WAN (in KBit/sec)." + ::= { vpnRouterTunnelChannelEntry 7 } + +vpnRouterTunnelChannelCurrentBandwidthFromWan OBJECT-TYPE + SYNTAX Integer32 + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "Current bandwidth from WAN (in KBit/sec)." + ::= { vpnRouterTunnelChannelEntry 8 } + +vpnRouterTunnelChannelTrafficUp OBJECT-TYPE + SYNTAX Counter32 + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "Total upstream traffic made (in Byte) since router boot." + ::= { vpnRouterTunnelChannelEntry 9 } + +vpnRouterTunnelChannelTrafficDown OBJECT-TYPE + SYNTAX Counter32 + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "Total downstream traffic made (in Byte) since router boot." + ::= { vpnRouterTunnelChannelEntry 10 } + +vpnRouterTunnelChannelReferencedTunnel OBJECT-TYPE + SYNTAX Integer32 + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "The OID of the tunnel that this channel is referencing to." + ::= { vpnRouterTunnelChannelEntry 11 } + +vpnRouterTunnelChannelIsBackup OBJECT-TYPE + SYNTAX Integer32(0..1) + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "Is this channel configured as fallback? Possible Values: + 0 = no, + 1 = yes" + ::= { vpnRouterTunnelChannelEntry 12 } + +vpnRouterTunnelChannelModuleSlot OBJECT-TYPE + SYNTAX Integer32(0..6) + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "Module that the channel is using. + Possible Values: + 0 = Hub WAN-Interface, + 1 = Module in Slot 1, + 2 = Module in Slot 2, + 3 = Module in Slot 3, + 4 = Module in Slot 4, + 5 = Module in Slot 5, + 6 = Module in Slot 6" + ::= { vpnRouterTunnelChannelEntry 13 } + +vpnRouterTunnelChannelPacketLoss OBJECT-TYPE + SYNTAX Integer32(0..100) + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "Overall packetloss experienced (in %) on the channel-connection." + ::= { vpnRouterTunnelChannelEntry 14 } + +vpnRouterTunnelChannelLinkStability OBJECT-TYPE + SYNTAX Integer32(0..100) + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "Estimated Link Stability (in %) of the channel-connection." + ::= { vpnRouterTunnelChannelEntry 15 } + + +-- Conformance information + +vpnRouterConformance OBJECT IDENTIFIER ::= { vpnRouter 7 } +vpnRouterGroups OBJECT IDENTIFIER ::= { vpnRouterConformance 1 } +vpnRouterCompliances OBJECT IDENTIFIER ::= { vpnRouterConformance 2 } + +-- Compliance statements + +vpnRouterReadOnlyCompliance MODULE-COMPLIANCE + STATUS current + DESCRIPTION + "When this MIB is implemented without support for read- + create (i.e., in read-only mode), the implementation can + claim read-only compliance." + MODULE -- this module + MANDATORY-GROUPS { vpnRouterObjects } + ::= { vpnRouterCompliances 1 } + + + -- units of conformance + +vpnRouterObjects OBJECT-GROUP + OBJECTS { vpnRouterTunnelChannelName, + vpnRouterTunnelChannelAdminStatus, + vpnRouterTunnelChannelOperativeStatus, + vpnRouterTunnelChannelMaxBandwidthToWan, + vpnRouterTunnelChannelMaxBandwidthFromWan, + vpnRouterTunnelChannelCurrentBandwidthToWan, + vpnRouterTunnelChannelCurrentBandwidthFromWan, + vpnRouterTunnelChannelTrafficUp, + vpnRouterTunnelChannelTrafficDown, + vpnRouterTunnelChannelReferencedTunnel, + vpnRouterTunnelChannelIsBackup, + vpnRouterTunnelChannelModuleSlot, + vpnRouterTunnelChannelPacketLoss, + vpnRouterTunnelChannelLinkStability, + vpnRouterTunnelName, + vpnRouterTunnelAdminStatus, + vpnRouterTunnelOperativeStatus, + vpnRouterTunnelCumulatedBandwidthToWan, + vpnRouterTunnelCumulatedBandwidthFromWan, + vpnRouterTunnelCurrentCumulatedBandwidthToWan, + vpnRouterTunnelCurrentCumulatedBandwidthFromWan, + vpnRouterTunnelTrafficUp, + vpnRouterTunnelTrafficDown, + vpnRouterTunnelRemoteRouterSerial, + vpnRouterInterfaceName, + vpnRouterInterfaceAdminStatus, + vpnRouterInterfaceOperativeStatus, + vpnRouterInterfaceBandwidthToWan, + vpnRouterInterfaceBandwidthFromWan, + vpnRouterInterfaceTrafficUp, + vpnRouterInterfaceTrafficDown, + vpnRouterFanAdminStatus, + vpnRouterFanOperativeStatus, + vpnRouterFanRPM, + vpnRouterName, + vpnRouterSerial, + vpnRouterModel, + vpnRouterFirmware, + vpnRouterMode, + vpnRouteruptime, + vpnRouterFirmwareStatus, + vpnRouterCPULoad, + vpnRouterMemoryUsage, + vpnRouterSystemTemperature, + vpnRouterCPUTemperature, + vpnRouterPowerSupplyFailure, + vpnRouterFanCount, + vpnRouterInterfaceCount, + vpnRouterTunnelCount, + vpnRouterTunnelChannelCount + } + STATUS current + DESCRIPTION + "The Objects of the vpnRouter." + ::= { vpnRouterGroups 1 } + +END diff --git a/scripts/ntpd-server.php b/scripts/ntpd-server.php index 508ca73893..aba7b1ffea 100644 --- a/scripts/ntpd-server.php +++ b/scripts/ntpd-server.php @@ -25,7 +25,7 @@ $cmd2 = shell_exec($ntpdc.' -c iostats'); $vars = array(); $vars2 = array(); $vars = explode(',', $cmd); -$vars2 = eregi_replace(' ', '', $cmd2); +$vars2 = str_replace(' ', '', $cmd2); $vars2 = explode("\n", $vars2); diff --git a/sql-schema/113.sql b/sql-schema/113.sql new file mode 100644 index 0000000000..92b97729fc --- /dev/null +++ b/sql-schema/113.sql @@ -0,0 +1,2 @@ +CREATE TABLE IF NOT EXISTS `route` ( `device_id` int(11) NOT NULL, `context_name` varchar(128) CHARACTER SET utf8 collate utf8_general_ci not null, `ipRouteDest` varchar(256) not null, `ipRouteIfIndex` varchar(256), `ipRouteMetric` varchar(256) not null, `ipRouteNextHop` varchar(256) not null, `ipRouteType` varchar(256) not null, `ipRouteProto` varchar(256) not null, `discoveredAt` int(11) NOT NULL, `ipRouteMask` varchar(256) not null ) ENGINE=InnoDB DEFAULT CHARSET=utf8; +ALTER TABLE `route` ADD INDEX `device` (`device_id` ASC, `context_name` ASC, `ipRouteDest`(255) ASC, `ipRouteNextHop` ASC); diff --git a/validate.php b/validate.php index 7bbdd04bc2..a130921cfc 100755 --- a/validate.php +++ b/validate.php @@ -109,7 +109,7 @@ if (isset($config['user'])) { // This isn't just the log directory, let's print the list to the user $files = explode(PHP_EOL, $find_result); if (is_array($files)) { - print_fail("We have found some files that are owned by a different user than $tmp_user, this will stop you updating automatically and / or rrd files being updated causing graphs to fail:\n"); + print_fail("We have found some files that are owned by a different user than $tmp_user, this will stop you updating automatically and / or rrd files being updated causing graphs to fail:\nIf you don't run a bespoke install then you can fix this by running `chown -R $tmp_user:$tmp_user ".$config['install_dir']."`"); foreach ($files as $file) { echo "$file\n"; }