LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Embedded & Single-board computer (http://www.linuxquestions.org/questions/linux-embedded-and-single-board-computer-78/)
-   -   Send message to server on Kernel Panic (http://www.linuxquestions.org/questions/linux-embedded-and-single-board-computer-78/send-message-to-server-on-kernel-panic-809096/)

bameije 05-20-2010 10:39 AM

Send message to server on Kernel Panic
 
Hi LQ,

I'm running a network with several embedded modules running Linux.
They are all controlled by 1 server, connected over a standard LAN network. This server can also take care of updates for the modules.

Whenever something goes wrong, for example after an update, one of the modules can suffer a kernel panic. I would like the module to report this to the server, instead of just panicking away...

So my question:
- would it be possible to edit the panic() function in the kernel source to send an (UDP) message to the server? (supposed it already has acquired an IP address through DHCP) (I do have C programming experience, but no Linux kernel programming experience)
- would it be _wise_ to do so?

Thanks in advance.

David1357 05-20-2010 01:33 PM

Quote:

Originally Posted by bameije (Post 3975593)
Would it be possible to edit the panic() function in the kernel source to send an (UDP) message to the server?

It would be possible, but it would be difficult for a novice kernel developer. And being a novice, you would probably use a solution that would introduce instability into the kernel. You might end up creating more panics than you were trying to monitor.

Quote:

Originally Posted by bameije (Post 3975593)
Would it be _wise_ to do so?

If you want the wise solution, you can easily write a user space application that sends out UDP heartbeat messages. If a machine stops sending out heartbeats, you can assume it is hung. The advantage of this situation is that you potentially capture a wider variety of problems than just kernel panics (e.g. network adapter failure).

bameije 05-21-2010 03:04 AM

Thanks for your reply.

I already have the alive messaging to the server, but I thought it would be useful that the module reported itself as 'panicked'.

Quote:

Originally Posted by David1357 (Post 3975726)
And being a novice, you would probably use a solution that would introduce instability into the kernel.

That is exactly what I was afraid of :)
I guess I will follow your advice, unless someone else comes up with some useful tips how to do it.

David1357 06-21-2010 01:27 PM

Quote:

Originally Posted by bameije (Post 3975593)
Whenever something goes wrong, for example after an update, one of the modules can suffer a kernel panic. I would like the module to report this to the server, instead of just panicking away...

Have you looked at using the "Remote Machine" facility in syslogd (man syslog.conf) to send the panic messages to the server?

zaks_974 07-19-2010 04:18 AM

Use kexec/kdump utility from
http://www.linux-mag.com/id/2998

OR

http://lxr.linux.no/linux+v2.6.34.1/...kdump.txt#L150

This will reboot the machine to the new kernel and create a /proc/vmcore (kernel dump core). You can write a user space program to send the update in the new kernel saying that the system rebooted with the dump core. Analysing the dump core with gdb OR crash utility will tell you which module created the panic.


All times are GMT -5. The time now is 05:25 AM.