Code Monkey home page Code Monkey logo

ansible-postgresql-replication-monitoring's Introduction

Ansible-Postgresql-Replication-Monitoring

Ansible Monitoring For Postgesql Replication. This monitor script can be used to add monitoring to any PostgreSQL replicated environment and is not limited to just monitor Ansible Tower. However for the purposes of this README.md I will mention Ansible specifics and can elaborate further in the future as use-cases arises.

Monitoring can be hooked in several sources including Ansible Tower logging aggregators externally or Ansible Tower notification template setup.

Pre-requisites

Inventory Example

[tower]
tower-server1

[database]
tower-pg-master pgsqlrep_role=master

[database_replica]
tower-pg-slave pgsqlrep_role=replica

[all:vars]
admin_password='admin'

pg_host='tower-pg-master'
pg_port='5432'

pg_database='awx'
pg_username='awx'
pg_password='password'

pgsqlrep_password='password'

rabbitmq_port=5672
rabbitmq_vhost=tower
rabbitmq_username=tower
rabbitmq_password='password'
rabbitmq_cookie=cookiemonster

# Needs to be true for fqdns and ip addresses
# rabbitmq_use_long_name=true

# Isolated Tower nodes automatically generate an RSA key for authentication;
# To disable this behavior, set this value to false
# isolated_key_generation=true

Job Execution Example

ansible-playbook -i inventory pgsql-replicate-monitor.yml

Required Variables

Variable Name Value Description
pgpass_loc ~/.pgpass Location to store .pgpass file for automated authentication to PostgreSQL.
psql_opts -h localhost -d {{ pg_database }} -U {{ pg_username }} -w -t Default options passed to psql command.
psql_query SELECT CASE WHEN pg_last_xlog_receive_location() = pg_last_xlog_replay_location() THEN 0 ELSE EXTRACT (EPOCH FROM now() - pg_last_xact_replay_timestamp()) END AS log_delay; Default query to send to psql command to search for time difference.
threshold 10 Default to 10 seconds. This can be configurable in a high-latency or high-load environment.
pg_database awx Ansible Tower defaults it's database name to awx in the installer. Configurable via inventory.
pg_username awx Ansible Tower defaults it's database user name to awx in the installer. Configurable via inventory.
pg_password password This is configureable via inventory for Ansible Tower installation.
pg_port 5432 Default port for PosgreSQL database.

Notes

User assumes all responsibility of PostgreSQL database data.

ansible-postgresql-replication-monitoring's People

Contributors

stoleas avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.