consul discovery

22 views
Skip to first unread message

sri L

unread,
Feb 28, 2024, 12:33:07 PM2/28/24
to Prometheus Users
Hi all,

I am trying to register onprem multiple nodes in consul DB using single json file but while registering through API, getting syntax error (Request decode failed: json: cannot unmarshal array into Go value of type structs.RegisterRequest)


I am using below curl command for registering nodes

curl --request PUT --data @nodes.json http://x.x.x.x:8500/v1/catalog/register


Below is the node json file I am using:

[
{
  "Node": "ABC",
  "Address": "ABC.net",
  "NodeMeta": {
    "external-node": "true",
    "external-probe": "true"
  },
  "Service": {
    "ID": "node_exporter",
    "Service": "monitoring",
    "Tags": ["node_exporter"],
    "Port": 9100
  }
},
{
  "Node": "XYZ",
  "Address": "XYZ.net",
  "NodeMeta": {
    "external-node": "true",
    "external-probe": "true"
  },
  "Service": {
    "ID": "node_exporter",
    "Service": "monitoring",
    "Tags": ["node_exporter"],
    "Port": 9100
  }
}
]


I am not installing consul agent in those nodes, just trying to register those external nodes in consul DB and from their Prometheus has to discover those nodes.

Can anyone please suggest on adding multiple nodes with one json file.

Thanks


Brian Candler

unread,
Feb 29, 2024, 4:25:18 AM2/29/24
to Prometheus Users
Consul is a Hashicorp product. How you configure and manage consul is not really a topic for a Prometheus mailing list. 

See https://www.consul.io/community for a list of Consul community resources.
Reply all
Reply to author
Forward
0 new messages