Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to get sdr/ sensor #17

Open
silenceJI opened this issue Jun 27, 2016 · 16 comments
Open

How to get sdr/ sensor #17

silenceJI opened this issue Jun 27, 2016 · 16 comments

Comments

@silenceJI
Copy link

shell command:
ipmitool -I lanplus -H $hostname -U admin -P xxxxxx sensor

The document was not found.
How in the python implementation? thx ~

@hthiery
Copy link
Contributor

hthiery commented Jun 27, 2016

what do you mean with the docment was not found?

2016-06-27 13:07 GMT+02:00 silenceJI notifications@github.com:

shell command:
ipmitool -I lanplus -H $hostname -U admin -P xxxxxx sensor

The document was not found.
How in the python implementation? thx ~


You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
#17, or mute the thread
https://github.com/notifications/unsubscribe/AGRTUtqBXLL2U7XFsZrevPG80dWPMZt3ks5qP67-gaJpZM4I-_EN
.

@silenceJI
Copy link
Author

README not found about sensor options query , Want to know how to do

@hthiery
Copy link
Contributor

hthiery commented Jun 27, 2016

do you use the ipmitool.py tool or do you want to do it in python?

If you use the ipmitool.py tool try the "sdr list" argument. If you want to
query the sensors/sdrs take a look in the ipmitool.py tool as example.

Heiko

2016-06-27 13:26 GMT+02:00 silenceJI notifications@github.com:

README not found about sensor options query , Want to know how to do


You are receiving this because you commented.
Reply to this email directly, view it on GitHub
#17 (comment),
or mute the thread
https://github.com/notifications/unsubscribe/AGRTUuBCWW2jgYBwqHYg3zp4Ni1jnU3iks5qP7NwgaJpZM4I-_EN
.

@silenceJI
Copy link
Author

yes, I want use python collect server temp data, but , now not find how to use ipmitool.py tools realization.

@hthiery
Copy link
Contributor

hthiery commented Jun 27, 2016

does the answer solves your problem?

you can take a look into the sources for collecting sdr data:

https://github.com/kontron/python-ipmi/blob/master/pyipmi/sdr.py#L95
https://github.com/kontron/python-ipmi/blob/master/pyipmi/sdr.py#L109

or for sensors:

https://github.com/kontron/python-ipmi/blob/master/pyipmi/sensor.py#L135
https://github.com/kontron/python-ipmi/blob/master/pyipmi/sensor.py#L149

or use ipmitool.py as example:

https://github.com/kontron/python-ipmi/blob/master/pyipmi/ipmitool.py#L160

Heiko

2016-06-27 13:40 GMT+02:00 silenceJI notifications@github.com:

yes, I want use python collect server temp data, but , now not find how to
use ipmitool.py tools realization.


You are receiving this because you commented.
Reply to this email directly, view it on GitHub
#17 (comment),
or mute the thread
https://github.com/notifications/unsubscribe/AGRTUssBooVxkAM1DmH-OyF_N6yQ9EZXks5qP7bEgaJpZM4I-_EN
.

@hthiery
Copy link
Contributor

hthiery commented Jun 27, 2016

does the answer solves your issue?

@silenceJI
Copy link
Author

no, This is my code:
#!/usr/bin/python

import pyipmi
import pyipmi.interfaces

interface = pyipmi.interfaces.create_interface('ipmitool', interface_type='lanplus')
ipmi = pyipmi.create_connection(interface)
ipmi.target = pyipmi.Target(0x20)
ipmi.target.set_routing([(0x20,0)])
ipmi.session.set_session_type_rmcp('10.90.8.214', port=623)
ipmi.session.set_auth_type_user('admin', 'xxxxx')
ipmi.session.establish()
for i in ipmi.device_sdr_entries():
print i

exec info :
➜ python get_ipmitool.py by silence
Traceback (most recent call last):
File "get_ipmitool.py", line 28, in
for i in ipmi.device_sdr_entries():
File "build/bdist.linux-x86_64/egg/pyipmi/sensor.py", line 139, in device_sdr_entries
File "build/bdist.linux-x86_64/egg/pyipmi/sensor.py", line 107, in reserve_device_sdr_repository
File "build/bdist.linux-x86_64/egg/pyipmi/init.py", line 197, in send_message_with_name
File "build/bdist.linux-x86_64/egg/pyipmi/utils.py", line 49, in check_completion_code
pyipmi.errors.CompletionCodeError: CompletionCodeError cc=0xc1 desc=Invalid Command

@hthiery
Copy link
Contributor

hthiery commented Jun 29, 2016

check if you device supports sensor commands.


id = ipmi.get_device_id()

print id.supported_functions

if not you should use the sdr_repository_entries (
https://github.com/kontron/python-ipmi/blob/master/pyipmi/sdr.py#L95)

2016-06-29 12:06 GMT+02:00 silenceJI notifications@github.com:

no, This is my code:
#!/usr/bin/python

import pyipmi
import pyipmi.interfaces

interface = pyipmi.interfaces.create_interface('ipmitool',
interface_type='lanplus')
ipmi = pyipmi.create_connection(interface)
ipmi.target = pyipmi.Target(0x20)
ipmi.target.set_routing([(0x20,0)])
ipmi.session.set_session_type_rmcp('10.90.8.214', port=623)
ipmi.session.set_auth_type_user('admin', 'xxxxx')
ipmi.session.establish()
for i in ipmi.device_sdr_entries():
print i

exec info :
➜ python get_ipmitool.py by silence
Traceback (most recent call last):
File "get_ipmitool.py", line 28, in
for i in ipmi.device_sdr_entries():
File "build/bdist.linux-x86_64/egg/pyipmi/sensor.py", line 139, in
device_sdr_entries
File "build/bdist.linux-x86_64/egg/pyipmi/sensor.py", line 107, in
reserve_device_sdr_repository
File "build/bdist.linux-x86_64/egg/pyipmi/init.py", line 197, in
send_message_with_name
File "build/bdist.linux-x86_64/egg/pyipmi/utils.py", line 49, in
check_completion_code
pyipmi.errors.CompletionCodeError: CompletionCodeError cc=0xc1
desc=Invalid Command


You are receiving this because you commented.
Reply to this email directly, view it on GitHub
#17 (comment),
or mute the thread
https://github.com/notifications/unsubscribe/AGRTUp2s6W2aDdcXB7syoYlnYu8RUziHks5qQkOVgaJpZM4I-_EN
.

@silenceJI
Copy link
Author

thank you
server device supports sensor commands

➜ ipmitool -I lanplus -H 10.90.8.214 -U admin -P xxxxx sensor

CPU1 Status | 0x0 | discrete | 0x8080| na | na | na | na | na | na
CPU2 Status | 0x0 | discrete | 0x8080| na | na | na | na | na | na
CPU1 Temp | 30.000 | degrees C | ok | na | na | na | na | na | na
CPU2 Temp | 34.000 | degrees C | ok | na | na | na | na | na | na
DIMM Zone1 Temp | 25.000 | degrees C | ok | na | na | na | 100.000 | 105.000 | 110.000
DIMM Zone2 Temp | 27.000 | degrees C | ok | na | na | na | 100.000 | 105.000 | 110.000
DIMM Zone3 Temp | 27.000 | degrees C | ok | na | na | na | 100.000 | 105.000 | 110.000
DIMM Zone4 Temp | 29.000 | degrees C | ok | na | na | na | 100.000 | 105.000 | 110.000
PCH Temp | 46.000 | degrees C | ok | na | na | na | 100.000 | 105.000 | 110.000
Inlet Amb Temp | 15.000 | degrees C | ok | na | 5.000 | 7.000 | 40.000 | 41.000 | 42.000

@silenceJI
Copy link
Author

use

id = ipmi.get_device_id()

print id.supported_functions

python get_ipmitool.py by silence
['sensor', 'sdr_repository', 'sel', 'fru_inventory']

@mousumipaul
Copy link

I am using ipmitool.py and tried the following command to run the program:
python ipmitool.py -H XXX.XXX.XXX.XXX -U XXXXX -P XXXXX -I ipmitool -o interface_type=lanplus sdr list
But I am getting the followng output:

SDR-ID |     | Device String    |
=======|=====|==================|====================
Command returned with completion code 0xc1

I have checked the supported functions and it gives:
['sensor', 'sdr_repository', 'sel', 'fru_inventory']
What is the problem here ? why sdr list is not showing anything?
When I run ipmitool command for sdr it gives the proper output but in case of python program I am getting the error.

@hthiery
Copy link
Contributor

hthiery commented Oct 23, 2018

Please provide the output with increasing the verbose level. Add '-v' to your command line.

@hthiery
Copy link
Contributor

hthiery commented Oct 23, 2018

What version of the lib do you use? The latest released or the last from master?

@barmadron
Copy link

Hi, i am using ipmitool.py and tried
python3 ipmitool.py -v -H 10.28.80.51 -U ADMIN -P ADMIN -I rmcp sdr list

but i get:

ASF TX: msg
ASF RX: msg
Get Channel Authentication Capabilities
IPMI TX: 20 18 c8 81 04 38 0e 04 31
IPMI RX: 81 1c 63 20 04 38 00 01 36 04 00 00 00 00 00 69
Authentication Capabilities:
IPMI v1.5: True
IPMI v2.0: False
Auth. types: md2 md5 straight oem_proprietary
Max Auth. type: 2

Get Session Challenge
IPMI TX: 20 18 c8 81 08 39 02 41 44 4d 49 4e 00 00 00 00 00 00 00 00 00 00 00 d3
IPMI RX: 81 1c 63 20 08 39 00 00 ba 00 04 b2 45 76 86 5a 49 61 16 e1 70 dc 80 ab f1 cc 83 3c
Activate Session
IPMI TX: 20 18 c8 81 0c 3a 02 04 b2 45 76 86 5a 49 61 16 e1 70 dc 80 ab f1 cc 83 e2 e1 5b 30 40
IPMI RX: 81 1c 63 20 0c 3a 00 02 00 bb 00 04 01 00 00 00 04 d4
Set Session Privilege Level
IPMI TX: 20 18 c8 81 10 3b 04 30
IPMI RX: 81 1c 63 20 10 3b 00 04 91
Session opened
IPMI TX: 20 18 c8 81 14 01 6a
IPMI RX: 81 1c 63 20 14 01 00 20 01 08 65 02 ff 0a 3c 00 0e 01 00 00 00 00 e7
SDR-ID | | Device String |
=======|=====|==================|====================
IPMI TX: 20 28 b8 81 18 22 45
IPMI RX: 81 2c 53 20 18 22 00 42 00 64
IPMI TX: 20 28 b8 81 1c 23 42 00 00 00 00 05 f9
IPMI RX: 81 2c 53 20 1c 23 00 02 00 01 00 51 12 10 2b
IPMI TX: 20 28 b8 81 20 23 42 00 01 00 05 10 e4
IPMI RX: 81 2c 53 20 20 23 00 02 00 20 00 00 ff 00 00 00 00 01 00 c5 30 30 2e 30 34 c4
0x0001 | na | b'00.04' | None | na
IPMI TX: 20 28 b8 81 24 23 42 00 02 00 00 05 ef
IPMI RX: 81 2c 53 20 24 23 00 03 00 02 00 51 c0 0b 78
IPMI TX: 20 28 b8 81 28 23 42 00 02 00 05 0b e0
IPMI RX: 81 2c 53 20 28 23 00 03 00 57 01 00 0d 01 2c 60 19 18 1a 1b 3a
Close Session Session:
ID: 0x0400bb00
Seq: 0x00000008
Host: 10.28.80.51:623
Auth.: 2
User: ADMIN
Password: ADMIN

IPMI TX: 20 18 c8 81 2c 3c 00 bb 00 04 58
IPMI RX: 81 1c 63 20 2c 3c 00 78
Traceback (most recent call last):
File "ipmitool.py", line 699, in
main()
File "ipmitool.py", line 593, in main
cmd(ipmi, args)
File "ipmitool.py", line 197, in cmd_sdr_list
print_sdr_list_entry(s.id, number, s.device_id_string,
AttributeError: 'SdrOEMSensorRecord' object has no attribute 'device_id_string'

I have checked the supported functions:

['sensor', 'sdr_repository', 'sel','fru_inventory', 'ipmb_inventory', ;ipmb_event_receiver', 'ipmb_event_generator', 'bridge', 'chassis']

I use version 0.4.1 from master, when i insert :

try:
    check = s.__dict__['device_id_string']
except KeyError:
    continue

to:

for s in iter_fct():

script never ends, how to fix it ?

@yingying-fazheng
Copy link

hello author, i got a problem in excute pyipmi shell, how did you get the address "0x20" in your code "pyipmi.Target(0x20)"?

@hthiery
Copy link
Contributor

hthiery commented Apr 23, 2022

Hi, normally the 0x20 is the standard address of an BMC.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants