pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
PgAgent
20+ messages / 8 participants
[nested] [flat]

* PgAgent
@ 2007-03-14 12:09  Ezequias R. da Rocha <ezequias@fastcon.com.br>
  0 siblings, 1 reply; 20+ messages in thread

From: Ezequias R. da Rocha @ 2007-03-14 12:09 UTC (permalink / raw)
  To: pgsql-general

Hello,

Has  someone noticed the problem of  installation  of contribs of 
postgreSQL 8.2.3.

I was looking for pgAgent and didn't noticed notting.

Has someone another alternative solution to install it  ?



Regards
Ezequias



^ permalink  raw  reply  [nested|flat] 20+ messages in thread

* Re: PgAgent
@ 2007-03-14 12:37  Richard Huxton <dev@archonet.com>
  parent: Ezequias R. da Rocha <ezequias@fastcon.com.br>
  0 siblings, 1 reply; 20+ messages in thread

From: Richard Huxton @ 2007-03-14 12:37 UTC (permalink / raw)
  To: Ezequias R. da Rocha <ezequias@fastcon.com.br>; +Cc: pgsql-general

Ezequias R. da Rocha wrote:
> Hello,
> 
> Has  someone noticed the problem of  installation  of contribs of 
> postgreSQL 8.2.3.
> 
> I was looking for pgAgent and didn't noticed notting.
> 
> Has someone another alternative solution to install it  ?

It's part of pgAdmin, not PostgreSQL

-- 
   Richard Huxton
   Archonet Ltd



^ permalink  raw  reply  [nested|flat] 20+ messages in thread

* Re: PgAgent
@ 2007-03-14 12:44  Ezequias R. da Rocha <ezequias@fastcon.com.br>
  parent: Richard Huxton <dev@archonet.com>
  0 siblings, 1 reply; 20+ messages in thread

From: Ezequias R. da Rocha @ 2007-03-14 12:44 UTC (permalink / raw)
  To: Richard Huxton <dev@archonet.com>; +Cc: pgsql-general

Richard Huxton escreveu:
> Ezequias R. da Rocha wrote:
>> Hello,
>>
>> Has  someone noticed the problem of  installation  of contribs of 
>> postgreSQL 8.2.3.
>>
>> I was looking for pgAgent and didn't noticed notting.
>>
>> Has someone another alternative solution to install it  ?
>
> It's part of pgAdmin, not PostgreSQL
>
So I must install pgAdmin on the server to have the pgAgent ?

Ezequias



^ permalink  raw  reply  [nested|flat] 20+ messages in thread

* Re: PgAgent
@ 2007-03-14 12:52  Richard Huxton <dev@archonet.com>
  parent: Ezequias R. da Rocha <ezequias@fastcon.com.br>
  0 siblings, 0 replies; 20+ messages in thread

From: Richard Huxton @ 2007-03-14 12:52 UTC (permalink / raw)
  To: Ezequias R. da Rocha <ezequias@fastcon.com.br>; +Cc: pgsql-general

Ezequias R. da Rocha wrote:
> Richard Huxton escreveu:
>> Ezequias R. da Rocha wrote:
>>> Hello,
>>>
>>> Has  someone noticed the problem of  installation  of contribs of 
>>> postgreSQL 8.2.3.
>>>
>>> I was looking for pgAgent and didn't noticed notting.
>>>
>>> Has someone another alternative solution to install it  ?
>>
>> It's part of pgAdmin, not PostgreSQL
>>
> So I must install pgAdmin on the server to have the pgAgent ?

Don't know - what does the pgAdmin documentation say about installing 
pgAgent?

-- 
   Richard Huxton
   Archonet Ltd



^ permalink  raw  reply  [nested|flat] 20+ messages in thread

* pgAgent
@ 2014-06-20 13:04  enrique.perez <enrique.perez@hlg.jovenclub.cu>
  0 siblings, 0 replies; 20+ messages in thread

From: enrique.perez @ 2014-06-20 13:04 UTC (permalink / raw)
  To: pgsql-general

how can i install pgAgent in postgresql 8.4 if mi internet conection don't
allow to any program to conect internet.



--
View this message in context: http://postgresql.1045698.n5.nabble.com/pgAgent-tp5808135.html
Sent from the PostgreSQL - general mailing list archive at Nabble.com.


-- 
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general



^ permalink  raw  reply  [nested|flat] 20+ messages in thread

* pgAgent
@ 2015-04-02 16:25  Champion Always <c2627914@gmail.com>
  0 siblings, 1 reply; 20+ messages in thread

From: Champion Always @ 2015-04-02 16:25 UTC (permalink / raw)
  To: pgsql-general

Hi,
           job_name => 'DELETE_NAMES'
     ,job_type => 'PLSQL_BLOCK'
     ,job_action => 'BEGIN DELETE_NAMES; END;'
     ,start_date => sysdate
     ,repeat_interval => 'FREQ=DAILY'
     ,enabled => TRUE);
it is oracle ..

.And i installed pgAgent On postgres ..
how  above oracle code can convert to postgres and place it in pgagent for
daily schedule....
any help..?

^ permalink  raw  reply  [nested|flat] 20+ messages in thread

* Re: pgAgent
@ 2015-04-06 19:29  Adam Brusselback <adambrusselback@gmail.com>
  parent: Champion Always <c2627914@gmail.com>
  0 siblings, 0 replies; 20+ messages in thread

From: Adam Brusselback @ 2015-04-06 19:29 UTC (permalink / raw)
  To: Champion Always <c2627914@gmail.com>; +Cc: pgsql-general

Here you are:

do $$
declare
    job_id int;
begin

    /* add a job and get its id: */
    insert into
        pgagent.pga_job (
        jobjclid
        , jobname
        )
    values
        (
        1 /*1=Routine Maintenance*/
        , 'DELETE_NAMES' /* job name */
        )
    returning
        jobid
    into
        job_id;


    /* add a step to the job: */
    insert into
        pgagent.pga_jobstep (jstjobid, jstname, jstkind, jstcode,
jstdbname)
    values
        (
            job_id
            , 'DELETE_NAMES' /* step name */
            , 's'                    /* sql step */
            , 'BEGIN DELETE_NAMES; END;'  /* the sql to run */
            , 'somedatabase'                  /* the name of the database
to run the step against */
        );


    /* add a schedule to the job. This one runs every day at midnight: */
    insert into pgagent.pga_schedule (
jscjobid
, jscname
, jscdesc
, jscminutes
, jschours
, jscweekdays
, jscmonthdays
, jscmonths
, jscenabled
, jscstart
, jscend)
    values(
job_id
, 'schedule name'
, ''
,
'{t,f,f,f,f,f,f,f,f,f,f,f,f,f,f,f,f,f,f,f,f,f,f,f,f,f,f,f,f,f,f,f,f,f,f,f,f,f,f,f,f,f,f,f,f,f,f,f,f,f,f,f,f,f,f,f,f,f,f,f}'
, '{t,f,f,f,f,f,f,f,f,f,f,f,f,f,f,f,f,f,f,f,f,f,f,f}'
, '{f,f,f,f,f,f,f}'
, '{f,f,f,f,f,f,f,f,f,f,f,f,f,f,f,f,f,f,f,f,f,f,f,f,f,f,f,f,f,f,f,f}'
, '{f,f,f,f,f,f,f,f,f,f,f,f}'
, true
, '2015-04-06 00:00:00'
, NULL
    );


end $$;


On Thu, Apr 2, 2015 at 12:25 PM, Champion Always <c2627914@gmail.com> wrote:

> Hi,
>            job_name => 'DELETE_NAMES'
>      ,job_type => 'PLSQL_BLOCK'
>      ,job_action => 'BEGIN DELETE_NAMES; END;'
>      ,start_date => sysdate
>      ,repeat_interval => 'FREQ=DAILY'
>      ,enabled => TRUE);
> it is oracle ..
>
> .And i installed pgAgent On postgres ..
> how  above oracle code can convert to postgres and place it in pgagent for
> daily schedule....
> any help..?
>

^ permalink  raw  reply  [nested|flat] 20+ messages in thread

* Pgagent
@ 2015-04-13 13:53  Ramesh T <rameshparnanditech@gmail.com>
  0 siblings, 1 reply; 20+ messages in thread

From: Ramesh T @ 2015-04-13 13:53 UTC (permalink / raw)
  To: pgsql-general; Adrian Klaver <adrian.klaver@aklaver.com>; Raghu Ram <raghuchennuru@gmail.com>

Hi all,
         i have a function to delete data from table.Where i need to place
function in pgagent.in definition section can i select SQL or BATCH ..?

or else any other method.?
Any Help..

^ permalink  raw  reply  [nested|flat] 20+ messages in thread

* Re: Pgagent
@ 2015-04-13 13:56  Adrian Klaver <adrian.klaver@aklaver.com>
  parent: Ramesh T <rameshparnanditech@gmail.com>
  0 siblings, 1 reply; 20+ messages in thread

From: Adrian Klaver @ 2015-04-13 13:56 UTC (permalink / raw)
  To: Ramesh T <rameshparnanditech@gmail.com>; pgsql-general; Raghu Ram <raghuchennuru@gmail.com>

On 04/13/2015 06:53 AM, Ramesh T wrote:
> Hi all,
>           i have a function to delete data from table.Where i need to
> place function in pgagent.in <http://pgagent.in; definition section can
> i select SQL or BATCH ..?
>
> or else any other method.?

See here:

http://www.pgadmin.org/docs/dev/pgagent.html

> Any Help..


-- 
Adrian Klaver
adrian.klaver@aklaver.com


-- 
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general



^ permalink  raw  reply  [nested|flat] 20+ messages in thread

* Re: Pgagent
@ 2015-04-13 14:22  Ramesh T <rameshparnanditech@gmail.com>
  parent: Adrian Klaver <adrian.klaver@aklaver.com>
  0 siblings, 1 reply; 20+ messages in thread

From: Ramesh T @ 2015-04-13 14:22 UTC (permalink / raw)
  To: Adrian Klaver <adrian.klaver@aklaver.com>; pgsql-general

Hi,
in steps>definition->
do
$body$
begin
perform delete_empty_parts();
end;
$body$

delete_empty_parts is the function

i do selected SQL option in step process.Right clicked on job chosen run
now it getting failed(On error i selected failed,if select success it
getting success)

I'm running function on particular database and selected today dates..

but function wasn't executed.

let me know how to set it function in pgagent..

On Mon, Apr 13, 2015 at 7:26 PM, Adrian Klaver <adrian.klaver@aklaver.com>
wrote:

> On 04/13/2015 06:53 AM, Ramesh T wrote:
>
>> Hi all,
>>           i have a function to delete data from table.Where i need to
>> place function in pgagent.in <http://pgagent.in; definition section can
>> i select SQL or BATCH ..?
>>
>> or else any other method.?
>>
>
> See here:
>
> http://www.pgadmin.org/docs/dev/pgagent.html
>
>  Any Help..
>>
>
>
> --
> Adrian Klaver
> adrian.klaver@aklaver.com
>

^ permalink  raw  reply  [nested|flat] 20+ messages in thread

* Re: Pgagent
@ 2015-04-13 15:17  Adrian Klaver <adrian.klaver@aklaver.com>
  parent: Ramesh T <rameshparnanditech@gmail.com>
  0 siblings, 1 reply; 20+ messages in thread

From: Adrian Klaver @ 2015-04-13 15:17 UTC (permalink / raw)
  To: Ramesh T <rameshparnanditech@gmail.com>; pgsql-general

On 04/13/2015 07:22 AM, Ramesh T wrote:
> Hi,
> in steps>definition->
> do
> $body$
> begin
> perform delete_empty_parts();
> end;
> $body$
>
> delete_empty_parts is the function
>
> i do selected SQL option in step process.Right clicked on job chosen run
> now it getting failed(On error i selected failed,if select success it
> getting success)

Is there an error message in the Postgres logs?

>
> I'm running function on particular database and selected today dates..
>
> but function wasn't executed.

How do you know?

>
> let me know how to set it function in pgagent..
>
> On Mon, Apr 13, 2015 at 7:26 PM, Adrian Klaver
> <adrian.klaver@aklaver.com <mailto:adrian.klaver@aklaver.com>> wrote:
>
>     On 04/13/2015 06:53 AM, Ramesh T wrote:
>
>         Hi all,
>                    i have a function to delete data from table.Where i
>         need to
>         place function in pgagent.in <http://pgagent.in;
>         <http://pgagent.in; definition section can
>         i select SQL or BATCH ..?
>
>         or else any other method.?
>
>
>     See here:
>
>     http://www.pgadmin.org/docs/__dev/pgagent.html
>     <http://www.pgadmin.org/docs/dev/pgagent.html;
>
>         Any Help..
>
>
>
>     --
>     Adrian Klaver
>     adrian.klaver@aklaver.com <mailto:adrian.klaver@aklaver.com>
>
>


-- 
Adrian Klaver
adrian.klaver@aklaver.com


-- 
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general



^ permalink  raw  reply  [nested|flat] 20+ messages in thread

* Re: Pgagent
@ 2015-04-13 15:55  Ramesh T <rameshparnanditech@gmail.com>
  parent: Adrian Klaver <adrian.klaver@aklaver.com>
  0 siblings, 0 replies; 20+ messages in thread

From: Ramesh T @ 2015-04-13 15:55 UTC (permalink / raw)
  To: Adrian Klaver <adrian.klaver@aklaver.com>; pgsql-general

no error messages.. i checked at PostgreSQL\9.4\data\pg_log

Didn't deleted data from table.after schedule time..

one thing i don't understand ,after set timings and in definition section
also the function works fine individually.

any help..




On Mon, Apr 13, 2015 at 8:47 PM, Adrian Klaver <adrian.klaver@aklaver.com>
wrote:

> On 04/13/2015 07:22 AM, Ramesh T wrote:
>
>> Hi,
>> in steps>definition->
>> do
>> $body$
>> begin
>> perform delete_empty_parts();
>> end;
>> $body$
>>
>> delete_empty_parts is the function
>>
>> i do selected SQL option in step process.Right clicked on job chosen run
>> now it getting failed(On error i selected failed,if select success it
>> getting success)
>>
>
> Is there an error message in the Postgres logs?
>
>
>> I'm running function on particular database and selected today dates..
>>
>> but function wasn't executed.
>>
>
> How do you know?
>
>
>> let me know how to set it function in pgagent..
>>
>> On Mon, Apr 13, 2015 at 7:26 PM, Adrian Klaver
>> <adrian.klaver@aklaver.com <mailto:adrian.klaver@aklaver.com>> wrote:
>>
>>     On 04/13/2015 06:53 AM, Ramesh T wrote:
>>
>>         Hi all,
>>                    i have a function to delete data from table.Where i
>>         need to
>>         place function in pgagent.in <http://pgagent.in;
>>         <http://pgagent.in; definition section can
>>         i select SQL or BATCH ..?
>>
>>         or else any other method.?
>>
>>
>>     See here:
>>
>>     http://www.pgadmin.org/docs/__dev/pgagent.html
>>     <http://www.pgadmin.org/docs/dev/pgagent.html;
>>
>>         Any Help..
>>
>>
>>
>>     --
>>     Adrian Klaver
>>     adrian.klaver@aklaver.com <mailto:adrian.klaver@aklaver.com>
>>
>>
>>
>
> --
> Adrian Klaver
> adrian.klaver@aklaver.com
>

^ permalink  raw  reply  [nested|flat] 20+ messages in thread

* pgagent
@ 2020-11-05 21:07  Gabi Draghici <gabi.draghici@gmail.com>
  0 siblings, 1 reply; 20+ messages in thread

From: Gabi Draghici @ 2020-11-05 21:07 UTC (permalink / raw)
  To: pgsql-general

Hi,

I have installed postgresql 12 on sles 15 for some tests. Now I'm
interested in some sort of scheduler and from what I've read so far,
pgagent should do the job. So I've installed pgagent 4.0. I've added a job
(which I can see in pgagent.pga_job) but everytime I ran it (from pgadmin)
nothing happens ! When I start the pgagent I can see "... pgagent ...
connection authorized" in the main log. What else should I check ?

Thanks,
Gabi

^ permalink  raw  reply  [nested|flat] 20+ messages in thread

* Re: pgagent
@ 2020-11-05 21:34  Adrian Klaver <adrian.klaver@aklaver.com>
  parent: Gabi Draghici <gabi.draghici@gmail.com>
  0 siblings, 1 reply; 20+ messages in thread

From: Adrian Klaver @ 2020-11-05 21:34 UTC (permalink / raw)
  To: Gabi Draghici <gabi.draghici@gmail.com>; pgsql-general

On 11/5/20 1:07 PM, Gabi Draghici wrote:
> 
> Hi,
> 
> I have installed postgresql 12 on sles 15 for some tests. Now I'm 
> interested in some sort of scheduler and from what I've read so far, 
> pgagent should do the job. So I've installed pgagent 4.0. I've added a 
> job (which I can see in pgagent.pga_job) but everytime I ran it (from 
> pgadmin) nothing happens ! When I start the pgagent I can see "... 
> pgagent ... connection authorized" in the main log. What else should I 
> check ?

pg_cron:

https://www.citusdata.com/blog/2020/10/31/evolving-pg-cron-together/

For pgagent what is the job doing and when? Could it be it hasn't run 
because it has not reached it's scheduled time.

> 
> Thanks,
> Gabi
> 
> 


-- 
Adrian Klaver
adrian.klaver@aklaver.com





^ permalink  raw  reply  [nested|flat] 20+ messages in thread

* Re: pgagent
@ 2020-11-06 12:26  Gabi Draghici <gabi.draghici@gmail.com>
  parent: Adrian Klaver <adrian.klaver@aklaver.com>
  0 siblings, 1 reply; 20+ messages in thread

From: Gabi Draghici @ 2020-11-06 12:26 UTC (permalink / raw)
  To: Adrian Klaver <adrian.klaver@aklaver.com>; +Cc: pgsql-general

Hi,

1. The job it's a simple call to one stored function like that :
BEGIN
 CALL other_user_name.get_function();
END;
Problem is that despite the fact that it's long passed by the scheduled
running time and I tried the "Run now" option (from pgadmin) a couple of
times, there is no evidence that the job actually runned ! Nothing in
pgagent log, main log or in pgagent.pga_joblog or pgagent.pga_jobsteplog.
Is there any way to trace of debug this ?

2. Yes, pg_cron also looks good and it's my second option if I can't make 1
to work.

Regards,
Gabi


On Thu, Nov 5, 2020 at 11:34 PM Adrian Klaver <adrian.klaver@aklaver.com>
wrote:

> On 11/5/20 1:07 PM, Gabi Draghici wrote:
> >
> > Hi,
> >
> > I have installed postgresql 12 on sles 15 for some tests. Now I'm
> > interested in some sort of scheduler and from what I've read so far,
> > pgagent should do the job. So I've installed pgagent 4.0. I've added a
> > job (which I can see in pgagent.pga_job) but everytime I ran it (from
> > pgadmin) nothing happens ! When I start the pgagent I can see "...
> > pgagent ... connection authorized" in the main log. What else should I
> > check ?
>
> pg_cron:
>
> https://www.citusdata.com/blog/2020/10/31/evolving-pg-cron-together/
>
> For pgagent what is the job doing and when? Could it be it hasn't run
> because it has not reached it's scheduled time.
>
> >
> > Thanks,
> > Gabi
> >
> >
>
>
> --
> Adrian Klaver
> adrian.klaver@aklaver.com
>

^ permalink  raw  reply  [nested|flat] 20+ messages in thread

* Re: pgagent
@ 2020-11-06 15:38  Adrian Klaver <adrian.klaver@aklaver.com>
  parent: Gabi Draghici <gabi.draghici@gmail.com>
  0 siblings, 1 reply; 20+ messages in thread

From: Adrian Klaver @ 2020-11-06 15:38 UTC (permalink / raw)
  To: Gabi Draghici <gabi.draghici@gmail.com>; +Cc: pgsql-general

On 11/6/20 4:26 AM, Gabi Draghici wrote:
> Hi,
> 
> 1. The job it's a simple call to one stored function like that :
> BEGIN
>   CALL other_user_name.get_function();
> END;
> Problem is that despite the fact that it's long passed by the scheduled 
> running time and I tried the "Run now" option (from pgadmin) a couple of 
> times, there is no evidence that the job actually runned ! Nothing in 
> pgagent log, main log or in pgagent.pga_joblog or pgagent.pga_jobsteplog.
> Is there any way to trace of debug this ?


Is the pgagent daemon running?

You could crank up the the log_statement to 'all'(temporarily as this 
can generate a lot of logs) in postgresql.conf and reload the server. 
Then tail the Postgres log file when click on 'Run now' to see what 
happens.

> 
> 2. Yes, pg_cron also looks good and it's my second option if I can't 
> make 1 to work.
> 
> Regards,
> Gabi
> 
> 
> On Thu, Nov 5, 2020 at 11:34 PM Adrian Klaver <adrian.klaver@aklaver.com 
> <mailto:adrian.klaver@aklaver.com>> wrote:
> 
>     On 11/5/20 1:07 PM, Gabi Draghici wrote:
>      >
>      > Hi,
>      >
>      > I have installed postgresql 12 on sles 15 for some tests. Now I'm
>      > interested in some sort of scheduler and from what I've read so far,
>      > pgagent should do the job. So I've installed pgagent 4.0. I've
>     added a
>      > job (which I can see in pgagent.pga_job) but everytime I ran it
>     (from
>      > pgadmin) nothing happens ! When I start the pgagent I can see "...
>      > pgagent ... connection authorized" in the main log. What else
>     should I
>      > check ?
> 
>     pg_cron:
> 
>     https://www.citusdata.com/blog/2020/10/31/evolving-pg-cron-together/
>     <https://www.citusdata.com/blog/2020/10/31/evolving-pg-cron-together/;
> 
>     For pgagent what is the job doing and when? Could it be it hasn't run
>     because it has not reached it's scheduled time.
> 
>      >
>      > Thanks,
>      > Gabi
>      >
>      >
> 
> 
>     -- 
>     Adrian Klaver
>     adrian.klaver@aklaver.com <mailto:adrian.klaver@aklaver.com>
> 


-- 
Adrian Klaver
adrian.klaver@aklaver.com





^ permalink  raw  reply  [nested|flat] 20+ messages in thread

* Re: pgagent
@ 2020-11-06 16:12  Gabi Draghici <gabi.draghici@gmail.com>
  parent: Adrian Klaver <adrian.klaver@aklaver.com>
  0 siblings, 1 reply; 20+ messages in thread

From: Gabi Draghici @ 2020-11-06 16:12 UTC (permalink / raw)
  To: Adrian Klaver <adrian.klaver@aklaver.com>; +Cc: pgsql-general

It't not a daemon yet (I started manually) but yes, it's running :

postgres@dbdocs:~> ps aux | grep postgresql
postgres  2093  0.0  0.3 8720088 218280 ?      Ss   17:54   0:00
/usr/lib/postgresql12/bin/postgres -D /opt/postgresql/database
postgres  2315  0.0  0.0  64664  5708 pts/2    S    17:57   0:00
/usr/bin/postgresql12-pgagent hostaddr=10.1.0.4 dbname=postgres
user=pgagent -s /opt/postgresql/pglog/pg_agent.log
postgres  2326  0.0  0.0   8696   820 pts/2    S+   17:57   0:00 grep
--color=auto postgresql

I've switched log_statement to 'all' and restarted the DB. All I see it's a
bunch of statements like these :

2020-11-06 18:07:03.869 EET postgres pgagent [2316]LOG:  statement: SELECT
J.jobid   FROM pgagent.pga_job J  WHERE jobenabled    AND jobagentid IS
NULL    AND jobnextrun <= now()    AND (jobhostagent = '' OR jobhostagent =
'dbdocs-prd') ORDER BY jobnextrun
2020-11-06 18:07:04.466 EET postgres postgres [2104]LOG:  statement:
/*pga4dash*/
SELECT 'session_stats' AS chart_name, row_to_json(t) AS chart_data
FROM (SELECT
  (SELECT count(*) FROM pg_stat_activity) AS "Total",
  (SELECT count(*) FROM pg_stat_activity WHERE state = 'active')  AS
"Active",
  (SELECT count(*) FROM pg_stat_activity WHERE state = 'idle')  AS "Idle"
) t
UNION ALL
SELECT 'tps_stats' AS chart_name, row_to_json(t) AS chart_data
FROM (SELECT
  (SELECT sum(xact_commit) + sum(xact_rollback) FROM pg_stat_database) AS
"Transactions",
  (SELECT sum(xact_commit) FROM pg_stat_database) AS "Commits",
  (SELECT sum(xact_rollback) FROM pg_stat_database) AS "Rollbacks"
) t
UNION ALL
SELECT 'ti_stats' AS chart_name, row_to_json(t) AS chart_data
FROM (SELECT
  (SELECT sum(tup_inserted) FROM pg_stat_database) AS "Inserts",
  (SELECT sum(tup_updated) FROM pg_stat_database) AS "Updates",
  (SELECT sum(tup_deleted) FROM pg_stat_database) AS "Deletes"
) t
UNION ALL
SELECT 'to_stats' AS chart_name, row_to_json(t) AS chart_data
FROM (SELECT
  (SELECT sum(tup_fetched) FROM pg_stat_database) AS "Fetched",
  (SELECT sum(tup_returned) FROM pg_stat_database) AS "Returned"
) t
UNION ALL
SELECT 'bio_stats' AS chart_name, row_to_json(t) AS chart_data
FROM (SELECT
  (SELECT sum(blks_read) FROM pg_stat_database) AS "Reads",
  (SELECT sum(blks_hit) FROM pg_stat_database) AS "Hits"
) t

2020-11-06 18:07:05.459 EET postgres postgres [2104]LOG:  statement:
/*pga4dash*/
SELECT 'session_stats' AS chart_name, row_to_json(t) AS chart_data
FROM (SELECT
  (SELECT count(*) FROM pg_stat_activity) AS "Total",
  (SELECT count(*) FROM pg_stat_activity WHERE state = 'active')  AS
"Active",
  (SELECT count(*) FROM pg_stat_activity WHERE state = 'idle')  AS "Idle"
) t
UNION ALL
SELECT 'tps_stats' AS chart_name, row_to_json(t) AS chart_data
FROM (SELECT
  (SELECT sum(xact_commit) + sum(xact_rollback) FROM pg_stat_database) AS
"Transactions",
  (SELECT sum(xact_commit) FROM pg_stat_database) AS "Commits",
  (SELECT sum(xact_rollback) FROM pg_stat_database) AS "Rollbacks"
) t
UNION ALL
SELECT 'ti_stats' AS chart_name, row_to_json(t) AS chart_data
FROM (SELECT
  (SELECT sum(tup_inserted) FROM pg_stat_database) AS "Inserts",
  (SELECT sum(tup_updated) FROM pg_stat_database) AS "Updates",
  (SELECT sum(tup_deleted) FROM pg_stat_database) AS "Deletes"
) t
UNION ALL
SELECT 'to_stats' AS chart_name, row_to_json(t) AS chart_data
FROM (SELECT
  (SELECT sum(tup_fetched) FROM pg_stat_database) AS "Fetched",
  (SELECT sum(tup_returned) FROM pg_stat_database) AS "Returned"
) t
UNION ALL
SELECT 'bio_stats' AS chart_name, row_to_json(t) AS chart_data
FROM (SELECT
  (SELECT sum(blks_read) FROM pg_stat_database) AS "Reads",
  (SELECT sum(blks_hit) FROM pg_stat_database) AS "Hits"
) t
......

Regards,
Gabi








On Fri, Nov 6, 2020 at 5:38 PM Adrian Klaver <adrian.klaver@aklaver.com>
wrote:

> On 11/6/20 4:26 AM, Gabi Draghici wrote:
> > Hi,
> >
> > 1. The job it's a simple call to one stored function like that :
> > BEGIN
> >   CALL other_user_name.get_function();
> > END;
> > Problem is that despite the fact that it's long passed by the scheduled
> > running time and I tried the "Run now" option (from pgadmin) a couple of
> > times, there is no evidence that the job actually runned ! Nothing in
> > pgagent log, main log or in pgagent.pga_joblog or pgagent.pga_jobsteplog.
> > Is there any way to trace of debug this ?
>
>
> Is the pgagent daemon running?
>
> You could crank up the the log_statement to 'all'(temporarily as this
> can generate a lot of logs) in postgresql.conf and reload the server.
> Then tail the Postgres log file when click on 'Run now' to see what
> happens.
>
> >
> > 2. Yes, pg_cron also looks good and it's my second option if I can't
> > make 1 to work.
> >
> > Regards,
> > Gabi
> >
> >
> > On Thu, Nov 5, 2020 at 11:34 PM Adrian Klaver <adrian.klaver@aklaver.com
> > <mailto:adrian.klaver@aklaver.com>> wrote:
> >
> >     On 11/5/20 1:07 PM, Gabi Draghici wrote:
> >      >
> >      > Hi,
> >      >
> >      > I have installed postgresql 12 on sles 15 for some tests. Now I'm
> >      > interested in some sort of scheduler and from what I've read so
> far,
> >      > pgagent should do the job. So I've installed pgagent 4.0. I've
> >     added a
> >      > job (which I can see in pgagent.pga_job) but everytime I ran it
> >     (from
> >      > pgadmin) nothing happens ! When I start the pgagent I can see "...
> >      > pgagent ... connection authorized" in the main log. What else
> >     should I
> >      > check ?
> >
> >     pg_cron:
> >
> >     https://www.citusdata.com/blog/2020/10/31/evolving-pg-cron-together/
> >     <
> https://www.citusdata.com/blog/2020/10/31/evolving-pg-cron-together/;
> >
> >     For pgagent what is the job doing and when? Could it be it hasn't run
> >     because it has not reached it's scheduled time.
> >
> >      >
> >      > Thanks,
> >      > Gabi
> >      >
> >      >
> >
> >
> >     --
> >     Adrian Klaver
> >     adrian.klaver@aklaver.com <mailto:adrian.klaver@aklaver.com>
> >
>
>
> --
> Adrian Klaver
> adrian.klaver@aklaver.com
>

^ permalink  raw  reply  [nested|flat] 20+ messages in thread

* Re: pgagent
@ 2020-11-06 16:41  Adrian Klaver <adrian.klaver@aklaver.com>
  parent: Gabi Draghici <gabi.draghici@gmail.com>
  0 siblings, 1 reply; 20+ messages in thread

From: Adrian Klaver @ 2020-11-06 16:41 UTC (permalink / raw)
  To: Gabi Draghici <gabi.draghici@gmail.com>; +Cc: pgsql-general

On 11/6/20 8:12 AM, Gabi Draghici wrote:
> 
> It't not a daemon yet (I started manually) but yes, it's running :
> 
> postgres@dbdocs:~> ps aux | grep postgresql
> postgres  2093  0.0  0.3 8720088 218280 ?      Ss   17:54   0:00 
> /usr/lib/postgresql12/bin/postgres -D /opt/postgresql/database
> postgres  2315  0.0  0.0  64664  5708 pts/2    S    17:57   0:00 
> /usr/bin/postgresql12-pgagent hostaddr=10.1.0.4 dbname=postgres 
> user=pgagent -s /opt/postgresql/pglog/pg_agent.log
> postgres  2326  0.0  0.0   8696   820 pts/2    S+   17:57   0:00 grep 
> --color=auto postgresql

> 
> I've switched log_statement to 'all' and restarted the DB. All I see 
> it's a bunch of statements like these :
> 
> 2020-11-06 18:07:03.869 EET postgres pgagent [2316]LOG:  statement: 
> SELECT J.jobid   FROM pgagent.pga_job J  WHERE jobenabled    AND 
> jobagentid IS NULL    AND jobnextrun <= now()    AND (jobhostagent = '' 
> OR jobhostagent = 'dbdocs-prd') ORDER BY jobnextrun
> 2020-11-06 18:07:04.466 EET postgres postgres [2104]LOG:  statement: 
> /*pga4dash*/

The above is from when you click 'Run now'?

> 
> Regards,
> Gabi
> 
> 
> 
> 
> 
> 
> 



-- 
Adrian Klaver
adrian.klaver@aklaver.com





^ permalink  raw  reply  [nested|flat] 20+ messages in thread

* Re: pgagent
@ 2020-11-07 11:29  Gabi Draghici <gabi.draghici@gmail.com>
  parent: Adrian Klaver <adrian.klaver@aklaver.com>
  0 siblings, 1 reply; 20+ messages in thread

From: Gabi Draghici @ 2020-11-07 11:29 UTC (permalink / raw)
  To: Adrian Klaver <adrian.klaver@aklaver.com>; +Cc: pgsql-general

I don't think that most of them are related to pgagent, since they are
coming anyway  (I suppose it's about pgadmin's Dashboard).
There is just one that I think it's about "Run now" :

... EET postgres postgres [2104]LOG:  statement: UPDATE pgagent.pga_job SET
jobnextrun=now()::timestamptz WHERE jobid=1::integer

but that's just about it !
Is there any way I can test that pgagent it's able to start a job ?

Regards,
Gabi






On Fri, Nov 6, 2020 at 6:41 PM Adrian Klaver <adrian.klaver@aklaver.com>
wrote:

> On 11/6/20 8:12 AM, Gabi Draghici wrote:
> >
> > It't not a daemon yet (I started manually) but yes, it's running :
> >
> > postgres@dbdocs:~> ps aux | grep postgresql
> > postgres  2093  0.0  0.3 8720088 218280 ?      Ss   17:54   0:00
> > /usr/lib/postgresql12/bin/postgres -D /opt/postgresql/database
> > postgres  2315  0.0  0.0  64664  5708 pts/2    S    17:57   0:00
> > /usr/bin/postgresql12-pgagent hostaddr=10.1.0.4 dbname=postgres
> > user=pgagent -s /opt/postgresql/pglog/pg_agent.log
> > postgres  2326  0.0  0.0   8696   820 pts/2    S+   17:57   0:00 grep
> > --color=auto postgresql
>
> >
> > I've switched log_statement to 'all' and restarted the DB. All I see
> > it's a bunch of statements like these :
> >
> > 2020-11-06 18:07:03.869 EET postgres pgagent [2316]LOG:  statement:
> > SELECT J.jobid   FROM pgagent.pga_job J  WHERE jobenabled    AND
> > jobagentid IS NULL    AND jobnextrun <= now()    AND (jobhostagent = ''
> > OR jobhostagent = 'dbdocs-prd') ORDER BY jobnextrun
> > 2020-11-06 18:07:04.466 EET postgres postgres [2104]LOG:  statement:
> > /*pga4dash*/
>
> The above is from when you click 'Run now'?
>
> >
> > Regards,
> > Gabi
> >
> >
> >
> >
> >
> >
> >
>
>
>
> --
> Adrian Klaver
> adrian.klaver@aklaver.com
>

^ permalink  raw  reply  [nested|flat] 20+ messages in thread

* Re: pgagent
@ 2020-11-07 12:17  Gabi Draghici <gabi.draghici@gmail.com>
  parent: Gabi Draghici <gabi.draghici@gmail.com>
  0 siblings, 0 replies; 20+ messages in thread

From: Gabi Draghici @ 2020-11-07 12:17 UTC (permalink / raw)
  To: Adrian Klaver <adrian.klaver@aklaver.com>; +Cc: pgsql-general

My bad !
I didn't read the documentation too well ... and completed the 'Host agent'
with the IP instead of the hostname !
The job it's running now.
Thank you for help !

Regards,
Gabriel







On Sat, Nov 7, 2020 at 1:29 PM Gabi Draghici <gabi.draghici@gmail.com>
wrote:

>
> I don't think that most of them are related to pgagent, since they are
> coming anyway  (I suppose it's about pgadmin's Dashboard).
> There is just one that I think it's about "Run now" :
>
> ... EET postgres postgres [2104]LOG:  statement: UPDATE
> pgagent.pga_job SET jobnextrun=now()::timestamptz WHERE jobid=1::integer
>
> but that's just about it !
> Is there any way I can test that pgagent it's able to start a job ?
>
> Regards,
> Gabi
>
>
>
>
>
>
> On Fri, Nov 6, 2020 at 6:41 PM Adrian Klaver <adrian.klaver@aklaver.com>
> wrote:
>
>> On 11/6/20 8:12 AM, Gabi Draghici wrote:
>> >
>> > It't not a daemon yet (I started manually) but yes, it's running :
>> >
>> > postgres@dbdocs:~> ps aux | grep postgresql
>> > postgres  2093  0.0  0.3 8720088 218280 ?      Ss   17:54   0:00
>> > /usr/lib/postgresql12/bin/postgres -D /opt/postgresql/database
>> > postgres  2315  0.0  0.0  64664  5708 pts/2    S    17:57   0:00
>> > /usr/bin/postgresql12-pgagent hostaddr=10.1.0.4 dbname=postgres
>> > user=pgagent -s /opt/postgresql/pglog/pg_agent.log
>> > postgres  2326  0.0  0.0   8696   820 pts/2    S+   17:57   0:00 grep
>> > --color=auto postgresql
>>
>> >
>> > I've switched log_statement to 'all' and restarted the DB. All I see
>> > it's a bunch of statements like these :
>> >
>> > 2020-11-06 18:07:03.869 EET postgres pgagent [2316]LOG:  statement:
>> > SELECT J.jobid   FROM pgagent.pga_job J  WHERE jobenabled    AND
>> > jobagentid IS NULL    AND jobnextrun <= now()    AND (jobhostagent = ''
>> > OR jobhostagent = 'dbdocs-prd') ORDER BY jobnextrun
>> > 2020-11-06 18:07:04.466 EET postgres postgres [2104]LOG:  statement:
>> > /*pga4dash*/
>>
>> The above is from when you click 'Run now'?
>>
>> >
>> > Regards,
>> > Gabi
>> >
>> >
>> >
>> >
>> >
>> >
>> >
>>
>>
>>
>> --
>> Adrian Klaver
>> adrian.klaver@aklaver.com
>>
>

^ permalink  raw  reply  [nested|flat] 20+ messages in thread


end of thread, other threads:[~2020-11-07 12:17 UTC | newest]

Thread overview: 20+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2007-03-14 12:09 PgAgent Ezequias R. da Rocha <ezequias@fastcon.com.br>
2007-03-14 12:37 ` Richard Huxton <dev@archonet.com>
2007-03-14 12:44   ` Ezequias R. da Rocha <ezequias@fastcon.com.br>
2007-03-14 12:52     ` Richard Huxton <dev@archonet.com>
2014-06-20 13:04 pgAgent enrique.perez <enrique.perez@hlg.jovenclub.cu>
2015-04-02 16:25 pgAgent Champion Always <c2627914@gmail.com>
2015-04-06 19:29 ` Re: pgAgent Adam Brusselback <adambrusselback@gmail.com>
2015-04-13 13:53 Pgagent Ramesh T <rameshparnanditech@gmail.com>
2015-04-13 13:56 ` Re: Pgagent Adrian Klaver <adrian.klaver@aklaver.com>
2015-04-13 14:22   ` Re: Pgagent Ramesh T <rameshparnanditech@gmail.com>
2015-04-13 15:17     ` Re: Pgagent Adrian Klaver <adrian.klaver@aklaver.com>
2015-04-13 15:55       ` Re: Pgagent Ramesh T <rameshparnanditech@gmail.com>
2020-11-05 21:07 pgagent Gabi Draghici <gabi.draghici@gmail.com>
2020-11-05 21:34 ` Re: pgagent Adrian Klaver <adrian.klaver@aklaver.com>
2020-11-06 12:26   ` Re: pgagent Gabi Draghici <gabi.draghici@gmail.com>
2020-11-06 15:38     ` Re: pgagent Adrian Klaver <adrian.klaver@aklaver.com>
2020-11-06 16:12       ` Re: pgagent Gabi Draghici <gabi.draghici@gmail.com>
2020-11-06 16:41         ` Re: pgagent Adrian Klaver <adrian.klaver@aklaver.com>
2020-11-07 11:29           ` Re: pgagent Gabi Draghici <gabi.draghici@gmail.com>
2020-11-07 12:17             ` Re: pgagent Gabi Draghici <gabi.draghici@gmail.com>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox