# script to monitor solaris server and take identity if down



## csross (Sep 2, 2004)

I have 2 Solaris servers that are mirror images of each other, one being live and the other the backup. I need to have server 2 continually check if server 1 is up, and if it isn't, take-on the identity (IP and hostname) of server 1 and continue working. 

I was thinking or hoping I could do this in scripts. Maybe having server 2 ping server 1, and if server 2 doesn't get a response from server 1, become server 1. 

I don't know how to do that though, and I'm not a heavy scripter. 

If anyone has an idea about how I can accomplist this, please let me know.

Thanks


----------



## lotuseclat79 (Sep 12, 2003)

csross said:


> I have 2 Solaris servers that are mirror images of each other, one being live and the other the backup. I need to have server 2 continually check if server 1 is up, and if it isn't, take-on the identity (IP and hostname) of server 1 and continue working.
> I was thinking or hoping I could do this in scripts. Maybe having server 2 ping server 1, and if server 2 doesn't get a response from server 1, become server 1.
> I don't know how to do that though, and I'm not a heavy scripter.
> If anyone has an idea about how I can accomplist this, please let me know.
> Thanks


Hi csross,

If you have two Solaris servers that are mirror images of each other - are not both live, i.e. mirrored by failover software like what Veritas software does, and I assume Solaris has the capability?

In mirrored disk image software, a heartbeat routine continually checks the other disk to see if it is up, and can be written/read from the secondary disk. If not, then the failover software kicks in from the secondary disk, and switches the disk identities when the primary fails in order to keep on going.

If the primary comes back on line, then a recovery routine re-mirrors the disks so that the primary, secondary pair is fully recovered.

You should not have to write any scripts to do that - it would be quite complex to do anyway, and should check with others in the system admin or development group that would know the answer. Or check with the Solaris help line re: the identity of your OS and ask how you can check to see if you have the mirrored disk failover capability for your version of Solaris - I would be surprised if you did not.

-- Tom


----------



## BanditFlyer (Oct 25, 2005)

I once had a script do an http GET on a (web)server. If the response to the GET request didn't fit the regex I had set up, the script would send a text message to a pager.

Based on that history, I would set up a script on a third server, which would ping both servers. If one server is down, have a script on the third machine that does ipconfig /release, and then sets up the IP address and configuration of the "down server" on the "up server"


----------



## csross (Sep 2, 2004)

Thanks. That is an idea.


----------

