Difference between revisions of "FAQ"

From ZoneMinder Wiki
Jump to navigationJump to search
 
(94 intermediate revisions by 43 users not shown)
Line 1: Line 1:
== ZoneMinder Frequently Asked Questions ==


This is the new FAQ page. I will be migrating the existing FAQs here as soon as possible. In the meantime the old FAQ page is available [http://www.zoneminder.com/faq.html here].
==User Generated ZoneMinder Frequently Asked Questions ==


Feel free to contribute any FAQs that you think are missing.
These are user generated FAQs for ZoneMinder.
The official ZoneMinder FAQ can be found at http://zoneminder.readthedocs.org/en/latest/faq.html


===How can I stop ZoneMinder filling up my disk?===
Please treat this page as a supplement to the official FAQ. If you have tips that are not covered in the official FAQ
please add them here. If we find some tips really interesting, we may move them to the official FAQ.


Recent versions of ZoneMinder come with a filter you can use for this purpose already included. However '''by default it is not enabled for event deletion'''.
You can add your FAQ by following the format below


The filter is called ''PurgeWhenFull'' and to find it, choose one of the event counts from the console page, for instance events in the last hour, for one of your monitors.
=== Sample FAQ Heading ===
Sample FAQ answer.


This will bring up an event listing and a filter window.
----


In the filter window there is a dropdown select box labelled 'Use Filter', that lets your select a saved filter. Select 'PurgeWhenFull' and it will load that filter.
=== Montage Layout Names duplicity ===


Make any modifications you might want, such as the percentage full you want it to kick in, or how many events to delete at a time (it will repeat the filter as many times as needed to clear the space, but will only delete this many events each time to get there).
Problem with Montage Layout naming - using same name <b><i>causes creating new one instead of updating existing one...</i></b><br>
Ubuntu 20.04.3 LTS Focal Fossa - easy setup - thank You ZoneMinder !<br>
- but then You need to access the database "zm" - and I searched and found easy solution and modified a little...<br>
- in this case - I use webui of phpmyadmin to manage the content of database - it is easy for beginners,<br>
and You cannot harm the database so easy like with bad syntax on command line...<br>


Then click on 'Save' which will bring up a new window. Make sure the 'Automatically delete' box is checked and press save to save your filter. This will then run in the background to keep your disk within those limits.
<b>1./ log-in to terminal as su</b><br>
  sudo su
(provide password for Your superuser)<br>


After you've done that, you changes will automatically be loaded into zmfilter within a few minutes.
<b>2./ install phpmyadmin</b><br>
  apt-get install phpmyadmin
- I have used for both apache2 and lighttpd<br>
- I have created custom password (for example: PASSword123)<br>


Check the <tt>zmfilter.log</tt> file to make sure it is running as sometimes missing perl modules mean that it nevers runs but people don't always realise.
<b>3./ modify access to databases for default user "phpmyadmin"</b><br>
- enter mysql:<br>
  mysql -u root -pzm
- pzm is for -p and zm because "-p zm" with space don't work...<br>
- I have used command for all databases for easy use...<br>
  GRANT ALL ON *.* TO 'phpmyadmin'@'localhost'
- this causes that user "phpmyadmin" has all databases on host visible and editable<br>
- normaly it would look like this - only for "zm" database<br>
  GRANT ALL ON zm.* TO 'phpmyadmin'@'localhost'


===What does a 'Can't shmget: Invalid argument' error in my logs mean?===
<b>4./ delete or modify unwanted layouts</b><br>
- connect from browser:
  http://localhost/phpmyadmin
- username "phpmyadmin"
- password "PASSword123"
- open database "zm" and look for table "MontageLayouts"<br>
- do what You want (study how layout is defined...) :-)<br>
- or simply delete unwanted or broken layout - after this refresh page with layout and<br>
in the dropdown menu of layouts is the deleted one (or more) not more available...<br>


This error is discussed in the README in the following excerpt:-
<b><i>Don't forget - MYSQL and PHPMYADMIN are two DIFFERENT things...<br>
''...this is caused by an attempt to allocate an amount of shared memory greater than your system can handle. The size it requests is based on the following formula, ring buffer size x image width x image height x 3 (for 24 bit images) + a bit of overhead.
- also take care about usernames and passwords</i></b>


So, for example:
----
<pre>384x288 capture resolution, that makes: 110 592 pixels
in 24 bit color that's x24 = 2 654 208 bits per frame
by 80 frames ring buffer x80 = 212 336 640 bits per camera
by 4 cameras x4 = 849 346 560 bits.
Plus 10% overhead = 934 281 216 bits
That's 116 785 152 bytes, and
= 114 048 kB, respectively 111.38 MB.
If my shared memory is set to 134 217 728, which is exactly 128MB,
that means I shouldn't have any problem.
(Note that 1 byte = 8 bits and 1kbyte = 1024bytes, 1MB = 1024 kB)</pre>
 
If for instance you were using 24bit 640x480 then this would come to about 92Mb if you are using the default buffer size of 100. If this is too large then you can either reduce the image or buffer sizes or increase the maximum amount of shared memory available. If you are using RedHat then you can get details on how to change these settings at http://www.redhat.com/docs/manuals/database/RHDB-2.1-Manual/admin_user/kernel-resources.html
 
You should be able to use a similar procedure  with other distributions to modify the shared memory pool without kernel recompilations though in some cases this may be necessary. Note, this error also sometimes occurs if you have an old shared memory segment lying around from a previous run that is too small. Use the ipcs and ipcrm system commands to check and remove it if necessary.'"
 
You can often find out how much shared memory is available by typing the following :-
 
<pre>cat /proc/sys/kernel/shmall</pre>
 
and the most you can allocate in one go :-
 
<pre>cat /proc/sys/kernel/shmmax</pre>
 
To change these values type (for example) :-
 
<pre>echo 134217728 >/proc/sys/kernel/shmall
echo 134217728 >/proc/sys/kernel/shmmax</pre>
 
However be aware that sometimes you will only need to change the shmmax value as shmall is often large enough. Also changing these values in this way is only effective until your machine is rebooted. To change them permanently you will need to edit <tt>/etc/sysctl.conf</tt> and add the following lines (for example) :-
 
<pre>kernel.shmall = 134217728
kernel.shmmax = 134217728</pre>
 
Which will enforce the changes the next time your machine is restarted.
 
===Why can't I see streamed images when I can see stills in the Zone window etc?===
 
This issue is normally down to one of two causes
 
1) You are using Internet Explorer and are trying to view multi-part jpeg streams. IE does not support these streams directly, unlike most other browsers. You will need to install Cambozola or another multi-part jpeg aware pluging to view them. To do this you will need to obtain the applet from the Downloads page and install the cambozola.jar file in the same directly as the ZoneMinder php files. Then find the ZoneMinder Options->Images page and enable ZM_OPT_CAMBOZOLA and enter the web path to the .jar file in ZM_PATH_CAMBOZOLA. This will ordinarily just be cambozola.jar. Provided ZM_CAN_STREAM is set to auto and ZM_STREAM_METHOD is set to jpeg then Cambozola should be loaded next time you try and view a stream.
2) The other common cause for being unable to view streams is that you have installed the ZoneMinder cgi binaries (zms and nph-zms) in a different directory than your web server is expecting. Make sure that the --with-cgidir option you use to the ZoneMinder configure script is the same as the CGI directory configure for your web server. If you are using Apache, which is the most common one, then in your httpd.conf file there should be a line like <pre>ScriptAlias /cgi-bin/ "/var/www/cgi-bin/"</pre> where the last directory in the quotes is the one you have specified. If not then change one or the other to match. Be warned that configuring apache can be complex so changing the one passed to the ZoneMinder configure (and then rebuilding and reinstalling) is recommended in the first instance. If you change the apache config you will need to restart apache for the changes to take effect. If you still cannot see stream reliably then try changing Options->Paths->ZM_PATH_ZMS to just use zms if nph-zms is specified, or vice versa. Also check in your apache error logs.
 
===I have several monitors configured but when I load the Montage view in FireFox why can I only see two? or, Why don't all my cameras display when I use the Montage view in FireFox?===
 
By default FireFox only supports a small number of simultaneous connections. Using the montage view usually requires one persistent connection for each camera plus intermittent connections for other information such as statuses.
 
You will need to increase the number of allowed connections to use the montage view with more than a small number of cameras.  Certain FireFox extensions such as FasterFox may also help to achieve the same result.
 
To resolve this situation, follow the instructions below:
 
<pre>Enter about:config in the address bar
 
scroll down to
browser.cache.check_doc_frequency 3
change the 3 to a 1
 
browser.cache.disk.enable True -> False
network.http.max-connections-per-server -> put a value of 100
network.http.max-persistent-connections-per-proxy -> 100 again
network.http.max-persistent-connections-per-server -> 100 again
</pre>
 
===Why is ZoneMinder using so much CPU?===
 
The various elements of ZoneMinder can be involved in some pretty intensive activity, especially while analysing images for motion. However generally this should not overwhelm your machine unless it is very old or underpowered.
 
There are a number of specific reasons why processor loads can be high either by design or by accident. To figure out exactly what is causing it in your circumstances requires a bit of expermentation.
 
The main causes are.
 
# Using a video palette other than greyscale or RGB24. This can cause a relatively minor performace hit, though still significant. Although some cameras and cards require using planar palettes ZM currently doesn't support this format internally (yet) and each frame is converted to an RGB representation prior to processing. Unless you have compelling reasons for using YUV or reduced RGB type palettes such as hitting USB transfer limits I would experiment to see if RGB24 or greyscale is quicker. Put your monitors into 'Monitor' mode so that only the capture daemons are running and monitor the process load of these (the 'zmc' processes) using top. Try it with various palettes to see if it makes a difference.
# Big image sizes. A image of 640x480 requires at least four times the processing of a 320x240 image. Experiment with different sizes to see what effect it may have. Sometimes a large image is just two interlaced smaller frames so has no real benefit anyway.
# Capture frame rates. Unless there's a compelling reason in your case there is often little benefit in running cameras at 25fps when 5-10fps would often get you results just as good. Try changing your monitor settings to limit your cameras to lower frames rates. You can still configure ZM to ignore these limits and capture as fast as possible when an event is detected.
# Run function. Obviously running in Record or Mocord modes or in Modect with lots of events generates a lot of DB and file activity and so CPU and load will increase.
# Basic default detection zones. By default when a camera is added one detection zone is added which covers the whole image with a default set of parameters. If you camera covers a view in which various regions are unlikely to generate a valid alarm (ie the sky) then I would experiment with reducing the zone sizes or adding inactive zones to blank out areas you don't want to monitor. Additionally the actual settings of the zone themselves may not be optimal. When doing motion detection the number of changed pixels above a threshold is examined, then this is filter, then contiguous regions are calculated to see if an alarm is generated. If any maximum or minimum threshold is exceeded according to your zone settings at any time the calculation stops. If your settings always result in the calculations going through to the last stage before being failed then additional CPU time is used unnecessarily. Make sure your maximum and minimumzone thresholds are set to sensible values and experiment by switching RECORD_EVENT_STATS on and seeing what the actual values of alarmed pixels etc are during sample events.
# Optimise your settings. After you've got some settings you're happy with then switching off RECORD_EVENT_STATS will prevent the statistics being written to the database which saves some time. Other settings which might make a difference are ZM_FAST_RGB_DIFFS, ZM_OPT_FRAME_SERVER and the JPEG_xxx_QUALITY ones.
 
I'm sure there are other things which might make a difference such as what else you have running on the box and memory sizes (make sure there's no swapping going on). Also speed of disk etc will make some difference during event capture and also if you are watching the whole time then you may have a bunch of zms processes running also.
 
I think the biggest factors are image size, colour depth and capture rate. Having said that I also don't always know why you get certains results from 'top'. For instance if I have a 'zma' daemon running for a monitor that is capturing an image. I've commented out the actual analysis so all it's doing is blending the image with the previous one. In colour mode this takes ~11 milliseconds per frame on my system and the camera is capturing at ~10fps. Using 'top' this reports the process as using ~5% of CPU and permanently in R(un) state. Changing to greyscale mode the blending takes ~4msec (as you would expect as this is roughly a third of 11) but top reports the process as now with 0% CPU and permanently in S(leep) state. So an actual CPU resource usage change of a factor of 3 causes huge differences in reported CPU usage. I have yet to get to the bottom of this but I suspect it's to do with scheduling somewhere along the line and that maybe the greyscale processing will fit into one scheduling time slice whereas the colour one won't but I have no evidence of this yet!
 
===Why is the timeline view all messed up?===
 
The timeline view is a new view allowing you to see a graph of alarm activity over time and to quickly scan and home in on events of interest. However this feature is highly complex and still in beta. It is based extensively on HTML div tags, sometimes lots of them. Whilst FireFox is able to render this view successfully other browsers, particular Internet Explorer do not seem able to cope and so present a messed up view, either always or when there are a lot of events.
Using the timeline view is only recommended when using FireFox, however even then there may be issues.
 
===How much Hard Disk Space / Bandwidth do I need for ZM?===
Please see [http://www.jpwilson.eu/ZM_Utils/ZM%20storage%20calc%20sheet.xls Storage Calc] in excel format
 
Or go to [http://www.axis.com/techsup/cam_servers/bandwidth/bw_210.htm this link] for the Axis bandwidth calculator. Although this is aimed at Axis cameras it still produces valid results for any kind of IP camera.
 
As a quick guide I have 4 cameras at 320x240 storing 1 fps except during alarm events. After 1 week 60GB of space in the volume where the events are stored (/var/www/html/zm) has been used.
 
===When I try and run ZoneMinder I get lots of audit permission errors in the logs and it won't start===
Many Linux distributions nowadays are built with security in mind. One of the latest methods of achieving this is via SELinux (Secure Linux) which controls who is able to run what in a more precise way then traditional accounting and file based permissions ([http://en.wikipedia.org/wiki/Selinux]).
If you are seeing entries in your system log like:
 
  Jun 11 20:44:02 kernel: audit(1150033442.443:226): avc: denied { read } for pid=5068
  comm="uptime" name="utmp" dev=dm-0 ino=16908345 scontext=user_u:system_r:httpd_sys_script_t
  tcontext=user_u:object_r:initrc_var_run_t tclass=file
 
then it is likely that your system has SELinux enabled and it is preventing ZoneMinder from performaing certain activities. You then have two choices. You can either tune SELinux to permit the required operations or you can disable SELinux entirely which will permit ZoneMinder to run unhindered. Disabling SELinux is usually performed by editing it's configuration file (e.g., <tt>/etc/selinux/config</tt>) and then rebooting. However if you run a public server you should read up on the risks associated with disabled Secure Linux before disabling it.
 
Note that SELinux may cause errors other than those listed above. If you are in any doubt then it can be worth disabling SELinux experimentally to see if it fixes your problem before trying other solutions.
 
=== How do I enable ZoneMinder's security? ===
In the console, click on Options. Check the box next to "ZM_OPT_USE_AUTH". You will immediately be asked to login. The username is 'admin' and the password is 'admin'.
 
'''To Manage Users:'''<br>
In main console, go to '''Options->Users'''.
 
=== Why does ZM stop recording once I have 32000 events for my monitor? ===
This is a limitation of the ext3 filesystem that most Linux distributions use.
 
One directory cannot hold more than 32k approx  files. Future versions of ZM will have a deeper filesystem but for now you have to reduce the number of events or use a different filesystems such as reiserfs.
 
If you search for ext3 or reiserfs on the forums you will find various threads on this issue.
 
== Managing system load ''(with IP Cameras in mind)'' ==
 
=== Introduction ===
Zoneminder is a superb application in every way, but it does a job that needs a lot of horsepower especially when using multiple IP cameras. IP Cams require an extra level of processing to analogue cards as the jpg or mjpeg images need to be decoded before analysing. This needs grunt. If you have lots of cameras, you need lots of grunt.
 
Why do ZM need so much grunt?
Think what Zoneminder is actually doing. In modect mode ZM is:
1. Fetching a jpeg from the camera. (Either in single part or multipart stream)
2. Decoding the jpeg image.
3. Comparing the zoned selections to the previous image or images and applying rules.
4. If in alarm state, writing that image to the disk and updating the mysql database.
 
If you're capturing at five frames per second, the above is repeated five times every second, multiplied by the number of cameras. Decoding the images is what takes the real power from the processor and this is the main reason why analogue cameras which present an image ready-decoded in memory take less work.
 
=== How do I know if my computer is overloaded? ===
If your CPU is running at 100% all the time, it's probably overloaded (or running at exact optimisation). If the load is consistently high (over 10.0 for a single processor) then Bad Things happen - like lost frames, unrecorded events etc. Occasional peaks are fine, normal and nothing to worry about.
 
Zoneminder runs on Linux, Linux measures system load using "load", which is complicated but gives a rough guide on what the computer is doing at any given time. Zoneminder shows Load on the main page (top right) as well as disk space. Typing "uptime" on the command line will give a similar guide, but with three figures to give a fuller measure of what's happening over a period of time but for the best guide to see what's happening, install "htop" - which gives easy to read graphs for load, memory and cpu usage.
 
A load of 1.0 means the processor has "just enough to do right now". Also worth noting that a load of 4.0 means exactly the same for a quad processor machine - each number equals a single processor's workload. A very high load can be fine on a computer that has a stacked workload - such as a machine sending out bulk emails, or working its way through a knotty problem; it'll just keep churning away until it's done. However - Zoneminder needs to process information in real time so it can't afford to stack its jobs, it needs to deal with them right away.
 
For a better and full explanation of Load: http://en.wikipedia.org/wiki/Load_%28computing%29
 
=== My load is too high, how can I reduce it? ===
Zoneminder is /very/ tweakable and it's possible to tune it to compromise. The following are good things to try, in no particular order;
 
Change the jpeg libraries. In most distributions Linux uses standard jpeg libraries which although fine for most things, don't use the MMX functions in nearly all modern processors. Check whether your cpu supports mmx by running "cpuid |grep MMX" which should give you a line or two along the lines of "MMX instructions". If so, give the libs a try. Most people report their load halves simply by using these libs. http://www.zoneminder.com/forums/viewtopic.php?t=6419 gives more info. Nobody's posted there to say it broke their system... Yet.
 
If your camera allows you to change image size, think whether you can get away with smaller images. Smaller pics = less load. 320x240 is usually ok for close-up corridor shots.
 
Go Black and White. Colour pictures use twice to three times the CPU, memory and diskspace but give little benefit to identification.
 
Reduce frames per second. Halve the fps, halve the workload. If your camera supports fps throttling (Axis do), try that - saves ZM having to drop frames from a stream. 2-5 fps seems to be widely used.
 
Experiment with using jpeg instead of mjpeg. Some users have reported it gives better performance, but YMMV.
 
Tweak the zones. Keep them as small and as few as possible. Stick to one zone unless you really need more.
 
Schedule. If you are running a linux system at near capacity, you'll need to think carefully about things like backups and scheduled tasks. updatedb - the process which maintains a file database so that 'locate' works quickly, is normally scheduled to run once a day and if on a busy system can create a heavy increase on the load. The same is true for scheduled backups, especially those which compress the files. Re-schedule these tasks to a time when the cpu is less likely to be busy, if possible - and also use the "nice" command to reduce their priority. (crontab and /etc/cron.daily/ are good places to start)
 
Reduce clutter on your PC. Don't run X unless you really need it, the GUI is a huge overhead in both memory and cpu.
 
More expensive options:
 
Increase RAM. If your system is having to use disk swap it will HUGELY impact performance in all areas. Again, htop is a good monitor - but first you need to understand that because Linux is using all the memory, it doesn't mean it needs it all - linux handles ram very differently to Windows/DOS and caches stuff. htop will show cached ram as a different colour in the memory graph. Also check that you're actually using a high memory capable kernel - many kernels don't enable high memory by default.
 
Faster CPU. Simple but effective. Zoneminder also works very well with multiple processor systems out of the box (if SMP is enabled in your kernel). The load of different cameras is spread across the processors.
 
=== What about disks and bandwidth? ===
 
In most modern pc-based servers, disk I/O is more than adequate for the speeds involved in capturing from multiple cameras in most scenarios.
 
A typical 100mbit LAN will cope with most setups easily. If you're feeding from cameras over smaller or internet links, obviously fps will be much lower.
 
Disk and Bandwidth calculators are referenced on the Zoneminder wiki here: http://www.zoneminder.com/wiki/index.php/FAQ#How_much_Hard_Disk_Space_.2F_Bandwidth_do_I_need_for_ZM.3F
 
 
== Building ZoneMinder ==
 
=== How do I build for X10 support? ===
 
You do not need to rebuild ZM for X10 support. You will need to install the perl module and switch on X10 in the options, then restart. Installing the perl module is covered in the README amongst other places but in summary, do:
 
perl -MCPAN -eshell
install X10::ActiveHome
quit
 
 
== Extending ZoneMinder ==
 
=== How can I get ZM to do different things at different times of day or week? ===
If you want to configure ZoneMinder to do motion detection during the day and just record at night, for example, you will need to use ZoneMinder 'run states'. A run state is a particular configuration of monitor functions that you want to use at any time.
 
To save a run state you should first configure your monitors for Modect, Record, Monitor etc as you would want them during one of the times of day. Then click on the running state link at the top of the Console view. This will usually say 'Running' or 'Stopped'. You will then be able to save the current state and give it a name, 'Daytime' for example. Now configure your monitors how you would want them during other times of day and save that, for instance as 'Nighttime'.
 
Now you can switch between these two states by selecting them from the same dialog you saved them, or from the command line from issue the command ''zmpkg.pl <run state>'', for example ''zmpkg.pl Daytime''.
 
The final step you need to take, is scheduling the time the changes take effect. For this you can use [http://en.wikipedia.org/wiki/Cron cron]. A simple entry to change to the Daylight state at at 8am and to the nighttime state at 8pm would be as follows,
<pre>0 8 * * * /usr/local/bin/zmpkg.pl Daytime
0 20 * * * /usr/local/bin/zmpkg.pl Nighttime</pre>
 
Although the example above describes changing states at different times of day, the same principle can equally be applied to days of the week or other more arbitrary periods.
 
For an alternative method of time controlling ZoneMinder, forum user 'voronwe' has created a more interactive calendar style integration. Details of this can be found in this [http://www.zoneminder.com/forums/viewtopic.php?t=6519 forum thread]. If you would like to find out more about this contribution please post on this thread.
 
=== How can I use ZoneMinder to trigger something else when there is an alarm? ===
ZoneMinder includes a perl API which means you can create a script to interact with the ZM shared memory data and use it in your own scripts to react to ZM alarms or to trigger ZM to generate new alarms. Full details are in the README or by doing 'perdoc ZoneMinder', 'perldoc ZoneMinder::SharedMem' etc.
Below is an example script that checks all monitors for alarms and when one occurs, prints a message to the screen. You can add in your own code to make this reaction a little more useful.
 
<pre>#!/usr/bin/perl -w
 
use strict;
 
use ZoneMinder;
 
$| = 1;
 
zmDbgInit( "myscript", level=>0, to_log=>0, to_syslog=>0, to_term=>1 );
 
my $dbh = DBI->connect( "DBI:mysql:database=".ZM_DB_NAME.";host=".ZM_DB_HOST, ZM_DB_USER, ZM_DB_PASS );
 
my $sql = "select M.*, max(E.Id) as LastEventId from Monitors as M left join Events as E on M.Id = E.MonitorId where M.Function != 'None' group by (E.MonitorId)";
my $sth = $dbh->prepare_cached( $sql ) or die( "Can't prepare '$sql': ".$dbh->errstr() );
 
my $res = $sth->execute() or die( "Can't execute '$sql': ".$sth->errstr() );
my @monitors;
while ( my $monitor = $sth->fetchrow_hashref() )
{
    push( @monitors, $monitor );
}
 
while( 1 )
{
    foreach my $monitor ( @monitors )
    {
        next if ( !zmShmVerify( $monitor ) );
        if ( my $last_event_id = zmHasAlarmed( $monitor, $monitor->{LastEventId} ) )
        {
            $monitor->{LastEventId} = $last_event_id;
            print( "Monitor ".$monitor->{Name}." has alarmed\n" );
            #
            # Do your stuff here
            #
        }
    }
    sleep( 1 );
}</pre>
 
 
==Trouble Shooting==
Here are some things that will help you track down whats wrong.
This is also how to obtain the info that we need to help you on the forums.
 
===What logs should I check for errors?===
ZoneMinder creates its own logs and are usually located in the <tt>/tmp</tt> directory.
 
The ZoneMinder logs for the RPM packages are located in <tt>/var/log/zm</tt>.
 
Depending on your problem errors can show up in any of these logs but, usually the logs of interest are <tt>zmdc.log</tt> and <tt>zmpkg.log</tt> if ZM is not able to start.
 
Now since ZM is dependent on other components to work, you might not find errors in ZM but in the other components.
Other logs of interest are:<tt>
*/var/log/messages and/or /var/log/syslog
*/var/log/dmesg
*/var/log/httpd/error_log</tt> (RedHat/Fedora) or <tt>/var/log/apache2/error_log
*/var/log/mysqld.log</tt> (Errors here don't happen very often but just in case)
 
If ZM is not functioning, you should always be able to find an error in at least one of these logs. Use the [[tail]] command to get info from the logs. This can be done like so:
 
  tail -f /var/log/messages /var/log/httpd/error_log /var/log/zm/zm*.log
 
This will append any data entered to any of these logs to your console screen (<tt>-f</tt>). To exit, hit [ctrl -c].
 
===How can I trouble shoot the hardware and/or software?===
Here are some commands to get information about your hardware. Some commands are distribution dependent.
* <tt>[[lspci]] -vv</tt> -- Returns lots of detailed info. Check for conflicting interrupts or port assignments. You can sometimes alter interrupts/ ports in bios. Try a different pci slot to get a clue if it is HW conflict (comand provided by the pciutils package).
* <tt>[[scanpci]] -v</tt>  -- Gives you information from your hardware EPROM
* <tt>[[lsusb]] -vv</tt> -- Returns lots of detail about USB devices (camand provided by usbutils package).
* <tt>dmesg</tt> -- Shows you how your hardware initialized (or didn't) on boot-up. You will get the most use of this.
* <tt>v4l-info</tt> -- to see how driver is talking to card. look for unusual values.
* <tt>[[modinfo bttv]]</tt> -- some bttv driver stats.
* <tt>[[zmu]]  -m 0 -q -v</tt> -- Returns various information regarding a monitor configuration.
* <tt>[[ipcs]] </tt>  -- Provides information on the ipc facilities for which the calling process has read acccess.
* <tt>[[ipcrm]] </tt>  -- The ipcrm command can be used to remove an IPC object from the kernel.
 
===I am getting messages about a backtrace in my logs, what do I do?===
If you are seeing entries in your log like the following
<pre>Jan 11 20:25:22 localhost zma_m2[19051]: ERR [Backtrace: /lib64/libc.so.6 [0x3347230210]]
Jan 11 20:25:22 localhost zma_m2[19051]: ERR [Backtrace: /lib64/libc.so.6(memset+0xce) [0x334727684e]]
Jan 11 20:25:22 localhost zma_m2[19051]: ERR [Backtrace: /usr/local/bin/zma [0x40ee9a]]
Jan 11 20:25:22 localhost zma_m2[19051]: ERR [Backtrace: /usr/local/bin/zma [0x419946]]
Jan 11 20:25:22 localhost zma_m2[19051]: ERR [Backtrace: /usr/local/bin/zma [0x4213cf]]
Jan 11 20:25:22 localhost zma_m2[19051]: ERR [Backtrace: /usr/local/bin/zma(cos+0x35c) [0x404674]]
Jan 11 20:25:22 localhost zma_m2[19051]: ERR [Backtrace: /lib64/libc.so.6(__libc_start_main+0xf4) [0x334721da44]]
Jan 11 20:25:22 localhost zma_m2[19051]: ERR [Backtrace: /usr/local/bin/zma(cos+0xd1) [0x4043e9]]
Jan 11 20:25:22 localhost zma_m2[19051]: INF [Backtrace complete]</pre>
then you can help diagnose the problem by running a special command to translate the hex addresses into helpful information. This command is called addr2line and you can type 'man addr2line' for more information.
Basically addr2line takes two sets of parameters, the first is the name of the binary file, and the second is a list of addresses. Both of these pieces of information are displayed in the logs. The filename is the first part after the 'Backtrace:' tag, in this case /usr/local/bin/zma, though it may well be different in your case. Some of the lines refer to libraries rather than the zma executable but those can be ignored for now, the important part is noting which ZM binary is involved. The binary file is passed in following the -e flag. The addresses to pass to addr2line are those contained in the '[]' pairs. Again you can ignore those that are on a line that refers to a library but it will not hurt if you include them.
So in the example above, the command would be <pre>addr2line -e /usr/local/bin/zma 0x40ee9a 0x419946 0x4213cf 0x404674 0x4043e9</pre>
This should then dump out a more symbolic list containing source file names and line numbers, and it is this information which will be helpful if posted to the forums. Sometimes addr2line fails to produce useful output. This is usually because either the problem is so severe that it has corrupted the stack and prevented useful information from being displayed, or that you have either compiled ZM without the -g flag for debug, or you have stripped the binaries of symbol information after installation. This this case you would need to rebuild temporarily with debug enabled for the information to be useful.
 
===How do I repair the MySQL Database?===
There is two ways to go about this. In most cases you can run from the command prompt ->
* mysqlcheck --all-databases --auto-repair -p'''your_database_password''' -u '''your_databse_user'''
 
If that does not work then you will have to make sure that ZoneMinder is stopped then run the following (nothing should be using the database while running this and you will have to adjust for your correct path if it is different). ->
* myisamchk --silent --force --fast --update-state -O key_buffer=64M -O sort_buffer=64M -O read_buffer=1M -O write_buffer=1M /var/lib/mysql/*/*.MYI
 
===I upgraded by distribution and ZM stopped working===
Some possibilties (Incomplete list and subject to correction)
#[[/usr/local/bin/zmfix: /usr/lib/libmysqlclient.so.15: version `MYSQL_5.0' not found (required by /usr/local/bin/zmfix)]]  :: Solution: Recompile and reinstall Zoneminder.
Any time you update a major version that ZoneMinder depends on, you need to recompile ZoneMinder.

Latest revision as of 04:01, 4 October 2021

User Generated ZoneMinder Frequently Asked Questions

These are user generated FAQs for ZoneMinder. The official ZoneMinder FAQ can be found at http://zoneminder.readthedocs.org/en/latest/faq.html

Please treat this page as a supplement to the official FAQ. If you have tips that are not covered in the official FAQ please add them here. If we find some tips really interesting, we may move them to the official FAQ.

You can add your FAQ by following the format below

Sample FAQ Heading

Sample FAQ answer.


Montage Layout Names duplicity

Problem with Montage Layout naming - using same name causes creating new one instead of updating existing one...
Ubuntu 20.04.3 LTS Focal Fossa - easy setup - thank You ZoneMinder !
- but then You need to access the database "zm" - and I searched and found easy solution and modified a little...
- in this case - I use webui of phpmyadmin to manage the content of database - it is easy for beginners,
and You cannot harm the database so easy like with bad syntax on command line...

1./ log-in to terminal as su

 sudo su

(provide password for Your superuser)

2./ install phpmyadmin

 apt-get install phpmyadmin

- I have used for both apache2 and lighttpd
- I have created custom password (for example: PASSword123)

3./ modify access to databases for default user "phpmyadmin"
- enter mysql:

 mysql -u root -pzm

- pzm is for -p and zm because "-p zm" with space don't work...
- I have used command for all databases for easy use...

 GRANT ALL ON *.* TO 'phpmyadmin'@'localhost'

- this causes that user "phpmyadmin" has all databases on host visible and editable
- normaly it would look like this - only for "zm" database

 GRANT ALL ON zm.* TO 'phpmyadmin'@'localhost'

4./ delete or modify unwanted layouts
- connect from browser:

 http://localhost/phpmyadmin

- username "phpmyadmin" - password "PASSword123" - open database "zm" and look for table "MontageLayouts"
- do what You want (study how layout is defined...) :-)
- or simply delete unwanted or broken layout - after this refresh page with layout and
in the dropdown menu of layouts is the deleted one (or more) not more available...

Don't forget - MYSQL and PHPMYADMIN are two DIFFERENT things...
- also take care about usernames and passwords