Chapter 10. Monitoring your Ansible Automation Platform
After a successful installation of Ansible Automation Platform, it is crucial to prioritize the maintenance of its health and the ability to monitor key metrics.
This section focuses on how to monitor the API metrics provided by the newly installed Ansible Automation Platform environment that resides within Red Hat OpenShift.
10.1. What will be used to monitor the API metrics? Copy linkLink copied to clipboard!
Prometheus and Grafana.
Prometheus is an open source monitoring solution for collecting and aggregating metrics. Partner Prometheus’ monitoring capabilities with Grafana, an open source solution for running data analytics and pulling up metrics in customizable dashboards, and you get a real-time visualization of metrics to track the status and health of your Ansible Automation Platform.
10.2. What metrics can I expect to see? Copy linkLink copied to clipboard!
The Grafana pre-built dashboard displays:
- Ansible Automation Platform version
- Number of controller nodes
- Number of hosts available in the license
- Number of hosts used
- Total users
- Jobs successful
- Jobs failed
- Quantity by type of job execution
- Graphics showing the number of jobs running and pending jobs
- Graph showing the growth of the tool showing the amount of workflow, hosts, inventories, jobs, projects, organizations, etc.
This Grafana dashboard can be customized to capture other metrics you may be interested in. However, customizing the Grafana dashboard is out of scope of this reference architecture.
10.3. Installation via an Ansible Playbook Copy linkLink copied to clipboard!
The process to monitor Ansible Automation Platform via Prometheus with a customized Grafana dashboard can be installed in a matter of minutes. The following provides the steps to do just that, taking advantage of the pre-built Ansible playbook.
The following steps are required to run the Ansible Playbook successfully:
- Creation of a custom credential type within automation controller
- Creation of a kubeconfig credential within automation controller
- Creation of a project and job template to run the Ansible Playbook
10.3.1. Create a custom credential type Copy linkLink copied to clipboard!
Within your Ansible Automation Platform dashboard,
- Under Administration→Credential Types click the blue Add button.
- Provide a Name, e.g. Kubeconfig
Within the input configuration, input the following YAML:
fields: - id: kube_config type: string label: kubeconfig secret: true multiline: trueWithin the injector configuration, input the following YAML:
env: K8S_AUTH_KUBECONFIG: '{{ tower.filename.kubeconfig }}' file: template.kubeconfig: '{{ kube_config }}'- Click Save.
10.3.2. Create a kubeconfig credential Copy linkLink copied to clipboard!
Within your Ansible Automation Platform dashboard,
- Under Resources→Credentials click the blue Add button.
- Provide a Name, e.g. OpenShift-Kubeconfig
- Within the Credential Type dropdown, select Kubeconfig.
- Within the Type Details text box, insert your kubeconfig file for your Red Hat OpenShift cluster
- Click Save.
10.3.3. Create a project Copy linkLink copied to clipboard!
Within your Ansible Automation Platform dashboard,
- Under Resources→Projects click the blue Add button.
- Provide a Name, e.g. Monitoring AAP Project
- Select Default as the Organization.
- Select Default execution environment as the Execution Environment.
- Select Git as the Source Control Credential Type.
Within the Type Details,
- Add the Source Control URL (https://github.com/ansible/aap_ocp_refarch)
Within Options,
- Select Clean, Delete, Update Revision on Launch.
- Click Save.
10.3.4. Create a job template & run the Ansible Playbook Copy linkLink copied to clipboard!
Within your Ansible Automation Platform dsahboard,
- Under Resources→Templates click the blue Add→Add job template
- Provide a Name, e.g. Monitoring AAP Job
- Select Run as the Job Type.
- Select Demo Inventory as the Inventory.
- Select Monitoring AAP Project as the Project.
- Select Default execution environment as the Execution Environment.
- Select aap-prometheus-grafana/playbook.yml as the Playbook.
- Select Credentials and switch the category from Machine to Kubeconfig.
- Select the appropriate kubeconfig for access to the Red Hat OpenShift cluster, e.g. OpenShift-Kubeconfig
Optional Step: Within the Variables, the following variables may be modified:
- prometheus_namespace: <your-specified-value>
- ansible_namespace: <your-specified-value>
- Click Save.
- Click Launch to run the Ansible Playbook
- Details to login to Grafana and Prometheus are shown within the job output