initial nagios signalling support for web teir

pull/63/head
Tim Gerla 11 years ago
parent df9b42c3d1
commit cd3b1e30ca
  1. 15
      lamp_haproxy/README.md
  2. 2
      lamp_haproxy/roles/nagios/templates/servers.cfg.j2
  3. 9
      lamp_haproxy/roles/web/tasks/rolling_update.yml
  4. 2
      lamp_haproxy/rolling_update.yml
  5. 1
      lamp_haproxy/web.yml

@ -14,6 +14,10 @@ First we configure the entire stack by listing our hosts in the 'hosts' inventor
[lbservers]
lbserver
# an optional nagios node
[monitoring]
nagiosserver
After which we execute the following command to deploy the site:
ansible-playbook -i hosts site.yml
@ -24,13 +28,13 @@ The deployment can be verified by accessing the IP address of your load balnacer
Removal of a node from the cluster is as simple as executing the following command:
ansible-playbook -i hosts playbooks/remove_webservers.yml --limit=web2
ansible-playbook -i hosts remove_webservers.yml --limit=web2
###Add a Node
Adding a node to the cluster can be done by executing the following command:
ansible-playbook -i hosts playbooks/add_webservers.yml --limit=web2
ansible-playbook -i hosts add_webservers.yml --limit=web2
###Rolling Update
@ -41,10 +45,5 @@ that only one server will be updated at one time. If you have a lot of web serve
Once the code has been updated in the source repository for your application which can be defined in the group_vars/all file, execute the following command:
ansible-playbook -i hosts playbooks/rolling_update.yml
ansible-playbook -i hosts rolling_update.yml

@ -95,7 +95,7 @@ define service {
define service {
use local-service
hostgroup_name webservers
service_description Apache Web Server
service_description webserver
check_command check_http
notifications_enabled 0
}

@ -4,6 +4,11 @@
- name: Remove the code from server
command: rm -rf /var/www/html/*
- name: disable nagios alerts for this host's webserver service
nagios: action=disable_alerts host=$ansible_hostname services=webserver
delegate_to: $item
with_items: ${groups.monitoring}
- name: disable the server in haproxy
shell: echo "disable server myapplb/${ansible_hostname}" | socat stdio /var/lib/haproxy/stats
delegate_to: $item
@ -20,3 +25,7 @@
delegate_to: $item
with_items: ${groups.lbservers}
- name: re-enable nagios alerts
nagios: action=enable_alerts host=$ansible_hostname services=webserver
delegate_to: $item
with_items: ${groups.monitoring}

@ -6,4 +6,4 @@
user: root
serial: 1
tasks:
- include: ../roles/web/tasks/rolling_update.yml
- include: roles/web/tasks/rolling_update.yml

@ -1,6 +1,7 @@
---
# This playbook deploys the webservers with httpd and the code.
# fetch monitoring facts for iptables rules
- hosts: monitoring
tasks: