[Check_mk (english)] pgsql xid check

Hi,
I’ve been struggling with some custom postgres check. From what I
was told cmk accept any input language when it comes to setting up a
custom check.
atm I figured what i want to check (which is pgsql xid number) but i
do not know how to actually implement it so it would give me proper
output
Can anyone help? :slight_smile:

Full command in bash goes like this:
#!/bin/bash

echo "SELECT power(2,31) - age(datfrozenxid) as tr_left FROM

pg_database where datname = ‘postgres’;" | su - $USER -c “psql -h
localhost -p 5435 -d postgres -U user -A -t -F ’ '”

As it is limited to just one database it give a single number as

output which is a transaction XID number.
I would really want to have this giving me performance data and for
example inform me about going into warning or critical state at let
say 2000000 and 200000000 transactions.
If anyone would be so kind and just tell me how to do it i would be
very gratefull. Tutorial at cmk website is not rly written in a
language I understand (fu python!)

Tnx in advance for any kind of help.
···


Grzegorz Gruszecki

Are you trying to check the last vacuumed the database? I'm no PG
expert, but a quick search on your query hit this message from the PG
mailing list. If this is the case you should take a look at the
check_postgres plugin's txn_wraparound check, as it may be what you
want. If not take a look at it's other actions/checks, as one of them
might suite your needs.

http://bucardo.org/wiki/Check_postgres

···

--
Later,
Darin

On Fri, Jun 13, 2014 at 9:11 AM, Grzegorz Gruszecki <ggruszecki@crossfinance.pl> wrote:

Hi,
I've been struggling with some custom postgres check. From what I was told
cmk accept any input language when it comes to setting up a custom check.
atm I figured what i want to check (which is pgsql xid number) but i do not
know how to actually implement it so it would give me proper output
Can anyone help? :slight_smile:

Full command in bash goes like this:
#!/bin/bash

echo "SELECT power(2,31) - age(datfrozenxid) as tr_left FROM pg_database
where datname = 'postgres';" | su - $USER -c "psql -h localhost -p 5435 -d
postgres -U user -A -t -F ' '"

As it is limited to just one database it give a single number as output
which is a transaction XID number.
I would really want to have this giving me performance data and for example
inform me about going into warning or critical state at let say 2000000 and
200000000 transactions.
If anyone would be so kind and just tell me how to do it i would be very
gratefull. Tutorial at cmk website is not rly written in a language I
understand (fu python!)

Tnx in advance for any kind of help.

--
Grzegorz Gruszecki

_______________________________________________
checkmk-en mailing list
checkmk-en@lists.mathias-kettner.de
http://lists.mathias-kettner.de/mailman/listinfo/checkmk-en

You'll need to use legacy_checks for CMK to use those. For an example
on how to enable that see the nagios-commands-postgres.cfg file from
the check_postgres package in the openSUSE build service, links below.

http://mathias-kettner.de/checkmk_legacy_checks.html

···

--
Later,
Darin

On Fri, Jun 13, 2014 at 9:59 AM, Grzegorz Gruszecki <ggruszecki@crossfinance.pl> wrote:

That might be what I am looking for!
i hope it does work with OMD :slight_smile:

Gonna test this at home, tnx for that check info, I was looking for
something like this earlier today but had no success finding anything
helpful :>

--
Grzegorz

W dniu 2014-06-13 15:52, Darin Perusich pisze:

Are you trying to check the last vacuumed the database? I'm no PG
expert, but a quick search on your query hit this message from the PG
mailing list. If this is the case you should take a look at the
check_postgres plugin's txn_wraparound check, as it may be what you
want. If not take a look at it's other actions/checks, as one of them
might suite your needs.

PostgreSQL: Re: age(datfrozenxid)
PostgreSQL: Documentation: 16: 25.1. Routine Vacuuming
Check postgres
--
Later,
Darin

On Fri, Jun 13, 2014 at 9:11 AM, Grzegorz Gruszecki >> <ggruszecki@crossfinance.pl> wrote:

Hi,
I've been struggling with some custom postgres check. From what I was told
cmk accept any input language when it comes to setting up a custom check.
atm I figured what i want to check (which is pgsql xid number) but i do not
know how to actually implement it so it would give me proper output
Can anyone help? :slight_smile:

Full command in bash goes like this:
#!/bin/bash

echo "SELECT power(2,31) - age(datfrozenxid) as tr_left FROM pg_database
where datname = 'postgres';" | su - $USER -c "psql -h localhost -p 5435 -d
postgres -U user -A -t -F ' '"

As it is limited to just one database it give a single number as output
which is a transaction XID number.
I would really want to have this giving me performance data and for example
inform me about going into warning or critical state at let say 2000000 and
200000000 transactions.
If anyone would be so kind and just tell me how to do it i would be very
gratefull. Tutorial at cmk website is not rly written in a language I
understand (fu python!)

Tnx in advance for any kind of help.

--
Grzegorz Gruszecki

_______________________________________________
checkmk-en mailing list
checkmk-en@lists.mathias-kettner.de
http://lists.mathias-kettner.de/mailman/listinfo/checkmk-en

I managed to run this plugin using MRPE which is extremly easy :slight_smile:

All I had to do was:

  1. download that plugin you mentioned and unpack it to wherever :slight_smile: (i used //usr/check_mk_plugins/

  2. create //etc/check_mk/mrpe.cfg on the pgsql server (not the actuall OMD server)

  3. add full definition of MRPE script to be activated: 'XID_PGSQL //usr/check_mk_plugins/check_posgres.pl --host=HOST --port=PORT --dbname=DB --dbuser=USER --ACTION=DESIRED_PLUGIN_OPTION --output=nagios (without ’ ')

4)run one single command to automaticly collect the data on the OMD server itself: cmk -I --checks=mrpe PGSQL-HOST

And thats about it :wink: Thanks again for your help. I think this is also the easiest way to run any given classic nagios plugin without having to edit multipple files as u can have multipple MRPE checks in a single cfg file :slight_smile:

···

Grzegorz

Dnia 13 czerwiec 2014 o 16:04 Darin Perusich darin@darins.net napisał(a):

You’ll need to use legacy_checks for CMK to use those. For an example

on how to enable that see the nagios-commands-postgres.cfg file from

the check_postgres package in the openSUSE build service, links below.

http://mathias-kettner.de/checkmk_legacy_checks.html

Show server:monitoring / check_postgres - openSUSE Build Service

Later,

Darin

On Fri, Jun 13, 2014 at 9:59 AM, Grzegorz Gruszecki > ggruszecki@crossfinance.pl wrote:

That might be what I am looking for!

i hope it does work with OMD :slight_smile:

Gonna test this at home, tnx for that check info, I was looking for

something like this earlier today but had no success finding anything

helpful :>

Grzegorz

W dniu 2014-06-13 15:52, Darin Perusich pisze:

Are you trying to check the last vacuumed the database? I’m no PG

expert, but a quick search on your query hit this message from the PG

mailing list. If this is the case you should take a look at the

check_postgres plugin’s txn_wraparound check, as it may be what you

want. If not take a look at it’s other actions/checks, as one of them

might suite your needs.

PostgreSQL: Re: age(datfrozenxid)

PostgreSQL: Documentation: 16: 25.1. Routine Vacuuming

Check postgres

Later,

Darin

On Fri, Jun 13, 2014 at 9:11 AM, Grzegorz Gruszecki > >> ggruszecki@crossfinance.pl wrote:

Hi,

I’ve been struggling with some custom postgres check. From what I was told

cmk accept any input language when it comes to setting up a custom check.

atm I figured what i want to check (which is pgsql xid number) but i do not

know how to actually implement it so it would give me proper output

Can anyone help? :slight_smile:

Full command in bash goes like this:

#!/bin/bash

echo "SELECT power(2,31) - age(datfrozenxid) as tr_left FROM pg_database

where datname = ‘postgres’;" | su - $USER -c "psql -h localhost -p 5435 -d

postgres -U user -A -t -F ’ '"

As it is limited to just one database it give a single number as output

which is a transaction XID number.

I would really want to have this giving me performance data and for example

inform me about going into warning or critical state at let say 2000000 and

200000000 transactions.

If anyone would be so kind and just tell me how to do it i would be very

gratefull. Tutorial at cmk website is not rly written in a language I

understand (fu python!)

Tnx in advance for any kind of help.

Grzegorz Gruszecki


checkmk-en mailing list

checkmk-en@lists.mathias-kettner.de

http://lists.mathias-kettner.de/mailman/listinfo/checkmk-en