Solved

Needed help for a batch file calling an external command

Posted on 2010-11-11
3
1,097 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 68

Accepted Solution

by:
Qlemo earned 500 total points
Comment Utility
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
Comment Utility
Hello Qlemo;

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

Expert Comment

by:Qlemo
Comment Utility
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

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

Microsoft Windows Server Update Service (WSUS) is free for everyone, but it lacks of some desirable features like send an e-mail to the administrator with the status of all computers on the WSUS server. This article is based on my PowerShell script …
Use this article to create a batch file to backup a Microsoft SQL Server database to a Windows folder.  The folder can be on the local hard drive or on a network share.  This batch file will query the SQL server to get the current date & time and wi…
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 video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…

772 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now