Commit 790286cb authored by Carlos Torres's avatar Carlos Torres
Browse files

Adjusting pushgateway parameters.

parent ff2e8c73
#beging domain: {{ item }}
{% set domain = item %}
{% set domain = item %}
{% set http_status_code = domain | replace(".","_") %}
URL="https://{{ domain }}/.well-known/shimmercat/bot-blocking/?wants=/"
{% set host_ip = hostvars[inventory_hostname]['ansible_default_ipv4']['address'] %}
STATUS=$(curl --connect-to {{ domain }}:443:{{ host_ip }}:443 -s -o /dev/null -w "%{http_code}\n" $URL)
{% for deployment in deployments.values() %}
URL="https://{{ domain }}/.well-known/shimmercat/bot-blocking/?wants=/"
STATUS=$(curl -L --connect-to {{ domain }}:443:{{ host_ip }}:{{ deployment.https_port }} -s -o /dev/null -w "%{http_code}\n" $URL)
if [ $STATUS == 200 ] ; then
echo "http_status_botpage 1" | curl --data-binary @- http://localhost:{{ pushgateway_port }}/metrics/job/{{ http_status_code }}/instance/target
echo "http_status_botpage 1" | curl --data-binary @- http://localhost:{{ pushgateway_port }}/metrics/job/{{ http_status_code }}/instance/{{ deployment.deployment_name }}
else
echo "http_status_botpage 0" | curl --data-binary @- http://localhost:{{ pushgateway_port }}/metrics/job/{{ http_status_code }}/instance/target
echo "http_status_botpage 0" | curl --data-binary @- http://localhost:{{ pushgateway_port }}/metrics/job/{{ http_status_code }}/instance/{{ deployment.deployment_name }}
fi
{% endfor %}
# end domain: {{ item }}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment