HashiCorp Consul - Documentation for BMC Discovery content reference

Starting from July 2018 TKU release model of current product has been drastically changed. This may impact your CMDB. Please find more information on mentioned updates here.

Consul has multiple components, but as a whole, it is a tool for discovering and configuring services in target infrastructure. It provides several key features:

  • Service Discovery

  • Health Checking

  • KV Store

  • Multi Datacenter

Architecture

Known Versions

  • 0.1
  • 0.2
  • 0.3
  • 0.4
  • 0.5
  • 0.6
  • 0.7
  • 0.8
  • 0.9
  • 1.0
  • 1.1
  • 1.2
Product componentOS typeVersioningPattern Depth
Consul AgentWindows, UNIXActiveInstance-based
ConsulClusterWindows, UNIX_____Instance-based

All mentioned Consul components can be discovered on both Unix/Linux and Microsoft Windows platforms.

Software Instance Triggers

PatternTrigger NodeAttributeConditionArgument
ConsulServerDiscoveredProcess

cmd

matchesregex '(?i)consul(?:\.exe)?$'

and

args

matchregex "(?i)agent"
ConsulClusterSoftwareInstance

cluster_id


and
cluster_idmatches regex "."
and
leaderexists
and

leader

="true"
and

type

matches"HashiCorp Consul Agent"

This section describes attributes and Consul commands which provide data for these attributes assignment.

AttributeCommandNode TypePattern
cluster_id
  • consul members
  • consul members --http-addr=localhost:<port>
HashiCorp Consul Agent SIConsulServer

role, bootstrap,

leader

  • consul info
  • consul info --http-addr=localhost:<port>
HashiCorp Consul Agent SIConsulServer
version
  • consul info
  • consul info --http-addr=localhost:<port>
  • consul version
  • consul version --http-addr=localhost:<port>
HashiCorp Consul Agent SIConsulServer

name,

ipv4_addrs,

state

  • consul members
  • consul members --http-addr=localhost:<port>
ClusterMemberConsulCluster

name,

ipv4_addrs

  • for /f  %%i in ('"<process_cmd>" catalog services') DO echo service: %%i: &&("<process_cmd>" catalog nodes --service="%%i")
  • for /f  %%i in ('"<process_cmd>" catalog services --http-addr=localhost:<port>') DO echo service: %%i: &&(<process_cmd>" catalog nodes --service="%%i" --http-addr=localhost:<port>
  • for i in `<process_cmd> catalog services`; do echo "service:$i":`<process_cmd> catalog nodes --service="$i"` ; done ;
  • for i in `<process_cmd> catalog services --http-addr=localhost:<port>`; do echo "service:$i":`<process_cmd> catalog nodes --service="$i" --http-addr=localhost:<port>` ; done ;
ClusterServiceConsulCluster

cluster_id attribute is modeled by means of merging cluster members IPs together. Currently this is only available approach as HashiCorp Consul product doesn't have its own unique cluster identifier.

The following components/processes are identified using the simple identity mappings which map products known processes:

NameCondition
HashiCorp Consul Agent

regex '(?i)consul(?:\.exe)?$', regex '(?i)-agent'

ConsulServer pattern will try to run one of two commands in order to obtain version:

$consul version
$consul info

ConsulCluster pattern will trigger on HashiCorp Consul Agent SI which should be a leader and have cluster_id attribute.

It will then search all the members of the related cluster which have identical cluster_id attribute.

ConsulCluster pattern models Cluster Node which will contain related ClusterMember and ClusterService Nodes.

Subject Matter Expert input will be welcome on any other potential approaches not discussed.The patterns have been tested against the live installations on Windows, UNIX platforms.

More information about this product can be found here.

There are no known open issues with this pattern.

You Might Also Like