Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1136
  • Last Modified:

Needed help for a batch file calling an external command

Hello,

There is a command for monitoring the status of a RAID Hardware called hpacucli.exe (C:\Program Files (x86)\Compaq\Hpacucli\Bin\hpacucli.exe)...

The output of that command is

hpacucli.exe ctrl all show status

Smart Array B110i SATA RAID in Slot 0 (Embedded)
   Controller Status: OK

I need a batch file that could be added as a scheduled task  to check that the array is healthy, and if not, send an email informing of it.

Thanks in advance
0
VMWARE
Asked:
VMWARE
  • 2
1 Solution
 
QlemoC++ DeveloperCommented:
For sending email, I would use blat. There are other options, like using a smal WSH (VB) Script or the like, but BLAT is easy to use, though a bit old. Get if from http://sourceforge.net/projects/blat/files/ .


@echo off
hpacucli.exe ctrl all show status > %temp%\hpstats.txt
find "Controller Status: OK" %temp%\hpstats.txt >nul || blat.exe %temp%\hpstats.txt -server YourSMPTServer -to You@YourDomain.com -f ValidSender@YourDomain.com -s "HP RAID Util error!"
del %temp%\hpstats.txt >nul 2>nul

Open in new window

0
 
VMWAREAuthor Commented:
Hello Qlemo;

And finally how do i append the hostname to the email?
0
 
QlemoC++ DeveloperCommented:
Something like this. The host name is appended to the subject line.
@echo off
hpacucli.exe ctrl all show status > %temp%\hpstats.txt
find "Controller Status: OK" %temp%\hpstats.txt >nul || blat.exe %temp%\hpstats.txt -server YourSMPTServer -to You@YourDomain.com -f ValidSender@YourDomain.com -s "HP RAID Util error on %Computername%!"
del %temp%\hpstats.txt >nul 2>nul

Open in new window

0

Featured Post

Problems using Powershell and Active Directory?

Managing Active Directory does not always have to be complicated.  If you are spending more time trying instead of doing, then it's time to look at something else. For nearly 20 years, AD admins around the world have used one tool for day-to-day AD management: Hyena. Discover why

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now