Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jgwUM-0004JD-BA for pgsql-general@arkaria.postgresql.org; Thu, 04 Jun 2020 20:29:22 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1jgwUL-0003fE-8m for pgsql-general@arkaria.postgresql.org; Thu, 04 Jun 2020 20:29:21 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jgwUL-0003f7-1A for pgsql-general@lists.postgresql.org; Thu, 04 Jun 2020 20:29:21 +0000 Received: from smtp.burggraben.net ([88.198.69.140]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jgwUE-0003qO-5s for pgsql-general@lists.postgresql.org; Thu, 04 Jun 2020 20:29:20 +0000 Received: from elch.exwg.net (elch.exwg.net [IPv6:2001:470:7120:1:127b:44ff:fe4f:148d]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "elch.exwg.net", Issuer "Christoph Moench-Tegeder" (not verified)) by smtp.burggraben.net (Postfix) with ESMTPS id 06D30C00311 for ; Thu, 4 Jun 2020 22:29:12 +0200 (CEST) Received: by elch.exwg.net (Postfix, from userid 1000) id 92D3713983D; Thu, 4 Jun 2020 22:29:11 +0200 (CEST) Date: Thu, 4 Jun 2020 22:29:11 +0200 From: Christoph Moench-Tegeder To: pgsql-general@lists.postgresql.org Subject: Re: Monitoring for long running transactions Message-ID: <20200604202911.GB53594@elch.exwg.net> References: <920bb4ce-6ba8-2888-6239-52a15474fc58@net153.net> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <920bb4ce-6ba8-2888-6239-52a15474fc58@net153.net> User-Agent: Mutt/1.14.2 (2020-05-25) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk ## Samuel Smith (pgsql@net153.net): > Sorry, I should have clarified that I was aware of the pg_stat_activity > table. That is how we found the problem in the first place. And yes I > could just write a bash script and run it in cron. I just didn't know if > there was a more "official" way to go about this since it is probably a > common monitoring point and/or if something like this was already made. This works fine for everything nagios-like: https://bucardo.org/check_postgres/check_postgres.pl.html#txn_time Other solutions may be found via the PostgreSQL wiki - as you noted, this is (should be) monitored, so almost everything which can monitor PostgreSQL covers this. (which raises the obvious question - did you monitor your server or did you just use the common "shouting user" approach? ;)) Regards, Christoph -- Spare Space