Received: from maia.hub.org (unknown [200.46.204.183]) by mail.postgresql.org (Postfix) with ESMTP id 62170634212 for ; Tue, 11 Aug 2009 22:36:40 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 12124-09 for ; Wed, 12 Aug 2009 01:36:36 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from out01.mta.xmission.com (out01.mta.xmission.com [166.70.13.231]) by mail.postgresql.org (Postfix) with ESMTP id 0797C6327E5 for ; Tue, 11 Aug 2009 22:36:36 -0300 (ADT) Received: from in01.mta.xmission.com ([166.70.13.51]) by out01.mta.xmission.com with esmtp (Exim 4.62) (envelope-from ) id 1Mb2ll-0003QL-Jw; Tue, 11 Aug 2009 19:36:49 -0600 Received: from rsargent.dsl.xmission.com ([199.104.125.126] helo=[192.168.0.2]) by in01.mta.xmission.com with esmtp (Exim 4.69) (envelope-from ) id 1Mb2lU-0006ds-5Z; Tue, 11 Aug 2009 19:36:32 -0600 Message-ID: <4A821D12.3050500@gmail.com> Date: Tue, 11 Aug 2009 19:38:26 -0600 From: Rob Sargent User-Agent: Thunderbird 2.0.0.22 (X11/20090608) MIME-Version: 1.0 To: Denis BUCHER CC: Jan Verheyden , "'pgsql-sql@postgresql.org'" References: <4A81F244.9070402@hsolutions.ch> In-Reply-To: <4A81F244.9070402@hsolutions.ch> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-XM-SPF: eid=; ; ; mid=; ; ; hst=in01.mta.xmission.com; ; ; ip=199.104.125.126; ; ; frm=robjsargent@gmail.com; ; ; spf=neutral X-XM-DomainKey: sender_domain=gmail.com; ; ; sender=robjsargent@gmail.com; ; ; status=no signature X-SA-Exim-Connect-IP: 199.104.125.126 X-SA-Exim-Rcpt-To: dbucherml@hsolutions.ch, jan.verheyden@uz.kuleuven.ac.be, pgsql-sql@postgresql.org X-SA-Exim-Mail-From: robjsargent@gmail.com X-Spam-DCC: XMission; sa01 1397; Body=1 Fuz1=1 Fuz2=1 X-Spam-Combo: ;Denis BUCHER X-Spam-Relay-Country: Subject: Re: mail alert X-SA-Exim-Version: 4.2.1 (built Thu, 25 Oct 2007 00:26:12 +0000) X-SA-Exim-Scanned: Yes (on in01.mta.xmission.com) X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-2.11 tagged_above=-10 required=5 tests=BAYES_05=-1.11, RCVD_IN_DNSWL_LOW=-1 X-Spam-Level: X-Archive-Number: 200908/53 X-Sequence-Number: 32962 Denis BUCHER wrote: > Hello, > > Jan Verheyden a écrit : > >> I was looking in what way it’s possible to alert via mail when some >> conditions are true in a database. >> > > a) If the alert is not "very urgent" i.e. you can alter some minutes > later I would do it like this : > > 1. Create a function that returns what you need, most importantly if the > conditions are met > > 2. Create a script that does something like "SELECT * FROM function()..." > > b) If the email should be sent immediately, you could create a perl > function in the database, launched by a TRIGGER and launching an > "external" script... > > Therefore, first you have to know the requirements... > > Denis > > see "check_postgres" for nagios-style monitoring see \o /tmp/alert_data_file and \! mailx -s "alert" me@work.com /tmp/alert_data_file