fix defaults

This commit is contained in:
Cyberes 2024-02-25 21:08:32 -07:00
parent ecd70f4cf2
commit 0e210ea641
3 changed files with 11 additions and 3 deletions

View File

@ -2,10 +2,12 @@
# Check OPNsense network traffic for a host.
usage() {
echo "Usage: $0 --api <api_url> --user <username> --password <password>"
echo "Usage: $0 --api <api_url> --user <username> --password <password> [--fail]"
exit 1
}
EXIT_ON_FAILURE=false
while [ "$1" != "" ]; do
case $1 in
--api ) shift
@ -17,6 +19,9 @@ while [ "$1" != "" ]; do
--password ) shift
password=$1
;;
--fail ) shift
EXIT_ON_FAILURE=true
;;
* ) usage
esac
shift
@ -43,6 +48,9 @@ while true; do
echo "All pending alerts have been acknowledged."
else
echo "Failed to acknowledge the alerts. Status code: $response"
if $EXIT_ON_FAILURE; then
exit 1
fi
fi
sleep 60
done

View File

@ -75,7 +75,7 @@ def main(args):
if __name__ == "__main__":
parser = argparse.ArgumentParser()
parser.add_argument('--api', default='http://localhost:5665', help='Base Icinga2 API.')
parser.add_argument('--api', default='https://localhost:5665', help='Base Icinga2 API.')
parser.add_argument('--insecure', action='store_true', help='Disable SSL verification.')
parser.add_argument('--username', default='icingaweb2', help='API username.')
parser.add_argument('--password', required=True, help='API password.')

View File

@ -3,7 +3,7 @@ Description=Auto Acknowledge all Icinga2 apt alerts
[Service]
User=flask
ExecStart=/opt/icinga2-checks/Other/auto-acknowledge-apt.sh --api https://localhost:5665 --user icingaweb2 --password XXXXX
ExecStart=/opt/icinga2-checks/Other/auto-acknowledge-apt.sh --api https://localhost:5665 --fail --user icingaweb2 --password XXXXX
SyslogIdentifier=auto-acknowledge-apt
Restart=always