Video Screencast Help
Symantec to Separate Into Two Focused, Industry-Leading Technology Companies. Learn more.

Use of event triggers not working

Created: 17 Sep 2013 | 35 comments
Yet's picture

Hi,

My environment,

SFW-HA 6.0.1 & Windows 2008 R2

node 1 & node 2 in one cluster with EV service group

server 3 (not part of cluster) has CIFS shared folder \fileshare

 

I need to have \\server3\fileshare mounted as drive Z: on active node before EV service group goes online. From CLI I can issue "net use Z: \\server3\fileshare" and the share is mounting OK, so i added this to preonline.pl script thinking that it will run just like on CLI. I tried to online service group with that trigger but it seems to be not working though engine_A log shows it was executed successfully. 

This is what I've added on preonline.pl script,

$group = $ARGV[1];
if ($group eq "EV") {
    VCSAG_SYSTEM("net use Z: \\server3\fileshare");
}
 
i tried using preonline.bat instead of perl script with just one line command "net use Z: \\server3\fileshare". first, i tried to just double-click on batch file to make sure its working and it did mount fine, 2nd, i tried onlining the service group, this time it somehow mounted the share but on My Computer it shows disconnected though I can read/write the drive, but the service group did not go online. I cannot dismount it anymore unless i reboot the active node. 
 
Any idea why it's not mounting through perl, and why it behaves like that through batch file?
 
If the same syntax run manually it's fine but if its part of the trigger it's not workiing.
 
Operating Systems:

Comments 35 CommentsJump to latest comment

mikebounds's picture

Can you provide out of following:

hagrp -display

Mike

UK Symantec Consultant in VCS, GCO, SF, VVR, VxAT on Solaris, AIX, HP-ux, Linux & Windows

If this post has answered your question then please click on "Mark as solution" link below

mikebounds's picture

Sorry, in perl "\" is a special character which means ignore meaning of next character, so for example if you want to use a double quote you use:

\"

so the double quote is not interpreted as the end of the string, so if you want to use a \ you have to use \\, so you code needs to be:

VCSAG_SYSTEM("net use Z: \\\\server3\\fileshare");

 

You can test trigger script as follows:

C:\>cd "\Program Files\VERITAS\cluster server\bin\Triggers"

 

C:\Program Files\VERITAS\cluster server\bin\Triggers>"\Program Files\VERITAS\VRTSPerl\bin\perl.exe" preonline.pl node1 EV MANUAL

 
The 3 passed args of "node1 EV MANUAL" are case sensistive and arg1 and arg2 should be what are displayed by "hagrp -list"
 
I have tested this on VCS running in VMWare and it works fine.
You should put your code just before the line:
# give control back to HAD.
 
Mike
 
 

UK Symantec Consultant in VCS, GCO, SF, VVR, VxAT on Solaris, AIX, HP-ux, Linux & Windows

If this post has answered your question then please click on "Mark as solution" link below

mikebounds's picture

Your batch file did not work properly as you must do a hagrp -online -nopre at the end of the script as in the perl script:

 

`\"$vcs_home\\bin\\hagrp\" -online -nopre $ARGV[1] -sys $ARGV[0]`;
 
So you would need to do something like:
hagrp online -nopre %2 -sys %1
 
But if you do use a batch file then I would add messages to engine log like the perl script does - example:
halog -add "Invoked with system %1, group %2 for reason %3" -sev I -sys %1
and other messages to say you are mounting network drive
 
Mike

UK Symantec Consultant in VCS, GCO, SF, VVR, VxAT on Solaris, AIX, HP-ux, Linux & Windows

If this post has answered your question then please click on "Mark as solution" link below

Yet's picture

Thanks again Mike. I'm not much of perl scripter. :-)

I modified and tried to run first form CLI like below, and it worked fine, share got mounted and SG onlined.

C:\Program Files\VERITAS\cluster server\bin\Triggers>"\Program Files\VERITAS\VRTSPerl\bin\perl.exe" preonline.pl node1 EV MANUAL

However, when I online SG from JAva Console, mounting behaves like running batch file i mentioned before, it mounted share drive but shows disconnected from My Computer though I can access it and SG got onlined.

Tried using vmware environment, results still the same. could it be credential issue?

Also, i tried using postoffline.pl to unmount after offline and it offlined SG but did not unmount (when i mount it using CLI above). I just appended below lines to postoffline.pl script, the syntax running from CLI is "net use Z: /DELETE".

# put your code here...
$group = $ARGV[1];
if ($group eq "EV") {
    VCSAG_SYSTEM("net use Z: \/DELETE");
}
 
any ideas? I really need a help on this.
Yet's picture

I tried to run postoffline.pl script manually from CLI (after mounting it via preonline.pl using CLI as well) and it did unmount the drive properly, though it did not offline SG but that's OK since i don't have offline command onpostoffline.pl.

Why is it that when it executed from CLI it works but not from VC Manager Java Console? any difference there?

mikebounds's picture

The PreOnline can used to make a decision about whether to online the service group, so suppose EV will not work without Z been mounted then the code can be something like:

 

$return_code=0;
$group = $ARGV[1];
if ($group eq "EV") {
    $return_code=VCSAG_SYSTEM("net use Z: \\server3\fileshare");
}

if ($return_code eq 0) {
    if (defined $ARGV[3]) {
        `\"$vcs_home\\bin\\hagrp\" -online -nopre $ARGV[1] -sys $ARGV[0] -checkpartial $ARGV[3]`;
        exit;
    }
    `\"$vcs_home\\bin\\hagrp\" -online -nopre $ARGV[1] -sys $ARGV[0]`;
}
else {
    VCSAG_LOG_MSG ("E", "Mount of Z: failed, so not onlining EV",9000 )
}
exit;

 

 

So that is why Preonline requires "hagrp -online -nopre" in the code and why if you run manually the group will be onlined.  All other trigger scripts just run and do not effect onlining or offlining service groups,  so don't required any "hagrp" commands which is why if you run a postoffline manually, it will not offline the group.

The difference in running script manually and through VCS, is that manually you are running script as a "logged in user" to your session, whereas when VCS runs it, it is being run by the "non-logged in user" that the "had" service runs as.

I have seen before that if you are using Terminal services that if a drive is assigned by VCS, My Computer doesn't see it but it is there and if you log out of terminal services session and back in, then it sees it.  I guess this is an issue with terminal services, something like, where it doesn't expect a drive to arrive where a command was not issued in it's session.  I think when a drive is assigned via the MountV resource, Terminal serivce DOES see it, so there is probably some extra coding to make this happen in the MountV agent.

Mike

UK Symantec Consultant in VCS, GCO, SF, VVR, VxAT on Solaris, AIX, HP-ux, Linux & Windows

If this post has answered your question then please click on "Mark as solution" link below

Yet's picture

Thanks Mike for the script. I supposed i can just cut & paste this to preonline.pl and test.

mikebounds's picture

This code was an example if EV MUST have Z:

So if EV will work partially without Z: then I would not fail the online of the EV group if mount Z: fails, but if EV will not work at all without Z:, then yes you should copy this code into your script.

If mount does fail, I would give error code in log, like:

 

VCSAG_LOG_MSG ("E", "Mount of Z: failed with error code $return_code so not onlining EV",9000);
 
Mike
 
 
 

UK Symantec Consultant in VCS, GCO, SF, VVR, VxAT on Solaris, AIX, HP-ux, Linux & Windows

If this post has answered your question then please click on "Mark as solution" link below

Yet's picture

Thanks Mike, I tried but same thing. When I online via Java SG went online but the drive was mounted with a red x & shows disconnected and yet it can be accessed normally. At this point it cannot be unmounted and have to reboot to clear the mount. If I execute the online trigger via CLI it went perfectly fine. I have to use Java of course, and this is my dilema now.

 

 

mikebounds's picture

Are you using terminal services or do you have console access  - I have only seen this sort of behaviour with terminal server access.   If you are using terminal services, try logging user out and logging back in again.

Have you tried umounting by implementing postoffline trigger so that trigger is called when you offline service group?

What shows red x - is this VEA?

Mike

 

UK Symantec Consultant in VCS, GCO, SF, VVR, VxAT on Solaris, AIX, HP-ux, Linux & Windows

If this post has answered your question then please click on "Mark as solution" link below

Yet's picture

I access server via remote desktop connection. I tried logging out but when I login again the share still there showing disconnected but I can read/write on it.

I did try postoffline but nothing. I cannot even unmount it via CLI or from My Computer because it shows disconnected to nothing to unmount. I have to reboot the server to clear the mount.

When you map a network share from My Computer it will appear with the drive letter along with the local drives, on my case it appears but with red x and along with the drive letter display "Disconnected Network", though i can go to that drive and access the files.

I cannot keep the connection even after failover, it has to failover as well and I have to put this as part of the failover process.

I want to attach screenshot so you can see but I cannot do along with this post. Can i attach a file on this post as well?

mikebounds's picture

You should be able to attached a screenshot  just select "Insert an Image" icon (looks like a picture frame)

I don't know why you are have issues on your system.  On my VMWare workstation, I have 5.1 SFWHA on Windows 2003 and this is output:

 

C:\>find /v "#" "\Program Files\VERITAS\cluster server\bin\Triggers\preonline.pl"
 
---------- \PROGRAM FILES\VERITAS\CLUSTER SERVER\BIN\TRIGGERS\PREONLINE.PL
 
$vcs_home = $ENV{"VCS_HOME"};
if (!defined ($vcs_home)) {
        $vcs_home="C:\\Program Files\\VERITAS\\Cluster Server";
}
 
use ag_i18n_inc;
VCSAG_SET_ENVS();
 
if (!defined $ARGV[0]) {
        VCSAG_LOG_MSG ("W", "Failed to continue; undefined system name", 15028);
        exit;
} elsif (!defined $ARGV[1]) {
        VCSAG_LOG_MSG ("W", "Failed to continue; undefined group name", 15031);
        exit;
} elsif (!defined $ARGV[2]) {
        VCSAG_LOG_MSG ("W", "Failed to continue; undefined whyonlining", 15032);
        exit;
}
 
 
$group = $ARGV[1];
if ($group eq "testsg") {
        $return_code=VCSAG_SYSTEM("net use Z: \"\\\\.host\\Shared Folders\\unix-transfer\"");
        VCSAG_LOG_MSG ("I", "Mount of Z: has return code code $return_code",10000,$return_code);
}
 
if (defined $ARGV[3]) {
    `\"$vcs_home\\bin\\hagrp\" -online -nopre $ARGV[1] -sys $ARGV[0] -checkpartial $ARGV[3]`;
    exit;
}
 
`\"$vcs_home\\bin\\hagrp\" -online -nopre $ARGV[1] -sys $ARGV[0]`;
exit;
 
C:\>find /v /c "&*fake&*" "\Program Files\VERITAS\cluster server\log\engine_A.txt"
 
---------- \PROGRAM FILES\VERITAS\CLUSTER SERVER\LOG\ENGINE_A.TXT: 2635
 
C:\>net use
New connections will not be remembered.
 
There are no entries in the list.
 
 
C:\>hagrp -online testsg -sys W23-CMC
 
C:\>more +2635 "\Program Files\VERITAS\cluster server\log\engine_A.txt"
2013/09/18 23:50:22 VCS INFO V-16-1-50135 User Administrator fired command: hagrp -online testsg  W23-CMC  from 127.0.0.1
2013/09/18 23:50:22 VCS NOTICE V-16-1-10166 Initiating manual online of group testsg on system W23-CMC
2013/09/18 23:50:22 VCS NOTICE V-16-1-10233 Clearing Restart attribute for group testsg on all nodes
2013/09/18 23:50:22 VCS INFO V-16-6-10000 (W23-CMC) preonline:Mount of Z: has return code code 0
2013/09/18 23:50:22 VCS INFO V-16-1-50135 User Administrator fired command: hagrp -online testsg  W23-CMC  from 127.0.0.1
2013/09/18 23:50:23 VCS NOTICE V-16-1-10166 Initiating manual online of group testsg on system W23-CMC
2013/09/18 23:50:23 VCS NOTICE V-16-1-10233 Clearing Restart attribute for group testsg on all nodes
2013/09/18 23:50:23 VCS NOTICE V-16-1-10187 Received -nopre online command for group testsg on system W23-CMC
2013/09/18 23:50:23 VCS NOTICE V-16-1-10301 Initiating Online of Resource sharedfoldermount_mnt (Owner: unknown, Group: testsg) on System W23-CMC
2013/09/18 23:50:23 VCS INFO V-16-6-15002 (W23-CMC) hatrigger:hatrigger executed C:\Program Files\Veritas\Cluster Server\bin\triggers\preonline.pl successfully
 
C:\>net use
New connections will not be remembered.
 
 
Status       Local     Remote                    Network
 
-------------------------------------------------------------------------------
             Z:        \\.host\Shared Folders\unix-transfer
                                                 VMware Shared Folders
The command completed successfully.
 
 
C:\>z:
 
Z:\>c:
 
C:\>net use Z: /DELETE
Z: was deleted successfully.
 
 
C:\>
 
 
Mike

UK Symantec Consultant in VCS, GCO, SF, VVR, VxAT on Solaris, AIX, HP-ux, Linux & Windows

If this post has answered your question then please click on "Mark as solution" link below

Yet's picture

Thanks Mike for very detailed reply.

One thing I have not tried is to online SG via CLI not JAVA, i resumed its the same. I will also mimic the setup to my VMware workstation and see how it behaves.

mikebounds's picture

It shouldn't make any difference if you use CLI or Java as in both cases the preonline script is called by hatrigger.pl which is called by "had" service.

Mike

UK Symantec Consultant in VCS, GCO, SF, VVR, VxAT on Solaris, AIX, HP-ux, Linux & Windows

If this post has answered your question then please click on "Mark as solution" link below

Yet's picture

I mimic the setup to VMware workstation. SG is SQL-1. sys is SQL2

kindly see below, you can see at the bottom drive Z: is accessible. from My Computer this drive has red x and has status Disconnected Network Drive (Z:). To get rid of this I have to reboot.

**************************

C:\Program Files\Veritas\cluster server\bin\Triggers>find /v "#" preonline.pl

---------- PREONLINE.PL

$vcs_home = $ENV{"VCS_HOME"};
if (!defined ($vcs_home)) {
        $vcs_home="C:\\Program Files\\VERITAS\\Cluster Server";
}

use ag_i18n_inc;
VCSAG_SET_ENVS();

if (!defined $ARGV[0]) {
        VCSAG_LOG_MSG ("W", "Failed to continue; undefined system name", 15028);

        exit;
} elsif (!defined $ARGV[1]) {
        VCSAG_LOG_MSG ("W", "Failed to continue; undefined group name", 15031);
        exit;
} elsif (!defined $ARGV[2]) {
        VCSAG_LOG_MSG ("W", "Failed to continue; undefined whyonlining", 15032);

        exit;
}

$group = $ARGV[1];
if ($group eq "SQL-1") {
    VCSAG_SYSTEM("net use Z: \\\\DC\\Fileshare");
}

if (defined $ARGV[3]) {
    `\"$vcs_home\\bin\\hagrp\" -online -nopre $ARGV[1] -sys $ARGV[0] -checkparti
al $ARGV[3]`;
    exit;
}

`\"$vcs_home\\bin\\hagrp\" -online -nopre $ARGV[1] -sys $ARGV[0]`;
exit;

C:\Program Files\Veritas\cluster server\log>net use
New connections will not be remembered.

There are no entries in the list.

C:\Program Files\Veritas\cluster server\log>find /v /c "&*fake&*" engine_A.txt

---------- ENGINE_A.TXT: 5109

C:\Program Files\Veritas\cluster server\log>z:
The system cannot find the drive specified.

C:\Program Files\Veritas\cluster server\log>hagrp -online SQL-1 -sys SQL2

C:\Program Files\Veritas\cluster server\log>more +5109 engine_A.txt
2013/09/19 22:14:24 VCS INFO V-16-1-50135 User (sql2\Administrators):EVADMIN@ABC
 fired command: hagrp -online SQL-1  SQL2  from ::1
2013/09/19 22:14:24 VCS NOTICE V-16-1-10166 Initiating manual online of group SQ
L-1 on system SQL2
2013/09/19 22:14:24 VCS NOTICE V-16-1-10233 Clearing Restart attribute for group
 SQL-1 on all nodes
2013/09/19 22:14:24 VCS INFO V-16-1-50135 User (sql2\Administrators):SYSTEM@NT A
UTHORITY fired command: hagrp -online SQL-1  SQL2  from ::1
2013/09/19 22:14:24 VCS NOTICE V-16-1-10166 Initiating manual online of group SQ
L-1 on system SQL2
2013/09/19 22:14:24 VCS NOTICE V-16-1-10233 Clearing Restart attribute for group
 SQL-1 on all nodes
2013/09/19 22:14:24 VCS NOTICE V-16-1-10187 Received -nopre online command for g
roup SQL-1 on system SQL2
2013/09/19 22:14:24 VCS NOTICE V-16-1-10301 Initiating Online of Resource SQL-1-
IP (Owner: Unspecified, Group: SQL-1) on System SQL2
2013/09/19 22:14:24 VCS NOTICE V-16-1-10301 Initiating Online of Resource SQL-1-
VMDg (Owner: Unspecified, Group: SQL-1) on System SQL2
2013/09/19 22:14:25 VCS INFO V-16-1-10298 Resource SQL-1-VMDg (Owner: Unspecifie
d, Group: SQL-1) is online on SQL2 (VCS initiated)
2013/09/19 22:14:25 VCS NOTICE V-16-1-10301 Initiating Online of Resource SQL-1-
MountV (Owner: Unspecified, Group: SQL-1) on System SQL2
2013/09/19 22:14:25 VCS INFO V-16-6-15002 (SQL2) hatrigger:hatrigger executed "C
:\Program Files\Veritas\VRTSPerl\\bin\perl.exe" "C:\Program Files\Veritas\Cluste
r Server\bin\triggers\preonline.pl" SQL2 SQL-1 MANUAL  successfully
2013/09/19 22:14:26 VCS INFO V-16-1-10298 Resource SQL-1-MountV (Owner: Unspecif
ied, Group: SQL-1) is online on SQL2 (VCS initiated)
2013/09/19 22:14:26 VCS NOTICE V-16-1-10301 Initiating Online of Resource SQL-1-
RegRep-MSSQL (Owner: Unspecified, Group: SQL-1) on System SQL2
2013/09/19 22:14:27 VCS INFO V-16-1-10298 Resource SQL-1-RegRep-MSSQL (Owner: Un
specified, Group: SQL-1) is online on SQL2 (VCS initiated)
2013/09/19 22:14:28 VCS INFO V-16-1-10298 Resource SQL-1-IP (Owner: Unspecified,
 Group: SQL-1) is online on SQL2 (VCS initiated)
2013/09/19 22:14:28 VCS NOTICE V-16-1-10301 Initiating Online of Resource SQL-1-
Lanman (Owner: Unspecified, Group: SQL-1) on System SQL2
2013/09/19 22:14:46 VCS INFO V-16-1-10298 Resource SQL-1-Lanman (Owner: Unspecif
ied, Group: SQL-1) is online on SQL2 (VCS initiated)
2013/09/19 22:14:46 VCS NOTICE V-16-1-10301 Initiating Online of Resource SQLSer
ver-NEW_INSTANCE (Owner: Unspecified, Group: SQL-1) on System SQL2
2013/09/19 22:14:46 VCS NOTICE V-16-1-10301 Initiating Online of Resource MSOlap
-NEW_INSTANCE (Owner: Unspecified, Group: SQL-1) on System SQL2
2013/09/19 22:14:52 VCS INFO V-16-1-10298 Resource MSOlap-NEW_INSTANCE (Owner: U
nspecified, Group: SQL-1) is online on SQL2 (VCS initiated)
2013/09/19 22:14:55 VCS INFO V-16-1-10298 Resource SQLServer-NEW_INSTANCE (Owner:  Unspecified, Group: SQL-1) is online on SQL2 (VCS initiated)
2013/09/19 22:14:55 VCS NOTICE V-16-1-10301 Initiating Online of Resource SQLSer
verAgent-NEW_INSTANCE (Owner: Unspecified, Group: SQL-1) on System SQL2
2013/09/19 22:14:56 VCS INFO V-16-1-10298 Resource SQLServerAgent-NEW_INSTANCE (
Owner: Unspecified, Group: SQL-1) is online on SQL2 (VCS initiated)
2013/09/19 22:14:56 VCS NOTICE V-16-1-10447 Group SQL-1 is online on system SQL2

C:\Program Files\Veritas\cluster server\log>net use
New connections will not be remembered.

There are no entries in the list.

C:\Program Files\Veritas\cluster server\log>z:

Z:\>dir
 Volume in drive Z has no label.
 Volume Serial Number is D8B6-478C

 Directory of Z:\

09/16/2013  11:17 PM    <DIR>          .
09/16/2013  11:17 PM    <DIR>          ..
09/18/2013  12:01 AM    <DIR>          New folder
               0 File(s)              0 bytes
               3 Dir(s)  19,664,412,672 bytes free

Z:\>

 

 

 

 

 

 

 

Yet's picture

I tried running the preonline.pl script via CLI alone, it works just fine.

C:\Users\evadmin>net use
New connections will not be remembered.

There are no entries in the list.

C:\Users\evadmin>cd C:\Program Files\Veritas\cluster server\bin\Triggers

C:\Program Files\Veritas\cluster server\bin\Triggers>"C:\Program Files\Veritas\V
RTSPerl\bin\perl.exe" preonline.pl SQL2 SQL-1 MANUAL
The command completed successfully.

C:\Program Files\Veritas\cluster server\bin\Triggers>net use
New connections will not be remembered.

Status       Local     Remote                    Network

-------------------------------------------------------------------------------
OK           Z:        \\DC\Fileshare            Microsoft Windows Network
The command completed successfully.

C:\Program Files\Veritas\cluster server\bin\Triggers>net use Z: /DELETE
Z: was deleted successfully.

C:\Program Files\Veritas\cluster server\bin\Triggers>net use
New connections will not be remembered.

There are no entries in the list.

C:\Program Files\Veritas\cluster server\bin\Triggers>

Yet's picture

I tried to change the service logon of HAD service to user I'm currently logged and online SG but this time it seems did not run the script. it went online wihtout mounting the drive, unlike when the service logon is Local System it mount the drive but shows disconnected.

there's really no resource i can use to run a single command like translate the function of script to a resource.

 

Yet's picture

I tried capturing any error incase it shows and I got this from the log. What is error "512"

19:09 VCS INFO V-16-1-50135 User (sql2\Administrators):EVADMIN@ABC fired command: hagrp -online SQL-1  SQL2  from ::1
2013/09/20 11:19:09 VCS NOTICE V-16-1-10166 Initiating manual online of group SQL-1 on system SQL2
2013/09/20 11:19:09 VCS NOTICE V-16-1-10233 Clearing Restart attribute for group SQL-1 on all nodes
2013/09/20 11:19:09 VCS INFO V-16-6-10000 (SQL2) preonline:Mount of Z: has return code code 512
2013/09/20 11:19:10 VCS INFO V-16-1-50135 User (sql2\Administrators):SQLADMIN@ABC fired command: hagrp -online SQL-1  SQL2  from ::1
2013/09/20 11:19:10 VCS NOTICE V-16-1-10166 Initiating manual online of group SQL-1 on system SQL2

mikebounds's picture

If there is a typo (like you have missed a "\") then you get "The network name cannot be found" with return code 512.

Mike

UK Symantec Consultant in VCS, GCO, SF, VVR, VxAT on Solaris, AIX, HP-ux, Linux & Windows

If this post has answered your question then please click on "Mark as solution" link below

mikebounds's picture

I didn't think there was a generic resource to run a command, but after double checking, it appears you might be able to use process agent.

The Windows process agent has very bad documentation.   In UNIX with the process agent, you just specify the path of the process (and any args) and the Process agent starts this process, monitors it in the process table and kills process when it needs to be stopped, so you couldn't use the Process to mount a filsystem as this is NOT a process - i.e after you mount a filesystem there is not a process is in the process table to monitor - so to do this you  in UNIX you use the "Application" agent.  Windows has something close to Application agent - the GenericService agent, but this is only useful for Services.

I always thought the Windows Process agent did the same as its descrirption says:

 

The Process agent brings processes online, takes them offline, and monitors their status.
 
the online entry point says:
Starts the process configured as the start program.
 
the state definition says:
ONLINE—Indicates the process being monitored is running properly.
 
the opening line in the "StartProgram" definition is:
The process to be monitored by the agent.
 
the opening line in the "MonitorProgram" definition is:
A program that monitors the process specified as the start program
 
So this is ALL saying you are monitoring a process - the statement above ALL end in a fullstop, there is no "or" to say, "or you can run a program to check the resource is online where your resource does NOT have a process.
 
But if you read furher information in the StartProgram it says:
If you define the start program as a batch file or a script to launch another program, you
must specify the monitor program in the configuration file.
 
and the "MonitorProgram" says:
However, if the start program is a batch file or a script to launch another program, you must specify a monitor program.
 
So it could be the doucmentation does not mean "process" as in a process in "Task Manager", but a process as in "A series of actions, changes, or functions bringing about a result", but then you can't monitor these definition of process, rather you monitor the result of the actions .
 
So I THINK you can use the Process agent, but this will still mean your program is spawned by th "had"  service so it may not help.
 
So I THINK, the definitions above should be more accurately:
 
 
Online entry point:
Runs the program, batch file or script that you specify in the value of the StartProgram attribute
 
State definition:

ONLINE—If you specify the MonitorProgram attribute, this indicates the MonitorProgram returns ONLINE.
If you do NOT specify the MonitorProgram attribute, this indicates the process specified by the StartProgram is running properly.

 
"StartProgram" definition:
The executable, batch file or script which starts the application.
 
"MonitorProgram" definition:

The executable, batch file or script which monitors the application.  If this attribute is not specified then the process in the StartProgram is monitored.  If the attribute is specified then the executable, batch file or script must return 110 for ONLINE and 100 for OFFLINE.

 
This is what I THINK the agent does, so you could have a go at seeing if the Process agent will work for you.
 
Mike

 

UK Symantec Consultant in VCS, GCO, SF, VVR, VxAT on Solaris, AIX, HP-ux, Linux & Windows

If this post has answered your question then please click on "Mark as solution" link below

Yet's picture

Thanks Mike! :-)

After revision I got code "0" but still it's mounted & accessible but shows disconnected. this is if the service logon of HAD is Local System.

If i change service logon to user I currently logged in, code is still "0" but no share mounted.

Any idea?

mikebounds's picture

I think the issue is with the user/domain.  My setup has a ".local" domain, but I use predominatley UNIX, so I don't know that much about Windows domains.  It seems strange to me that the drive is mapped and you can access it, but "net use" doesn't show it - it would make more sense the otherway round - i.e "net use" listed it, but you couldn't access it.

http://www.microsoft.com/resources/documentation/windows/xp/all/proddocs/en-us/net_use.mspx?mfr=true shows you can specify a user and domainname to make the connection, so I would try using these switches in your script.

Mike

UK Symantec Consultant in VCS, GCO, SF, VVR, VxAT on Solaris, AIX, HP-ux, Linux & Windows

If this post has answered your question then please click on "Mark as solution" link below

mikebounds's picture

The Process agent does work as I thought and seems to work fine, so you could try this, but I think it will behave the same as using triggers:

 

 

C:\nw_mount>type online.bat
net use %1 %2
C:\nw_mount>type offline.bat
net use %1 /DELETE
C:\nw_mount>type monitor.bat
net use %1
IF %ERRORLEVEL% EQU 0 exit /b 110
IF %ERRORLEVEL% GTR 0 exit /b 100
C:\nw_mount>more +40 < "\Program Files\VERITAS\cluster server\conf\config\main.cf"
 
group testsg (
        SystemList = { W23-CMC = 0 }
        )
 
        Process nw_mount_z (
                StartProgram = "c:\\nw_mount\\online.bat z: \"\\\\.host\\Shared Folders\\unix-transfer\""
                StopProgram = "c:\\nw_mount\\offline.bat z:"
                MonitorProgram = "c:\\nw_mount\\monitor.bat z:"
                )
 
 
 
        // resource dependency tree
        //
        //      group testsg
        //      {
        //      Process nw_mount_z
        //      }
 
 
 
C:\nw_mount>hares -state nw_mount_z
#Resource    Attribute             System     Value
nw_mount_z   State                 W23-CMC    OFFLINE
 
C:\nw_mount>net use
New connections will not be remembered.
 
There are no entries in the list.
 
 
C:\nw_mount>hares -online nw_mount_z -sys W23-CMC
 
C:\nw_mount>hares -state nw_mount_z
#Resource    Attribute             System     Value
nw_mount_z   State                 W23-CMC    ONLINE
 
C:\nw_mount>net use
New connections will not be remembered.
 
 
Status       Local     Remote                    Network
 
-------------------------------------------------------------------------------
             z:        \\.host\Shared Folders\unix-transfer
                                                 VMware Shared Folders
The command completed successfully.
 
 
C:\nw_mount>z:
 
Z:\>c:
 
C:\nw_mount>hares -offline nw_mount_z -sys W23-CMC
 
C:\nw_mount>hares -state nw_mount_z
#Resource    Attribute             System     Value
nw_mount_z   State                 W23-CMC    OFFLINE
 
C:\nw_mount>net use
New connections will not be remembered.
 
There are no entries in the list.
 
 
C:\nw_mount>z:
The system cannot find the drive specified.
 
C:\nw_mount>
 
Mike

 

 

UK Symantec Consultant in VCS, GCO, SF, VVR, VxAT on Solaris, AIX, HP-ux, Linux & Windows

If this post has answered your question then please click on "Mark as solution" link below

Yet's picture

I tried the parameters of user cred on "net use", no progress.

I tried creating the Process alone, and yes you're right the results are the same as using triggers - no luck either :-(

C:\nw_mount>hares -state nw_mount_z
#Resource    Attribute             System     Value
nw_mount_z   State                 SQL1       OFFLINE
nw_mount_z   State                 SQL2       OFFLINE

C:\nw_mount>hares -online nw_mount_z -sys SQL2

C:\nw_mount>hares -state nw_mount_z
#Resource    Attribute             System     Value
nw_mount_z   State                 SQL1       OFFLINE
nw_mount_z   State                 SQL2       ONLINE

C:\nw_mount>net use
New connections will not be remembered.

There are no entries in the list.

C:\nw_mount>z:
The system cannot find the drive specified.

C:\nw_mount>hares -offline nw_mount_z -sys SQL2

C:\nw_mount>hares -state nw_mount_z
#Resource    Attribute             System     Value
nw_mount_z   State                 SQL1       OFFLINE
nw_mount_z   State                 SQL2       OFFLINE

C:\nw_mount>dir
 Volume in drive C has no label.
 Volume Serial Number is EE41-26CE

 Directory of C:\nw_mount

09/20/2013  02:14 PM    <DIR>          .
09/20/2013  02:14 PM    <DIR>          ..
09/20/2013  02:16 PM                83 monitor.bat
09/20/2013  02:16 PM                20 offline.bat
09/20/2013  02:16 PM                15 online.bat
               3 File(s)            118 bytes
               2 Dir(s)   2,281,209,856 bytes free

C:\nw_mount>type online.bat
net use %1 %2

C:\nw_mount>type offline.bat
net use %1 /DELETE

C:\nw_mount>type monitor.bat
net use %1
IF %ERRORLEVEL% EQU 0 exit /b 110
IF %ERRORLEVEL% GTR 0 exit /b 100

C:\nw_mount>

mikebounds's picture

Notice here that VCS says resource is online - this means that when VCS runs "net use Z:" in the monitor, it sees the drive and also VCS can umount the drive.  In an earlier post,  I suggested you use postoffline to offline the mount, so I suspect this would work also.

So this is progress, you can mount and umount the drive, so you don't have to reboot now and you can access the Z: drive, so issues are if VCS mounts the drive, you can't use "net use" to umount the drive and explorer (I believe) shows a red cross.

Have you tried failling the service group over - and does this work in terms of you can then access Z on the other node and you can no longer access Z: on the original node.  If this works do the issues matter, so long as you application can use the Z: drive?

You also try using "at" command to see if you see the same thing:
http://support.microsoft.com/kb/313565 says:

Note When you use the at command, the scheduled task is run by using the credentials of the system account.

So I think this is the same as VCS, so I suspect if you use "at" to mount the drive you will see the same issues and if you do you would need to speak to Microsoft as to why this is,

Mike

 

UK Symantec Consultant in VCS, GCO, SF, VVR, VxAT on Solaris, AIX, HP-ux, Linux & Windows

If this post has answered your question then please click on "Mark as solution" link below

mikebounds's picture

You can verify "net use Z:" can see the mount when run by VCS (i.e run by the system account) by changing monitor.bat to:

 

net use %1 >> c:\nw_mount\monitor_out.txt
net use %1
IF %ERRORLEVEL% EQU 0 exit /b 110
IF %ERRORLEVEL% GTR 0 exit /b 100
 
and then look at contents of c:\nw_mount\monitor_out.txt
 
Mike

UK Symantec Consultant in VCS, GCO, SF, VVR, VxAT on Solaris, AIX, HP-ux, Linux & Windows

If this post has answered your question then please click on "Mark as solution" link below

mikebounds's picture

I know more about issue now:

If you go to explorer to map a network drive, one of the options is "Reconnect at Logon", as oppose to "Reconnect where you reboot", so this implies a mapped network drive is associated with a  user, not the computer.

I did a test I onlined nw_mount_z resource and VCS sees it as online and as the monitor runs every minute it appeneds the result of "net use z:" showing Z: is online to my file.

Then I logged out and logged back in and VCS still reports the resource is online and continues to output a successul "net use z:"  to my file, but not only does "net use" not show any mapped network drives from the CLI, I also can't acesss Z: from CLI or explorer.

If I then offline resource and online it again in VCS, I can see it again.

So issue is that a network drive is associated with a user account, not the computer and so this acts strangely when you map the network drive as a non-logged in user, and so for me I see the drive in "net use", Z; from CLI and in explorer, but I loose all of these if I log out, but for you, you only see Z: from CLI and it makes no difference is you log out and back in again.

However, I guess if the application that needs to access the network drive can, none of this might matter if you can fail it over in VCS.

Mike

UK Symantec Consultant in VCS, GCO, SF, VVR, VxAT on Solaris, AIX, HP-ux, Linux & Windows

If this post has answered your question then please click on "Mark as solution" link below

Yet's picture

this is output monitor_out.txt,

Local name        Z:
Remote name       \\DC\fileshare
Resource type     Disk
Status            OK
# Opens           0
# Connections     1
The command completed successfully.
 
 
It did mount and accessible but shows disconnected. we know it's being mounted but what's keeping it from being logged as connected?
 
C:\Users\evadmin>hares -online nw_mount_z -sys SQL2
 
C:\Users\evadmin>hares -state nw_mount_z
#Resource    Attribute             System     Value
nw_mount_z   State                 SQL1       OFFLINE
nw_mount_z   State                 SQL2       ONLINE
 
C:\Users\evadmin>net use z:
The network connection could not be found.
 
More help is available by typing NET HELPMSG 2250.
 
 
C:\Users\evadmin>z:
 
Z:\>dir
 Volume in drive Z has no label.
 Volume Serial Number is D8B6-478C
 
 Directory of Z:\
 
09/16/2013  11:17 PM    <DIR>          .
09/16/2013  11:17 PM    <DIR>          ..
09/18/2013  12:01 AM    <DIR>          New folder
               0 File(s)              0 bytes
               3 Dir(s)  19,654,754,304 bytes free
 
Z:\>
 
Z:\>net use z:
The network connection could not be found.
 
More help is available by typing NET HELPMSG 2250.
 
 
Z:\>

 

mikebounds's picture

So can you fail the Z: from one node to the other using VCS?

Can your application access Z: ?

Mike

UK Symantec Consultant in VCS, GCO, SF, VVR, VxAT on Solaris, AIX, HP-ux, Linux & Windows

If this post has answered your question then please click on "Mark as solution" link below

mikebounds's picture

Also see http://www.techimo.com/forum/applications-operating-systems/154581-map-network-drive-computer-not-just-user.html

This says you use a short-cut to Z: and this works for me, but only because if you click on short-cut it maps your drive - ie even if you remove map to Z:, if you click on short-cut, it remaps it.

Mike

UK Symantec Consultant in VCS, GCO, SF, VVR, VxAT on Solaris, AIX, HP-ux, Linux & Windows

If this post has answered your question then please click on "Mark as solution" link below

Yet's picture

that's what i thought  when you said before the difference of running via CLI & JAVA - its the user acct. So I tried changing the HAD service logon to the user acct i used to login, and this time the drive is not mounted at all. But if I change it back to default Local System, it did mount and can be access but stays "disconnected", at this stage even if I logout and login again the drive still there. the only thing to dismount is to reboot.

Also, when I changed the HAD service logon to user acct I used to login in I noticed the engine_A.txt logged in to that user when it tries to execute the trigger, but did not mount it.

If the state of drive is mounted but disconnected and I tried to failover, it will do the same on the other node, it will mount but shows disconnected. at this point both nodes have drive mount but disconnected until I reboot.

So far, what we've found out is,

(A)
HAD service logon: Local System
trigger file: preonline.pl
execute: run using perl.exe via cli by user logged in
result: Z: mounted properly and seen by explorer as connected
 
(B)
HAD service logon: Local System
trigger file: preonline.pl
execute: via VCS (Jave or CLI)
result: Z: NOT mounted but accessible, seen by explorer as disconnected
 
(C)
HAD service logon: user acct used to login with admin priv
trigger file: preonline.pl
execute: via VCS (Jave or CLI)
result: Z: NOT mounted and seen by explorer as disconnected

 

Yet's picture

BTW, thanks so much Mike for working with me on this. I've learned a lot. I guess I'll have to involve MS here knowing why it's happening to my setup and not on yours. Also, I'll try to setup another HW & OS and replicate the problem.

I'm still keeping this case open incase you or someone comes up with something. Afraid I have to resolve this... Though, I wonder if Symantec encountered this.

mikebounds's picture

The issue is that a mapped network drive is against a user, not the computer, so my guess is that it is not supported by Microsoft to map a network drive from a user that is not logged in.  By this I mean you must map the network drive by an application (like explorer or CLI) running by a logged in user, not by a service even if the service runs with the same username as the logged in user.

Here is some output that demonstrates the issue (hares -probe forces the monitor program to be run):

 

C:\nw_mount>type monitor.bat
time /T > c:\nw_mount\monitor_out.txt
time /T > c:\nw_mount\monitor_err.txt
net use %1 >> c:\nw_mount\monitor_out.txt 2>>c:\nw_mount\monitor_err.txt
net use %1
IF %ERRORLEVEL% EQU 0 exit /b 110
IF %ERRORLEVEL% GTR 0 exit /b 100
C:\nw_mount>hares -state
#Resource    Attribute             System     Value
datavol_mnt  State                 W23-CMC    OFFLINE
nw_mount_z   State                 W23-CMC    OFFLINE
testdg       State                 W23-CMC    OFFLINE
 
C:\nw_mount>net use z: "\\.host\Shared Folders\unix-transfer"
The command completed successfully.
 
 
C:\nw_mount>net use
New connections will not be remembered.
 
 
Status       Local     Remote                    Network
 
-------------------------------------------------------------------------------
             z:        \\.host\Shared Folders\unix-transfer
                                                 VMware Shared Folders
The command completed successfully.
 
 
C:\nw_mount>net use z:
Local name        z:
Remote name       \\.host\Shared Folders\unix-transfer
Resource type     Disk
The command completed successfully.
 
 
C:\nw_mount>z:
 
Z:\>c:
 
C:\nw_mount>time /T
15:10
 
C:\nw_mount>hares -probe nw_mount_z -sys W23-CMC
 
C:\nw_mount>type monitor_out.txt
15:10
 
C:\nw_mount>type monitor_err.txt
15:10
The network connection could not be found.
 
More help is available by typing NET HELPMSG 2250.
 
 
C:\nw_mount>hares -online nw_mount_z -sys W23-CMC
 
C:\nw_mount>time
The current time is: 15:11:46.62
Enter the new time:
 
C:\nw_mount>hares -probe nw_mount_z -sys W23-CMC
 
C:\nw_mount>type monitor_out.txt
15:11
Local name        z:
Remote name       \\.host\Shared Folders\unix-transfer
Resource type     Disk
The command completed successfully.
 
 
C:\nw_mount>type monitor_err.txt
15:11
 
C:\nw_mount>
 
So here you can see, that even though if VCS maps network drive, the logged in user can see the drive (as shown in previous posts), for the reverse, where the logged in user maps the network drive, VCS cannot see the drive.

Have you actually tried with your application that requires Z: as for instance if you application runs using system account, then it MAY work, and actually, probably, if your application runs as a service then it probably won't see a drive that you map manually from CLI or explorer as this is similar to my test above.

Mike

 

UK Symantec Consultant in VCS, GCO, SF, VVR, VxAT on Solaris, AIX, HP-ux, Linux & Windows

If this post has answered your question then please click on "Mark as solution" link below

mikebounds's picture

You said:

If the state of drive is mounted but disconnected and I tried to failover, it will do the same on the other node, it will mount but shows disconnected. at this point both nodes have drive mount but disconnected until I reboot.

So using the resource nw_mount_z, are you saying if you offline the resource, you can still access drive if you type "Z:" in a command window and you can access through explorer, even though it has a red-cross?

Mike

UK Symantec Consultant in VCS, GCO, SF, VVR, VxAT on Solaris, AIX, HP-ux, Linux & Windows

If this post has answered your question then please click on "Mark as solution" link below

Yet's picture

Yes, the resource get's offlined from VCS but the drive still there with red x, only reboot can get rid of it.