ipmi class
This commit is contained in:
parent
193066a876
commit
93ab0159b6
1 changed files with 49 additions and 0 deletions
49
netbox_agent/ipmi.py
Normal file
49
netbox_agent/ipmi.py
Normal file
|
|
@ -0,0 +1,49 @@
|
||||||
|
import logging
|
||||||
|
import subprocess
|
||||||
|
|
||||||
|
class Ipmi():
|
||||||
|
"""
|
||||||
|
Parse IPMI output
|
||||||
|
ie:
|
||||||
|
|
||||||
|
Set in Progress : Set Complete
|
||||||
|
Auth Type Support :
|
||||||
|
Auth Type Enable : Callback :
|
||||||
|
: User :
|
||||||
|
: Operator :
|
||||||
|
: Admin :
|
||||||
|
: OEM :
|
||||||
|
IP Address Source : DHCP Address
|
||||||
|
IP Address : 10.192.2.1
|
||||||
|
Subnet Mask : 255.255.240.0
|
||||||
|
MAC Address : 98:f2:b3:f0:ee:1e
|
||||||
|
SNMP Community String :
|
||||||
|
BMC ARP Control : ARP Responses Enabled, Gratuitous ARP Disabled
|
||||||
|
Default Gateway IP : 10.192.2.254
|
||||||
|
802.1q VLAN ID : Disabled
|
||||||
|
802.1q VLAN Priority : 0
|
||||||
|
RMCP+ Cipher Suites : 0,1,2,3
|
||||||
|
Cipher Suite Priv Max : XuuaXXXXXXXXXXX
|
||||||
|
: X=Cipher Suite Unused
|
||||||
|
: c=CALLBACK
|
||||||
|
: u=USER
|
||||||
|
: o=OPERATOR
|
||||||
|
: a=ADMIN
|
||||||
|
: O=OEM
|
||||||
|
Bad Password Threshold : Not Available
|
||||||
|
"""
|
||||||
|
def __init__(self):
|
||||||
|
self.ret, self.output = subprocess.getstatusoutput('ipmitool lan print')
|
||||||
|
if not self.ret:
|
||||||
|
logging.error('Cannot get ipmi info: {}'.format(self.output))
|
||||||
|
|
||||||
|
|
||||||
|
def parse(self):
|
||||||
|
ret = {}
|
||||||
|
if self.ret != 0:
|
||||||
|
return ret
|
||||||
|
for line in self.output.split('\n'):
|
||||||
|
key = line.split(':')[0]
|
||||||
|
value = ':'.join(line.split(':')[1:])
|
||||||
|
ret[key] = value
|
||||||
|
return ret
|
||||||
Loading…
Add table
editor.link_modal.header
Reference in a new issue