Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FEED] Downtime cannot be changed #672

Open
mayrstefan opened this issue Oct 13, 2024 · 2 comments
Open

[FEED] Downtime cannot be changed #672

mayrstefan opened this issue Oct 13, 2024 · 2 comments
Assignees
Labels
enhancement New feature or request feedback General feedback help wanted Extra attention is needed module:downtime This affects the downtime module

Comments

@mayrstefan
Copy link

Describe the bug
When patching servers with ansible we set a quite long downtime in Checkmk. After the patching is done we would like to reduce the downtime window instead of removing it for auditing purpose.

Trying to do this with the ansible collection does not work: setting the endtime via the downtime module does not change the downtime.

Component Name
Component Name: downtime

Ansible Version
This is from a test wsl installation in Ubuntu 22.04. The issue is also present for different ansible versions

$ ansible --version
ansible 2.10.8
  config file = None
  configured module search path = ['/home/stefan/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/lib/python3/dist-packages/ansible
  executable location = /usr/bin/ansible
  python version = 3.10.12 (main, Sep 11 2024, 15:47:36) [GCC 11.4.0]

Checkmk Version and Edition

Checkmk Raw Edition 2.3.0p18

Collection Version

checkmk.general:5.3.0

To Reproduce
Steps to reproduce the behavior:

  1. Set downtime
  2. Try to change end_after or end_time
  3. See that downtime has not changed

Expected behavior
When a new endtime is set it should be changed

Actual behavior
Nothing changes

Minimum reproduction example

---
- name: "Test Downtimes"
  hosts: all
  connection: local
  gather_facts: false
  vars:
    checkmk_var_server_url: "http://localhost:8080"
    checkmk_var_automation_user: "cmkadmin"
    checkmk_var_automation_secret: "..."
    mysite: "cmk"
  tasks:
    - name: "Set Downtime"
      checkmk.general.downtime:
        comment: "Downtime to be changed"
        server_url: "{{ checkmk_var_server_url }}"
        site: "{{ mysite }}"
        automation_user: "{{ checkmk_var_automation_user }}"
        automation_secret: "{{ checkmk_var_automation_secret }}"
        host_name: "{{ inventory_hostname }}"
        end_after:
          hours: 2

    - name: "Change Downtime"
      checkmk.general.downtime:
        comment: "Downtime to be changed"
        server_url: "{{ checkmk_var_server_url }}"
        site: "{{ mysite }}"
        automation_user: "{{ checkmk_var_automation_user }}"
        automation_secret: "{{ checkmk_var_automation_secret }}"
        host_name: "{{ inventory_hostname }}"
        end_after:
          minutes: 1

Running this playbook already shows the second task does nothing:

$ ansible-playbook -i 'demo.example.com,' test-downtimes.yml

PLAY [Test Downtimes] **************************************************************************************

TASK [Set Downtime] ****************************************************************************************
changed: [demo.example.com]

TASK [Change Downtime] *************************************************************************************
ok: [demo.example.com]

PLAY RECAP *************************************************************************************************
demo.example.com           : ok=2    changed=1    unreachable=0    failed=0    skipped=0    rescued=0    ignored=0
@mayrstefan mayrstefan added the bug Something isn't working label Oct 13, 2024
@github-actions github-actions bot added the module:downtime This affects the downtime module label Oct 13, 2024
@robin-checkmk
Copy link
Member

Hi @mayrstefan and thanks for reporting this!
I can reproduce the issue and we will look into it.

As a workaround, you could use flexible downtimes or delete and re-add the downtime.

@lgetwan
Copy link
Contributor

lgetwan commented Oct 31, 2024

Hi @mayrstefan,
the current downtime module doesn't support changing existing downtimes.

Implementing the possibility to change existing downtimes needs a lot of code change. As the code of this module is quite old, I decided to overhaul it in general and implement your feature request, then.

Until this happens, you can use the workaround described by Robin.

@robin-checkmk robin-checkmk added enhancement New feature or request help wanted Extra attention is needed feedback General feedback and removed bug Something isn't working labels Oct 31, 2024
@robin-checkmk robin-checkmk changed the title [BUG] Downtime cannot be changed [FEED] Downtime cannot be changed Oct 31, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request feedback General feedback help wanted Extra attention is needed module:downtime This affects the downtime module
Projects
None yet
Development

No branches or pull requests

3 participants