2019-08-03 15:46:21 +02:00
|
|
|
import sys
|
|
|
|
from pprint import pprint
|
|
|
|
import netbox_agent.dmidecode as dmidecode
|
2019-08-02 18:39:05 +02:00
|
|
|
from netbox_agent.dell.dell import DellHost
|
|
|
|
from netbox_agent.hp.hp import HPHost
|
|
|
|
|
|
|
|
MANUFACTURERS = {
|
|
|
|
'Dell Inc.': DellHost,
|
|
|
|
'HP': HPHost,
|
|
|
|
'HPE': HPHost,
|
|
|
|
}
|
|
|
|
|
|
|
|
def main():
|
2019-08-03 15:46:21 +02:00
|
|
|
manufacturer = dmidecode.get_by_type('Chassis')[0].get('Manufacturer')
|
2019-08-03 15:57:06 +02:00
|
|
|
print(manufacturer)
|
2019-08-03 15:46:21 +02:00
|
|
|
server = MANUFACTURERS[manufacturer](dmidecode)
|
|
|
|
print(server.get_product_name())
|
2019-08-02 18:39:05 +02:00
|
|
|
print(server.get_chassis())
|
|
|
|
print(server.get_service_tag())
|
|
|
|
print(server.get_chassis_service_tag())
|
|
|
|
server.netbox_create()
|
2019-08-03 15:46:21 +02:00
|
|
|
# print(server.get_network_cards())
|
2019-08-02 18:39:05 +02:00
|
|
|
|
|
|
|
if __name__ == '__main__':
|
|
|
|
main()
|