Hi guys,
what is the correct command to stop the notifications via API?
Basicly we are trying to disable the notifications like via the web interface available at
/icingaweb2/monitoring/health/info
Hi guys,
what is the correct command to stop the notifications via API?
Basicly we are trying to disable the notifications like via the web interface available at
/icingaweb2/monitoring/health/info
I tried that according to https://icinga.com/blog/2021/03/12/using-the-icinga-web-api/ and it did not work:
curl -X POST -H "Accept: application/json" -u user:password "https://icinga-master/icingaweb2/monitoring/health/info" -F "notifications_enabled=0"
I would recommend writing a module that does “something similar” like the monitoring/health/info toggle and provide it with a working rest api call or open a ticket in github
You could simply switch off notifications with the icinga2 shell command ({icinga2 feature …}), and then restart the Icinga service. Not API but shell commands…
Not sure if that’s exactly what you want, but only for one host :
curl -k -u 'username:a_key' \
-H 'Accept: application/json' \
-d '{ "attrs": { "enable_notifications": false } }' \
'https://icinga.example.com:5665/v1/objects/hosts?host=example.vm.com' | jq
I was in the application log the other day, in the Debug Section, and I read something rather odd about a bit of rare log entry. It’s called, as I understand it… Toggle Notification through icinga2 api.
Executing curl -s -X POST -H 'Accept: application/json' -k -u 'user':'password' -d '{"attrs":{"enable_notifications":false}}' 'https://icinga-master:5665/v1/objects/icingaapplications/app'
Executing curl -s -X POST -H 'Accept: application/json' -k -u 'user':'password' -d '{"attrs":{"enable_notifications":true}}' 'https://icinga-master:5665/v1/objects/icingaapplications/app'
I came across the term while reading, be careful it is icinga2 api not icingaweb2 api, so you need a icinga2 api user
something more official :
“Actions which affect the Icinga Application itself such as disabling notification on a program-wide basis must be applied by updating the IcingaApplication object called
app
.” → https://icinga.com/docs/icinga-2/latest/doc/12-icinga2-api/
curl -k -s -S -i -u root:icinga -H 'Accept: application/json' \
-X POST 'https://localhost:5665/v1/objects/icingaapplications/app' \
-d '{ "attrs": { "enable_notifications": false } }'
I also activated the debug log and played around with the Notifications button, but seems I oversaw those entries.
That is exactly what I was looking for. Thank you very much!