Periodical email inform of running system and cameras

Forum for questions and support relating to the 1.24.x releases only.
Locked
johnnytolengo
Posts: 184
Joined: Tue Oct 14, 2008 5:59 pm

Periodical email inform of running system and cameras

Post by johnnytolengo »

Hi, I am interested in a new feature for ZM, would be perfect to get once day an email notification that ZM system and all cameras (analog & IP) are running.

Do you have some ideas or experiences with this?


Thanks.

J.
rcswrc
Posts: 29
Joined: Thu Dec 29, 2005 10:19 pm
Location: Costa Rica

Post by rcswrc »

Maybe you should try bash or perl for making an script which connects to database and selects the state of your cameras, then email it using a cron job.

I haven't found any option on zoneminder that can do that.

I already did a similar perl script that connected to a postgresql database, that won't work for you but here is a part:

Code: Select all

#!/usr/bin/perl -w
#use strict;
use CGI qw(:standard);
use DBI;

#make script that connects to database and stores data on $databasedata
#this will send the email
#You need to have sendmail and perl of course

envio("test\@domain.com","other\@domain.com","Subject ",$databasedata);

sub envio {
  my ($email, $otro_email ,$subject,$message) = @_;
  open MAIL, "| /usr/lib/sendmail -t -i" or die "Can't open sendmail: $!";
  print MAIL <<END_OF_MESSAGE;
To: $email
Reply-To: $otro_email
Subject: $subject

Mail send using sendmail and perl:


$message
END_OF_MESSAGE
      close MAIL or die "Error cerrando sendmail: $!";
      }
Locked