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

Error while running action plugin 'alerta_prometheus': name 'USE_AM_EXTERNALURL_FOR_SILENCES' is not defined (500) #379

Open
richardsavage opened this issue Dec 20, 2021 · 1 comment

Comments

@richardsavage
Copy link

Issue Summary
When using the prometheus plugin, I get an error, as mentionned in the title:
Error while running action plugin 'alerta_prometheus': name 'USE_AM_EXTERNALURL_FOR_SILENCES' is not defined (500)

The problem seem to be this:

the variable set is:
ALERTMANAGER_USE_EXTERNALURL_FOR_SILENCES = os.environ.get('ALERTMANAGER_USE_EXTERNALURL_FOR_SILENCES') or app.config.get('ALERTMANAGER_USE_EXTERNALURL_FOR_SILENCES',False)

but the plugin is looking for this:

        # if alertmanager is clustered behind a load balancer that mirrors requests we should prefer to create one silence
        # rather than many
        if USE_AM_EXTERNALURL_FOR_SILENCES:

I tried to change the condition to ALERTMANAGER_USE_EXTERNALURL_FOR_SILENCES and it seem to work fine so far

Environment

  • OS: LLinux

  • API version: 8.6.5

  • Deployment: self-hosted

  • For self-hosted, WSGI environment: nginx/uwsgi

  • Database: MongoDB

  • Server config:
    Auth enabled? Yes
    Auth provider? Basic
    Customer views? No
    (or provide the /config endpoint output)

  • web UI version: 6.7.0

  • CLI version: na

To Reproduce
Steps to reproduce the behavior:

  1. Go to the web ui
  2. Try to ackonowledge an Alertmanager alert.
    '
  3. See error (include command output)

Traceback (most recent call last):
File "/opt/alerta/lib64/python3.6/site-packages/flask/app.py", line 1516, in full_dispatch_request
rv = self.dispatch_request()
File "/opt/alerta/lib64/python3.6/site-packages/flask/app.py", line 1502, in dispatch_request
return self.ensure_sync(self.view_functions[rule.endpoint])(**req.view_args)
File "/opt/alerta/lib64/python3.6/site-packages/flask_cors/decorator.py", line 128, in wrapped_function
resp = make_response(f(*args, **kwargs))
File "/opt/alerta/lib64/python3.6/site-packages/alerta/auth/decorators.py", line 90, in wrapped
return f(*args, **kwargs)
File "/opt/alerta/lib64/python3.6/site-packages/alerta/models/metrics.py", line 258, in wrapped
response = f(*args, **kwargs)
File "/opt/alerta/lib64/python3.6/site-packages/alerta/utils/response.py", line 18, in decorated
return func(*args, **kwargs)
File "/opt/alerta/lib64/python3.6/site-packages/alerta/views/alerts.py", line 173, in action_alert
raise ApiError(str(e), 500)

Traceback (most recent call last):
File "/opt/alerta/lib64/python3.6/site-packages/flask/app.py", line 1516, in full_dispatch_request
rv = self.dispatch_request()
File "/opt/alerta/lib64/python3.6/site-packages/flask/app.py", line 1502, in dispatch_request
return self.ensure_sync(self.view_functions[rule.endpoint])(**req.view_args)
File "/opt/alerta/lib64/python3.6/site-packages/flask_cors/decorator.py", line 128, in wrapped_function
resp = make_response(f(*args, **kwargs))
File "/opt/alerta/lib64/python3.6/site-packages/alerta/auth/decorators.py", line 90, in wrapped
return f(*args, **kwargs)
File "/opt/alerta/lib64/python3.6/site-packages/alerta/models/metrics.py", line 258, in wrapped
response = f(*args, **kwargs)
File "/opt/alerta/lib64/python3.6/site-packages/alerta/utils/response.py", line 18, in decorated
return func(*args, **kwargs)
File "/opt/alerta/lib64/python3.6/site-packages/alerta/views/alerts.py", line 173, in action_alert
raise ApiError(str(e), 500)

For web app issues, include any web browser JavaScript console errors.

Expected behavior
A clear and concise description of what you expected to happen.

Screenshots
If applicable, add screenshots to help explain your problem.

Additional context
Add any other context about the problem here.

NOTE: Please provide as much information about your issue as possible.
Failure to provide basic details about your specific environment make
it impossible to know if an issue has already been fixed, can delay a
response and may result in your issue being closed without a resolution.

NeilOrley added a commit to NeilOrley/alerta-contrib that referenced this issue Jan 26, 2022
Resolves issue 'USE_AM_EXTERNALURL_FOR_SILENCES' is not defined : alerta#379
satterly pushed a commit that referenced this issue Jun 22, 2022
Resolves issue 'USE_AM_EXTERNALURL_FOR_SILENCES' is not defined : #379
@micwiel
Copy link

micwiel commented Jul 28, 2022

Bug seems to be fixed in #380 but the fix is still unavailable in alerta docker image (currently latest=8.7.0) https://github.com/alerta/docker-alerta/releases. Please release new image version.

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

No branches or pull requests

2 participants