Can't save "Add New Monitor" in ZM-Console

Forum for questions and support relating to the 1.29.x releases only.
Locked
dorus43
Posts: 5
Joined: Sat Apr 23, 2016 1:41 pm

Can't save "Add New Monitor" in ZM-Console

Post by dorus43 »

I have a good working system on an other desktop (lubuntu 15.10 with Zoneminder 1.28), there
I can add my 2 IP camera's ( D-link 932L) without any problem.

On an other desktop I installed Ubuntu 16.04 (Amd 64) and installed zoneminder 1.29 via
https://wiki.zoneminder.com/Ubuntu_Serv ... e_easy_way.

I had a few missing dependencies, but overall I got the ZM-console without to many problems.

When adding my 2 camera's ( with the same data as in the "Zoneminder 1.28 " system) I noticed an additional field "Server" with the not changeable value 'None'.


When I tried to save it, the window shows:


SQL-ERR 'SQLSTATE[HY000]: General error: 1366 Incorrect integer value: '' for column 'ServerId' at row 1', statement was 'insert into Monitors set LinkedMonitors = '', Name = 'Monitor-1', ServerId = '', Type = 'Remote', Function = 'Monitor', Enabled = '1', RefBlendPerc = '6', AlarmRefBlendPerc = '6', AnalysisFPS = '', MaxFPS = '', AlarmMaxFPS = '', Device = '/dev/video0', Channel = '0', Format = '255', Palette = '0', V4LMultiBuffer = '', V4LCapturesPerFrame = '1', Options = '', LabelFormat = '%N - %Y-%m-%d %H:%M:%S %z', LabelX = '0', LabelY = '0', LabelSize = '1', ImageBufferCount = '50', WarmupCount = '25', PreEventCount = '25', PostEventCount = '25', StreamReplayBuffer = '1000', AlarmFrameCount = '1', EventPrefix = 'Event-', SectionLength = '600', FrameSkip = '0', MotionFrameSkip = '0', AnalysisUpdateDelay = '0', FPSReportInterval = '1000', DefaultView = 'Events', DefaultRate = '100', DefaultScale = '100', WebColour = 'red', Exif = '0', SignalCheckColour = '#0000c0', Protocol = 'http', Method = 'simple', Host = 'admin:dorus43@192.168.2.5', Port = '80', Path = 'video.cgi', Colours = '4', Width = '640', Height = '480', Orientation = '0', Deinterlacing = '0', Sequence = 1'


Any help will be appreciated

dorus43
krasnal
Posts: 7
Joined: Sat Apr 23, 2016 8:45 am

Re: Can't save "Add New Monitor" in ZM-Console

Post by krasnal »

I had the same problem with my install on Debian 8 with MySQL upgraded to v5.6.

Long story short, you probably need to have the line

Code: Select all

sql_mode=NO_ENGINE_SUBSTITUTION
in file /etc/mysql/my.cnf in place of

Code: Select all

sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES
The serverid column is integer, so should only accept either an integet value or NULL. It should not accept a zero length string, which is what it is being supplied instead of a NULL value. Removing the STRICT_TRANS_TABLES option from the above line of the config file tells MySQL to operate in a more permissive (but technically incorrect) manner. It looks like a rookie programming error that hasn't yet been corrected but I guess there might also be a more involved reason why it's as it is.
bbunge
Posts: 2951
Joined: Mon Mar 26, 2012 11:40 am
Location: Pennsylvania

Re: Can't save "Add New Monitor" in ZM-Console

Post by bbunge »

All that stuff is in the instructions.

When all else fails...
krasnal
Posts: 7
Joined: Sat Apr 23, 2016 8:45 am

Re: Can't save "Add New Monitor" in ZM-Console

Post by krasnal »

bbunge wrote:All that stuff is in the instructions.

When all else fails...
The guide that the OP refers to makes no mention of the STRICT_TRANS_TABLES directive, which is what *appears* to be the issue here. We'll need to await the OP's response to see if its removal was necessary. In my case, the sql_mode was set to "NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES" from the beginning and it took a bit of detective work to figure out what was going wrong. The Debian installation guide does not cover this point, nor could I find anything related to it when upgrading MySQL to version 5.6.
dorus43
Posts: 5
Joined: Sat Apr 23, 2016 1:41 pm

Re: Can't save "Add New Monitor" in ZM-Console

Post by dorus43 »

@krasnal Thanks for your help, but neither in /etc/mysql/my.cnf or in ~/.my.cnf ,
I could find "sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES", but in /usr/share/mysql/my-default.cnf
I found it and changed it to" sql_mode=NO_ENGINE_SUBSTITUTION" restarted the system, but unfortunately it didn't solve
my problem.
Has anybody has an other suggestion ?
Thanks
krasnal
Posts: 7
Joined: Sat Apr 23, 2016 8:45 am

Re: Can't save "Add New Monitor" in ZM-Console

Post by krasnal »

@dorus43 The instructions mention that you should

Code: Select all

cp /etc/mysql/mysql.conf.d/mysqld.cnf /etc/mysql/my.cnf
and then edit the second file. Do you have the "NO_ENGINE_SUBSTITUTION" line in the second file?

You can also logon to mysql (mysql -u root -p) and run the following

Code: Select all

SELECT @@GLOBAL.sql_mode;
SELECT @@SESSION.sql_mode;
Maybe they'll throw something up.
dorus43
Posts: 5
Joined: Sat Apr 23, 2016 1:41 pm

Re: Can't save "Add New Monitor" in ZM-Console

Post by dorus43 »

I did not found "NO_ENGINE_SUBSTITUTION" in /etc/mysql/my.cnf
--------------------------
mysql> SELECT @@GLOBAL.sql_mode;
+-------------------------------------------------------------------------------------------------------------------------------------------+
| @@GLOBAL.sql_mode |
+-------------------------------------------------------------------------------------------------------------------------------------------+
| ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION |
+-------------------------------------------------------------------------------------------------------------------------------------------+
1 row in set (0,00 sec)

mysql> SELECT @@SESSION.sql_mode;
+-------------------------------------------------------------------------------------------------------------------------------------------+
| @@SESSION.sql_mode |
+-------------------------------------------------------------------------------------------------------------------------------------------+
| ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION |
+-------------------------------------------------------------------------------------------------------------------------------------------+
1 row in set (0,00 sec)

mysql>
krasnal
Posts: 7
Joined: Sat Apr 23, 2016 8:45 am

Re: Can't save "Add New Monitor" in ZM-Console

Post by krasnal »

dorus43 wrote:I did not found "NO_ENGINE_SUBSTITUTION" in /etc/mysql/my.cnf
Well, it should be there, so you'll need to edit the file.

The sql queries show that STRICT_TRANS_TABLES is still set. I think it's the root cause of your problem.
dorus43
Posts: 5
Joined: Sat Apr 23, 2016 1:41 pm

Re: Can't save "Add New Monitor" in ZM-Console

Post by dorus43 »

cat /etc/mysql/my.cnf
#
# The MySQL database server configuration file.
#
# You can copy this to one of:
# - "/etc/mysql/my.cnf" to set global options,
# - "~/.my.cnf" to set user-specific options.
#
# One can use all long options that the program supports.
# Run program with --help to get a list of available options and with
# --print-defaults to see which it would actually understand and use.
#
# For explanations see
# http://dev.mysql.com/doc/mysql/en/serve ... ables.html

# This will be passed to all mysql clients
# It has been reported that passwords should be enclosed with ticks/quotes
# escpecially if they contain "#" chars...
# Remember to edit /etc/mysql/debian.cnf when changing the socket location.

# Here is entries for some specific programs
# The following values assume you have at least 32M ram

[mysqld_safe]
socket = /var/run/mysqld/mysqld.sock
nice = 0

[mysqld]
#
# * Basic Settings
#
user = mysql
pid-file = /var/run/mysqld/mysqld.pid
socket = /var/run/mysqld/mysqld.sock
port = 3306
basedir = /usr
datadir = /var/lib/mysql
tmpdir = /tmp
lc-messages-dir = /usr/share/mysql
skip-external-locking
#
# Instead of skip-networking the default is now to listen only on
# localhost which is more compatible and is not less secure.
bind-address = 127.0.0.1
#
# * Fine Tuning
#
key_buffer_size = 16M
max_allowed_packet = 16M
thread_stack = 192K
thread_cache_size = 8
# This replaces the startup script and checks MyISAM tables if needed
# the first time they are touched
myisam-recover-options = BACKUP
#max_connections = 100
#table_cache = 64
#thread_concurrency = 10
#
# * Query Cache Configuration
#
query_cache_limit = 1M
query_cache_size = 16M
#
# * Logging and Replication
#
# Both location gets rotated by the cronjob.
# Be aware that this log type is a performance killer.
# As of 5.1 you can enable the log at runtime!
#general_log_file = /var/log/mysql/mysql.log
#general_log = 1
#
# Error log - should be very few entries.
#
log_error = /var/log/mysql/error.log
#
# Here you can see queries with especially long duration
#log_slow_queries = /var/log/mysql/mysql-slow.log
#long_query_time = 2
#log-queries-not-using-indexes
#
# The following can be used as easy to replay backup logs or for replication.
# note: if you are setting up a replication slave, see README.Debian about
# other settings you may need to change.
#server-id = 1
#log_bin = /var/log/mysql/mysql-bin.log
expire_logs_days = 10
max_binlog_size = 100M
#binlog_do_db = include_database_name
#binlog_ignore_db = include_database_name
#
# * InnoDB
#
# InnoDB is enabled by default with a 10MB datafile in /var/lib/mysql/.
# Read the manual for more InnoDB related options. There are many!
#
# * Security Features
#
# Read the manual, too, if you want chroot!
# chroot = /var/lib/mysql/
#
# For generating SSL certificates I recommend the OpenSSL GUI "tinyca".
#
# ssl-ca=/etc/mysql/cacert.pem
# ssl-cert=/etc/mysql/server-cert.pem
# ssl-key=/etc/mysql/server-key.pem
dorus43
Posts: 5
Joined: Sat Apr 23, 2016 1:41 pm

Re: Can't save "Add New Monitor" in ZM-Console

Post by dorus43 »

@krasnal Thanks for your help at last it works , I just added "sql_mode = NO_ENGINE_SUBSTITUTION" at the end of the "/etc/mysql/my.cnf "file and restarted my desktop
thanks again

Dorus
Flyindogo
Posts: 1
Joined: Sun May 15, 2016 5:18 am

Re: Can't save "Add New Monitor" in ZM-Console

Post by Flyindogo »

Hello,
For me, it only worked by adding "sql_mode = NO_ENGINE_SUBSTITUTION" to /etc/mysql/mysql.conf.d/mysqld.cnf
Adding it my.cnf prevented mysql to restart...
Thank you for your great help
Rizome
Posts: 5
Joined: Fri May 11, 2018 5:52 am

Re: Can't save "Add New Monitor" in ZM-Console

Post by Rizome »

A newer discussion of this issue, and another solution is here: https://github.com/ZoneMinder/zoneminder/issues/2504:

"using kate to edit both zm and cake php files, .. inserted 'IGNORE' between all 'INSERT INTO' and after 'APPEND ' sql statements.
Locked