如何获取内核崩溃计数

如何获取内核崩溃计数

有没有办法检查系统上发生的内核崩溃次数?如果没有,您知道如何实现这个新功能吗?

我希望听到针对大多数类 Unix 系统的答案:)

答案1

如果您配置内核转储

  Kdump is a kexec based crash dumping mechansim for Linux. 
  Kdump functionality is broken mainly in two components, user space and kernel space.    
  Kernel space patches are already part of main line kernel tree. 
  User space component is nothing but a patch on top of existing kexec tools. 

您可以配置一个kdump_post脚本来/etc/kdump.conf运行任意脚本,以便在每次获得一个数字时增加一个数字恐慌..

kdump_post <binary | script>

This directive allows you to run a specified executable just after the memory dump     
process terminates. The exit status from the dump process is fed to the kdump_post     
executable, which can be used to trigger different actions for success or failure. 

这种方法的优点是,您也将配置 kdump,即使您不是内核黑客,它也可以为内核恐慌的根本原因分析提供有价值的信息......

答案2

您可以查看所有 /var/log/message 文件并计算重新启动特定标头的数量。因为通常在内核崩溃后才会重新启动。

相关内容