PSQLCompare
PSQLCompare is a golang-based nagios check which works like Bucardo's check_postgresql check and will take 2
or more (PostgreSQL) strings containing a pair of a connection string and a query to run on for example:
"postgres://user:password@hostOrIP:Port/DBname#Query"
or
"user::password@hostOrIP:Port/DBname#Query"
which can be something like this
"postgres://myuser:secretpassword@localhost:5432/myapp#SELECT id FROM randomtable WHERE columnx = 23"
or
"myuser:secretpassword@localhost:5432/myapp#SELECT id FROM randomtable WHERE columnx = 23"
Installation
Just clone the repo and built it with
go build check_psqlcompare.go
Alternatively you can also use the latest binaries pre-built for different OS and architectures using gox.
You can find them in the Releases tab.
Usage
./check_psqlcompare --compare "<querystring1>" "<querystring2>" "<querystring...>"
It will split up the querystrings for the connection and query parts and get the output of the query parts in a new slice. After that
it compares all slice values with the first querystring output as a reference. If it finds differences in the output values the check
will exit CRITICAL and tell you which querystring does not match the reference. Otherwise the check will return OK.
Starting with psqlcompare v1.1.1 the "postgres://" protocol prefix is optional and can be omitted to reduce string length.
Known issues
The check validates neither the connection string nor the query.
Contributing
This is an open source project and your contribution is very much appreciated.
- Check for open issues or open a fresh issue to start a discussion around a feature idea or a bug.
- Fork the repository on Github and make your changes on the develop branch (or branch off of it).
- Send a pull request (with the develop branch as the target).
Changelog
See CHANGELOG.md
License
PSQLCompare is available under the MIT license. See the LICENSE file for more info.