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

Failure to send alerts to Pagerduty through a squid proxy (error:invalid-request) #74

Open
sajoupa opened this issue Mar 12, 2024 · 1 comment

Comments

@sajoupa
Copy link

sajoupa commented Mar 12, 2024

Bug Description

Configuring cos-alerter to use a squid proxy to reach the internet (and pagerduty), yields an invalid request in Squid:
1710247929.228 0 <IP adress> NONE/400 3824 NONE error:invalid-request - HIER_NONE/- text/html
And then cos-alerter logs an error:
Mar 12 10:31:19 prod-is-cos-alerter-1 docker[3288655]: 2024-03-12T10:31:19.847Z [cos-alerter] WARNING:apprise:A Connection error occurred sending Pager Duty notification to events.pagerduty.com.

Whereas, when using the apprise application from the same machine, through the same proxy, the alerts are successfully sent.
(Yielding 1710257497.415 783 <IP address> TCP_TUNNEL/200 4124 CONNECT events.pagerduty.com:443 - HIER_DIRECT/44.233.86.211 -)

$ https_proxy="http://<proxy adress>:3128" apprise -vvvv -t "Test Alert, please ignore" -b "Test Message Body" "pagerduty://<routing key>@events.pagerduty.com/"
[...]
2024-03-12 15:31:36,624 - DEBUG - Loaded Pager Duty URL: pagerduty://****@****/A...e/N...n?region=us&image=yes&format=text&overflow=upstream&rto=4.0&cto=4.0&verify=yes
2024-03-12 15:31:36,625 - DEBUG - Pager Duty POST URL: https://events.pagerduty.com/v2/enqueue (cert_verify=True)
2024-03-12 15:31:36,625 - DEBUG - Pager Duty Payload: {'routing_key': '<REDACTED>', 'payload': {'summary': 'Test Alert, please ignore\r\nTest Message Body', 'severity': 'info', 'source': 'Apprise', 'component': 'Notification'}, 'client': 'Apprise', 'event_action': 'trigger', 'images': [{'src': 'https://github.com/caronc/apprise/raw/master/apprise/assets/themes/default/apprise-info-128x128.png', 'alt': 'info'}]}
2024-03-12 15:31:37,410 - INFO - Sent Pager Duty notification.

To Reproduce

(see above)

Environment

cos-alerter running in a docker container:

$ systemctl cat docker.cos-alerter.service 
# /etc/systemd/system/docker.cos-alerter.service
[Unit]
Description=cos-alerter service
After=docker.service
Requires=docker.service

[Service]
TimeoutStartSec=0
Restart=always
ExecStartPre=-/usr/bin/docker exec %n stop
ExecStartPre=-/usr/bin/docker rm %n
ExecStartPre=/usr/bin/docker pull ghcr.io/canonical/cos-alerter:latest
ExecStart=/usr/bin/docker run --env HTTP_PROXY="http://<proxy address>:3128" --env HTTPS_PROXY="https://<proxy address>:3128" --rm --name %n \
    -p 8080:8080 \
    --mount type=bind,source=/home/ubuntu/cos-alerter-config.yaml,target=/etc/cos-alerter.yaml,readonly \
    ghcr.io/canonical/cos-alerter:latest

[Install]
WantedBy=default.target

Relevant log output

(see above)

Additional context

No response

@lucabello
Copy link
Contributor

We should make sure we correctly pass the proxy variables to whatever is doing the request.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants