fix a few things
This commit is contained in:
parent
4488e04b28
commit
21eb6729cc
|
@ -38,7 +38,8 @@ payload='{
|
||||||
|
|
||||||
while true; do
|
while true; do
|
||||||
response=$(curl -s -o /dev/null -w "%{http_code}" -X POST -H "Accept: application/json" -u "$user:$password" -d "$payload" -k "$api/v1/actions/acknowledge-problem")
|
response=$(curl -s -o /dev/null -w "%{http_code}" -X POST -H "Accept: application/json" -u "$user:$password" -d "$payload" -k "$api/v1/actions/acknowledge-problem")
|
||||||
if [ "$response" == "200" ]; then
|
if [ "$response" == "200" ] || [ "$response" == "409" ]; then
|
||||||
|
# 409 is okay because that means it's already been acknowledged.
|
||||||
echo "All pending alerts have been acknowledged."
|
echo "All pending alerts have been acknowledged."
|
||||||
else
|
else
|
||||||
echo "Failed to acknowledge the alerts. Status code: $response"
|
echo "Failed to acknowledge the alerts. Status code: $response"
|
||||||
|
|
|
@ -7,6 +7,8 @@ import urllib3
|
||||||
from flask import Flask, Response, request
|
from flask import Flask, Response, request
|
||||||
from icinga2api.client import Client
|
from icinga2api.client import Client
|
||||||
|
|
||||||
|
script_dir = os.path.dirname(os.path.realpath(__file__))
|
||||||
|
sys.path.insert(0, str(Path(script_dir).parent))
|
||||||
from checker import nagios
|
from checker import nagios
|
||||||
|
|
||||||
# TODO: add query arg to not return an error when the host check is down
|
# TODO: add query arg to not return an error when the host check is down
|
||||||
|
|
|
@ -3,7 +3,7 @@ Description=Auto Acknowledge all Icinga2 apt alerts
|
||||||
|
|
||||||
[Service]
|
[Service]
|
||||||
User=flask
|
User=flask
|
||||||
ExecStart=/opt/icinga2-checks/Other/auto-acknowledge-apt.sh --api https://localhost:5665 --user icingaweb2 --password queeyahnahz3Zie1
|
ExecStart=/opt/icinga2-checks/Other/auto-acknowledge-apt.sh --api https://localhost:5665 --user icingaweb2 --password XXXXX
|
||||||
SyslogIdentifier=auto-acknowledge-apt
|
SyslogIdentifier=auto-acknowledge-apt
|
||||||
Restart=always
|
Restart=always
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue