diff --git a/callback.php b/callback.php
new file mode 100644
index 0000000000..2c82b3ef95
--- /dev/null
+++ b/callback.php
@@ -0,0 +1,103 @@
+
+ *
+ * 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.
+ */
+
+$enabled = dbFetchCell("SELECT `value` FROM `callback` WHERE `name` = 'enabled'");
+if ($enabled == 1) {
+
+ if (dbFetchCell("SELECT `value` FROM `callback` WHERE `name` = 'uuid'") == '') {
+ dbInsert(array('name'=>'uuid','value'=>guidv4(openssl_random_pseudo_bytes(16))), 'callback');
+ }
+ $uuid = dbFetchCell("SELECT `value` FROM `callback` WHERE `name` = 'uuid'");
+
+ $queries = array(
+ 'alert_rules'=>'SELECT COUNT(`severity`) AS `total`,`severity` FROM `alert_rules` WHERE `disabled`=0 GROUP BY `severity`',
+ 'alert_templates'=>'SELECT COUNT(`id`) AS `total` FROM `alert_templates`',
+ 'api_tokens'=>'SELECT COUNT(`id`) AS `total` FROM `api_tokens` WHERE `disabled`=0',
+ 'applications'=>'SELECT COUNT(`app_type`) AS `total`,`app_type` FROM `applications` GROUP BY `app_type`',
+ 'bgppeer_state'=>'SELECT COUNT(`bgpPeerState`) AS `total`,`bgpPeerState` FROM `bgpPeers` GROUP BY `bgpPeerState`',
+ 'bgppeer_status'=>'SELECT COUNT(`bgpPeerAdminStatus`) AS `total`,`bgpPeerAdminStatus` FROM `bgpPeers` GROUP BY `bgpPeerAdminStatus`',
+ 'bills'=>'SELECT COUNT(`bill_type`) AS `total`,`bill_type` FROM `bills` GROUP BY `bill_type`',
+ 'cef'=>'SELECT COUNT(`device_id`) AS `total` FROM `cef_switching`',
+ 'cisco_asa'=>'SELECT COUNT(`oid`) AS `total`,`oid` FROM `ciscoASA` WHERE `disabled` = 0 GROUP BY `oid`',
+ 'mempool'=>'SELECT COUNT(`cmpName`) AS `total`,`cmpName` FROM `cmpMemPool` GROUP BY `cmpName`',
+ 'current'=>'SELECT COUNT(`current_type`) AS `total`,`current_type` FROM `current` GROUP BY `current_type`',
+ 'dbschema'=>'SELECT COUNT(`version`) AS `total`, `version` FROM `dbSchema`',
+ 'snmp_version'=>'SELECT COUNT(`snmpver`) AS `total`,`snmpver` FROM `devices` GROUP BY `snmpver`',
+ 'os'=>'SELECT COUNT(`os`) AS `total`,`os` FROM `devices` GROUP BY `os`',
+ 'type'=>'SELECT COUNT(`type`) AS `total`,`type` FROM `devices` GROUP BY `type`',
+ 'full_type'=>'SELECT COUNT(`device_id`) AS `total`, CONCAT_WS(', ', `os`,`hardware`,`type`) FROM `devices` GROUP BY `os`,`hardware`,`type`',
+ 'ipsec'=>'SELECT COUNT(`device_id`) AS `total` FROM `ipsec_tunnels`',
+ 'ipv4_addresses'=>'SELECT COUNT(`ipv4_address_id`) AS `total` FROM `ipv4_addresses`',
+ 'ipv4_macaddress'=>'SELECT COUNT(`port_id`) AS `total` FROM ipv4_mac',
+ 'ipv4_networks'=>'SELECT COUNT(`ipv4_network_id`) AS `total` FROM ipv4_networks',
+ 'ipv6_addresses'=>'SELECT COUNT(`ipv6_address_id`) AS `total` FROM `ipv6_addresses`',
+ 'ipv6_networks'=>'SELECT COUNT(`ipv6_network_id`) AS `total` FROM `ipv6_networks`',
+ 'xdp'=>'SELECT COUNT(`id`) AS `total`,`protocol` FROM `links` GROUP BY `protocol`',
+ 'ospf'=>'SELECT COUNT(`device_id`) AS `total`,`ospfVersionNumber` FROM `ospf_instances` GROUP BY `ospfVersionNumber`',
+ 'ospf_links'=>'SELECT COUNT(`device_id`) AS `total`,`ospfIfType` FROM `ospf_ports` GROUP BY `ospfIfType`',
+ 'arch'=>'SELECT COUNT(`pkg_id`) AS `total`,`arch` FROM `packages` GROUP BY `arch`',
+ 'pollers'=>'SELECT COUNT(`id`) AS `total` FROM `pollers`',
+ 'port_type'=>'SELECT COUNT(`port_id`) AS `total`,`ifType` FROM `ports` GROUP BY `ifType`',
+ 'port_ifspeed'=>'SELECT COUNT(`ifSpeed`) AS `total`,ROUND(`ifSpeed`/1000/1000) FROM `ports` GROUP BY `ifSpeed`',
+ 'port_vlans'=>'SELECT COUNT(`device_id`) AS `total`,`state` FROM `ports_vlans` GROUP BY `state`',
+ 'processes'=>'SELECT COUNT(`device_id`) AS `total` FROM `processes`',
+ 'processors'=>'SELECT COUNT(`processor_id`) AS `total`,`processor_type` FROM `processors` GROUP BY `processor_type`',
+ 'pseudowires'=>'SELECT COUNT(`pseudowire_id`) AS `total` FROM `pseudowires`',
+ 'sensors'=>'SELECT COUNT(`sensor_id`) AS `total`,`sensor_class` FROM `sensors` GROUP BY `sensor_class`',
+ 'storage'=>'SELECT COUNT(`storage_id`) AS `total`,`storage_type` FROM `storage` GROUP BY `storage_type`',
+ 'toner'=>'SELECT COUNT(`toner_id`) AS `total`,`toner_type` FROM `toner` GROUP BY `toner_type`',
+ 'vlans'=>'SELECT COUNT(`vlan_id`) AS `total`,`vlan_type` FROM `vlans` GROUP BY `vlan_type`',
+ 'vminfo'=>'SELECT COUNT(`id`) AS `total`,`vm_type` FROM `vminfo` GROUP BY `vm_type`',
+ 'vmware'=>'SELECT COUNT(`id`) AS `total` FROM `vmware_vminfo`',
+ 'vrfs'=>'SELECT COUNT(`vrf_id`) AS `total` FROM `vrfs`');
+
+
+ foreach ($queries as $name => $query) {
+ $data = dbFetchRows($query);
+ $response[$name] = $data;
+ }
+ $output = array('uuid'=>$uuid,'data'=>$response);
+ $data = json_encode($output);
+ $submit = array('data'=>$data);
+
+ $fields = '';
+ foreach ($submit as $key => $value) {
+ $fields .= $key . '=' . $value . '&';
+ }
+ rtrim($fields, '&');
+
+ $post = curl_init();
+ set_curl_proxy($post);
+ curl_setopt($post, CURLOPT_URL, $config['callback_post']);
+ curl_setopt($post, CURLOPT_POST, count($submit));
+ curl_setopt($post, CURLOPT_POSTFIELDS, $fields);
+ curl_setopt($post, CURLOPT_RETURNTRANSFER, 1);
+ $result = curl_exec($post);
+} elseif ($enabled == 2) {
+
+ $uuid = dbFetchCell("SELECT `value` FROM `callback` WHERE `name` = 'uuid'");
+ $fields = "uuid=$uuid";
+
+ $clear = curl_init();
+ set_curl_proxy($clear);
+ curl_setopt($clear, CURLOPT_URL, $config['callback_clear']);
+ curl_setopt($clear, CURLOPT_POST, count($clear));
+ curl_setopt($clear, CURLOPT_POSTFIELDS, $fields);
+ curl_setopt($clear, CURLOPT_RETURNTRANSFER, 1);
+ $result = curl_exec($clear);
+ dbDelete('callback', '`name`="uuid"', array());
+ dbUpdate(array('value' => '0'), 'callback', '`name` = "enabled"', array());
+}
+
+?>
diff --git a/config.php.default b/config.php.default
index c98b8677ba..479482113b 100755
--- a/config.php.default
+++ b/config.php.default
@@ -41,3 +41,6 @@ $config['auth_mechanism'] = "mysql"; # default, other options: ldap, http-auth
$config['poller-wrapper']['alerter'] = FALSE;
# Uncomment the next line to disable daily updates
#$config['update'] = 0;
+
+# Uncomment to submit callback stats via proxy
+#$config['callback_proxy'] = "hostname:port";
diff --git a/daily.php b/daily.php
index 38ac1584ef..03176a47d3 100644
--- a/daily.php
+++ b/daily.php
@@ -55,5 +55,8 @@ if ($options['f'] === 'perf_times') {
}
}
}
+if ($options['f'] === 'callback') {
+ require_once "callback.php";
+}
?>
diff --git a/daily.sh b/daily.sh
index ca8c87077a..4168d73448 100644
--- a/daily.sh
+++ b/daily.sh
@@ -11,3 +11,4 @@ php daily.php -f syslog
php daily.php -f eventlog
php daily.php -f authlog
php daily.php -f perf_times
+php daily.php -f callback
diff --git a/doc/General/Callback-Stats-and-Privacy.md b/doc/General/Callback-Stats-and-Privacy.md
new file mode 100644
index 0000000000..e0d32c7a78
--- /dev/null
+++ b/doc/General/Callback-Stats-and-Privacy.md
@@ -0,0 +1,32 @@
+## Stats data and your privacy ##
+
+This document has been put together to explain what LibreNMS does when it calls back home to report some anonymous statistics.
+
+Let's start off by saying, all of the code that processes the data and submits it is included in the standard LibreNMS branch you've installed, the code that accepts this data and in turn generates some pretty graphs is all open source and available on Git Hub. Please feel free to review the code, comment on it and suggest changes / improvements. Also, don't forget - by default installations DO NOT call back home, you need to opt into this.
+
+Above all we respect users privacy which is why this system has been designed like it has.
+
+Now onto the bit you're interested in, what is submitted and what we do with that data.
+
+#### What is submitted ####
+- All data is anonymous.
+- Generic statistics are taken from the database, these include things like device total, type and os, port types, speeds and total, total bgp peers. Take a look at the code for full details.
+- A random UUID is generated on your own install.
+- That's it!
+- Your IP isn't logged, even via our web service accepting the data. We don't need to know who you are so don't ask.
+
+#### What we do with the data ####
+- We store it, not for long - 3 months at the moment although this could change.
+- We use it to generate pretty graphs for people to see.
+- We use it to help prioritise issues and features that need to be worked on.
+
+#### Questions? ####
+- Q. How often is data submitted? A. We submit the data once a day according to running daily.sh via cron. If you disable this then opting in will not have any affect.
+- Q. Where can I see the data I submitted? A. You can't see the data raw, but we collate all of the data together and provide a dynamic site so you can see the results of all contributed stats [here](https://stats.librenms.org)
+- Q. I want my data removed. A. That's easy, simply press 'Clear remote stats' in the About LibreNMS page of your control panel, the next time the call back script is run it will remove all the data we have.
+- Q. I clicked the 'Clear remote stats' button by accident. A. No problem, before daily.sh runs again - just opt back in, all of your existing data will stay.
+
+Hopefully this answers the questions you might have on why and what we are doing here, if not, please pop into our irc channel or google mailing list and ask any questions you like.
+
+If you're happy with all of this - please consider switching the call back system on, you can do this within the About LibreNMS page within your control panel. In the Statistics section you will find a toggle switch to enable / disable the feature. If you've previously had it switched on and want to opt out and remove your data, click the 'Clear remote stats' button and on the next submission all the data you've sent us will be removed!
+
diff --git a/doc/General/Changelog.md b/doc/General/Changelog.md
index cc025fef6f..4233ecd178 100644
--- a/doc/General/Changelog.md
+++ b/doc/General/Changelog.md
@@ -3,6 +3,11 @@
####Bug fixes
- Fixed ack of worse/better alerts (PR720)
- Fixed ORIG_PATH_INFO warnings (PR727)
+ - Added missing CPU id for Cisco SB (PR744)
+ - Changed Processors table name to lower case in processors discovery (PR751)
+ - Fixed alerts path issue (PR756, PR760)
+ - Supress further port alerts when interface goes down (PR745)
+ - Fixed login so redirects via 303 when POST data sent (PR775)
####Improvements
- New theme support added (light,dark and mono) (PR682,PR683,PR701)
@@ -13,6 +18,15 @@
- Update to Foritgate support (PR709)
- Added support for UBNT AirOS and AirFibre (PR721,PR730,PR731)
- Added support device groups + alerts to be mapped to devices or groups (PR722)
+ - Added basic Cambium support (PR738)
+ - Added basic F5 support (PR670)
+ - Shorten interface names on map (PR752)
+ - Added PowerCode support (PR762)
+ - Added Autodiscovery via OSPF (PR772)
+ - Added visual graph of alert log (PR777)
+ - Added Callback system to send anonymous stats (PR768)
+ - More tables converted to use bootgrid (PR729, PR761)
+ - New Global Cache to store common queries added (PR780)
### Mar 2015
diff --git a/doc/Installation/Installation-(Debian-Ubuntu).md b/doc/Installation/Installation-(Debian-Ubuntu).md
index d85aa6ff4a..4df0bfee4c 100644
--- a/doc/Installation/Installation-(Debian-Ubuntu).md
+++ b/doc/Installation/Installation-(Debian-Ubuntu).md
@@ -42,7 +42,7 @@ This host is where the web server and SNMP poller run. It could be the same mac
Install the required software:
- apt-get install libapache2-mod-php5 php5-cli php5-mysql php5-gd php5-snmp php-pear snmp graphviz php5-mcrypt php5-json apache2 fping imagemagick whois mtr-tiny nmap python-mysqldb snmpd mysql-client php-net-ipv4 php-net-ipv6 rrdtool git
+ apt-get install libapache2-mod-php5 php5-cli php5-mysql php5-gd php5-snmp php-pear php5-curl snmp graphviz php5-mcrypt php5-json apache2 fping imagemagick whois mtr-tiny nmap python-mysqldb snmpd mysql-client php-net-ipv4 php-net-ipv6 rrdtool git
The packages listed above are an all-inclusive list of packages that were necessary on a clean install of Ubuntu 12.04/14.04.
diff --git a/doc/Installation/Installation-(RHEL-CentOS).md b/doc/Installation/Installation-(RHEL-CentOS).md
index 4dd28a6f8c..e8a17014d4 100644
--- a/doc/Installation/Installation-(RHEL-CentOS).md
+++ b/doc/Installation/Installation-(RHEL-CentOS).md
@@ -47,7 +47,7 @@ Install necessary software. The packages listed below are an all-inclusive list
Note if not using HTTPd (Apache): RHEL requires `httpd` to be installed regardless of of `nginx`'s (or any other web-server's) presence.
rpm -Uvh http://download.fedoraproject.org/pub/epel/6/i386/epel-release-6-8.noarch.rpm
- yum install php php-cli php-gd php-mysql php-snmp php-pear httpd net-snmp graphviz graphviz-php mysql ImageMagick jwhois nmap mtr rrdtool MySQL-python net-snmp-utils vixie-cron php-mcrypt fping git
+ yum install php php-cli php-gd php-mysql php-snmp php-pear php-curl httpd net-snmp graphviz graphviz-php mysql ImageMagick jwhois nmap mtr rrdtool MySQL-python net-snmp-utils vixie-cron php-mcrypt fping git
pear install Net_IPv4-1.3.4
pear install Net_IPv6-1.2.2b2
diff --git a/doc/Installation/Installation-Lighttpd-(Debian-Ubuntu).md b/doc/Installation/Installation-Lighttpd-(Debian-Ubuntu).md
index 0af3cc363b..1966542830 100644
--- a/doc/Installation/Installation-Lighttpd-(Debian-Ubuntu).md
+++ b/doc/Installation/Installation-Lighttpd-(Debian-Ubuntu).md
@@ -37,7 +37,7 @@ Change `127.0.0.1` to the IP address that your MySQL server should listen on. R
Install necessary software. The packages listed below are an all-inclusive list of packages that were necessary on a clean install of Debian 7.
- apt-get install lighttpd php5-cli php5-mysql php5-gd php5-snmp php5-cgi php-pear snmp graphviz mysql-server mysql-client rrdtool sendmail fping imagemagick whois mtr-tiny nmap ipmitool php5-mcrypt php5-json python-mysqldb snmpd php-net-ipv4 php-net-ipv6 rrdtool git
+ apt-get install lighttpd php5-cli php5-mysql php5-gd php5-snmp php5-cgi php-pear php5-curl snmp graphviz mysql-server mysql-client rrdtool sendmail fping imagemagick whois mtr-tiny nmap ipmitool php5-mcrypt php5-json python-mysqldb snmpd php-net-ipv4 php-net-ipv6 rrdtool git
### Cloning ###
diff --git a/html/ajax_table.php b/html/ajax_table.php
index 7f906e64ad..dc5af2c6e6 100644
--- a/html/ajax_table.php
+++ b/html/ajax_table.php
@@ -39,6 +39,7 @@ if (isset($_POST['sort']) && is_array($_POST['sort'])) {
}
$searchPhrase = mres($_POST['searchPhrase']);
$id = mres($_POST['id']);
+$response = array();
if (isset($id)) {
if (file_exists("includes/table/$id.inc.php")) {
diff --git a/html/css/styles.css b/html/css/styles.css
index 0b5b5faeb2..61a546dfb0 100644
--- a/html/css/styles.css
+++ b/html/css/styles.css
@@ -1605,3 +1605,8 @@ tr.search:nth-child(odd) {
width: 90%;
height: 600px;
}
+
+.threeqtr-width {
+ display:block;
+ width: 75%;
+}
diff --git a/html/forms/callback-clear.inc.php b/html/forms/callback-clear.inc.php
new file mode 100644
index 0000000000..236c28c90d
--- /dev/null
+++ b/html/forms/callback-clear.inc.php
@@ -0,0 +1,15 @@
+
+ *
+ * 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.
+ */
+
+dbUpdate(array('value' => '2'), 'callback', '`name` = "enabled"', array());
diff --git a/html/forms/callback-statistics.inc.php b/html/forms/callback-statistics.inc.php
new file mode 100644
index 0000000000..22f65e71d1
--- /dev/null
+++ b/html/forms/callback-statistics.inc.php
@@ -0,0 +1,25 @@
+
+ *
+ * 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 ($_POST['state'] == 'true') {
+ $state = 1;
+} elseif ($_POST['state'] == 'false') {
+ $state = 0;
+} else {
+ $state = 0;
+}
+
+if( dbUpdate(array('value' => $state), 'callback', '`name` = "enabled"', array()) == 0) {
+ dbInsert(array('value' => $state,'name' => 'enabled'), 'callback');
+}
diff --git a/html/images/icons/battery charge.png b/html/images/icons/battery charge.png
new file mode 100644
index 0000000000..ae40aaf3c9
Binary files /dev/null and b/html/images/icons/battery charge.png differ
diff --git a/html/images/icons/charge.png b/html/images/icons/charge.png
new file mode 100644
index 0000000000..ae40aaf3c9
Binary files /dev/null and b/html/images/icons/charge.png differ
diff --git a/html/includes/authenticate.inc.php b/html/includes/authenticate.inc.php
index 42dc82b33e..e64465a35e 100644
--- a/html/includes/authenticate.inc.php
+++ b/html/includes/authenticate.inc.php
@@ -108,6 +108,10 @@ if ((isset($_SESSION['username'])) || (isset($_COOKIE['sess_id'],$_COOKIE['token
setcookie("auth", $_COOKIE['auth'], time()+60*60*24*$config['auth_remember'], "/", null, false, true);
}
$permissions = permissions_cache($_SESSION['user_id']);
+ if (isset($_POST['username'])) {
+ header('Location: '.$_SERVER['REQUEST_URI'],TRUE,303);
+ exit;
+ }
}
elseif (isset($_SESSION['username']))
{
diff --git a/html/includes/functions.inc.php b/html/includes/functions.inc.php
index b11033b78f..6a94719f1d 100644
--- a/html/includes/functions.inc.php
+++ b/html/includes/functions.inc.php
@@ -744,4 +744,12 @@ function shorten_interface_type($string) {
);
}
+function clean_bootgrid($string) {
+
+ $output = str_replace(array("\r","\n"), "", $string);
+ $output = addslashes($output);
+ return $output;
+
+}
+
?>
diff --git a/html/includes/hostbox-basic.inc.php b/html/includes/hostbox-basic.inc.php
deleted file mode 100644
index c46713d7c6..0000000000
--- a/html/includes/hostbox-basic.inc.php
+++ /dev/null
@@ -1,51 +0,0 @@
-
-
');
-require 'hostbox-menu.inc.php';
-
-echo(' ');
-
-?>
diff --git a/html/includes/object-cache.inc.php b/html/includes/object-cache.inc.php
index 45abaf45af..b6b9a50840 100644
--- a/html/includes/object-cache.inc.php
+++ b/html/includes/object-cache.inc.php
@@ -1,5 +1,7 @@
= 5)
-{
- $devices['count'] = dbFetchCell("SELECT COUNT(*) FROM devices");
- $devices['up'] = dbFetchCell("SELECT COUNT(*) FROM devices WHERE `status` = '1' AND `ignore` = '0' AND `disabled` = '0'");
- $devices['down'] = dbFetchCell("SELECT COUNT(*) FROM devices WHERE `status` = '0' AND `ignore` = '0' AND `disabled` = '0'");
- $devices['ignored'] = dbFetchCell("SELECT COUNT(*) FROM devices WHERE `ignore` = '1' AND `disabled` = '0'");
- $devices['disabled'] = dbFetchCell("SELECT COUNT(*) FROM devices WHERE `disabled` = '1'");
-
- $ports['count'] = dbFetchCell("SELECT COUNT(*) FROM ports WHERE `deleted` = '0'");
- $ports['up'] = dbFetchCell("SELECT COUNT(*) FROM ports AS I, devices AS D WHERE I.`deleted` = '0' AND D.`device_id` = I.`device_id` AND I.`ignore` = '0' AND D.`ignore` = '0' AND I.`ifOperStatus` = 'up'");
- $ports['down'] = dbFetchCell("SELECT COUNT(*) FROM ports AS I, devices AS D WHERE I.`deleted` = '0' AND D.`device_id` = I.`device_id` AND I.`ignore` = '0' AND D.`ignore` = '0' AND I.`ifOperStatus` = 'down' AND I.`ifAdminStatus` = 'up'");
- $ports['shutdown'] = dbFetchCell("SELECT COUNT(*) FROM ports AS I, devices AS D WHERE I.`deleted` = '0' AND D.`device_id` = I.`device_id` AND I.`ignore` = '0' AND D.`ignore` = '0' AND I.`ifAdminStatus` = 'down'");
- $ports['errored'] = dbFetchCell("SELECT COUNT(*) FROM ports AS I, devices AS D WHERE I.`deleted` = '0' AND D.`device_id` = I.`device_id` AND I.`ignore` = '0' AND D.`ignore` = '0' AND (I.`ifInErrors_delta` > '0' OR I.`ifOutErrors_delta` > '0')");
- $ports['ignored'] = dbFetchCell("SELECT COUNT(*) FROM ports AS I, devices AS D WHERE I.`deleted` = '0' AND D.`device_id` = I.`device_id` AND (I.`ignore` = '1' OR D.`ignore` = '1')");
-
- $services['count'] = dbFetchCell("SELECT COUNT(*) FROM services");
- $services['up'] = dbFetchCell("SELECT COUNT(*) FROM services WHERE `service_ignore` = '0' AND `service_disabled` = '0' AND `service_status` = '1'");
- $services['down'] = dbFetchCell("SELECT COUNT(*) FROM services WHERE `service_ignore` = '0' AND `service_disabled` = '0' AND `service_status` = '0'");
- $services['ignored'] = dbFetchCell("SELECT COUNT(*) FROM services WHERE `service_ignore` = '1' AND `service_disabled` = '0'");
- $services['disabled'] = dbFetchCell("SELECT COUNT(*) FROM services WHERE `service_disabled` = '1'");
-}
-else
-{
- $devices['count'] = dbFetchCell("SELECT COUNT(*) FROM devices AS D, devices_perms AS P WHERE P.`user_id` = ? AND P.`device_id` = D.`device_id`", array($_SESSION['user_id']));
- $devices['up'] = dbFetchCell("SELECT COUNT(*) FROM devices AS D, devices_perms AS P WHERE P.`user_id` = ? AND P.`device_id` = D.`device_id` AND D.`status` = '1' AND D.`ignore` = '0' AND D.`disabled` = '0'", array($_SESSION['user_id']));
- $devices['down'] = dbFetchCell("SELECT COUNT(*) FROM devices AS D, devices_perms AS P WHERE P.`user_id` = ? AND P.`device_id` = D.`device_id` AND D.`status` = '0' AND D.`ignore` = '0' AND D.`disabled` = '0'", array($_SESSION['user_id']));
- $devices['ignored'] = dbFetchCell("SELECT COUNT(*) FROM devices AS D, devices_perms AS P WHERE P.`user_id` = ? AND P.`device_id` = D.`device_id` AND D.`ignore` = '1' AND D.`disabled` = '0'", array($_SESSION['user_id']));
- $devices['disabled'] = dbFetchCell("SELECT COUNT(*) FROM devices AS D, devices_perms AS P WHERE P.`user_id` = ? AND P.`device_id` = D.`device_id` AND D.`disabled` = '1'", array($_SESSION['user_id']));
-
- $ports['count'] = dbFetchCell("SELECT COUNT(*) FROM ports AS I, devices AS D, devices_perms AS P WHERE I.`deleted` = '0' AND P.`user_id` = ? AND P.`device_id` = D.`device_id` AND I.`device_id` = D.`device_id`", array($_SESSION['user_id']));
- $ports['up'] = dbFetchCell("SELECT COUNT(*) FROM ports AS I, devices AS D, devices_perms AS P WHERE I.`deleted` = '0' AND P.`user_id` = ? AND P.`device_id` = D.`device_id` AND I.`device_id` = D.`device_id` AND I.`ignore` = '0' AND D.`ignore` = '0' AND I.`ifOperStatus` = 'up'", array($_SESSION['user_id']));
- $ports['down'] = dbFetchCell("SELECT COUNT(*) FROM ports AS I, devices AS D, devices_perms AS P WHERE I.`deleted` = '0' AND P.`user_id` = ? AND P.`device_id` = D.`device_id` AND I.`device_id` = D.`device_id` AND I.`ignore` = '0' AND D.`ignore` = '0' AND I.`ifOperStatus` = 'down' AND I.`ifAdminStatus` = 'up'", array($_SESSION['user_id']));
- $ports['shutdown'] = dbFetchCell("SELECT COUNT(*) FROM ports AS I, devices AS D, devices_perms AS P WHERE I.`deleted` = '0' AND P.`user_id` = ? AND P.`device_id` = D.`device_id` AND I.`device_id` = D.`device_id` AND I.`ignore` = '0' AND D.`ignore` = '0' AND I.`ifAdminStatus` = 'down'", array($_SESSION['user_id']));
- $ports['errored'] = dbFetchCell("SELECT COUNT(*) FROM ports AS I, devices AS D, devices_perms AS P WHERE I.`deleted` = '0' AND P.`user_id` = ? AND P.`device_id` = D.`device_id` AND I.`device_id` = D.`device_id` AND I.`ignore` = '0' AND D.`ignore` = '0' AND (I.`ifInErrors_delta` > '0' OR I.`ifOutErrors_delta` > '0')", array($_SESSION['user_id']));
- $ports['ignored'] = dbFetchCell("SELECT COUNT(*) FROM ports AS I, devices AS D, devices_perms AS P WHERE I.`deleted` = '0' AND P.`user_id` = ? AND P.`device_id` = D.`device_id` AND I.`device_id` = D.`device_id` AND (I.`ignore` = '1' OR D.`ignore` = '1')", array($_SESSION['user_id']));
-
- $services['count'] = dbFetchCell("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`", array($_SESSION['user_id']));
- $services['up'] = dbFetchCell("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'", array($_SESSION['user_id']));
- $services['down'] = dbFetchCell("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'", array($_SESSION['user_id']));
- $services['ignored'] = dbFetchCell("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` = '1' AND S.`service_disabled` = '0'", array($_SESSION['user_id']));
- $services['disabled'] = dbFetchCell("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_disabled` = '1'", array($_SESSION['user_id']));
-}
+$devices = new ObjCache('devices');
+$ports = new ObjCache('ports');
+$services = new ObjCache('services');
if ($devices['down']) { $devices['bgcolour'] = "#ffcccc"; } else { $devices['bgcolour'] = "transparent"; }
if ($ports['down']) { $ports['bgcolour'] = "#ffcccc"; } else { $ports['bgcolour'] = "#e5e5e5"; }
diff --git a/html/includes/print-debug.php b/html/includes/print-debug.php
index 5c23a35368..f35cd05bfe 100644
--- a/html/includes/print-debug.php
+++ b/html/includes/print-debug.php
@@ -47,7 +47,7 @@ foreach ($sql_debug as $sql_error) {
-
SQL Debug
+
PHP Debug
diff --git a/html/includes/print-graph-alerts.inc.php b/html/includes/print-graph-alerts.inc.php
new file mode 100644
index 0000000000..ac4a713f0a
--- /dev/null
+++ b/html/includes/print-graph-alerts.inc.php
@@ -0,0 +1,100 @@
+
+* 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.
+*/
+$pagetitle[] = "Alert Stats";
+
+if (isset($device['device_id']) && $device['device_id'] > 0) {
+ $sql = " AND alert_log.device_id=?";
+ $param = array(
+ $device['device_id']
+ );
+}
+
+if ($_SESSION['userlevel'] >= '5') {
+ $query = "SELECT DATE(time_logged) Date, COUNT(alert_log.device_id) totalCount, alert_rules.severity Severity FROM alert_log,alert_rules WHERE alert_log.rule_id=alert_rules.id $sql GROUP BY DATE(time_logged),alert_rules.severity";
+}
+
+if ($_SESSION['userlevel'] < '5') {
+ $query = "SELECT DATE(time_logged) Date, COUNT(alert_log.device_id) totalCount, alert_rules.severity Severity FROM alert_log,alert_rules,devices_perms WHERE alert_log.rule_id=alert_rules.id $sql AND alert_log.device_id = devices_perms.device_id AND devices_perms.user_id = " . $_SESSION['user_id'] . " GROUP BY DATE(time_logged),alert_rules.severity";
+}
+
+?>
+
+
+
\ No newline at end of file
diff --git a/html/includes/print-map.inc.php b/html/includes/print-map.inc.php
index cb574f9412..97ca4a7e20 100644
--- a/html/includes/print-map.inc.php
+++ b/html/includes/print-map.inc.php
@@ -24,11 +24,11 @@ $sql .= ' AND `local_device_id` != 0 AND `remote_device_id` != 0';
$tmp_ids = array();
foreach (dbFetchRows("SELECT DISTINCT least(`devices`.`device_id`, `remote_device_id`) AS `remote_device_id`, GREATEST(`remote_device_id`,`devices`.`device_id`) AS `local_device_id` FROM `links` LEFT JOIN `ports` ON `local_port_id`=`ports`.`port_id` LEFT JOIN `devices` ON `ports`.`device_id`=`devices`.`device_id` $sql", $sql_array) as $link_devices) {
- if (!in_array($link_devices['local_device_id'], $tmp_ids)) {
+ if (!in_array($link_devices['local_device_id'], $tmp_ids) && device_permitted($link_devices['local_device_id'])) {
$link_dev = dbFetchRow("SELECT `hostname`,`location` FROM `devices` WHERE `device_id`=?",array($link_devices['local_device_id']));
$tmp_devices[] = array('id'=>$link_devices['local_device_id'],'label'=>$link_dev['hostname'],'title'=>$link_dev['hostname'],'group'=>$link_dev['location']);
}
- if (!in_array($link_devices['remote_device_id'], $tmp_ids)) {
+ if (!in_array($link_devices['remote_device_id'], $tmp_ids) && device_permitted($link_devices['remote_device_id'])) {
$link_dev = dbFetchRow("SELECT `hostname`,`location` FROM `devices` WHERE `device_id`=?",array($link_devices['remote_device_id']));
$tmp_devices[] = array('id'=>$link_devices['remote_device_id'],'label'=>$link_dev['hostname'],'title'=>$link_dev['hostname'],'group'=>$link_dev['location']);
}
diff --git a/html/includes/print-menubar.php b/html/includes/print-menubar.php
index 37e0850416..6ac12cb7b8 100644
--- a/html/includes/print-menubar.php
+++ b/html/includes/print-menubar.php
@@ -1,4 +1,5 @@
@@ -175,3 +195,35 @@ echo("
+
+
diff --git a/html/pages/alert-stats.inc.php b/html/pages/alert-stats.inc.php
new file mode 100644
index 0000000000..1fcf438308
--- /dev/null
+++ b/html/pages/alert-stats.inc.php
@@ -0,0 +1,13 @@
+
+* 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.
+*/
+require_once('includes/print-graph-alerts.inc.php');
+?>
\ No newline at end of file
diff --git a/html/pages/device.inc.php b/html/pages/device.inc.php
index c60b654f00..773f7a3b43 100644
--- a/html/pages/device.inc.php
+++ b/html/pages/device.inc.php
@@ -325,6 +325,15 @@ if (device_permitted($vars['device']) || $check_device == $vars['device'])
');
}
+ if (device_permitted($device['device_id']))
+ {
+ echo('
+
+
+
diff --git a/html/pages/front/default.php b/html/pages/front/default.php
index 12bdc52e90..ac09f29088 100644
--- a/html/pages/front/default.php
+++ b/html/pages/front/default.php
@@ -199,10 +199,10 @@ if ($config['enable_syslog'])
if ($_SESSION['userlevel'] >= '10')
{
$query = "SELECT *,DATE_FORMAT(datetime, '%D %b %T') as humandate FROM `eventlog` ORDER BY `datetime` DESC LIMIT 0,15";
- $alertquery = "SELECT devices.device_id,name,state,time_logged FROM alert_log LEFT JOIN devices ON alert_log.device_id=devices.device_id RIGHT JOIN alert_rules ON alert_log.rule_id=alert_rules.id ORDER BY `time_logged` DESC LIMIT 0,15";
+ $alertquery = "SELECT devices.device_id,name,state,time_logged FROM alert_log LEFT JOIN devices ON alert_log.device_id=devices.device_id LEFT JOIN alert_rules ON alert_log.rule_id=alert_rules.id ORDER BY `time_logged` DESC LIMIT 0,15";
} else {
$query = "SELECT *,DATE_FORMAT(datetime, '%D %b %T') as humandate FROM `eventlog` AS E, devices_perms AS P WHERE E.host = P.device_id AND P.user_id = " . $_SESSION['user_id'] . " ORDER BY `datetime` DESC LIMIT 0,15";
- $alertquery = "SELECT devices.device_id,name,state,time_logged FROM alert_log LEFT JOIN devices ON alert_log.device_id=devices.device_id RIGHT JOIN alert_rules ON alert_log.rule_id=alert_rules.id RIGHT JOIN devices_perms ON alert_log.device_id = devices_perms.device_id AND devices_perms.user_id = " . $_SESSION['user_id'] . " ORDER BY `time_logged` DESC LIMIT 0,15";
+ $alertquery = "SELECT devices.device_id,name,state,time_logged FROM alert_log LEFT JOIN devices ON alert_log.device_id=devices.device_id LEFT JOIN alert_rules ON alert_log.rule_id=alert_rules.id RIGHT JOIN devices_perms ON alert_log.device_id = devices_perms.device_id AND devices_perms.user_id = " . $_SESSION['user_id'] . " ORDER BY `time_logged` DESC LIMIT 0,15";
}
$data = mysql_query($query);
diff --git a/html/pages/search/arp.inc.php b/html/pages/search/arp.inc.php
index 8b02112383..5e7df42666 100644
--- a/html/pages/search/arp.inc.php
+++ b/html/pages/search/arp.inc.php
@@ -1,139 +1,91 @@
-
+