Difference between revisions of "ZMTrigger"
Line 23: | Line 23: | ||
After you have verified the script is running, test it is working. | After you have verified the script is running, test it is working. | ||
Choose a monitor, say monitor 1, then add %Q to the monitors timestamp section. | Choose a monitor by monitor ID, say monitor 1, then add %Q to the monitors timestamp section. | ||
The monitor '''must be''' in either modect, mocord, or nodect mode. | The monitor '''must be''' in either modect, mocord, or nodect mode. | ||
Line 35: | Line 35: | ||
then press return. | then press return. | ||
Refer to [[Documentation]] for what this command means. A brief explanation for this is: <pre> | Refer to [[Documentation]] for what this command means. A brief explanation for this is: <pre>MonitorID # | Show text mode |||| text to put in.</pre> | ||
You should immediately see testingOSD in place of the %Q you put in the timestamps section. | You should immediately see testingOSD in place of the %Q you put in the timestamps section. |
Revision as of 18:54, 3 October 2017
About
/usr/bin/zmtrigger.pl is an optional perl script for zoneminder. See the script for a brief description. One way it can be used is to overlay text information from an outside source (say a temperature sensor) onto the video feed.
Configuration
Enable it first, by going into options, config, and checking Enable Triggers.
Then
# service restart zoneminder
Verify it is running with
ps auxw | grep zmtrigger
Usage
Overlaying Text Data onto a Video Feed
After you have verified the script is running, test it is working.
Choose a monitor by monitor ID, say monitor 1, then add %Q to the monitors timestamp section.
The monitor must be in either modect, mocord, or nodect mode.
Open the video feed for monitor 1.
Then type in another terminal
telnet ipaddress 6802
in the telnet session type the following
1|show||||testingOSD
then press return.
Refer to Documentation for what this command means. A brief explanation for this is:
MonitorID # | Show text mode |||| text to put in.
You should immediately see testingOSD in place of the %Q you put in the timestamps section.
For more examples and scripts of ZMTrigger search the forums.
Example Script
Here is a script of connecting to an ipaddress that serves a value from a sensor. Wget is not as fast as possible, but this is simple and works quickly as a test.
#!/bin/bash counter=1 while [$counter -le 10] do PRESSURE=`wget ipaddress -q -O -` echo "1|show||||$PRESSURE" | telnet ipaddress 6802 sleep 4 #((counter++)) done
Troubleshooting
tail -f /var/log/zm/zmtrigger.log
Enable debug on it in the logs and set to 9. The logs that contain the /var/log/zm/ logs are the component logs in options.
MySQL server has gone away error
After following forum recommendations to use mysqltuner (see MySQL), mysqltuner told me to add wait_timeout=300 to my.cnf.
Unfortunately, ZMTrigger will disconnect every five minutes, if this is enabled. It appears that ZMTrigger will "Loading monitors" every five minutes, so you can't have a wait_timeout equal or lower than that. Otherwise the MySQL server will go away. If the wait timeout is higher, then ZMTrigger will "Loading monitors" without error.
This timeout error doesn't seem to adversely affect any other features of ZM so, a low wait_timeout may be acceptable if you don't use ZMTrigger.
The default wait timeout is 8 hours for MySQL. The solution seems to be add a wait_timeout >300, or use the default. Reference:[1]