Video Screencast Help

hastatus and hares are showing different outputs

Created: 17 Oct 2012 | 7 comments

Hi,

 

I have a very weird issue with one of my system's Veritas Cluster.

When using "hares -state|grep RESOURCE" i see the resource is online on one server and offline on the other, just as expected

But, when using "hastatus |grep RESOURCE" i don't see anything. It's like the cluster doesn't have that resource.

The group to which the resource belongs to is online, the resource is online, the resource process is running - so everything seems OK, besides the hastatus output.

On my other systems, i see the resource when using both hares and hastatus.

Any ideas as to why?

Thanks,
Beni

Comments 7 CommentsJump to latest comment

Yasuhisa Ishikawa's picture

First of all, just run "hastatus" and check if the resouce is listed.
Running "hastatus |grep ..." will hide any clue displayed to stdout and stderr. For example, if HAD is stopped, we can realize that by "hastatus".

BTW, how and why do you use "hastatus | grep ..."?
I believe this command will be block until you send SIGTERM(Ctrl+C) or so. This means "hastatus | grep ..." is harmful in scripting. 

Authorized Symantec Consultant(ASC) Data Protection in Tokyo, Japan

BeniF's picture

i just use the "hastatus |grep ..." to screen out only the resources i want to see. 

It is similar to running "hares -state|grep ..."

in any case, running just hastatus also awaits sigterm to finish.

i ran "hastatus" - the resource shows correctly (online on one server and offline on the other)

after that i ran the "hastatus |grep ..." again and the resource shows as well, although it didn't before.

Weird...

BTW - i am not using this in a script, just as means to check resources status

mikebounds's picture

See extract from manual from hastatus - 

The hastatus command displays resource, group, and system attribute value changes, and monitors transitions

So this shows changes and I THINK it does this by just extracting what is in memory of had daemon, so if your resource were to fault while running "hastatus |grep ..." then you should see resource, but if the resource does not change state, then you MAY see it depending on whether the resource state happens to be in memory.

So hastatus is NOT like "hares -state" as hastatus is a continuous output stream, not a fixed length output like hares -state , so hares -state is the command you should use, unless you are looking for a state change and then you should use something like:

hares -wait resource state OFFLINE -sys system [-time timeout]

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

arangari's picture

1. hastatus gets the information about various cluster objects from HAD and displays for user. In '-summary' mode, it gets the information once, displays and exits.  without any option, it will continue to get the information from HAD and continue to display.  Here, 'hastatus' acts as subscriber for any changes for cluster objects, and hence it can show the changes. 

2. 'hares -wait' will subscribe to changes in resource objects, and check if the given attribute is changed to required value or timeout.

 

Thanks and Warm Regards,

Amit Rangari

If this post helped you resolving the issue, please mark it as solution. _____________________________________________________________________________

BeniF's picture

Thanks Mike!

It makes sense that the resource MAY or MAY NOT be in the memory, thus the output will either show it or not

yes

Marianne's picture

hastatus without any options is a foreground process that updates continuously.

So, it does not terminate after displaying status. Therefore piping it to grep will produce nothing...

Supporting Storage Foundation and VCS on Unix and Windows as well as NetBackup on Unix and Windows
Handy NBU Links

Jubin's picture

hastatus (1M) manual pages:

hastatus(1M) manual pages for other releases can be found on the SORT website.