ugoren
ugoren

Reputation: 16441

How to know that the kernel has panicked?

I want to be able to monitor kernel panics - know if and when they have happened.
Is there a way to know, after the machine has booted, that it went down due to a kernel panic (and not, for example, an ordered reboot or a power failure)?

The machine may be configured with KDUMP and/or KDB, but I prefer not to assume that either is or is not installed.

Patching the kernel is an option, though I prefer to avoid it. But even if I do it, I'm not sure what can the patch do.

I'm using kernel 2.6.18 (ancient, I know). Solutions for newer kernels may be interesting too.

Thanks.

Upvotes: 1

Views: 1856

Answers (1)

Brightshine
Brightshine

Reputation: 965

The kernel module 'netconsole' may help you to log kernel printk messages over UDP.

You can view the log message in remote syslog server, event if the machine is rebooted.

Introduction:
=============

This module logs kernel printk messages over UDP allowing debugging of
problem where disk logging fails and serial consoles are impractical.

It can be used either built-in or as a module. As a built-in,
netconsole initializes immediately after NIC cards and will bring up
the specified interface as soon as possible. While this doesn't allow
capture of early kernel panics, it does capture most of the boot
process.

Check kernel document for more information: https://www.kernel.org/doc/Documentation/networking/netconsole.txt

Upvotes: 1

Related Questions