Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Drive Watch script 4.5 Win2000

Status
Not open for further replies.

JeppeOls

IS-IT--Management
Jun 27, 2002
24
0
0
SE
Hi!

I need to make our find a script that can take downed drives io up state. So anyone who got any good idees??

Thanks
 
Use the NetBackup provided command "vmoprcmd"
It is available in both UNIX and Windows.

# man vmoprcmd
Reformatting entry. Wait... done

vmoprcmd(1M) vmoprcmd(1M)
18 Jul 2003

NAME
vmoprcmd - perform operator functions on drives

SYNOPSIS
/usr/openv/volmgr/bin/vmoprcmd [-h device_host] -down | -up | -upopr |
-reset drive_index | -downbyname | -upbyname | -upoprbyname |
-resetbyname drive_name | -crawlreleasebyname drive_name |
-comment drive_index ["comment"] | -commentbyname drive_name
["comment"] | -assign drive_index mount_request_id | -assignbyname
drive_name mount_request_id | -deny | -resubmit mount_request_id |
-d [pr | ds | ad] | -help

DESCRIPTION
Perform operator functions on drives. The -h option is not required,
but you must choose one and only one of the other options listed
below.

This command can be executed by any authorized users. For more
information about NetBackup authorization, refer to "Enhanced
Authorization and Authentication" in the NetBackup System
Administrator's Guide or the NetBackup Media Manager System
Administrator's Guide.

OPTIONS
-h device_host
Name of the device host where the drives are attached and
configured. If no host option is specified, the device host
where you execute the command is assumed.

The following point applies only to NetBackup Server:

The device host is the host where Media Manager is
installed.

-down | -up | -upopr | -reset drive_index
-down Sets the drive to the DOWN state, if it is not
assigned.

-up Sets the drive to UP in Automatic Volume Recognition
(AVR) mode. This is the normal mode for all drives.

-upopr Sets the drive to UP in Operator (OPR) mode. This
mode is normally used only for security reasons. For a drive
in a robot, OPR and AVR are treated identically while the
robot daemon is up.

-reset Resets the specified drive, terminating the drive
assignment and taking control away from the assigned user.

CAUTION: Do not reset an assigned drive unless directed by site
policy or the system administrator. Terminating an active

- 1 - Formatted: December 15, 2004

vmoprcmd(1M) vmoprcmd(1M)
18 Jul 2003

job can destroy user data.

-downbyname | -upbyname | -upoprbyname | -resetbyname drive_name
These options are similar to -down, -up, -upopr, and -reset
respectively, except the drive is specified by the drive
name instead of drive index.

-comment drive_index ["comment"]
Add a comment for the drive. The quotes are required if your
comment contains any spaces. If you do not specify comment,
any existing comments for the drive are deleted.

-commentbyname drive_name ["comment"]
This option is similar to the -comment option, except the
drive is specified by the drive name instead of drive index.

-assign drive_index mount_request_id
Assign a drive to a mount request.

-assignbyname drive_name mount_request_id
This option is similar to the -assign option, except the
drive is specified by the drive name instead of drive index.

-deny | -resubmit mount_request_id
-deny Denying a mount request returns an error message to
the user.

-resubmit Resubmit a mount request. If a pending action
message involves a robot, you must correct the problem and
resubmit the request that caused the message.

-d [pr | ds | ad]
If none of the following optional display parameters are
specified, all information is displayed.

pr Display pending requests.

ds Display the status of drives under control of Media
Manager.

ad Display additional status of drives under control of
Media Manager.

-help Display the usage statement for this command.

-crawlreleasebyname drive_name
This option is only applicable for NetBackup Enterprise
Server. This option forces all hosts (that are registered
to use the drive) to issue a SCSI release command to the
drive. Issue this option on the host that is the SSO device
allocator (DA host) or use the -h option to specify the DA

- 2 - Formatted: December 15, 2004

vmoprcmd(1M) vmoprcmd(1M)
18 Jul 2003

host.

CAUTION: Use this option after a PEND status has been seen in Device
Monitor. Do not use this option during backups.

NOTES
Only limited validation of the option parameters is done.

tpconfig -d, tpconfig -l, and vmoprcmd may truncate long drive names.
Please use tpconfig -dl to obtain the full drive name.

vmoprcmd may truncate drive names to 20 characters.

EXAMPLES
The following command sets the drive, with a drive index of 0, to UP
mode:

vmoprcmd -up 0

The following command displays the drive status of all drives:

vmoprcmd -d ds

The following command displays pending requests and the drive status
of all drives on the device host named crab:

vmoprcmd -h crab

SEE ALSO
tpconfig(1M)

COPYRIGHT
Copyright 2002-2003 VERITAS Software Corporation. All rights reserved.

- 3 - Formatted: December 15, 2004

Bob Stump
Incorrigible punster -- Do not incorrige
 
i used vmoprcmd and schedule it to run every 15 mins... because my drives keep going down.
 
Here is a perl script that works for me:
#!/usr/local/bin/perl
@master = `/usr/openv/volmgr/bin/vmoprcmd -d ds -h master`;
$runlast = `cat /tmp/up_drives.dat`;
$runlast =~ s/\s+$//;
$date = `date +%j`;
if ($date == $runlast) { $first = "no"; }
else { $first = "yes"; }
open(tofile,">/tmp/up_drives.dat");
print tofile "$date\n";
close tofile;

foreach $line(@master)
{
$site = "master";
$line =~ s/\s+$//;
$line =~ s/^\s+//;
if (grep(/DRIVE STATUS/,$line) || $line eq "" || (grep/Control/,$line))
{
next;
}
else
{
($drv,$type,$control,$user,$label,$rvsn,$evsn,$ready,$wrenbl,$reqid) = split(/\s+/,$line);
if (grep/DOWN/,$control)
{
if ($first eq "yes")
{
$doit = `/usr/openv/volmgr/bin/vmoprcmd -h $site -up $drv`;
}
else
{
&mailit;
}
}
}
}

sub mailit{
open(tomail,"|/usr/sbin/sendmail mailbox\@mail.drms.dla.mil");
print tomail "From Drive_UP_Checker\@thissite.com Tue Oct 26 12\:25\:13 EDT 2020\n";
print tomail "From\: A Drive is Down\n";
print tomail "To: People_who_care\@drms.mil\n";
print tomail "Subject\: A drive is down!\n";
print tomail "Mime-Version\: 1.0\n";
print tomail "Content-Type\: text\/plain\; charset=us-ascii\n";
print tomail "Content-Transfer-Encoding\: 7bit\n\n";
print tomail "On $site, drive $drv has fallen and it wont start up!\n";
print tomail "\n\n";
close tomail;
}

Bob Stump
Incorrigible punster -- Do not incorrige
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top