Exemplo n.º 1
0
        sys.exit(1)


if __name__ == '__main__':
    naparser.add_argument('-ch',
                          '--check',
                          action='store_true',
                          help='check input file for nonexistent volumes')
    naparser.add_argument('-i',
                          '--input',
                          help='the input file of volumes',
                          default='volumes.txt')

    args = naparser.parse_args()

    CLMan = ClusterManager(args)

    volumes = read_file(args.input)

    for volume in volumes:
        vol = volume['vol']
        cluster = volume['cluster']
        nvol = CLMan.findvolume(vol, cluster=cluster)[0]
        if args.check:
            if not nvol:
                print('%s - %s not found' % (cluster, vol))
        else:
            if nvol:
                print('%s,%s,%s,%s,%s,%s' %
                      (nvol.svm.cluster.name, nvol.svm.cluster.cname,
                       nvol.svm.name, nvol.attr['Aggregate Name'], nvol.name,
Exemplo n.º 2
0

if __name__ == '__main__':
    naparser.add_argument('-s', '--svm', help='the svm to check')
    naparser.add_argument('-cl', '--cluster', help='the cluster to check')
    naparser.add_argument('-d',
                          '--date',
                          required=True,
                          help='the date in "01/01/2016 14:22:00" format')
    naparser.add_argument('-csv',
                          action='store_true',
                          help="output in comma delimited format")

    args = naparser.parse_args()

    CLMan = ClusterManager(args)

    tst = time.strptime(args.date, "%m/%d/%Y %H:%M:%S")

    ndate = time.mktime(tst)

    if args.svm and args.cluster:
        if args.cluster in CLMan.clusters:
            cluster = CLMan.clusters[args.cluster]

            if args.svm in cluster.svms:
                checksvm(cluster.svms[args.svm], ndate)
            else:
                print('%s is not a valid svm' % args.svm)
                print('valid svms for cluster %s:' % (args.cluster))
                print('%s' % ", ".join(cluster.svms.keys()))
Exemplo n.º 3
0
                  (aggr.name,
                   approximate_size(aggr.attr['Used Size'],
                                    newsuffix='GB',
                                    withsuffix=False)))
            print('NETAPP|DAL09|Aggregates|%s,Percent Used(GB)=%.2d' %
                  (aggr.name,
                   (aggr.attr['Used Size'] / aggr.attr['Size']) * 100))


if __name__ == '__main__':
    naparser.add_argument('-cl', '--cluster', help='the cluster to check')
    naparser.add_argument('-csv',
                          action='store_true',
                          help="output in comma delimited format")

    args = naparser.parse_args()
    CLMan = ClusterManager(args)

    if args.cluster:
        if args.cluster in CLMan.clusters:
            checkcluster(CLMan.clusters[args.cluster])

        else:
            print(
                '%s is not a valid Netapp cluster. Valid Netapp clusters in config are %s.'
                % (args.cluster, ", ".join(CLMan.clusters.keys())))

    else:
        for cluster in CLMan.clusters.values():
            checkcluster(cluster)
Exemplo n.º 4
0
    if not (args.unmount or args.mount or args.offline \
            or args.online or args.delete or args.details \
            or args.releasesnapmirror or args.listsnapmirror \
            or args.clones or args.check\
            or args.deleteallsnapshots):
        print('Please specify an action')
        sys.exit(1)

    if (not (args.volume or args.input)):
        print(
            'Please specify a volume, either through -i with an input file or specifically with -v'
        )
        sys.exit(1)

    CLMan = ClusterManager(args)

    if args.input:
        volumes = read_file(args.input)
    elif args.volume:
        volumes = []
        cls, vol = args.volume.split(':')
        volumes.append({'cluster': cls, 'vol': vol})

    if volumes:
        for volume in volumes:
            vol = volume['vol']
            cluster = volume['cluster']
            vols = CLMan.findvolume(vol, cluster=cluster)
            nvol = None
            if len(vols) > 1: