Page 1 of 1

Documentation for newbie programers

Posted: Tue May 26, 2009 11:20 pm
by johnnytolengo
Hello, i am new in ZM and i want to do some improvments for my homeZM,
i am studing how the perl componets works. I need to do some changes in my box at the moment in zmfilter.pl, but i don't know where the variables in it come from. "ZM_EMAIL_SUBJECT, etc"

Other mysterious is : i did a change in zmfilter.pl , i added a line inside a function "sub sendEmail" this function sends emails when a alarm happened.

My add:

system("touch /usr/src/myfile.txt");


The filter works correctly i recieved the email all seems to be allright BUT

the file named myfile.txt was never created. so... WHAT'S UP?


I just need some documentation to understand the process of the things in this scripts and some other info.


This doc could be a big step for zoneminder, because i read that are a lot of people in this forum which wants to make improvments but they have not the path (documentation) to do it.


May i am the only dokey who haven't this manual, am I ? :D

Sorry i want to share my ideas. :)

Thanks for your time.

J.

Posted: Tue May 26, 2009 11:57 pm
by rdmelin
First regarding zmfilter.pl. The variable ZM_EMAIL_SUBJECT (constant actually) comes from the database Config table, and can be set in the email tab of the Option window in the web interface.
zmfilter.pl is run by the web user (apache, http, or other depending on your distro) so it does not have permission to write to /usr/src/

The Documentation is the wiki
http://www.zoneminder.com/wiki/index.php/Welcome
Also scattered throughout this forum.
You are welcome to add to and improve it :)

Posted: Wed May 27, 2009 12:15 am
by johnnytolengo
Thanks for your reply but wiki has almost user info not for us or me. :)

i an freezed in this point:

My add:

system("touch /usr/src/myfile.txt");


The filter works correctly i recieved the email all seems to be allright BUT

the file named myfile.txt was never created. so... WHAT'S UP?


All what instrunctions i add there never comes to work.


Anyway i when i resolve it i'll post a feature for SMSing , gnokii. I want to receive sms notifications when: some alarm occurs, when some camera stop to work. This i want to add to the filter.


Thanks.

J.

Posted: Wed May 27, 2009 12:34 am
by MrEvoMan
Most likely this is a permissions problem.

Pretty sure the zmfilter.pl script runs as www-data (default) and I'm pretty sure that this user id doesn't have write permissions to that directory.

Posted: Wed May 27, 2009 9:12 am
by johnnytolengo
I try 777 perm and www-data group+own. But still does not react :(

The touch is a simply test, it can be there what else.

If i put before --> Info( "Sending notification sms \n" );

another notification like

--> Info( "I am testing \n" );

then i can se this in my log but not my system() action;


I seems that zmfilter.pl is read when ZM starts and then the script runs from another side, not that /usr/bin/zmfilter.pl

It's so extrange, my God!


J.

Posted: Wed May 27, 2009 12:01 pm
by belanger
johnnytolengo wrote: My add:

system("touch /usr/src/myfile.txt");
/usr/src is NOT a good place at all to create a file. Use /tmp or /var/tmp or create a directory in /var/... or /home/... owned by www-data user & group.

Pierre B.