Exemplo n.º 1
0
def checkcluster(cluster):
    # Get cluster stats
    cpu, ops, bps, latency = cluster.fetchclusterstats()
    bps = int(bps)
    latency = int(latency)
    print('NETAPP|DAL09|Cluster,CPU %%=%s' % cpu)
    print('NETAPP|DAL09|Cluster,Total IOPs=%s' % ops)
    print('NETAPP|DAL09|Cluster,MBPS=%.2f' % (bps / 1024 / 1024))
    print('NETAPP|DAL09|Cluster,Latency(ms)=%s' % (latency / 1000))

    # Get aggregate stats
    cluster.fetchaggrs()

    tkeys = cluster.aggregates.keys()
    skeys = sorted(tkeys)

    for taggr in skeys:
        aggr = cluster.aggregates[taggr]
        if not ('root' in aggr.name):
            print('NETAPP|DAL09|Aggregates|%s,Total Space (GB)=%.2f' %
                  (aggr.name,
                   approximate_size(
                       aggr.attr['Size'], newsuffix='GB', withsuffix=False)))
            print('NETAPP|DAL09|Aggregates|%s,Used Space (GB)=%.2f' %
                  (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))
Exemplo n.º 2
0
def checkcluster(cluster):
    cluster.fetchpeers()
    cluster.fetchsnapmirrors()

    for mirror in cluster.snapmirrors:
        srcsvm = mirror['Source Path']['svm']
        srcvol = mirror['Source Path']['vol']
        svol = CLMan.findvolume(srcvol, svm=srcsvm)

        destsvm = mirror['Destination Path']['svm']
        destvol = mirror['Destination Path']['vol']
        dvol = CLMan.findvolume(destvol, svm=destsvm)

        if not svol:
            print('Could not find source volume - %s:%s' % (srcsvm, srcvol))

        if not dvol:
            print('Could not find destination volume - %s:%s' %
                  (destsvm, destvol))

        if not dvol or not svol:
            continue

        svol = svol[0]
        dvol = dvol[0]

        if svol.attr['Volume Size'] != dvol.attr['Volume Size']:
            print('%s:%s:%s not equal to %s:%s:%s' %
                  (srcsvm, srcvol,
                   approximate_size(svol.attr['Volume Size'], False), destsvm,
                   destvol, approximate_size(dvol.attr['Volume Size'], False)))
Exemplo n.º 3
0
def checkcluster(cluster):
    totalsize = 0
    aggrs = {}
    for svmname in sorted(cluster.svms.keys()):
        svm = cluster.svms[svmname]
        svm.fetchvolumes()
        svm.fetchluns()

        for volume in svm.volumes.values():
            if not ('_root' in volume.name) and volume.name != 'vol0':
                if volume.attr['Space Guarantee Style'] != 'none':
                    if len(volume.luns) > 0:
                        continue
                    if volume.attr['Volume State'] != 'offline':
                        try:
                            totalsize = totalsize + volume.attr[
                                'Available Size']
                            aggr = volume.attr["Aggregate Name"]
                            if not (aggr in aggrs):
                                aggrs[aggr] = 0
                            aggrs[aggr] = aggrs[aggr] + volume.attr[
                                'Available Size']

                        except TypeError:
                            print(volume.name, volume.attr['Available Size'])
                        if args.csv:
                            print('%s (%s),%s,%s,%s,%d' %
                                  (cluster.name, cluster.cname, svm.name,
                                   volume.name, volume.attr['Aggregate Name'],
                                   volume.attr['Available Size']))
                        else:
                            print('%s (%s) - Not thin - %-20s : %-12s : %s' %
                                  (cluster.name, cluster.cname, svm.name,
                                   approximate_size(
                                       volume.attr['Available Size'],
                                       False), volume.name))

    for aggr in sorted(aggrs.keys()):
        if args.csv:
            print('%s,%d' % (aggr, aggrs[aggr]))
        else:
            print('aggr %s would gain %s' %
                  (aggr, approximate_size(aggrs[aggr], False)))

    if args.csv:
        print('%s (%s),%d' % (cluster.name, cluster.cname, totalsize))
    else:
        print(
            '%s (%s) - %s more space if the above volumes were thin provisioned'
            %
            (cluster.name, cluster.cname, approximate_size(totalsize, False)))
Exemplo n.º 4
0
def checksvm(svm, ndate):
    svm.fetchvolumes()
    cluster = svm.cluster
    for volume in svm.volumes.values():
        if not ('_root' in volume.name):
            if volume.attr['Volume State'] != 'offline':
                volume.fetchsnapshots()
                for snap in volume.snaps.values():
                    stime = time.mktime(snap['Creation Time'])
                    if ndate > stime:
                        if args.csv:
                            print("%s (%s),%s,%s,%s,%s,%s" %
                                  (cluster.name, cluster.cname, svm.name,
                                   volume.name, snap['Snapshot'],
                                   snap['Snapshot Size'],
                                   time.strftime("%m/%d/%Y %H:%M:%S",
                                                 snap['Creation Time'])))
                        else:
                            print(
                                'Volume: %s - Snap: %s (%s) with time %s is before %s'
                                % (volume.name, snap['Snapshot'],
                                   approximate_size(snap['Snapshot Size'],
                                                    False),
                                   time.strftime("%m/%d/%Y %H:%M:%S",
                                                 snap['Creation Time']),
                                   time.strftime("%m/%d/%Y %H:%M:%S",
                                                 time.localtime(ndate))))
Exemplo n.º 5
0
def checkcluster(cluster):
    totalsize = 0
    for svmname in sorted(cluster.svms.keys()):
        svm = cluster.svms[svmname]
        size = checksvm(svm)

        totalsize = totalsize + size

    print('%s (%s) - Total size of used data: %s' %
          (cluster.name, cluster.cname, approximate_size(totalsize, False)))
def checkcluster(cluster):
    for svm in cluster.svms.values():
        svm.fetchvolumes()

        for volume in svm.volumes.values():
            if not ('_root'
                    in volume.name) and volume.name != 'vol0' and volume.attr[
                        'Volume State'] != 'offline':
                size = approximate_size(volume.attr['Volume Size'], False,
                                        "GB", False)
                usedsize = approximate_size(volume.attr['Used Size'], False,
                                            "GB", False)
                for limit in nkeys:
                    if size >= limit:
                        if int(volume.
                               attr['Files Used (for user-visible data)']
                               ) > vollimitsGB[limit]:
                            outfile.write(
                                '%s (%s),Increase Size for inodes,%-20s,%-40s,%s,%s\n'
                                % (cluster.name, cluster.cname, svm.name,
                                   volume.name,
                                   approximate_size(volume.attr['Volume Size'],
                                                    False, "GB"), volume.
                                   attr['Files Used (for user-visible data)']))
                        break

                if usedsize > 12000:
                    outfile.write(
                        '%s (%s),Volume Used Size,%-20s,%-40s,%s,%s\n' %
                        (cluster.name, cluster.cname, svm.name, volume.name,
                         approximate_size(volume.attr['Used Size'], False,
                                          "GB"),
                         volume.attr['Files Used (for user-visible data)']))
                if size > 12000:
                    outfile.write(
                        '%s (%s),Volume Overall Size,%-20s,%-40s,%s,%s\n' %
                        (cluster.name, cluster.cname, svm.name, volume.name,
                         approximate_size(volume.attr['Volume Size'], False,
                                          "GB"),
                         volume.attr['Files Used (for user-visible data)']))
Exemplo n.º 7
0
def checksvm(svm):
    svm.fetchvolumes()
    size = 0
    for volume in svm.volumes.values():
        if not ('_root' in volume.name):
            if volume.attr['Volume State'] != 'offline':
                try:
                    size = size + volume.attr['Used Size']
                except TypeError:
                    for i in volume.attr:
                        print(i, volume.attr[i])

    print('%s (%s) - Total size for volumes in %s: %s' %
          (svm.cluster.name, svm.cluster.cname, svm.name,
           approximate_size(size, False)))
    return size
Exemplo n.º 8
0
def checkcluster(cluster):
    for svm in cluster.svms.values():
        svm.fetchvolumes()

        for volume in svm.volumes.values():
            if not ('_root'
                    in volume.name) and volume.name != 'vol0' and volume.attr[
                        'Volume State'] != 'offline':
                if volume.attr['Space Guarantee Style'] != 'none':
                    if args.csv:
                        print('%s,%s,%s,%s,%s,%s' %
                              (cluster.name, svm.name,
                               volume.attr['Aggregate Name'], volume.name,
                               volume.attr['Available Size']))
                    else:
                        print('%s (%s) - Not thin - %-20s : %-40s : %s' %
                              (cluster.name, cluster.cname, svm.name,
                               volume.name,
                               approximate_size(volume.attr['Available Size'],
                                                False)))