@@ -410,9 +410,6 @@ metrics:
410410 - ' *'
411411 metric_storage_name : db_size
412412 db_stats :
413- init_sql : |-
414- GRANT EXECUTE ON FUNCTION pg_stat_file(text) TO pgwatch;
415- GRANT EXECUTE ON FUNCTION pg_stat_file(text, boolean) TO pgwatch;
416413 sqls :
417414 11 : |-
418415 select /* pgwatch_generated */
@@ -433,7 +430,7 @@ metrics:
433430 deadlocks,
434431 blk_read_time,
435432 blk_write_time,
436- extract(epoch from (now() - coalesce((pg_stat_file('postmaster.pid', true)).modification, pg_postmaster_start_time() )))::int8 as postmaster_uptime_s,
433+ extract(epoch from (now() - pg_postmaster_start_time()))::int8 as postmaster_uptime_s,
437434 extract(epoch from (now() - pg_backup_start_time()))::int8 as backup_duration_s,
438435 case when pg_is_in_recovery() then 1 else 0 end as in_recovery_int,
439436 system_identifier::text as tag_sys_id,
@@ -469,7 +466,7 @@ metrics:
469466 deadlocks,
470467 blk_read_time,
471468 blk_write_time,
472- extract(epoch from (now() - coalesce((pg_stat_file('postmaster.pid', true)).modification, pg_postmaster_start_time() )))::int8 as postmaster_uptime_s,
469+ extract(epoch from (now() - pg_postmaster_start_time()))::int8 as postmaster_uptime_s,
473470 extract(epoch from (now() - pg_backup_start_time()))::int8 as backup_duration_s,
474471 checksum_failures,
475472 extract(epoch from (now() - checksum_last_failure))::int8 as checksum_last_failure_s,
@@ -507,7 +504,7 @@ metrics:
507504 deadlocks,
508505 blk_read_time,
509506 blk_write_time,
510- extract(epoch from (now() - coalesce((pg_stat_file('postmaster.pid', true)).modification, pg_postmaster_start_time() )))::int8 as postmaster_uptime_s,
507+ extract(epoch from (now() - pg_postmaster_start_time()))::int8 as postmaster_uptime_s,
511508 extract(epoch from (now() - pg_backup_start_time()))::int8 as backup_duration_s,
512509 checksum_failures,
513510 extract(epoch from (now() - checksum_last_failure))::int8 as checksum_last_failure_s,
@@ -552,7 +549,7 @@ metrics:
552549 deadlocks,
553550 blk_read_time,
554551 blk_write_time,
555- extract(epoch from (now() - coalesce((pg_stat_file('postmaster.pid', true)).modification, pg_postmaster_start_time() )))::int8 as postmaster_uptime_s,
552+ extract(epoch from (now() - pg_postmaster_start_time()))::int8 as postmaster_uptime_s,
556553 checksum_failures,
557554 extract(epoch from (now() - checksum_last_failure))::int8 as checksum_last_failure_s,
558555 case when pg_is_in_recovery() then 1 else 0 end as in_recovery_int,
@@ -3930,7 +3927,7 @@ metrics:
39303927 pg_wal_lsn_diff(pg_last_wal_replay_lsn(), '0/0')::int8
39313928 end as xlog_location_b,
39323929 case when pg_is_in_recovery() then 1 else 0 end as in_recovery_int,
3933- extract(epoch from (now() - coalesce((pg_stat_file('postmaster.pid', true)).modification, pg_postmaster_start_time() )))::int8 as postmaster_uptime_s,
3930+ extract(epoch from (now() - pg_postmaster_start_time()))::int8 as postmaster_uptime_s,
39343931 system_identifier::text as tag_sys_id,
39353932 case
39363933 when pg_is_in_recovery() = false then
@@ -3956,12 +3953,9 @@ metrics:
39563953 wal_size :
39573954 sqls :
39583955 11 : |-
3959- /* If using not a real superuser but a role with "pg_monitor" grant then below execute grant is needed:
3960- GRANT EXECUTE ON FUNCTION pg_stat_file(text) to pgwatch;
3961- */
39623956 select /* pgwatch_generated */
39633957 (extract(epoch from now()) * 1e9)::int8 as epoch_ns,
3964- ( sum((pg_stat_file('pg_wal/' || name)). size) )::int8 as wal_size_b
3958+ sum(size)::int8 as wal_size_b
39653959 from pg_ls_waldir()
39663960 gauges :
39673961 - ' *'
0 commit comments