sensu-go: Custom / extended attributes not working with agent yaml config
Expected Behavior
Should be able to pass extended attributes using either command line, or json/yml file.
Current Behavior
Custom attributes are not passed
Steps to Reproduce (for bugs)
Tried to set the attributes in several ways (according to the doc) : Dummy client agent.yml :
---
##
# agent configuration
##
id: "test.machine"
#organization: "default"
#environment: "default"
subscriptions:
backend-url:
- "ws://myserver:8081"
testattr1: "test"
extended_attributes:
testattr2: "test123"
##
# authentication configuration
##
user: "agent"
password: "superpassword"
##
# other
##
cache-dir: "~/sensu/cache"
Running it with command : sensu-agent start -c agent.yml --custom-attributes "testattr3: test"
sensuctl entity info test.machine --format json
output :
{
"class": "agent",
"deregister": false,
"deregistration": {},
"environment": "default",
"id": "test.machine",
"keepalive_timeout": 120,
"last_seen": 1535095375,
"organization": "default",
"redact": [
"password",
"passwd",
"pass",
"api_key",
"api_token",
"access_key",
"secret_key",
"private_key",
"secret"
],
"subscriptions": [
"entity:test.machine"
],
"system": {
"hostname": "pc1-ps002",
"os": "linux",
"platform": "ubuntu",
"platform_family": "debian",
"platform_version": "18.04",
"network": {
"interfaces": [
{
"name": "lo",
"addresses": [
"127.0.0.1/8",
"::1/128"
]
},
{
"name": "enp0s31f6",
"mac": "30:9c:23:70:5d:a3",
"addresses": [
"10.252.36.30/22",
"fe80::d8f3:ac37:47a2:74e7/64"
]
},
{
"name": "anbox0",
"mac": "ea:8c:b9:08:39:e3",
"addresses": [
"192.168.250.1/24",
"fe80::e88c:b9ff:fe08:39e3/64"
]
},
{
"name": "docker0",
"mac": "02:42:0b:58:21:3a",
"addresses": [
"172.17.0.1/16",
"fe80::42:bff:fe58:213a/64"
]
},
{
"name": "br-e907becf2e0f",
"mac": "02:42:ed:71:56:69",
"addresses": [
"172.19.0.1/16",
"fe80::42:edff:fe71:5669/64"
]
},
{
"name": "br-fd51f7f7a5da",
"mac": "02:42:09:62:10:b9",
"addresses": [
"172.18.0.1/16"
]
},
{
"name": "vethd2d58e2",
"mac": "7a:39:c9:c0:d4:c1",
"addresses": [
"fe80::7839:c9ff:fec0:d4c1/64"
]
}
]
},
"arch": "amd64"
},
"user": "agent"
}
As you can see, none of the testattr are displayed here.
Context
Unable to use custom attributes as tokens
Your Environment
sensu-agent : sensu-agent version 2.0.0-beta.4-4#a05ad41, build a05ad411199077286f49c06629eed4823331176c, built 2018-08-16T21:25:14+0000 Running on Ubuntu 18.04
sensu-backend : sensu-backend version 2.0.0-beta.4-4#a05ad41, build a05ad411199077286f49c06629eed4823331176c, built 2018-08-16T21:23:57+0000 Running on Centos 7.5
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Comments: 15 (7 by maintainers)
You would need to use a string in the agent.yml - the data is expected to be serialized for agent config.
Agent configs don’t map 1:1 with entities - so you can’t retrieve the entity resource and expect to use it for configuring an agent.
We could consider adding extended attributes to the agent config so that yaml and json configuration feels a bit more natural with extended attributes. I’ll bring it up with the team.