# {{ ansible_managed }} define hostgroup { hostgroup_name webservers alias Web Servers } define hostgroup { hostgroup_name loadbalancers alias Load Balancers } define hostgroup { hostgroup_name dbservers alias Database Servers } {% for host in groups['webservers'] %} define host { use linux-server host_name {{ host }} alias {{ host }} address {{ hostvars[host].ansible_default_ipv4.address }} hostgroups webservers } {% endfor %} {% for host in groups['lbservers'] %} define host { use linux-server host_name {{ host }} alias {{ host }} address {{ hostvars[host].ansible_default_ipv4.address }} hostgroups loadbalancers } define service { use local-service host_name {{ host }} service_description HAProxy Load Balancer check_command check_http!-p{{ hostvars[host].listenport }} } {% endfor %} {% for host in groups['dbservers'] %} define host { use linux-server host_name {{ host }} alias {{ host }} address {{ hostvars[host].ansible_default_ipv4.address }} hostgroups dbservers } {% endfor %} # service checks to be applied to all hosts define service { use local-service host_name localhost service_description Root Partition check_command check_local_disk!20%!10%!/ } define service { use local-service host_name * service_description Current Users check_command check_local_users!20!50 } define service { use local-service host_name * service_description Total Processes check_command check_local_procs!250!400!RSZDT } define service { use local-service host_name * service_description Current Load check_command check_local_load!5.0,4.0,3.0!10.0,6.0,4.0 } define service { use local-service host_name * service_description Swap Usage check_command check_local_swap!20!10 } # service checks to be applied to the web server define service { use local-service hostgroup_name webservers service_description webserver check_command check_http notifications_enabled 0 } # service checks to be applied to the database server #define service { # use local-service # hostgroup_name dbservers # service_description MySQL Database Server # check_command check_mysql # notifications_enabled 0 #}