consul

echo '["abcdef123458"]' /var/consul/serf/local.keyring
service consul restart
 
# config
cat /etc/consul/config.json
 
# log
/var/log/syslog

CLI

consul catalog datacenters
consul catalog nodes
consul catalog services
 
consul monitor
consul validate /etc/consul/config.json 
consul operator raft list-peers

UI listen on external
https://stackoverflow.com/questions/35132687/how-to-access-externally-to-consul-ui

# Redirect UI to localhost
ssh -L 8500:localhost:8500 root@node1.example.com -N
 
# cat /etc/consul/config.json 
{
...
    "addresses": {
        "dns": "127.0.0.1",
        "grpc": "127.0.0.1",
        "http": "0.0.0.0",
        "https": "127.0.0.1"
    },
...

Remove service from specific node

ssh node1
consul services deregister -id=prometheus

checks
https://www.consul.io/api/agent/check.html

Get service state
https://consul.example.com/v1/agent/service/neutron

Icinga / Nagios checks

for SERVICE in $(consul catalog services); do
    echo ${SERVICE}
    /usr/lib/nagios/plugins/check_consul_service.py ${SERVICE}
    echo
done

Ansible module
https://docs.ansible.com/ansible/latest/modules/consul_module.html

Links
https://www.consul.io/docs/agent/options.html
https://www.hashicorp.com/blog/load-balancing-strategies-for-consul
https://blog.eleven-labs.com/en/consul-service-discovery-failure-detection/