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

alertad.conf settings not taken into account (same settings working if put inside the alerta.conf file) #1537

Closed
AndreaLVR opened this issue May 27, 2021 · 9 comments · Fixed by #1639
Labels
bug Something isn't working priority: medium A problem affecting a core component for which there is a workaround

Comments

@AndreaLVR
Copy link

AndreaLVR commented May 27, 2021

Hi,
I am facing a problem with some settings in the alertad.conf file. I state that I'm using Alerta inside a docker container, but I doubt that is the source of the problem.
What I am trying to do is simply preventing Alerta from automatically deleting the alerts after a certain period of time.
Below are the relevant environment variables and the contents of /app/alertad.conf, /app/alerta.conf and /web/config.json.

  • environment variables:

ALERTA_SVR_CONF_FILE=/app/alertad.conf
ALERTA_CONF_FILE=/app/alerta.conf

  • /app/alertad.conf:

DEFAULT_EXPIRED_DELETE_HRS = 0
DEFAULT_INFO_DELETE_HRS = 0

  • /app/alerta.conf:

[DEFAULT]
endpoint = http://localhost:8080/api

  • /web/config.json:

{"endpoint": "http://localhost:8080/api"}

Despite the settings in the /app/alertad.conf file, the alerts are cleared shortly after their insertion, but the interesting thing is that if I copy the exact content of /app/alertad.conf into /app/alerta.conf then everything works as expected and the alerts are no longer deleted.

Is there something that I am wrong or that I misunderstood? Thank you in advance.

@satterly
Copy link
Member

You don't say what version you are running.

@satterly
Copy link
Member

This issue is blocked waiting on more information. The description or subsequent comments do not provide enough information to triage, investigate or resolve the issue. Please review the description against the issue template and ensure all relevant information is included. If you do not know what is expected you can ask on Slack.

@satterly satterly added the blocked This issue can't be resolved unless something else is done label Jun 10, 2021
@CWollinger
Copy link

Hi,

I have the same problem. I don't want to delete closed alarms.
For this I set DEFAULT_EXPIRED_DELETE_HRS = 0 in the alertad.conf - with no effect.

I can only find closed alarms not older than 2 hours.
Using alerta 8.5.0.

Regards
CWollinger

@CWollinger
Copy link

Found a old issue #1493

Will try the parameter DELETE_EXPIRED_AFTER = 0 and come back with a comment.

@AndreaLVR
Copy link
Author

Sorry, I am using this version:

image

@CWollinger
Copy link

The parameter DELETE_EXPIRED_AFTER = 0 or DELETE_EXPIRED_AFTER = 240 dosn't work, too

@CWollinger
Copy link

I found the solution in the docker-alerta repo/commit: alerta/docker-alerta@9aa906c

Supervisord for the housekeeping is running in the docker container. The housekeeping reference the var HK_EXPIRED_DELETE_HRS & HK_INFO_DELETE_HRS which is set to 2 and 12 hours in the Dockerfile.

To change this you have to set/override the var in your docker environment e.g. docker-compose file.

The other variables in alertad.conf are not suitable/used for docker.
Maybe a lack of documentation here.

@AndreaLVR hope this will help you

@AndreaLVR
Copy link
Author

Thank you so much, @CWollinger.

@hugoShaka
Copy link
Contributor

Hello @satterly

I believe this is a regression introduced by #1508.

Passing DEFAULT_EXPIRED_DELETE_HRS and DEFAULT_INFO_DELETE_HRS in alertad.conf is ignored since 8.6.0. I was running with 1 week of retention and upgrading from 8.4.1 to 8.6.0 triggered an aggressive housekeeping flushing almost all of the alerts.

In the following piece of code the backward compatibility is kept only for environment variables. get_config() is never called on DEFAULT_EXPIRED_DELETE_HRS, thus alertad.conf is ignored for those two parameters.

delete_expired_hrs = (
os.environ.get('DEFAULT_EXPIRED_DELETE_HRS', None)
or os.environ.get('HK_EXPIRED_DELETE_HRS', None)
)
delete_expired = delete_expired_hrs * 60 * 60 if delete_expired_hrs else None
config['DELETE_EXPIRED_AFTER'] = get_config('DELETE_EXPIRED_AFTER', default=delete_expired, type=int, config=config)

@3IMOH 3IMOH added bug Something isn't working priority: medium A problem affecting a core component for which there is a workaround and removed blocked This issue can't be resolved unless something else is done labels Oct 6, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working priority: medium A problem affecting a core component for which there is a workaround
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

5 participants