Icinga / icingaweb2-module-director

The Director aims to be your new favourite Icinga config deployment tool. Director is designed for those who want to automate their configuration deployment and those who want to grant their “point & click” users easy access to the configuration.
https://icinga.com/docs/director/latest
GNU General Public License v2.0
413 stars 201 forks source link

Create and modify notification and service apply rules via REST API #2664

Open RafaelSche opened 1 year ago

RafaelSche commented 1 year ago

Expected Behavior

requests.post(f'{url}/notifications/applyrules', json={"object_name": "notification_name", "object_type": "apply", ...}, headers=headers, auth=auth)

... should create a notification, just like with the hosts.

Current Behavior

It just returns the current notifications.

But it is possible to create notifications via the CLI. It feels like it should be possible via the API to. Doesn't the CLI use the API? Did I do something wrong? I didn't find anything in the docs

Environment

Copyright (c) 2012-2022 Icinga GmbH (https://icinga.com/) License GPLv2+: GNU GPL version 2 or later https://gnu.org/licenses/gpl2.html This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law.

System information: Platform: Debian GNU/Linux Platform version: 11 (bullseye) Kernel: Linux Kernel version: 5.10.0-19-amd64 Architecture: x86_64

Build information: Compiler: GNU 10.2.1 Build host: runner-hh8q3bz2-project-575-concurrent-0 OpenSSL version: OpenSSL 1.1.1n 15 Mar 2022

* Operating System and version:
```sh
PRETTY_NAME="Debian GNU/Linux 11 (bullseye)"
NAME="Debian GNU/Linux"
VERSION_ID="11"
VERSION="11 (bullseye)"
VERSION_CODENAME=bullseye
ID=debian
HOME_URL="https://www.debian.org/"
SUPPORT_URL="https://www.debian.org/support"
BUG_REPORT_URL="https://bugs.debian.org/"
/etc/os-release (END)
cmusinsky commented 1 year ago

I am experiencing the same issue. Would love to see this added, it seems any request to director/notifications/applyrules just ends up acting as a GET with no parameters. As such, I'm also unable to get objects by name- it's just a dump of all apply rules every time.