#!/usr/bin/python
from __future__ import print_function
from builtins import str
import sys

try:
    import retask.queue

    queue = retask.queue.Queue('fedora-packages')
    queue.connect()

    items = queue.length
    if items > 500:
        print("CRITICAL:  %i tasks in fcomm queue" % items)
        sys.exit(2)
    elif items > 250:
        print("WARNING:  %i tasks in fcomm queue" % items)
        sys.exit(1)
    else:
        print("OK:  %i tasks in fcomm queue" % items)
        sys.exit(0)

except Exception as e:
    print("UNKNOWN:", str(e))
    sys.exit(3)
