Python exception and abnormal mac address

Source: Internet
Author: User
Tags glpi

Python exception and abnormal mac address

[Root @ pc0003 MySQL-python-1.2.5] # yum install MySQL-python #! /Usr/bin/python # coding = UTF-8 ''' dependent on MySQLdb python library depends on host = "192. 168. ****. * ** ", user =" ***** ", passwd =" ***** ", db =" ***** "depends on glpi. switch1119 table ''' import osimport MySQLdbos. mkdir (r 'tmp ') filedir = '. /tmp/6.exception.mac-wlan.onboard.mac.error.list.csv 'macfile = open (filedir, 'w') MacFile. write ("exception. mac \ nMAC address, user, device model, approval source \ n ") print (" contacting Database ") conn = MySQLdb. connect (host = "192. 168. ****. * *** ", user =" ***** ", passwd =" ***** ", db = "*****" Your curtailconn.cursor(your select‑cur.exe cute ("use *****;") print ("retrieving exceptions that do not match the wlan and glpi. mac "select0000cur.exe cute (" select mac from switch1119 where UPPER (switch1119.mac) not in (select upper (buffers) from UPPER, glpi_devicenetworkcards where buffers = upper); ") info = cur. fetchmany (sel Ect) for I in info: MacFile. write (str (I) [2:-3] + ", unknow \ n") print ("retrieving MAC of Ethernet-Onboard in glpi stored in MAC in wlan ") macFile. write ("\ n \ nonboard. mac? \ NMAC address, user, device model, approval source \ n ")select0000cur.exe cute (" select mac from switch1119 where UPPER (switch1119.mac) in (select upper (cursor) from glpi_items_devicenetworkcards, glpi_devicenetworkcards where region = glpi_devicenetworkcards.id and glpi_devicenetworkcards.designation = 'ethernet-onboard'); ") info = cur. fetchmany (select) for I in info: MacFile. write (str (I) [2:-3] + ", unknow \ n") cur. close () conn. commit () conn. close () MacFile. close () print ('file storage path: '+ filedir) [root @ pc0003 glpi_switch_ocs] # cat. /tmp/6.exception.mac-wlan.onboard.mac.error.list.csv exception. macMAC address, user, device model, approval Source: 20: 7C: 8F: 76: *****, unknow34: DE: 1A: 1B: *****, unknow onboard. mac? MAC address, user, device model, approval source C8: F7: 33: 15: *****, unknowC8: F7: 33: 18: *****, unknow

 

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.