cancel
Showing results for 
Search instead for 
Did you mean: 

hastatus and hares are showing different outputs

BeniF
Level 2

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

7 REPLIES 7

Yasuhisa_Ishika
Level 6
Partner Accredited Certified

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. 

BeniF
Level 2

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
Level 6
Partner Accredited

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

BeniF
Level 2

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
Moderator
Moderator
Partner    VIP    Accredited Certified

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...

arangari
Level 5

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.

 

Jubin
Level 3
Employee Accredited

hastatus (1M) manual pages:

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