Search This Blog

Monday 11 January 2016

Expect script to audit Data Protector versions

In the grand scheme of things, what I'm about to share is not a terribly useful script.

I had a cell where Data Protector was reporting that the clients were at a different version to what they really were. Normally this is easy to fix: right click on the client and select "Check Installation" and it will sort itself out.

But in this case, the hostname of the client computer didn't match the DNS name known by the cell manager. So the check installation failed before it had a chance to probe what version was running on the client.

This can also be solved by re-running "Upgrade Components". But for tedious reasons, this wasn't an option either.

I really wanted to know what version everything was at, and I had a Linux box handy, and it had Expect on it. (Actually it didn't, but I was able to run yum install expect). This is what I put together:

#!/usr/bin/expect -f

set timeout 30
log_user 0
set cellmember [lindex $argv 0]
spawn telnet $cellmember 5555
expect {
  -re (HP.*)INET { puts "$cellmember: $expect_out(1,string)" }
  timeout { puts "$cellmember: timeout" }
  eof { puts "$cellmember: some other problem" }

}

In other words, this script will check the computer listed on the command line and print out either:
  • the version of Data Protector installed on the client
  • a timeout if there was no response in 30 seconds
  • a dumb message if something else went wrong (e.g. name resolution failure)
Feel free to use this if you find it useful.

Greg Baker is an independent consultant who happens to do a lot of work on HPE DataProtector. He is the author of the only published books on HP Data Protector (http://www.ifost.org.au/books/#dp). He works with HPE and HPE partner companies to solve the hardest big-data problems (especially around backup). See more at IFOST's DataProtector pages at http://www.ifost.org.au/dataprotector, or visit the online store for Data Protector products, licenses and renewals at http://store.data-protector.net/ 

No comments:

Post a Comment