def main(argv):
    str_status = ''
    str_uuid = ''
    str_primary = ''
    str_members = ''
    str_index = ''
    message = ''

    usage = "Usage: " + os.path.basename(sys.argv[0]) + " --status <status str>"
    usage += " --uuid <state UUID> --primary <yes/no> --members <comma-seperated"
    usage += " list of the component member UUIDs> --index <n>"

    try:
        opts, args = getopt.getopt(argv, "h", ["status=","uuid=",'primary=','members=','index='])
    except getopt.GetoptError:
        print usage
        sys.exit(2)

    if(len(opts) > 0):
        message_obj = GaleraStatus(THIS_SERVER)

        for opt, arg in opts:
            if opt == '-h':
                print usage
                sys.exit()
            elif opt in ("--status"):
                message_obj.set_status(arg)
            elif opt in ("--uuid"):
                message_obj.set_uuid(arg)
            elif opt in ("--primary"):
                message_obj.set_primary(arg)
            elif opt in ("--members"):
                message_obj.set_members(arg)
            elif opt in ("--index"):
                message_obj.set_index(arg)
        try:
            send_notification(MAIL_FROM, MAIL_TO, 'Galera Notification: ' + THIS_SERVER, DATE,
                              str(message_obj), SMTP_SERVER, SMTP_PORT, SMTP_SSL, SMTP_AUTH,
                              SMTP_USERNAME, SMTP_PASSWORD)
        except Exception, e:
            print "Unable to send notification: %s" % e
            sys.exit(1)
    else:
        print usage
        sys.exit(2)

    sys.exit(0)