如何获得内核恐慌计数

有什么办法来检查系统上发生的内核恐慌的数量吗? 如果没有,关于如何做这个新function的任何想法?

我想听到大多数类Unix系统的答案:)

如果你configurationkdump

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. 

你可以在/etc/kdump.confconfiguration一个kdump_post脚本来运行一个任意的脚本来在你每次遇到恐慌时增加一个数字。

 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. 

这种方法的优点是你也可以configurationkdump,即使你不是内核黑客,也可以为内核恐慌的根本原因分析提供有价值的信息。

您可以查看所有/ var / log / messages文件,并计算重新启动特定标题的数量。 由于在内核恐慌之后通常会重启。