Skip to content

ArchCast/graphite-postgres-connections

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 

Repository files navigation

graphite-postgres-connections

Polls metrics from Postgres and delivers them to Graphite.

graphite-postgres-connections (gr-pg-cx.py) is a Python script that polls total connection count from a list of Postgres servers using Nagios' NRPE and delivers the data to a Graphite server.

Getting Started

These instructions will get you graphite-postgres-connections up and running:

  1. It is recommended to download and run graphite-postgres-connections on the Nagios/Icinga server. Otherwise, additional tweaks is required to allow it to run properly with a Nagios/Icinga and Postgres servers.
git clone https://github.com/ArchCast/graphite-postgres-connections.git
  1. Prerequisite software installed. See the Prerequisites > Software section.

  2. Update/redefine values in the code. See the Prerequisites > Configuration section.

  3. Update nrpe.cfg to include "check_postgres_connections" command. See Prerequisites > Configuration section.

  4. When all necessary steps are completed and configured accordingly, the script should normally not take longer than a minute to finish running. Otherwise, proceed to troubleshoot. See Troubleshooting section.

  5. Add gr-pg-cx.py to crontab with the run interval of your choice.

Prerequisites

Software

Other required software that works in conjunction with graphite-postgres-connections:

Configuration

  • Update/redefine values in gr-pg-cx.py to your specifications. (See comments in the code.)
  • Update/redefine 'path' in the function "dissect".
  • On all affected Postgres servers, define the NRPE command "check_postgres_connections" in /etc/nrpe.cfg and restart the nrpe service on all affected servers. i.e.:
command[check_postgres_connections]=/path/to/check_postgres.pl --action=connection --db=your_database

Known Issue

All data will not be pulled if a Postgres server fails or becomes inaccessible in the list.

Troubleshooting

gr-pg-cx.py 'hangs':

  • Control-C to exit and examine the error output for possible clues.
  • Ensure all Postgres servers are accessible via NRPE.
  • Ensure all Postgres servers have check_postgres Nagios plugin installed and nrpe.cfg is properly configured.
  • Ensure all Postgres servers are configured properly.
  • Try restarting the nrpe service.

No results in Graphite:

  • Ensure Graphite server is running and can accept connections from Nagios (or where gr-pg-cx.py resides on).
  • May need to remove all old/previous whisperdata on Graphite related to gr-pg-cx.py.

Author

License

This project is licensed under the MIT License - see the LICENSE file for details.

About

Polls metrics from Postgres and delivers them to Graphite

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages