Solved

Needed help for a batch file calling an external command

Posted on 2010-11-11
3
1,104 Views
Last Modified: 2012-05-10
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
Comment
Question by:VMWARE
  • 2
3 Comments
 
LVL 69

Accepted Solution

by:
Qlemo earned 500 total points
ID: 34113724
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
 

Author Comment

by:VMWARE
ID: 34145169
Hello Qlemo;

And finally how do i append the hostname to the email?
0
 
LVL 69

Expert Comment

by:Qlemo
ID: 34145393
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

Does Powershell have you tied up in knots?

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

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Utilizing an array to gracefully append to a list of EmailAddresses
This script can help you clean up your user profile database by comparing profiles to Active Directory users in a particular OU, and removing the profiles that don't match.
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
This Micro Tutorial will give you a basic overview how to record your screen with Microsoft Expression Encoder. This program is still free and open for the public to download. This will be demonstrated using Microsoft Expression Encoder 4.

803 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question