[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re[2]: postgresql test
From: |
nonotats |
Subject: |
Re[2]: postgresql test |
Date: |
Fri, 20 Jan 2006 01:28:33 +0900 |
Yes! finally I made it,
as Jan-Henrik's suggestion, in "standard" monit way without libpq link.
Now monit with PGSQL is working perfect on my box, with either socket or
port, no warning log "polutions" at all in system log nor pg_log!
Here at my HomePage is the diff (steaming hot) from monit-4.7 souce;
http://www.asahi-net.or.jp/~aa4t-nngk/codes/monit-4.7-pgsql.diff
In writing that pgsql.c I chose to test `root' database owned by `root'
because monit is usually run by root. Though Authentication Error
Message from PostgreSQL, which means such database or user does
not exist, is handled as functional SUCCESS, I recommend to do
CREATE USER root;
and
CREATE DATABASE root OWNER root;
and then to the pg_hba.conf, add;
local root root ident sameuser
or if you choose to test PostgreSQL service via TCP port;
host root root 127.0.0.1/32 trust
to keep pg_log in the cleanest state.
I hope pgsql.c benefits Postgres users.
Thanks Jan-Henric for inspiration.
Using my code into future monit release is ever more than welcome.
>
>> These struggles would be unncessary only if I knew how to "speak" to
>> postgres directly...
>
>
>That is the key, monit provides a connected socket for you and
>instead of linking in the postgres client library to ping the server,
>you should send data using the postgres network protocol. Unless you
>can find documentation for the protocol, fire up Ethereal and see
>what happens both ways when when you send e.g. this query to postgres
>"select 1;" then send and expect those packages. Look at the protocol
>tests for mysql and oracle for inspiration.
>
>--
>Jan-Henrik Haukeland
>Mobil +47 97141255
>