Active IQ Unified Manager Discussions
Active IQ Unified Manager Discussions
Can someone explaine where you specify pre and post scripts to snapvault jobs in Operations Manager 3.7? Thanks.
Hi Michael,
I'm going to assume you want to know about the "Backup Script" for protection manager Backup policies.
I'm describing the 3.7 version, but earlier version will work the same but the GUI layout may
be different.
I have a simple script that is located at /x/eng/scripts/bu-script. It is accessible from the DFM Server
host. All the script does is append some
basic information to a file located at /x/eng/scripts/output/bu-output.
Here is a simple backup script for solaris and linux
#!/bin/sh
echo "=============== BACKUP SCRIPT ===============" >> /x/eng/scripts/output/bu-output
date >> /x/eng/scripts/output//bu-output
echo "" >> /x/eng/scripts/output/bu-output
printenv >> /x/eng/scripts/output/bu-output
Using the NetAppManagement Console, I associate the backup script with the Backup policy.
I do this by going to Policies->Protection->Overview.
I select the "Back up" policy and click on the edit button.
I select the "Nodes & Connections" and the "Primary data" node.
In the Backup Script section I set Path: /x/eng/scripts/bu-script and Run As: root
Now each time a scheduled backup or a protect-now is executed for a dataset using
the "Back up" policy, the bu-script will
be run twice. Once before the local snapshots are taken and once afterwards.
Here is an example of the output from bu-scripts. There are two entries because
the script is called twice
=============== BACKUP SCRIPT ===============
Mon Jul 21 18:15:04 PDT 2008
ASANY9=/opt/NTAPdfm/
ASTMP=/tmp
COLUMNS=119
DISPLAY=
DP_BACKUP_RESULT=DP_SUCCEEDED
DP_BACKUP_STATUS=DP_BEFORE_SNAPSHOTS
DP_DATASET_ID=52020
DP_DATASET_NAME=imp-mirror
DP_JOB_ID=1935
DP_POLICY_ID=51544
DP_POLICY_NAME=ExampleMirror
DP_RETENTION_TYPE=DP_HOURLY
DP_SERIAL_NUMBER=1-50-000001
EDITOR=vi
HISTFILESIZE=500
HOME=/u/marlon
LD_LIBRARY_PATH=/opt/NTAPdfm/lib/:/opt/NTAPdfm/lib:/opt/NTAPdfm/plugins
LINES=50
=============== BACKUP SCRIPT ===============
Mon Jul 21 18:15:07 PDT 2008
ASANY9=/opt/NTAPdfm/
ASTMP=/tmp
COLUMNS=119
DISPLAY=
DP_BACKUP_RESULT=DP_SUCCEEDED
DP_BACKUP_STATUS=DP_AFTER_SNAPSHOTS
DP_DATASET_ID=52020
DP_DATASET_NAME=imp-mirror
DP_JOB_ID=1935
DP_POLICY_ID=51544
DP_POLICY_NAME=ExampleMirror
DP_RETENTION_TYPE=DP_HOURLY
DP_SERIAL_NUMBER=1-50-000001
EDITOR=vi
HISTFILESIZE=500
HOME=/u/marlon
LD_LIBRARY_PATH=/opt/NTAPdfm/lib/:/opt/NTAPdfm/lib:/opt/NTAPdfm/plugins
LINES=50
For DFM Servers on Windows, you can use .bat files as backup scripts.
Marlon,
Thank you for the great information. I just have a few additional questions. You stated that the script needs to be accessible from the DFM host. Does the script reside on the DFM host or on the host that you want to issue commands? If the latter, how is the script made accessible to the DFM host? Within the script, how do you differentiate between pre script tasks and post script tasks? Thank you very much!
As far as I know, the script needs to be accessible from the DFM Host. The DFM Server
launchs the script. Of course, the script can then talk, via rsh or whatever, to other systems.
In the example that I gave, the /x/eng/scripts/bu-scripts file is accessible and runnable
from the DFM Server. I could log onto the DFM Server as root and literally run it directly.
The way you tell the difference between pre and post invocation is by looking at
the DP_BACKUP_STATUS variable
pre invocation will have
DP_BACKUP_STATUS=DP_BEFORE_SNAPSHOTS
and the post will have
DP_BACKUP_STATUS=DP_AFTER_SNAPSHOTS
Marlon,
Thank you. That is the info I needed.
Hi Marlon,
Would you be able to repost the sample scripts?
thanks,
David
Hi David,
If you take a look at the full discussion you can see the example script and output from it.
Here is a simple backup script for solaris and linux
#!/bin/sh
echo "=============== BACKUP SCRIPT ===============" >> /x/eng/scripts/output/bu-output
date >> /x/eng/scripts/output//bu-output
echo "" >> /x/eng/scripts/output/bu-output
printenv >> /x/eng/scripts/output/bu-output
Below is the complete description of the pre and post backup script.
The same is available in the man pages which can be accessed from Contorl-Center->Help->General Help->Man pages at the bottom for windows installtion.
For linux the same can be accessed at the below location as follows.
man -M /opt/NTAPdfm/man dfpm and seach for the below string.
PRE- AND POST-PROCESSING SCRIPTS FOR DATA TRANSFERS
Users can install a pre- and post-processing script for data transfers. This script will be called before and after the data transfers.
The script should return 0 on success and 1-255 on error. An exit code of greater than 255 is not supported by the DataFabric Manager server. If a script returns a
non-zero exit code, no data transfer for the dataset will occur. A log entry will be added to the job indicating that the script invocation has failed. If for any
reason the data transfer fails after the first script invocation, the script is called as soon as the failure (or abort) occurs.
The script can be installed using the "dfpm policy node set policy-name-or-id node-name backupScriptPath=backup-script-path" command. The user as which the script
should be invoked can be set using the "dfpm policy node set policy-name-or-id node-name backupScriptRunAs=backup-script-run-as" command.
Parameters and status codes are passed to the script as environment variables. The names for these strings begin with DP_; e.g. DP_DATASET_ID
The following perl script fragment prints all of the environment variables passed to the script.
foreach $key (sort(keys %ENV))
{
if ($key =~ /^DP_/) {
print "$key: $ENV{$key}\n";
}
}
For backup connections (snapvault and QSM), an installed pre- and post-processing script will be called upto four times during the course of the backup.
It is called once right before taking snapshots on the primaries. It is called again before starting data transfer for backup relationships. It is called third time
after data transfer is completed. It is called fourth time after the job has registered a backup in the Protection Manager.
The script can tell if it is the first or the second etc. invocation by examining the "DP_BACKUP_STATUS" environment variable.
(See the Environment Variables section for details).
The time when script should quiesce application using primary data depends on on whether the snapshot capability is available on the primary host.
On storage systems where snapshot is available, the script should quiesce application when it is invoked before taking primary snapshots. It can resume normal activi-
ties of application when it is invoked for the second time i.e. before transferring data.
On Open Systems agents where snapshot capability is not available, the script should quiece application when it is invoked for the second time i.e. before transfer-
ring data. It should resume normal operation of application when it is invoked for the third time i.e. after transferring data.
For mirror connections (VSM), an installed pre- and post-processing script will be called twice, once before the mirror transfer and once after the mirror transfer. On
first invocation, the script should quiece the application and when it is invoked for the second time, it can resume the normal activities of the application.
For local snapshot creation, an installed pre- and post-processing script will be called twice, once before the creating the snapshot and once after creating the snap-
shot. On first invocation, the script should quiece the application and when it is invoked for the second time, it can resume the normal activities of the application.
The following environment variables are passed into the scripts:
DP_JOB_ID
The data protection job ID.
DP_DATASET_ID
ID of dataset that is being backed up.
DP_DATASET_NAME
Name of dataset that is being backed up.
DP_POLICY_ID
ID of policy associated with the dataset that is being backed up.
DP_POLICY_NAME
Name of policy associated with the dataset that is being backed up.
DP_CONNECTION_ID
ID of policy connection associated with backup job. This environment variable is not defined for local snapshot creation.
DP_FROM_NODE_NAME
Name of policy node from which data is to be transferred. This environment variable is not defined for local snapshot creation.
DP_TO_NODE_NAME
Name of policy node to which data is to be transferred. This environment variable is not defined for local snapshot creation.
DP_BACKUP_STATUS
State of the data transfer. Valid values for backup connection are:
* DP_BEFORE_PRIMARY_SNAPSHOTS
* DP_BEFORE_TRANSFERS
* DP_AFTER_TRANSFERS
* DP_AFTER_BACKUP_REGISTRATION
Valid values for a mirror connection are:
* DP_BEFORE_MIRROR_TRANSFERS
* DP_AFTER_MIRROR_TRANSFERS
Valid values for a local snapshot creation are:
* DP_BEFORE_SNAPSHOTS
* DP_AFTER_SNAPSHOTS
DP_BACKUP_RESULT
Result of the backup. Valid values are:
* DP_SUCCEEDED
* DP_FAILED
* DP_ABORTED
The result is undefined when the script is invoked before data transfers.
DP_RETENTION_TYPE
Type of retention used for backup. It is also defined in mirror connections but is only intended for pre/post backup scripts.
Valid values are:
* DP_HOURLY
* DP_DAILY
* DP_WEEKLY
* DP_MONTHLY
* DP_UNLIMITED
DP_SERIAL_NUMBER
Serial number of the DataFabric Manager installation.
Regards
adai
Hey All,
Im trying to get the write a simple backup script for windows and nothing happens. Please advise what im doing wrong or if my syntax is incorrect.
(excuting this command by it self works fine c:\pstools\psexec \\10.45.88.221 C:\3.bat in cmd promt works fine)
@echo off
if DP_BACKUP_STATUS==DP_BEFORE_TRANSFERS c:\pstools\psexec \\10.45.88.221 C:\3.bat
My linux OM/PM works fine.
#!/bin/sh
# Execute script to take CG snapshot during pre mirror operation. sync sync
if [ "$DP_BACKUP_STATUS" = "DP_BEFORE_TRANSFERS" ]
then dfpm dataset list >> /opt/00012.txt
fi
thanks,
David
Hi Reed,
By any chance do you receieve the error message: "Custom script exited with errors, exit code 1". ?
Thanks and regards
Shiva Raja
Hi rshiva,
By "Chance" i have this same errors on DFM "Custom script exited with errors..." when I try to execute a script on c:\script\redpro.cmd
Can you help me ?
Thank a lot,
Yoann
thanks everyone for their input. psexec is the one hangs.
Has anyone able to execute remote command on a windows 2k3 server using the PM backup script?
thanks,
David