Page 1 of 1
Mysql error in log "Unknown MySQL Server Host"
Posted: Sat Mar 12, 2005 9:45 am
by diepes
Hi, I get the following error in the log file when I start ZM v1.20.1
Why is it not displaying the wrong values ? 'ZM_DB_SERVER'=localhost ?
==> zmdc.log <==
Starting pending process, zmtrigger.pl
'zmtrigger.pl' started at 05/03/12 11:32:09
'zmtrigger.pl' starting at 05/03/12 11:32:09, pid = 9197
DBI connect('database=ZM_DB_NAME;host=ZM_DB_SERVER','ZM_DB_USERA',...) failed: Unknown MySQL Server Host 'ZM_DB_SERVER' (1) at /usr/local/bin/zmtrigger.pl line 62
Can't call method "prepare_cached" on an undefined value at /usr/local/bin/zmtrigger.pl line 64.
BEGIN failed--compilation aborted at /usr/local/bin/zmtrigger.pl line 72.
'zmtrigger.pl ' crashed at 05/03/12 11:32:09, exit status 255
# cat /usr/local/etc/zm.conf
# ZoneMinder config
ZM_DB_SERVER=localhost
ZM_DB_NAME=zm
ZM_DB_USER=zm
ZM_DB_PASS=zmadmin
more info - mysql
Posted: Sat Mar 12, 2005 12:04 pm
by diepes
I enabled logging in mysql to the mysql.log file, and although i still see the error above form zmtrigger.pl
In the sql log everything seems fine.
Here is a snippit.
050312 14:00:50 48 Connect zm@localhost on zm
48 Query select * from Config
48 Quit
21 Query select count(Id) as ZoneCount from Zones where MonitorId = '7'
21 Query select count(if(Archived=0,1,NULL)) as EventCount, count(if(Archived,1,NULL)) as ArchEventCount, count(if(StartTime>'2005-03-12 14:00:49' - INTERVAL 1 HOUR && Archived = 0,1,NULL)) as HourEventCount, count(if(StartTime>'2005-03-12 14:00:49' - INTERVAL 1 DAY && Archived = 0,1,NULL)) as DayEventCount, count(if(StartTime>'2005-03-12 14:00:49' - INTERVAL 7 DAY && Archived = 0,1,NULL)) as WeekEventCount, count(if(StartTime>'2005-03-12 14:00:49' - INTERVAL 1 MONTH && Archived = 0,1,NULL)) as MonthEventCount from Events as E where MonitorId = '7'
050312 14:00:52 35 Query select * from Filters where (AutoArchive = 1 or AutoDelete = 1 or AutoUpload = 1 or AutoEmail = 1 or AutoMessage = 1 or AutoExecute != '') order by Name
35 Query select * from Filters where (AutoArchive = 1 or AutoDelete = 1 or AutoUpload = 1 or AutoEmail = 1 or AutoMessage = 1 or AutoExecute != '') order by Name
050312 14:01:18 49 Connect zm@localhost on zm
49 Query select * from Monitors
050312 14:01:28 49 Query select * from Monitors
050312 14:01:38 49 Query select * from Monitors
50 Connect zm@localhost on zm
50 Query select * from Config
50 Quit
51 Connect zm@localhost on
51 Init DB zm
51 Query select Name, Value, Type from Config order by Id
51 Query select Id, Name, Type, Function+0, Device, Channel, Format, Host, Port, Path, Width, Height, Palette, Orientation+0, Brightness, Contrast, Hue, Colour, EventPrefix, LabelFormat, LabelX, LabelY, ImageBufferCount, WarmupCount, PreEventCount, PostEventCount, AlarmFrameCount, SectionLength, FrameSkip, MaxFPS, FPSReportInterval, RefBlendPerc from Monitors where Id = 7
050312 14:01:39 51 Query select Id,Name,Type+0,Units,LoX,LoY,HiX,HiY,AlarmRGB,CheckMethod+0,MinPixelThreshold,MaxPixelThreshold,MinAlarmPixels,MaxAlarmPixels,FilterX,FilterY,MinFilterPixels,MaxFilterPixels,MinBlobPixels,MaxBlobPixels,MinBlobs,MaxBlobs from Zones where MonitorId = 7 order by Type, Id
050312 14:01:49 49 Query select * from Monitors
050312 14:01:59 49 Query select * from Monitors
050312 14:02:09 49 Query select * from Monitors
050312 14:02:19 49 Query select * from Monitors
050312 14:02:29 49 Query select * from Monitors
050312 14:02:39 49 Query select * from Monitors
050312 14:02:49 49 Query select * from Monitors
52 Connect zm@localhost on zm
52 Query select * from Config
52 Quit
53 Connect zm@localhost on
53 Init DB zm
53 Query select Name, Value, Type from Config order by Id
53 Query select Id, Name, Type, Function+0, Device, Channel, Format, Host, Port, Path, Width, Height, Palette, Orientation+0, Brightness, Contrast, Hue, Colour, EventPrefix, LabelFormat, LabelX, LabelY, ImageBufferCount, WarmupCount, PreEventCount, PostEventCount, AlarmFrameCount, SectionLength, FrameSkip, MaxFPS, FPSReportInterval, RefBlendPerc from Monitors where Id = 7
53 Query select Id,Name,Type+0,Units,LoX,LoY,HiX,HiY,AlarmRGB,CheckMethod+0,MinPixelThreshold,MaxPixelThreshold,MinAlarmPixels,MaxAlarmPixels,FilterX,FilterY,MinFilterPixels,MaxFilterPixels,MinBlobPixels,MaxBlobPixels,MinBlobs,MaxBlobs from Zones where MonitorId = 7 order by Type, Id
050312 14:02:59 49 Query select * from Monitors
050312 14:03:09 49 Query select * from Monitors
050312 14:03:19 49 Query select * from Monitors
050312 14:03:29 49 Query select * from Monitors
050312 14:03:39 49 Query select * from Monitors
050312 14:03:49 49 Query select * from Monitors
050312 14:03:59 49 Query select * from Monitors
050312 14:04:09 49 Query select * from Monitors
050312 14:04:19 49 Query select * from Monitors
Line 62 from /usr/local/bin/zmtrigger.pl
Posted: Sat Mar 12, 2005 12:40 pm
by diepes
Line 62 from /usr/local/bin/zmtrigger.pl
my $dbh = DBI->connect( "DBI:mysql:database=".ZM_DB_NAME.";host=".ZM_DB_SERVER, ZM_DB_USERA, ZM_DB_PASSA );
#I proceeded to replace line 62 with
my $dbh = DBI->connect( "DBI:mysql:database=zm;host=localhost", "zm", "zmadmin");
#producing new error in log
Bareword "ZM_DB_USERA" not allowed while "strict subs" in use at /usr/local/bin/zmtrigger.pl line 123.
Bareword "ZM_DB_PASSA" not allowed while "strict subs" in use at /usr/local/bin/zmtrigger.pl line 123.
#line 123
my $dbh = DBI->connect( "DBI:mysql:database=".ZM_DB_NAME.";host=".ZM_DB_SERVER, ZM_DB_USERA, ZM_DB_PASSA );
#Why is it using ZM_DB_USERA and not ZM_DB_USER ?
Fix for zmtrigger.pl
Posted: Sat Mar 12, 2005 3:58 pm
by diepes
In zmtrgger.pl, (ZM 1.20.1)
replaced
my $dbh = DBI->connect( "DBI:mysql:database=".ZM_DB_NAME.";host=".ZM_DB_SERVER, ZM_DB_USERA, ZM_DB_PASSA );
with
my $dbh = DBI->connect( "DBI:mysql:database=".&ZM_DB_NAME.";host=".&ZM_DB_SERVER, &ZM_DB_USER, &ZM_DB_PASS );
from zmfilter.pl in 2 places.
Now there is no more errors in log file.
Posted: Mon Mar 14, 2005 2:28 pm
by zoneminder
Yes, this was a problem in zmtrigger.pl that I'd already corrected for the next version, but not got around to mentioning here.
Phil
Posted: Sun Mar 20, 2005 10:14 pm
by lazyleopard
Is that problem in other files in 1.20.1 as well? The version lacking the '&'s seems to be present in zmaudit.p, zmfilter.pl, zmpkg.pl, zmtrigger.pl, zmupdate.pl, zmvideo.pl, and zmwatch.pl.
Posted: Sun Mar 20, 2005 11:50 pm
by zoneminder
No. The problem was with ZM_DB_USERA and ZM_DB_PASSA rather than ZM_DB_USER and ZM_DB_PASS (without any 'A's). The & I think is just a way of getting perl not to complain about references and whilst it won't hurt should not be necessary if the constants are correctly defined. This was just in zmtrigger.pl btw.
Phil
Posted: Mon Mar 21, 2005 7:17 am
by cordel
I made a new RPM that has this correction in it. The source RPM is there as well.
ftp://download.computerntelecom.com/pub ... updates/3/
Cheers,
Cordel
Posted: Mon Mar 21, 2005 10:21 pm
by lazyleopard
zoneminder wrote:The & I think is just a way of getting perl not to complain about references and whilst it won't hurt should not be necessary if the constants are correctly defined.
Hmmm... The '&'s do seem to be needed within the BEGIN block. If they're not there the script gets a bit confused:
Code: Select all
'zmtrigger.pl' started at 05/03/21 22:08:01
'zmtrigger.pl' starting at 05/03/21 22:08:01, pid = 8807
DBI connect('database=ZM_DB_NAME;host=ZM_DB_SERVER','ZM_DB_USER',...) failed: Unknown MySQL Server Host 'ZM_DB_SERVER' (1) at /usr/bin/zmtrigger.pl line 62
Can't call method "prepare_cached" on an undefined value at /usr/bin/zmtrigger.pl line 64.
BEGIN failed--compilation aborted at /usr/bin/zmtrigger.pl line 72.
'zmtrigger.pl ' crashed at 05/03/21 22:08:02, exit status 255
Presumably within that block things are still less than perfectly defined, or something...
Posted: Mon Mar 21, 2005 11:26 pm
by zoneminder
Yes, sorry. I didn't actually twig that it was the instance in the BEGIN block that was being discussed. You need the & in there, but don't anywhere else in the script.
It's updated in 1.21.0 to be correct in both places even though it sounds like I have no clue what I'm talking about!
Phil
Posted: Tue Mar 22, 2005 1:33 pm
by lazyleopard
Cheers! When's 1.21.0 escaping?
Posted: Tue Mar 22, 2005 7:42 pm
by zoneminder
Escaped!!