HashiCorp Consul

Related topics
Product name
Publisher page
  • [HashiCorp|HashiCorp]
Category
System Software and Hardware
Release
TKU 2021-Mar-1
More information
Publisher link

Product Description

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

Software pattern summary

Product componentOS typeVersioningPattern Depth
Consul AgentWindows, UNIXActiveInstance-based
ConsulClusterWindows, UNIX_____Instance-based

Platforms Supported by the Pattern

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

Identification

Software Instance Triggers

PatternTrigger NodeAttributeConditionArgument
ConsulServerDiscoveredProcess

cmd

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

and

args

matchregex "(?i)agent"
ConsulCluster

SoftwareInstance

cluster_id

exists


and
cluster_idmatches regex "."
and
leaderexists
and

leader

="true"
and

type

matches"HashiCorp Consul Agent"

Node Attributes

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

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.

Simple Identification Mappings

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'

Versioning

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

$consul version


$consul info


Consul Cluster

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 Expertise

Subject Matter Expert input will be welcome on any other potential approaches not discussed.

Testing

The patterns have been tested against the live installations on Windows, UNIX platforms.

Information Sources

More information about this product can be found here.

Open Issues

There are no known open issues with this pattern.

Was this page helpful? Yes No Submitting... Thank you

Comments