From Git Push to Running PostgreSQL: An End-to-End AWX Workflow
Monitoring on a Schedule, Alerting on Failure
We created a job that verifies if PostgreSQL is running. Although it's a simple check, it can be useful for monitoring the service. You can add more checks to the playbook for finer-grained monitoring. For example, you can check whether the service is enabled to start at boot, whether it's listening on the correct port, whether it's reachable from a remote host, whether it's accepting connections, and whether the expected users and databases are present.
Then, you can create a schedule to run the playbook every 5 minutes, every hour, or at any interval you prefer. This way, you can monitor the service and be alerted if something goes wrong.
Let's create the schedule to run the playbook every 5 minutes. Use the following configurations.
Go to the Schedules section in the job template (CheckPostgres) and create a new schedule with the following configurations.
- Name: Use
MonitorPostgreSQL. - Description: Use
A schedule to monitor the PostgreSQL service. - Repeat Frequency: Use
Every 5 minutes.
Monitoring without alerting is not very useful. You should create a notification template. Let's use the email type for this example. Go to Notification in the sidebar panel and create a new notification template with the following configurations:
- Name: Use
PostgreSQLServiceMonitor
AWX in Action
Ansible Orchestration at ScaleEnroll now to unlock all content and receive all future updates for free.
