nagios: fine tune mail queue check on bastion01
Signed-off-by: Francois Andrieu <darknao@fedoraproject.org>
This commit is contained in:
parent
d203048115
commit
655d167750
1 changed files with 23 additions and 21 deletions
|
@ -13,8 +13,10 @@ parser.add_argument('-c', '--critical', dest='critical', type=int, default=50,
|
|||
help="Critical threshold")
|
||||
parser.add_argument('-w', '--warning', dest='warning', type=int, default=20,
|
||||
help="Warning threshold")
|
||||
parser.add_argument('-i', '--ignore', dest='ignore', type=int, default=5,
|
||||
help="Ignore queues from the last X minutes (default: 5)")
|
||||
parser.add_argument('-L', '--lower', dest='lower', type=int, default=5,
|
||||
help="ignore queues ages lower than x minutes (default: 5)")
|
||||
parser.add_argument('-H', '--higher', dest='higher', type=int, default=1440,
|
||||
help="ignore queues ages higher than x minutes (default: 1440)")
|
||||
args = parser.parse_args()
|
||||
|
||||
|
||||
|
@ -30,7 +32,6 @@ mail_queue = 0
|
|||
if args.domain == 'all':
|
||||
mail_queue = len(output)
|
||||
else:
|
||||
|
||||
for line in output:
|
||||
j = json.loads(line)
|
||||
if j["queue_name"] == 'active':
|
||||
|
@ -38,7 +39,8 @@ else:
|
|||
continue
|
||||
|
||||
queue_old = now - datetime.fromtimestamp(j["arrival_time"])
|
||||
if queue_old.total_seconds() / 60 < args.ignore:
|
||||
if (queue_old.total_seconds() / 60 < args.lower
|
||||
or queue_old.total_seconds() / 60 > args.higher):
|
||||
# Not old enough
|
||||
continue
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue