Re: Email notification pgAgent - Mailing list pgadmin-hackers

From Jasmin Dizdarevic
Subject Re: Email notification pgAgent
Date
Msg-id CAOveQuPam3UWiq4qM+RC3DAUNodhM8G9-QKw_Q_i46FVAGHUag@mail.gmail.com
Whole thread Raw
In response to Email notification pgAgent  (Jasmin Dizdarevic <jasmin.dizdarevic@gmail.com>)
Responses Re: Email notification pgAgent  (Dave Page <dpage@pgadmin.org>)
List pgadmin-hackers
Well...it took a long time, but the feature is done :)

A friend of mine wrote a C implementation of an smtp client and gave it to me to include it into pgAgent. 
It's a very basic smtp client, without authentication support. I think we're going to include it, if needed.
There is another change in pgAgent. Now it's possible to execute an SQL statement from a file located on a place, where pgAgent can access it. I've included this feature, because we need it at work. We can exclude it, if you're against it.

The second patch is the GUI for pgAdmin - email notification fields.
The mailer.c in pgAgent will need some tweaking because of possible double includes (wxWidgets). 

pgAgent version has to be 4 now.

Any comments are welcome.
Jasmin

2011/1/5 Jasmin Dizdarevic <jasmin.dizdarevic@gmail.com>
First of all the agents check's if email is configured and writes this to the database (pga_jobagent).
Older agent's won't run, if the schema version has changed. This is nothing new: Matching between PGAGENT_VERSION_MAJOR and pgagent.schema_version().

For the User there are two scenarios:
1. Creating/Modifying job
see screen1.png

It will check, if the desired agents are configured for email. If "Host agent" is empty, it will check every host registered otherwise the selected host only.
This check only applies, when you enable email notification - so there is no problem, when not using it.

2. The configuration changes after the job has been created with email notification
see screen2.png
In this case the configuratin status for this job will be shown in properties box. It's not possible to update the job, until email notification is disabled, configured or bound to an host agent, that is already configured properly.

I'm relatively sure, that we will get the authorization, so I'm supposing that pgAgent 4 will be with SMTP support.

Regards,
Jasmin

2011/1/5 Dave Page <dpage@pgadmin.org>
On Tue, Jan 4, 2011 at 10:33 PM, Jasmin Dizdarevic
> Hi Dave, i think we're on the right way to bear this baby ;)

Well, that's one way of putting it :-)

> I'm waiting for the authorization for jwsmtp now. When I get it, i will
> include the files into the source tree of pgAgent.

Please ensure he CC's me with his authorisation, as I'll need to keep
a record of it.

> The UI checks the schema version and disables/enables all related features.
> I've also added an column to pgagent.pga_jobagent, that shows if smtp-server
> on the host instance is configured.
> If the user creates or modifies a job where email notification is enabled,
> he will get a message, that it won't work.

How does that work with multiple agents? Don't forget, one of our
supported configurations is having agents running on multiple machines
against the same database, so we'd need to allow for the case where a
user has some agents with SMTP support and some without.

Though of course, if we get permission to incorporate the code into
pgagent under the appropriate licence, then that is irrelevant as
we'll be able to safely enable email in all cases, and rely on the
schema version to ensure agents are compatible.

--
Dave Page
Blog: http://pgsnake.blogspot.com
Twitter: @pgsnake

EnterpriseDB UK: http://www.enterprisedb.com
The Enterprise PostgreSQL Company


Attachment

pgadmin-hackers by date:

Previous
From: Guillaume Lelarge
Date:
Subject: pgAdmin III commit: XRC updates, and make style
Next
From: Ashesh Vashi
Date:
Subject: Re: pgAdmin III commit: Database Designer (milestone 1 of GSoC 2011)