Skip to content

Commit

Permalink
Merge pull request #1635 from laf/issue-1618
Browse files Browse the repository at this point in the history
Added docs for MySQL strict mode + update validate to warn about it
  • Loading branch information
f0o committed Aug 7, 2015
2 parents c935759 + b1c7b1e commit f02acd6
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 11 deletions.
4 changes: 4 additions & 0 deletions doc/Installation/Installation-(Debian-Ubuntu).md
Expand Up @@ -7,6 +7,8 @@

This host is where the MySQL database runs. It could be the same machine as your network management server (this is the most common initial deployment scenario).

> ** Whilst we are working on ensuring LibreNMS is compatible with MySQL strict mode, for now, please disable this after mysql is installed.
You are free to choose between using MySQL or MariaDB:

**MySQL**
Expand Down Expand Up @@ -45,6 +47,8 @@ Find the line: `bind-address = 127.0.0.1`

Change `127.0.0.1` to the IP address that your MySQL server should listen on. Restart MySQL:

If you see a line that starts `sql-mode` then change this to `sql-mode=""`.

service mysql restart

### On the NMS ###
Expand Down
6 changes: 6 additions & 0 deletions doc/Installation/Installation-(RHEL-CentOS).md
Expand Up @@ -4,6 +4,10 @@ NOTE: These instructions assume you are the root user. If you are not, prepend

### On the DB Server ###

This host is where the MySQL database runs. It could be the same machine as your network management server (this is the most common initial deployment scenario).

> ** Whilst we are working on ensuring LibreNMS is compatible with MySQL strict mode, for now, please disable this after mysql is installed.
You are free to choose between using MySQL or MariaDB:

**MySQL**
Expand Down Expand Up @@ -56,6 +60,8 @@ Add the following line:

Change `<ip>` to the IP address that your MySQL server should listen on. Restart MySQL:

If you see a line that starts `sql-mode` then change this to `sql-mode=""`.

service mysqld restart

### On the NMS ###
Expand Down
6 changes: 6 additions & 0 deletions doc/Installation/Installation-Lighttpd-(Debian-Ubuntu).md
Expand Up @@ -4,6 +4,10 @@
### On the DB Server ###

This host is where the MySQL database runs. It could be the same machine as your network management server (this is the most common initial deployment scenario).

> ** Whilst we are working on ensuring LibreNMS is compatible with MySQL strict mode, for now, please disable this after mysql is installed.
You are free to choose between using MySQL or MariaDB:

**MySQL**
Expand Down Expand Up @@ -42,6 +46,8 @@ Find the line: `bind-address = 127.0.0.1`

Change `127.0.0.1` to the IP address that your MySQL server should listen on. Restart MySQL:

If you see a line that starts `sql-mode` then change this to `sql-mode=""`.

service mysql restart

### On the NMS ###
Expand Down
22 changes: 11 additions & 11 deletions validate.php
Expand Up @@ -13,13 +13,10 @@
* the source code distribution for details.
*/

require 'includes/console_colour.php';
$console_color = new Console_Color2();

$options = getopt('m:h::');

if (isset($options['h'])) {
print $console_color->convert(
echo
"\n Validate setup tool
Usage: ./validate.php [-m <module>] [-h]
Expand All @@ -31,7 +28,7 @@
Example: ./validate.php -m mail.
"
);
;
exit;
}

Expand Down Expand Up @@ -71,6 +68,12 @@
print_ok('Database connection successful');
}

// Test for MySQL Strict mode
$strict_mode = dbFetchCell("SELECT @@global.sql_mode");
if(strstr($strict_mode, 'STRICT_TRANS_TABLES')) {
print_warn('You have MySQL STRICT_TRANS_TABLES enabled, it is advisable to disable this until full support has been added: https://dev.mysql.com/doc/refman/5.0/en/sql-mode.html');
}

// Test transports
if ($config['alerts']['email']['enable'] === true) {
print_warn('You have the old alerting system enabled - this is to be deprecated on the 1st of June 2015: https://groups.google.com/forum/#!topic/librenms-project/1llxos4m0p4');
Expand Down Expand Up @@ -203,21 +206,18 @@


function print_ok($msg) {
global $console_color;
print $console_color->convert("%g[OK]%n %W$msg\n");
echo "[OK] $msg\n";

}//end print_ok()


function print_fail($msg) {
global $console_color;
print $console_color->convert("%r[FAIL]%n %W$msg\n");
echo "[FAIL] $msg\n";

}//end print_fail()


function print_warn($msg) {
global $console_color;
print $console_color->convert("%y[WARN]%n %W$msg\n");
echo "[WARN] $msg\n";

}//end print_warn()

0 comments on commit f02acd6

Please sign in to comment.