zmfilter.pl not working in 1.26.5????

Forum for questions and support relating to the 1.26.x releases only.
Locked
sidepipe
Posts: 2
Joined: Fri Jan 03, 2014 2:46 pm

zmfilter.pl not working in 1.26.5????

Post by sidepipe »

I'm using 1.26.5 on Ubuntu Saucy, and I noticed that old events weren't getting deleted. I tried running a filter manually, and events were listed, but not deleted. In order to make it work, I had to change the following in zmfilter.pl:

Line 54:
Was: use constant EVENT_PATH => (ZM_DIR_EVENTS=~m|/|)?ZM_DIR_EVENTS:(ZM_PATH_WEB.'/'.ZM_DIR_EVENTS);
Mine: use constant EVENT_PATH => ($Config{ZM_DIR_EVENTS}=~m|/|)?$Config{ZM_DIR_EVENTS}:($Config{ZM_PATH_WEB}.'/'.$Config{ZM_DIR_EVENTS});

Line 166:
Was: chdir( $Config{EVENT_PATH} );
Mine: chdir( EVENT_PATH );

Line 878 ish:
Was: my $url = ZM_URL;
Mine: my $url = $Config{ZM_URL};

Now, I haven't programmed in perl for about 10 years, and was never very good even then.... so I'm sort of assuming that there must be something fundamental wrong with my setup rather than a problem with zmfilter.pl ( because surely everyone would be having issues! ) Can anyone tell me what I'm missing? :)
pyroman
Posts: 25
Joined: Fri Jan 03, 2014 6:40 pm

Re: zmfilter.pl not working in 1.26.5????

Post by pyroman »

I have the same problem. I tried the edits shown here, and the ones discussed in the other topic that addresses the same issue.

None of the edits had any effects. zmfilter still exits with status 9.
sogood007
Posts: 25
Joined: Tue Oct 26, 2004 6:53 pm

Re: zmfilter.pl not working in 1.26.5????

Post by sogood007 »

sidepipe wrote:I'm using 1.26.5 on Ubuntu Saucy, and I noticed that old events weren't getting deleted. I tried running a filter manually, and events were listed, but not deleted. In order to make it work, I had to change the following in zmfilter.pl:

Line 54:
Was: use constant EVENT_PATH => (ZM_DIR_EVENTS=~m|/|)?ZM_DIR_EVENTS:(ZM_PATH_WEB.'/'.ZM_DIR_EVENTS);
Mine: use constant EVENT_PATH => ($Config{ZM_DIR_EVENTS}=~m|/|)?$Config{ZM_DIR_EVENTS}:($Config{ZM_PATH_WEB}.'/'.$Config{ZM_DIR_EVENTS});

Line 166:
Was: chdir( $Config{EVENT_PATH} );
Mine: chdir( EVENT_PATH );

Line 878 ish:
Was: my $url = ZM_URL;
Mine: my $url = $Config{ZM_URL};

Now, I haven't programmed in perl for about 10 years, and was never very good even then.... so I'm sort of assuming that there must be something fundamental wrong with my setup rather than a problem with zmfilter.pl ( because surely everyone would be having issues! ) Can anyone tell me what I'm missing? :)
This is my local change compare to the 1.26.5 release

Code: Select all

4c54
< use constant EVENT_PATH => (ZM_DIR_EVENTS=~m|/|)?ZM_DIR_EVENTS:(ZM_PATH_WEB.'/'.ZM_DIR_EVENTS);
---
> use constant EVENT_PATH => ($Config{ZM_DIR_EVENTS}=~m|/|)?$Config{ZM_DIR_EVENTS}:($Config{ZM_PATH_WEB}.'/'.$Config{ZM_DIR_EVENTS});
166c166
< chdir( $Config{EVENT_PATH} );
---
> chdir( EVENT_PATH );
181c181
<     sleep( $Config{START_DELAY} );
---
>     sleep( START_DELAY );
879c879
<     my $url = ZM_URL;
---
>     my $url = $Config{ZM_URL};

What happened when you run zmfilter.pl manually in a shell. ?
sidepipe
Posts: 2
Joined: Fri Jan 03, 2014 2:46 pm

Re: zmfilter.pl not working in 1.26.5????

Post by sidepipe »

pyroman wrote:I have the same problem. I tried the edits shown here, and the ones discussed in the other topic that addresses the same issue.

None of the edits had any effects. zmfilter still exits with status 9.
Actually, I missed one of the changes in sogood007's post:
sogood007 wrote: < sleep( $Config{START_DELAY} );
---
> sleep( START_DELAY );
I needed to make that change too. Without all of these changes, zmfilter.pl exits with compilation or runtime errors, so you need to make all of them. Again as sogood007 says, if you just open a shell and run zmfilter.pl, you should see any errors that are produced.
pyroman
Posts: 25
Joined: Fri Jan 03, 2014 6:40 pm

Re: zmfilter.pl not working in 1.26.5????

Post by pyroman »

I double-checked my filter file and found an ommision in the changes. I did the changes and ran it from the command line:

root@server-1:/usr/bin# zmfilter.pl
Global symbol "%Config" requires explicit package name at /usr/bin/zmfilter.pl line 55.
Global symbol "%Config" requires explicit package name at /usr/bin/zmfilter.pl line 55.
Global symbol "%Config" requires explicit package name at /usr/bin/zmfilter.pl line 55.
Global symbol "%Config" requires explicit package name at /usr/bin/zmfilter.pl line 55.
BEGIN not safe after errors--compilation aborted at /usr/bin/zmfilter.pl line 55

It doesnt like Config for some reason. Could I be missing some library? If so, is there a reason why is it not in the dependencies to be installed automaticaly?
pyroman
Posts: 25
Joined: Fri Jan 03, 2014 6:40 pm

Re: zmfilter.pl not working in 1.26.5????

Post by pyroman »

also, after the changes, I can bring up an Events window, then the filters window, select a filter (purge when > 3 days old). The Events window gets purged, but the event count in the main console remains the same. If I close the Events window then re-open it, the old events are back.

I also waited the 10 minutes between zmfilter runs, and found that the same errors remained.
Exit with Status 9
elmer
Posts: 18
Joined: Mon Dec 23, 2013 10:09 pm

Re: zmfilter.pl not working in 1.26.5????

Post by elmer »

I'm having a variation of this problem (1.26.5 on Ubuntu 12.04). If I set up a filter to delete after X days and execute it, it'll pull all the events with the applicable dates and remove them from the main console window. HOWEVER, when I actually navigate the events folder, the images are not actually deleted.

If I run /usr/bin/zmfilter.pl manually I don't get any of the above errors, though it will "run" until I ^C out of it. I get this output:

Code: Select all

Name "Net::SFTP::Foreign::debug" used only once: possible typo at /usr/bin/zmfilter.pl line 811.
I had tried all the above edits but got the same Global Symbol %Config error messages listed above. I could try the edits again today, perhaps with a clearer mind.

Is it possible some Perl module is missing? I'm like a drunk baby when it comes to perl, I break more than I fix.
elmer
Posts: 18
Joined: Mon Dec 23, 2013 10:09 pm

Re: zmfilter.pl not working in 1.26.5????

Post by elmer »

I just applied all of sogood007's edits and I get the same results as pyroman. From my SSH session:

Code: Select all

Global symbol "%Config" requires explicit package name at /usr/bin/zmfilter.pl line 54.
Global symbol "%Config" requires explicit package name at /usr/bin/zmfilter.pl line 54.
Global symbol "%Config" requires explicit package name at /usr/bin/zmfilter.pl line 54.
Global symbol "%Config" requires explicit package name at /usr/bin/zmfilter.pl line 54.
BEGIN not safe after errors--compilation aborted at /usr/bin/zmfilter.pl line 54.
If someone has a working zmfilter.pl could they post it? I can run it on my system and see what happens. My guess is there's some inconsistency with perl modules between systems, but that's a purely ignorant shot in the dark.
elmer
Posts: 18
Joined: Mon Dec 23, 2013 10:09 pm

Re: zmfilter.pl not working in 1.26.5????

Post by elmer »

Perhaps I should be more patient. I see mine did eventually delete the actual events and my disk percentage went down. Must have needed to give it a while. That being the case, everything appears to be working for me with my original zmfilter.pl. When doing sogood007's edits, some of them already matched the replacement values so editing was unnecessary. I'd post my zmfilter.pl but this forum says pl and txt extensions are not allowed. If anyone wants to see mine I can post it to dropbox by request.
B_jare_hotrods
Posts: 6
Joined: Fri Jan 10, 2014 4:38 am

Re: zmfilter.pl not working in 1.26.5????

Post by B_jare_hotrods »

Okay so am new to the forums cause finally registered, but have used zoneminder for awhile now probably between 1-2 years, I been using linux mint for awhile, but been running into the same troubles as everyone else and been making more of an effort in the last week to get mine working after trying from scratch after trying to get an 8 channel techwell card with 2 tw6816 card to work, there is a posting for that I believe and I will post my progress on that believe you have to type in the search for tw68 to find it but separate issue:

so I have linux mint 16 kde 64bit I installed: did the updates and then followed the :

ubuntu 13.04 1.26.5 install easy way instructions , then linked with the apache2.4 steps

I can get the console up, add a monitor it changes from red to orange, but not getting the live event view like I've had before because of the new apache2.4 cause I can try and keep on the raring repository without updating and I can get it to work from a new install, next i did the steps from "sogood007" just above:

This is my local change compare to the 1.26.5 release


Code:
4c54
< use constant EVENT_PATH => (ZM_DIR_EVENTS=~m|/|)?ZM_DIR_EVENTS:(ZM_PATH_WEB.'/'.ZM_DIR_EVENTS);
---
> use constant EVENT_PATH => ($Config{ZM_DIR_EVENTS}=~m|/|)?$Config{ZM_DIR_EVENTS}:($Config{ZM_PATH_WEB}.'/'.$Config{ZM_DIR_EVENTS});
166c166
< chdir( $Config{EVENT_PATH} );
---
> chdir( EVENT_PATH );
181c181
< sleep( $Config{START_DELAY} );
---
> sleep( START_DELAY );
879c879
< my $url = ZM_URL;
---
> my $url = $Config{ZM_URL};


then I tried to run under terminal as root and run /usr/bin/zmfilter.pl

I did get the same error as "elmer" got:


Code:
Name "Net::SFTP::Foreign::debug" used only once: possible typo at /usr/bin/zmfilter.pl line 811.

mine was actually on line 812 but I think this is just a syntax error, cause when I ran the terminal it gave me some kind of message about suspecting its a typo, i did study some programming in school about ten years ago and not super familiar with perl but I understand variables and if statements and such, but I think the "Net::SFTP::Foreign::debug" relates to a variable or system call or something as shown on line 78 as there is a similar one just above on line 74 the full line is "" require Net::FTP; "" and appears again on line 790 from doing the find option, so what i did to line 812 is take out the ::debug part as the next line seems to use the same variable or call so my line 812 looks like this now:

$Net::SFTP::Foreign = -1 if $Config{ZM_UPLOAD_DEBUG};

I'm not sure if that fixes the zmfilter.pl cause when I try to run /usr/bin/zmfilter.pl in terminal I dont get anymore errors that come up but it doesnt go to a prompt either it just sits on the next line with a black cursor, I have to actually stop it with control-c so I don't know what that means but I'm going to reboot the system and try again and see what works(sorry everybody not good at linking things so my post is a mess)
ris2t
Posts: 43
Joined: Thu Jan 22, 2009 8:44 am

Re: zmfilter.pl not working in 1.26.5????

Post by ris2t »

Just made identical changes to my ZM 1.26.5 on Ubuntu 13.10 installation from http://ppa.launchpad.net/iconnor/zoneminder/ubuntu PPA.

After the changes no more exit code 9 log entries.
I'm not sure if that fixes the zmfilter.pl cause when I try to run /usr/bin/zmfilter.pl in terminal I dont get anymore errors that come up but it doesnt go to a prompt either it just sits on the next line with a black cursor, I have to actually stop it with control-c
I get the same behaviour but believe its by design. If you check the perl code there is a while(1) loop in there as the filter module is intended to run continous hence doesn't exit naturally from command line.

Checking the logs I see scanning for event entries which indicator to me the filter is working.

Code: Select all

Jan 14 22:15:12 hammerstien zmfilter[13284]: INF [Scanning for events]
pyroman
Posts: 25
Joined: Fri Jan 03, 2014 6:40 pm

Re: zmfilter.pl not working in 1.26.5????

Post by pyroman »

I did the last posted change and re-checked all the mods in the zmfilter file. No joy, I still get the message about needing an explicit package for Config.

Global symbol "%Config" requires explicit package name at /usr/bin/zmfilter.pl line 55.
myrison
Posts: 1
Joined: Tue Jan 14, 2014 4:21 pm

Re: zmfilter.pl not working in 1.26.5????

Post by myrison »

Thanks to the previous tips, I was able to get very close to a working config. I was faced with a couple of final errors I didn't see here before:

Code: Select all

jason@zoneminder:/usr/bin$ sudo ./zmfilter.pl
Name "Net::SFTP::Foreign::debug" used only once: possible typo at ./zmfilter.pl line 820.
Can't locate MIME/Entity.pm in @INC (@INC contains: /usr/share/perl/5.14.2 /etc/perl /usr/local/lib/perl/5.14.2 /usr/local/share/perl/5.14.2 /usr/lib/perl5 /usr/share/perl5 /usr/lib/perl/5.14 /usr/share/perl/5.14 /usr/local/lib/site_perl) at ./zmfilter.pl line 97.
The final missing step for me was to install MIME:Entity in Perl, which somehow was not installed (correctly) on my system. For anyone else, the command to do so is:

Code: Select all

root@zoneminder:/usr/share/perl/5.14.2# cpan
Terminal does not support AddHistory.

cpan shell -- CPAN exploration and modules installation (v1.960001)
Enter 'h' for help.

cpan[1]> install MIME::Entity

Going to read '/root/.cpan/Metadata'
  Database was generated on Wed, 01 Jan 2014 10:53:03 GMT
Fetching with LWP:
**cpan.mirror.clemson.edu/authors/01mailrc.txt.gz
Going to read '/root/.cpan/sources/authors/01mailrc.txt.gz'
............................................................................DONE
Fetching with LWP:
**cpan.mirror.clemson.edu/modules/02packages.details.txt.gz
Going to read '/root/.cpan/sources/modules/02packages.details.txt.gz'
  Database was generated on Tue, 14 Jan 2014 10:41:02 GMT
..............
And then it continues from there... and ultimately ends with....

Code: Select all

Appending installation info to /usr/lib/perl/5.14/perllocal.pod
  DSKOLL/MIME-tools-5.505.tar.gz
  sudo /usr/bin/make install  -- OK
At that point, after making the debug changes posted below, and the other config line changes, my zmfilter is FINALLY working again.

Thanks again to the previous posters. I was totally stuck before finding this thread.
elmer
Posts: 18
Joined: Mon Dec 23, 2013 10:09 pm

Re: zmfilter.pl not working in 1.26.5????

Post by elmer »

Big ups to myrison on this one. My boss likes to install all updates randomly, and he updated perl. So this morning I came in and noticed that my disk utilization was up over my purge threshold. Fortunately I noticed and didn't let it run like that all weekend. I did everything in myrison's post and that ultimately fixed me up. Before the build/make of the module would actually work I needed to install the build-essential package. I could have sworn I already had that on this box, but no matter. It was easy enough to add.

For the lost souls that find this thread...

Code: Select all

sudo apt-get install build-essential
Then follow myrison's post above.
Redstorm
Posts: 5
Joined: Wed May 14, 2014 9:01 pm

Re: zmfilter.pl not working in 1.26.5????

Post by Redstorm »

B_jare_hotrods wrote:
This is my local change compare to the 1.26.5 release


Code:
4c54
< use constant EVENT_PATH => (ZM_DIR_EVENTS=~m|/|)?ZM_DIR_EVENTS:(ZM_PATH_WEB.'/'.ZM_DIR_EVENTS);
---
> use constant EVENT_PATH => ($Config{ZM_DIR_EVENTS}=~m|/|)?$Config{ZM_DIR_EVENTS}:($Config{ZM_PATH_WEB}.'/'.$Config{ZM_DIR_EVENTS});
166c166
< chdir( $Config{EVENT_PATH} );
---
> chdir( EVENT_PATH );
181c181
< sleep( $Config{START_DELAY} );
---
> sleep( START_DELAY );
879c879
< my $url = ZM_URL;
---
> my $url = $Config{ZM_URL};


then I tried to run under terminal as root and run /usr/bin/zmfilter.pl

I did get the same error as "elmer" got:


Code:
Name "Net::SFTP::Foreign::debug" used only once: possible typo at /usr/bin/zmfilter.pl line 811.
This solved this issue for me, apart from the NET::SFTP possible typo, I havent bothered investigating past making sure NET:SFTP perl module was installed.

Emails being sent for events, will monitor and see what happens.
Locked