-
Notifications
You must be signed in to change notification settings - Fork 5
Home
Welcome to the tower-nagios-integration wiki!
This repository will contain various documentation and scripts that help integrate Ansible Tower with Nagios.
Script to be used as Nagios event handler to trigger jobs in Ansible Tower.
- Python 2.7
- Nagios 3.5 or higher
- Ansible Tower 3.2 or higher
By the time that you arrived here, you may already have everything you need to run this script. We will list the requirements here, but this document does not intend to explain how to achieve these. Please refer to the specific documentation of the given technology used.
- Ansible Tower
- Username/password to be used by Nagios.
- At least one inventory and one job template.
- It's highly advisable that your job template have the inventory "prompt on launch" check box marked, however it's not required.
- Nagios
-
tower-cli installed and configured with the proper credentials.
- HINT: On RHEL7 you can install
python2-ansible-tower-cli
from EPEL
- HINT: On RHEL7 you can install
-
tower-cli installed and configured with the proper credentials.
Copy tower_handler.py
into the directory where your event handler scripts should run (as defined by your configuration).
First of all, make sure tower-cli
is working properly. The minimum viable test is this:
# tower-cli job list
===== ============ ======================== ========== =======
id job_template created status elapsed
===== ============ ======================== ========== =======
1 1 2018-10-03T18:30:00.000Z successful 42.000
===== ============ ======================== ========== =======
To confirm if the handler itself is working, you can trigger a job from the command line:
# /path/to/tower_handler.py --template <my_template> --inventory <my_inventory> --attempt 2
If successful, the script will not produce any return, but you will see a job on your Ansible Tower Jobs tab (or in the job list, if you repeat the command above).