#5908 Monitoring for bastion* mail queue
Closed: Fixed by kevin. Opened by puiterwijk.

We should check whether the bastion* mail queue is at least "progressing", at least to @redhat.com.
Right now, all emails to @redhat.com have been non-working for 15 hours.


I'm not sure how we can check this easily. I suppose we could ask for some @redhat.com alias that would just send back to nagios-redhat-check@fedoraproject.org and the nagios plugin could confirm it got one every hour or something?

We cant really monitor the queue size. It goes up and down all the time with various providers throttling us or the like.

Metadata Update from @kevin:
- Issue priority set to: Waiting on Asignee

Metadata Update from @mizdebsk:
- Issue tagged with: monitoring

We discussed this a while back:

Nov 09 10:28:39 <nirik> so, this was filed by puiterwijk a while back... 
Nov 09 10:28:50 <nirik> but I am not sure how we can best implement this. 
Nov 09 10:28:55 <nirik> open to ideas
Nov 09 10:29:41 <smooge>        I am not sure how to implement this either.. the redhat.com queue is very complicated
Nov 09 10:29:42 <puiterwijk>    nirik: maybe a queue check for just @redhat.com?
Nov 09 10:29:53 <puiterwijk>    That queue should not get too huge at any point in time
Nov 09 10:30:02 <nirik> well, if we send them a bunch of things they may throttle. 
Nov 09 10:30:34 <nirik> if we could get them to make us an alias that sends back to us we could do a 'ping' email loop back and forth. 
Nov 09 10:30:46 <nirik> but that seems pretty heavy and not sure they would want to do it
Nov 09 10:30:58 <puiterwijk>    I think we've been set on the "no-throttle" list
Nov 09 10:31:04 <puiterwijk>    Sure.
Nov 09 10:32:33 <smooge>        I don't have any good/better ideas at the moment.
Nov 09 10:32:36 <nirik> ok, if so we could try and look at queue for that domain and check it. 
Nov 09 10:32:58 <smooge>        phone call brb
Nov 09 10:33:13 <nirik> I don't know if any of the existing nagios plugins would do this or need a custom one
Nov 09 10:35:06 <nirik> might be a nice project for an apprentice I suppose... a bit on the complicated side tho
Nov 09 10:35:51 <smooge>        we would need a custom one.
Nov 09 10:36:14 <smooge>        sounds like an not-so-easy-fix

So, what I think we want here is a custom plugin thats just a simple script. It runs postqueue -p on bastion01/02 and if there's more than say 10 redhat.com deliveries waiting, alert.

is this still valid? if it is and nobody is working on it I would like to take it!

It is still valid! Feel free to work on it... ask questions here or in #fedora-admin. ;)

Metadata Update from @cverna:
- Issue assigned to lrossett

Metadata Update from @cverna:
- Assignee reset

I'll gladly take a shot at this, if it still required, and no one is already working on it.
I should have a script proposal very soon.

I worked on something but I was unable to test it due to lack of time.. let me try to find what I did and attach it in the issue (I am not working on it anymore).

Ok, I found the script I created. I did some testing in a docker comtainer but nothing beyond it.

I hope it can be of any help :-)
check_mailqueue.py

Since you showed me yours, I'll show mine :)
check_postqueue.py
I'm still in observation phase on bastion01, and queue to redhat.com seems to go past 10 on a regular basis. 20 seems like a good first threshold.

mailman0 (and a bunch of others apparently) already use a similar script (check_postfix_queue) to monitor the entire postfix queue length. Can we merge those two scripts into one ?
mailman will use something like check_postfix_queue.py all (for all queues)
and bastion will use check_postfix_queue.py redhat.com (for queues processing redhat.com emails)
Related script : check_postfix_queue.py

What do you think @kevin ?

We could sure, but not sure it's worth the trouble. :)

Your script appears to work fine in my limited testing. Would you be willing to make a PR against https://pagure.io/fedora-infra/ansible to enable it and add it to our ansible repo?

Happy to help with pointers to do that...

Thanks for the PR. It seems to be working just grand. :)

Well done.

Metadata Update from @kevin:
- Issue close_status updated to: Fixed
- Issue status updated to: Closed (was: Open)

Metadata