ansible-collections / community.grafana

Grafana Collection for Ansible
http://galaxy.ansible.com/community/grafana
GNU General Public License v3.0
126 stars 82 forks source link

Manage silences without alertmanager #387

Open sfhl opened 1 month ago

sfhl commented 1 month ago
SUMMARY

Hi there, with the current code it is only possbile to manage silences if any kind of alertmanager(-connection) is available.

If using alerting via grafana only (unified alerting) its not possible to manage silences, because the collection/module uses the /api/alertmanager/grafana/api/v2/silences endpoint.

ISSUE TYPE
COMPONENT NAME

grafana

ADDITIONAL INFORMATION

image

Nemental commented 1 month ago

Hey @sfhl, I'll take a look at this 👍

Nemental commented 1 month ago

Hi @sfhl, it should be possible to manage silences with grafana unified alerting and without an external alert manager. The tests of this repository work exactly this way. If you have any further problems on this topic, feel free to re-open this issue again!

sfhl commented 1 week ago

@Nemental Updated to latest collection version, still (same) error:

failed: [zacoy-dev01] (item={'comment': 'Silence due to planned downtime', 'created_by': 'API user', 'starts_at': '2024-08-27T09:28:55Z', 'ends_at': '2024-08-27T10:28:55Z', 'state': 'present', 'org_name': 'ORG', 'matchers': [{'isEqual': True, 'isRegex': True, 'name': 'stage', 'value': 'dev'}]}) => {
    "ansible_loop_var": "silence",
    "changed": false,
    "invocation": {
        "module_args": {
            "client_cert": null,
            "client_key": null,
            "comment": "Silence due to planned downtime",
            "created_by": "API user",
            "ends_at": "2024-08-27T10:28:55Z",
            "grafana_api_key": null,
            "matchers": [
                {
                    "isEqual": true,
                    "isRegex": true,
                    "name": "stage",
                    "value": "dev"
                }
            ],
            "org_id": 1,
            "org_name": null,
            "skip_version_check": false,
            "starts_at": "2024-08-27T09:28:55Z",
            "state": "present",
            "url": "https://monitoring.domain.tld",
            "url_password": "VALUE_SPECIFIED_IN_NO_LOG_PARAMETER",
            "url_username": "api-user",
            "use_proxy": true,
            "validate_certs": true
        }
    },
    "msg": "Grafana Silences API answered with HTTP -1",
    "silence": {
        "comment": "Silence due to planned downtime",
        "created_by": "API user",
        "ends_at": "2024-08-27T10:28:55Z",
        "matchers": [
            {
                "isEqual": true,
                "isRegex": true,
                "name": "stage",
                "value": "dev"
            }
        ],
        "org_name": "ORG",
        "starts_at": "2024-08-27T09:28:55Z",
        "state": "present"
    }
}