Пример #1
0
            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))


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())))
                        '%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)']))


if __name__ == '__main__':
    naparser.add_argument('-cl', '--cluster', help='the cluster to check')
    naparser.add_argument('-d',
                          '--datadir',
                          default='data',
                          help='the data directory to keep the stats')

    outfile = open("slrestrictions.csv", "w")

    vollimitsGB = {
        20: 622484,
        40: 1245084,
        80: 2490263,
        100: 3112863,
        250: 7782300,
        500: 15564695,
        1000: 31876593,
Пример #3
0
            line = line.strip()
            if not line or line[0] == '#':
                continue
            cls, vol = line.split(':')
            vols.append({'cluster': cls, 'vol': vol})

        return vols

    else:
        print('input file %s does not exist' % volfile)
        sys.exit(1)


if __name__ == '__main__':
    naparser.add_argument('-ch',
                          '--check',
                          action='store_true',
                          help='check input file for nonexistent volumes')
    naparser.add_argument('-n',
                          '--name',
                          help='the name to append to the clone')
    naparser.add_argument('-s', '--snapshot', help='the snapshot to use')
    naparser.add_argument('-i',
                          '--input',
                          help='the input file of volumes',
                          default='volumes.txt')
    naparser.add_argument('-m', '--mount', help='mount the volume')
    naparser.add_argument('-so',
                          '--showonly',
                          action='store_true',
                          help='only show the commands')
Пример #4
0
    body = body + \
  """
Cluster: %s
Node: %s
Virtual Size: %s
Max Virtual Size: %s
Percentage: %s
""" % (cluster.name, cluster.name + '-02', vsize, maxvsize, percentage)

    return body


if __name__ == '__main__':

    naparser.add_argument('-e',
                          '--environment',
                          help='The environment this script is checking')

    args = naparser.parse_args()

    CLMan = ClusterManager(args)

    nowtime = datetime.now(timezone(timezoneoutput))
    date_t = nowtime.strftime('%m/%d/%Y %H:%M') + ' ' + timezoneoutput

    msgtext = """
SECD Virtual Memory Update: %s

  """ % date_t

    for cluster in CLMan.clusters.values():
Пример #5
0
                                                    False),
                                   time.strftime("%m/%d/%Y %H:%M:%S",
                                                 snap['Creation Time']),
                                   time.strftime("%m/%d/%Y %H:%M:%S",
                                                 time.localtime(ndate))))


def checkcluster(cluster, ndate):
    totalsize = 0
    for svmname in sorted(cluster.svms.keys()):
        svm = cluster.svms[svmname]
        checksvm(svm, ndate)


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")
Пример #6
0
def checkcluster(cluster):
    """
  get information for a specific cluster
  """
    for svm in cluster.svms.values():
        svm.fetchvolumes()
        for nvol in svm.volumes.values():
            print('%s,%s,%s,%s,%s,%s,%s' %
                  (nvol.svm.cluster.name, nvol.svm.cluster.cname,
                   nvol.svm.name, nvol.attr['Aggregate Name'], nvol.name,
                   nvol.attr['Used Size'],
                   nvol.attr['Total Physical Used Size']))


if __name__ == '__main__':
    naparser.add_argument('-cl', '--cluster', help='the cluster to check')

    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:
Пример #7
0
    node2vsize, node2maxvsize, node2percentage = getheapstats(
        cluster, cmdnode2)

    node1data = "%s,%s,%s,%s,%s,%s\n" % (date_t, cluster.name,
                                         cluster.name + '-01', node1vsize,
                                         node1maxvsize, node1percentage)
    node2data = "%s,%s,%s,%s,%s,%s\n" % (date_t, cluster.name,
                                         cluster.name + '-02', node2vsize,
                                         node2maxvsize, node2percentage)

    CSVFILE_FO.write(node1data)
    CSVFILE_FO.write(node2data)


if __name__ == '__main__':

    naparser.add_argument('-csv', '--csvfile', help='The csv file to write to')
    args = naparser.parse_args()

    CLMan = ClusterManager(args)

    now = datetime.now()
    date_t = now.strftime('%m/%d/%Y %H:%M:%S')

    CSVFILE_FO = open(args.csvfile, "a")

    for cluster in CLMan.clusters.values():
        getdestination(cluster, date_t)

    CSVFILE_FO.close()
Пример #8
0
                fullpath = "\\\\" + "\\".join([server, sharename])
                if type(share.attr['Share ACL']) == type([]):
                    permission = ';'.join(share.attr['Share ACL'])
                else:
                    permission = share.attr['Share ACL']
                comment = share.attr['Share Comment']
                outfile.write(','.join([
                    svmname, "\\\\" +
                    server, sharename, fullpath, path, comment, permission
                ]) + '\n')

            outfile.close()


if __name__ == '__main__':

    naparser.add_argument(
        '-cl',
        '--cluster',
        help='the cluster of the svm, must be in the config (optional)')

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

    if args.cluster:
        if args.cluster in CLMan.clusters:
            checkcluster(CLMan.clusters[args.cluster])
    else:
        for cluster in CLMan.clusters.values():
            checkcluster(cluster)
Пример #9
0
            node2stress)
        print('stats after runnning for node: %s' % othernode)
        print('\n'.join(output4))

        output5 = cluster.runcmd(
            "set d;diag secd echo -echo-text showLimits -node %s" % othernode)
        print('stats after runnning for node: %s' % othernode)
        print('\n'.join(output5))

        time.sleep(interval)


if __name__ == '__main__':
    naparser.add_argument('-i',
                          '--interval',
                          type=int,
                          default=5,
                          help='The interval (in seconds) to stress secd')
    args = naparser.parse_args()

    CLMan = ClusterManager(args)

    now = datetime.now()
    date_t = now.strftime('%m/%d/%Y %H:%M:%S')

    node2stress = 'ZUSNCLTELFST010-01'
    othernode = 'ZUSNCLTELFST010-02'

    for cluster in CLMan.clusters.values():
        if node2stress in cluster.nodes:
            stressnode(cluster, node2stress, args.interval, othernode)
Пример #10
0
def findvolume(volname, cluster=None, svm=None, exact=False):

    nvol = CLMan.findvolume(volname, cluster=cluster, svm=svm, exact=exact)

    if nvol:
        for volume in nvol:
            print('%-10s (%s) - %-20s - %s' %
                  (volume.svm.cluster.name, volume.svm.cluster.cname,
                   volume.svm.name, volume.name))
    else:
        print('could not find volume %s' % volname)


if __name__ == '__main__':
    naparser.add_argument('-v', '--volume', help='the volume to find, a regex')
    naparser.add_argument(
        '-cl',
        '--cluster',
        help='the cluster of the svm, must be in the config (optional)')
    naparser.add_argument('-s',
                          '--svm',
                          help='the svm the volume is located (optional)')
    naparser.add_argument('-i',
                          '--input',
                          help='the input file of volumes',
                          default=None)
    naparser.add_argument('-e',
                          '--exact',
                          action='store_true',
                          help='show only exact names',
Пример #11
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)))


if __name__ == '__main__':
    naparser.add_argument('-s', '--svm', help='the svm to total')
    naparser.add_argument('-cl',
                          '--cluster',
                          help='the cluster of the svm, must be in the config')

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

    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])
            else:
                print('%s is not a valid svm' % args.svm)
Пример #12
0
  for node in cluster.nodes.values():
    if checknodeneedsrestart(node, threshhold) or force:
      output.append('--------------------------------------------------')
      if force:
        output.append('Node %s secd was forced restarted' % node['Node'])
      else:
        output.append('Node %s secd was over the threshhold %s and was restarted' % (node['Node'], threshhold))
      restartnodecmd = 'set d -c off;diag secd restart -node %s' % node['Node']
      output.extend(cluster.runinteractivecmd(restartnodecmd, respondto='This command can take up to 2 minutes to complete.'))

  return output

if __name__ == '__main__':

  naparser.add_argument('-e', '--environment', required=True,
                  help='The environment this script is checking')
  naparser.add_argument('-t', '--threshhold', type=int, default=65,
                  help='The threshhold to restart secd if above')
  naparser.add_argument('-f', '--force', action='store_true',
                  help='Force restart secd with no checking')
  naparser.add_argument('-ar', '--autorestarttime', action="append",
                  help='the time to do an autorestart, in military time. Example: 16:00, can pass multiple times')
  
  args = naparser.parse_args()

  print args.autorestarttime

  nowtime = datetime.now(timezone(timezoneoutput))
  date_t = nowtime.strftime('%m/%d/%Y %H:%M') + ' ' + timezoneoutput
  time = nowtime.strftime('%H:%M')
Пример #13
0
    else:
        print('input file %s does not exist' % volfile)
        sys.exit(1)


def listsnapmirror(vol):
    vol.getsnapmirrordest()
    if vol.snapdests:
        print('%s has the following destinations' % nvol.name)
        for i in vol.snapdests.values():
            print('   Dest: %s' % i['Destination Path'])


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')
    naparser.add_argument(
        '-v',
        '--volume',
        help='act on a specific volume of the form CTL:Volume')
    naparser.add_argument('-m',
                          '--mount',
                          action='store_true',
                          help='action: mount the volumes')
    naparser.add_argument('-u',
                          '--unmount',
                          action='store_true',
                          help='action: unmount the volumes')
    naparser.add_argument('-off',
Пример #14
0
            line = line.strip()
            if not line or line[0] == '#':
                continue
            cls, vol = line.split(':')
            vols.append({'cluster': cls, 'vol': vol})

        return vols

    else:
        print('input file %s does not exist' % volfile)
        sys.exit(1)


if __name__ == '__main__':
    naparser.add_argument('-cr',
                          '--create',
                          action='store_true',
                          help='create the snapshot')
    naparser.add_argument('-de',
                          '--delete',
                          action='store_true',
                          help='delete the snapshot')
    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')
    naparser.add_argument('-n', '--name', help='the name of the snapshot')
    naparser.add_argument('-so',