Create
    ➜  ~ cat /opt/scripts/mail.py
    !/usr/bin/env python3
    import os
    import sys
    import smtplib
    import mimetypes
    from email.mime.multipart import MIMEMultipart
    from email.mime.base import MIMEBase
    from email.mime.text import MIMEText
    from email.mime.audio import MIMEAudio
    from email.mime.image import MIMEImage
    from email import encoders
    
    def sendMail(subject, text):
        gmailUser = 'pve@t.ch'
        gmailPassword = 'pa55Word'
        recipient = 'pve@t.ch'
    
         Create the container email message
        msg = MIMEMultipart()
        msg['From'] = gmailUser
        msg['To'] = recipient
        msg['Subject'] = subject
        msg.attach(MIMEText(text, 'plain'))
    
        try:
             Setup the SMTP server
            mailServer = smtplib.SMTP('xxxx.xxx', 1234)
            #mailServer.ehlo()
            #mailServer.starttls()
            #mailServer.ehlo()
            mailServer.login(gmailUser, gmailPassword)
    
             Send the email
            mailServer.sendmail(gmailUser, recipient, msg.as_string())
            mailServer.close()
    
            print('Sent email to %s' % recipient)
        except Exception as e:
            print('Failed to send email: %s' % str(e))
    
    if __name__ == "__main__":
        if len(sys.argv) != 3:
            print("Usage: send_mail.py <subject> <message>")
            sys.exit(1)
    
        subject = sys.argv[1]
        text = sys.argv[2]
        sendMail(subject, text)
联系方式

关于我

那年今日
4 月前

分形工艺R6

13 月前

有位置信息的一条报错[47716.772022] EDAC MC0: 1 CE ie31200 CE on mc#0csrow#1channel#0 (csrow:1 channel:0 page:0x0 offset:0x0 grain:8 syndrome:0x8)内存位置信息P0_Node0_Channel0_Dimm0 DIMMA1 18ADF4G72AZ-3G2BT P0_Node0_Channel1_Dimm1 DIMMB2 MTA18ASF4G72AZ-3G2BZ dmidecode -t memory | grep 'Locator' Locator: DIMMA1 Bank Locator: P0_Node0_Channel0_Dimm0 Locator: DIMMA2 Bank Locator: P0_Node0_Channel0_Dimm1 Locator: DIMMB1 Bank Locator: P0_Node0_Channel1_Dimm0 Locator: DIMMB2 Bank Locator: P0_Node0_Channel1_Dimm1错误信息➜ ~ grep "[0-9]" /sys/devices/system/edac/mc/mc0/rank*/dimm_ce_count /sys/devices/system/edac/mc/mc0/rank0/dimm_ce_count:0 /sys/devices/system/edac/mc/mc0/rank1/dimm_ce_count:0 /sys/devices/system/edac/mc/mc0/rank2/dimm_ce_count:1 /sys/devices/system/edac/mc/mc0/rank3/dimm_ce_count:0这里 rank 和上述的内存位置信息无法对应关系。查看该目录下的 dimm_locationls /sys/devices/system/edac/mc/mc0/rank2/ dimm_ce_count dimm_dev_type dimm_edac_mode dimm_label dimm_location dimm_mem_type dimm_ue_count power size uevent grep "[0-9]" /sys/devices/system/edac/mc/mc0/rank2/dimm_location csrow 1 channel 0可以看到和上面 mc#0csrow#1channel#0 能够对应上。继续核实位置信息➜ ~ grep "[0-9]" /sys/devices/system/edac/mc/mc0/rank*/dimm_location /sys/devices/system/edac/mc/mc0/rank0/dimm_location:csrow 0 channel 0 /sys/devices/system/edac/mc/mc0/rank1/dimm_location:csrow 0 channel 1 /sys/devices/system/edac/mc/mc0/rank2/dimm_location:csrow 1 channel 0 /sys/devices/system/edac/mc/mc0/rank3/dimm_location:csrow 1 channel 1这里可以确定出问题的内存条是 第二个内存通道的第一条出现了问题,但问题来了哪个是第二个内存通道?出问题的是B1吗?但是B1处没有内存条。