[check_postgres] Is it possible to run on *all* databases?

Aleksey Tsalolikhin atsaloli.tech at gmail.com
Mon Aug 22 19:30:46 UTC 2016


On a related note, it seems the "bloat" check does not respect multiple
database names on the -db switch:

For example, I've created three databases: apple, orange and banana.  When
I check locks or sequences, check_postgres checks all three databases:

# check_postgres.pl --action=locks -db apple,orange,banana
POSTGRES_LOCKS OK: DB "*apple*" total=1  DB "*banana*" total=1  DB "*orange*"
total=1  | ...
# check_postgres.pl --action=sequence -db apple,orange,banana
POSTGRES_SEQUENCE OK: DB "*apple*" No sequences found DB "*banana*" No
sequences found DB "*orange*" No sequences found | time=0.04s time=0.04s
time=0.04s
#


But when I check bloat, it only checks the first one:

# check_postgres.pl --action=bloat -db apple,orange,banana
POSTGRES_BLOAT OK: DB "*apple*" (db apple) table pg_catalog.pg_description
rows:2403 pages:21 shouldbe:20 (1.1X) wasted size:8192 (8192 bytes) | ...
#




On Mon, Aug 22, 2016 at 12:06 PM, Aleksey Tsalolikhin <
atsaloli.tech at gmail.com> wrote:

>
> On Tue, Oct 27, 2015 at 2:21 AM, Jehan-Guillaume de Rorthais <
> jgdr at dalibo.com> wrote:
>
>> On Thu, 15 Oct 2015 11:33:46 +0200
>> Rory McCann <rory at technomancy.org> wrote:
>>
>> > check_postgres looks pretty cool, and I'm adding it to our Nagios set
>> > up. But it would be very helpful if there is a way to run an action on
>> > *all* databases, so that I don't have to add a separate service for each
>> > database. Is this possible? Built-in nagios checks like check_disk do
>> > this, and will report a CRITICAL/WARNING if any one of the disks is
>> > full. Is it possible to have this for check_postgres?
>>
>> Checks in check_pgactivity are running on all database by default. Then
>> you
>> have --dbinclude or --dbexclude change this behaviour if needed.
>>
>> See:
>> https://exchange.nagios.org/directory/Plugins/Databases/Post
>> gresQL/check_pgactivity/details
>
>
> We have run into the same issue as Rory -- I would like the check_postgres
> checks for bloat, locks and sequence exhaustion to run across all databases
> in the database cluster specified with the -H command.
>
> Reading the man page, I see that we can have multiple --dbname commands:
>
>        -db NAME or --dbname=NAME
>            Specifies which database to connect to. Can be a
> comma-separated list of names, and multiple dbname arguments are allowed.
> If no dbname option is provided, defaults to the "PGDATABASE" environment
> variable.
>            If that is not set, it defaults to ’postgres’ if psql is
> version 8 or greater, and ’template1’ otherwise.
>
> As a user, it would be nice to be able to say -db '*', or just have that
> happen by default.  :)
>
> Thanks for a great utility!
>
> Best,
> -at
>
>


-- 
Need CFEngine training?  Email training at verticalsysadmin.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.endcrypt.com/pipermail/check_postgres/attachments/20160822/d8f08aec/attachment.html>


More information about the Check_postgres mailing list