sensu / sensu-go

Simple. Scalable. Multi-cloud monitoring.
https://sensu.io
MIT License
1k stars 178 forks source link

Labels in `/etc/sensu/agent.yml` not reflected in Sensu UI #5059

Open amitbasuri opened 3 months ago

amitbasuri commented 3 months ago

Expected Behavior

Labels defined in the /etc/sensu/agent.yml should appear in the Sensu UI for the respective agent.

Current Behavior

The Sensu UI does not display the labels defined in the agent.yml file. When the Sensu agent is started with the --label flag, labels appear in the UI, but not when they're configured directly in the agent.yml.

Possible Solution

A potential cause might be the Sensu UI not reloading or recognizing updates made to the agent.yml configuration file.

Steps to Reproduce (for bugs)

  1. Configure labels in /etc/sensu/agent.yml.
  2. Restart sensu-agent using systemctl.
  3. Observe that labels do not appear in the Sensu UI.
  4. Stop the agent and restart with the --labels flag, noting that labels now appear in the UI.

Context

This issue is causing difficulties in dynamically managing labels through configuration management tools like Ansible. My objective is to manage agent configuration solely through Ansible without needing additional flags at startup.

Your Environment

My Setup

sudo cat  /etc/sensu/agent.yml
---
#
# Managed by Ansible - do NOT edit this file manually!
#

##
# Sensu agent configuration
##
backend-url:
- ws://<sensu-backend>:8081

keepalive-interval: 5
keepalive-timeout: 10
labels:
    node_tag: mix-node-0
name: my-agent

Ansible

- name: Install, configure and run Sensu agents
  hosts: agents
  become: true
  tasks:
    - name: Install agent
      include_role:
        name: sensu.sensu_go.agent
      vars:
        agent_config:
          name: my-agent
          keepalive-interval: 5
          keepalive-timeout: 10
          labels:
            node_tag: "{{ node_tag }}"