Обсуждение: how to know cpu utilization using sql command

Поиск
Список
Период
Сортировка

how to know cpu utilization using sql command

От
M Tarkeshwar Rao
Дата:

Hello Friends,

 

How to know cpu and memory utilization in postgres.

We require this information to show it on our Application using any postgres command or tool.

 

Regards

Tarkeshwar

Re: how to know cpu utilization using sql command

От
John R Pierce
Дата:
On 10/3/2013 1:50 AM, M Tarkeshwar Rao wrote:

How to know cpu and memory utilization in postgres.

We require this information to show it on our Application using any postgres command or tool.


the CPU usage would be the total of CPU used by the various postgres server processes.   accurately determining the memory usage is more complex as versions up to 9.2 use shared memory so this same block, often quite large, shows up in each process but its the same block.   if you can use OS API's to determine how much shared memory the postmaster is using, subtract that much from each of the other postgres processes's memory to get an accurate total.

if your application is a monitoring tool, you might look at check_postgresql.pl, this calculates and displays many different sorts of postgres specific values, it was originally intended for use with Nagios, but it can be used with any monitoring system.


-- 
john r pierce                                      37N 122W
somewhere on the middle of the left coast

Re: how to know cpu utilization using sql command

От
bricklen
Дата:

On Thu, Oct 3, 2013 at 1:50 AM, M Tarkeshwar Rao <m.tarkeshwar.rao@ericsson.com> wrote:

How to know cpu and memory utilization in postgres.

We require this information to show it on our Application using any postgres command or tool.


pg_activity works pretty well:
https://github.com/julmon/pg_activity/