Disk Enclosures
1753746 Members
5150 Online
108799 Solutions
New Discussion юеВ

Re: Script to get storage information (with hpacucli)

 
SOLVED
Go to solution
BiancaP.
Frequent Advisor

Script to get storage information (with hpacucli)

Hey all.

I need to write a script to get nagios information.
I need to return with echo command.

If i use the hpacucli with this commands:

ctrl all show status
or
controller sn=PAB360NX3UC0AD array A physicaldrive all show status
or
controller sn=PAB360NX3UC0AD array A physicaldrive 1:1 show status

What can i do ???

lik....if i put:
echo ctrl all show status

the answer is:
ctrl all show status

and i need the real information:
MSA500 G2 in M57TLYPN8H
Controller Status: OK
Cache Status: OK
Battery Status: OK

Any help ?
6 REPLIES 6
TTr
Honored Contributor

Re: Script to get storage information (with hpacucli)

What OS is this on?
KarloChacon
Honored Contributor

Re: Script to get storage information (with hpacucli)

hi

If I am not mistaken it is

"ctrl all show" removing "status"

oly "ctrl all show"

regards
Didn't your momma teach you to say thanks!
TTr
Honored Contributor
Solution

Re: Script to get storage information (with hpacucli)

The problem is not the ctrl command, it is the echo command. You don't "echo ctrl all show status", you execute the "ctrl all show status" command and store it's output to a variable or a file. In UNIX you could do something like

ctrl all show status > status_file.txt

or

status=`ctrl all show status`

Then you still have to parse the output and check if it says "OK" for further processing so you need additional code here to interface with nagios. Not sure of the details.
BiancaP.
Frequent Advisor

Re: Script to get storage information (with hpacucli)

>>The problem is not the ctrl command, it is the echo command. You don't "echo ctrl all show status", you execute the "ctrl all show status" command and store it's output to a variable or a file. In UNIX you could do something like


Yes... i need to know how to do this in Unix. My OS is Linux Red Hat.
I will try this.
Thanks
BiancaP.
Frequent Advisor

Re: Script to get storage information (with hpacucli)

I still need help.

My script:

#!/bin/bash
status='hpacucli controller sn=PAB360NX3UC0AD array A physicaldrive 1:1 show status'
echo "$status"

Don't work.
I already try echo status, echo $status..

Any help ?



BiancaP.
Frequent Advisor

Re: Script to get storage information (with hpacucli)

I understand my error:

#!/bin/bash
status=`hpacucli controller sn=PAB360NX3UC0AD array A physicaldrive 1:1 show status`
echo $status


I change ' to `

Thanks!