def main():
    """
    Fetches the following information from a BigBlueButton server:
    - Number of meetings
    - Number of users connected (in all meetings)
    - Number of users with video (in all meetings)
    - Number of users with audio (in all meetings)
    Returns the codes:
    0: all ok
    1: entered the WARNING status
    2: entered the CRITICAL status
    1: couldn't get an anwser from BBB, is at the UNKNOWN status
    """

    # args
    args = parse_args()

    # get the data from BBB
    try:
        url = urlparse(args.host)
        results = bigbluebutton_info.fetch(url.hostname, url.port, args.salt)
    except Exception as e:
        sys.stdout.write(str(e))
        sys.exit((UNKNOWN))

    # output
    sys.stdout.write(get_output_message(results, args.limits))
    sys.exit((get_status(results.limits(), args.limits)))
def main():
    """
    Fetches the following information from a BigBlueButton server:
    - Number of meetings
    - Number of users connected (in all meetings)
    - Number of users with video (in all meetings)
    - Number of users with audio (in all meetings)
    Returns the codes:
    0: all ok
    1: entered the WARNING status
    2: entered the CRITICAL status
    1: couldn't get an anwser from BBB, is at the UNKNOWN status
    """

    # args
    args = parse_args()

    # get the data from BBB
    try:
        url = urlparse(args.host)
        results = bigbluebutton_info.fetch(url.hostname, url.port, args.salt)
    except Exception as e:
        sys.stdout.write(str(e))
        sys.exit((UNKNOWN))

    # output
    sys.stdout.write(get_output_message(results, args.limits))
    sys.exit((get_status(results.limits(), args.limits)))
Exemplo n.º 3
0
def main():
    """
    Fetches the following information from a BigBlueButton server:
    - Number of meetings
    - Number of users connected (in all meetings)
    - Number of users with video (in all meetings)
    - Number of users with audio (in all meetings)
    Returns the codes:
    0: all ok
    1: entered the WARNING status
    2: entered the CRITICAL status
    3: couldn't get an anwser from BBB, is at the UNKNOWN status
    """

    # args
    args = parse_args()

    # get the data from BBB
    try:
        # args from configfile
        try:
            config = SafeConfigParser()
            config.read(args.config)
#            import pdb; pdb.set_trace()
        except SafeConfigParser.ParsingError, err:
            print 'Could not parse config:', err


        if config.has_option('connection', 'host'):
            url = urlparse(config.get('connection', 'host'))
        else:
            url = urlparse(args.host)

        if config.has_option('connection', 'salt'):
            salt = config.get('connection', 'salt')
        else:
            salt = args.salt

        if config.has_option('connection', 'limits'):
            limits = info_limits(config.get('connection', 'limits'))
        else:
            limits = args.limits

        results = bigbluebutton_info.fetch(url.hostname, url.port, salt)