Quantcast
Channel: Zenoss Community: Message List
Viewing all articles
Browse latest Browse all 1097

Re: IPMI Commands in Zenoss

$
0
0

Ok ran into a couple of issues with the code you provide but I was able to make some progress. The main problem I ran into is that the /usr/bin/lparstat directory does not exist on my server. The second is I kept getting an error when using the result.sub statement that you had in your code. So with some modifying this is what I have come up with so far.

 

 

 

#!/usr/bin/env python

 

import os

import re

import sys

 

serverName=sys.argv[1]

usern=sys.argv[2]

password=sys.argv[3]

 

from subprocess import Popen, PIPE

 

cmd_to_execute = "ipmitool -H " +serverName+  " -U " +usern+  " -P " +password+  " sdr"

 

r=Popen(cmd_to_execute, shell=True, stdout=PIPE, stderr=PIPE)

 

results = r.communicate()[0]

 

results = results.replace(" ","")

results = results.replace("\n","")

results = results.replace("|"," ")

results = results.replace("ok","=1")

results = results.replace("=ns","=0")

results = results.replace("\t"," ")

 

print 'COUNT OK|' + results

 

 

with this I can get the following output.

 

COUNT OK|SystemTemp 31degreesC =1CPUTemp 0unspecified =1FAN1 4995RPM =1FAN2 4860RPM =1FAN3 5130RPM =1FAN4 disabled nsFANA 4725RPM =1Vcore 0.88Volts =13.3VCC 3.36Volts =112V 11.98Volts =1VDIMM 1.52Volts =15VCC 5.06Volts =1-12V -11.87Volts =1VBAT 3.12Volts =1VSB 3.33Volts =1AVCC 3.36Volts =1ChassisIntru 0unspecified ncPSStatus 0unspecified nc

 

So the output is getting close to what I need but in need to find a way to eleminate the text after the number in example if the out put is SystemTemp 31degrees FAN1 4995RPM how do I remove degrees and RPM.

 

would like the output to look like SystemTemp=31 FAN1=4995.


Viewing all articles
Browse latest Browse all 1097

Trending Articles