作为一个企业服务器管理员,面对服务器莫名宕机或者主动重启,历经折磨后判断为内存问题引起,可当看到内存多达几十条时,难道要单条测试?要真这样,估计领导也要废了你吧。有没方便有效的方法去速度定位那个DIMM槽内存或者在日常监测内存正常与否呢?下面介绍下linux系统下的监控方法--MCElog。    

What are Machine Check Exceptions (or MCE)?


A machine check exception is an error dedected by your system's processor. There are 2 major types of MCE errors, a notice or warning error, and a fatal execption. The warning will be logged by a "Machine Check Event logged" notice in your system logs, and can be later viewed via some Linux utilities. A fatal MCE will cause the machine to stop responding and the details of the MCE will be printed out to the system's console.



What causes MCE errors?


There most common reason for MCE events to occur are:



1.Memory errors or Error Correction Code (ECC) problems


2.Inadequate cooling / processor over-heating


3.System bus errors


4.Cache errors in the processor or hardware


##一般来说当有错误提示时,需要优先注意内存问题,但由于现在内存控制器是集成在cpu里,所以有个别情况是由CPU问题引起的##


Install mcelog-1.0_pre3_p20120918.tar.gz


Download from http://download.chinaunix.net/download/0007000/6605.shtml

Mcelog安装

#tar -zxvf mcelog-1.0_pre3_p20120918.tar.gz    解压出来

#cd  andikleen-mcelog-0f5d023                  进入解压出来的文件夹

#make

#make install                                  编译和安装

Mcelog相关文件

/dev/mcelog 设备文件

/var/log/mcelog    messages日志文件

/etc/mcelog/mcelog.conf配置文件

/var/run/mcelog.pid

默认故障日志只记录在/var/log/mcelog,并不记录到系统日志中。

如果需要在系统日志中也体现,需修改/etc/mcelog/mcelog.conf文件,将前面#去掉,并保存。

141948954.jpg

Mcelog相关设置

1.mcelog的随系统启动,查看boot下的config文件,可以看到mce模块随机启动

142251453.jpg

2.配置mcelog后台运行

#mcelog --daemon

3.查看mcelog日志文件

142742490.png

由于各厂家服务器内存槽位设计可能不同,这边关于错误中的cpu0 bank5内存槽位定位不做讨论。