The board can monitor a PC's activity in several ways to determine if it has locked up.
Product: PC Watchdog
Manufacturer: Berkshire Products
Price: $144.95 US $159.95 US with temperature monitor option
Reviewer: David Walker
Do you have an Internet server that needs to be on-line 24 hours a day, 7 days a week dependably? A hardware watchdog timer is one way to be sure such a system is down for a minimal length of time. One such board is the PC Watchdog System Monitoring Board made by Berkshire Products.
I reviewed the PC Watchdog (rev. C) with the temperature monitoring option, part number 1090-1. From the manual: “The PC Watchdog board is a short, 8-bit ISA card that is used to monitor a PC to ensure maximum system availability.”
The board can monitor a PC's activity in several ways to determine if it has locked up. Dip switches on the board can be set to monitor specific I/O addresses for activity. If the PC Watchdog board does not detect activity on the monitored addresses for the specified period of time, it reboots the machine.
The board has a user I/O port that can be used for enhanced watchdog control and monitoring. This is the same interface used by the Linux kernel PC watchdog driver and PC watchdog daemon. If an I/O port on the board is not written to within the specified time, the board reboots the machine.
The board came packed in an anti-static bag in a box with a manual and a 3.5-inch MS-DOS disk of MS-DOS software, including source code. The manual covers the details of the hardware thoroughly. However, it did not specifically describe a Linux installation, and no Linux software is included on the disk.
The PC Watchdog comes with software drivers for MS-DOS/MS Windows. Linux support is available with the kernel and on the Internet. The board works with Intel architecture motherboards and requires one ISA slot.
The board uses three dip switches to configure its operation. I configured the board in order to ignore I/O activity as the Linux driver writes to the user I/O port to keep the board from resetting the PC. I set the address of the user I/O port to 0x0270 and set the delay time to one minute. My switch settings are shown in Figure 1.
I compiled the Linux 2.0.28 kernel with the PC Watchdog driver enabled as a module. I also compiled the watchdog daemon from watchdog_2.0-0.tar.gz (from sunsite.unc.edu in /pub/Linux/system/Admin) and added it to /etc/rc.d/rc.local. I created /dev/watchdog and /dev/temperature with the major and minor device numbers specified in the kernel documentation on the watchdog (linux/Documentation/watchdog.txt).
When all was ready, I shut down my machine, turned off the power and installed the PC Watchdog board in an ISA slot, following the instructions in the manual.
A wire on the board connects to the reset connecter on the motherboard. The wire from the reset switch connects to another connecter on the Watchdog board, so that the reset switch on the case will still work.
When I turned the power on, my machine booted. After a 3.5-minute delay, the PC Watchdog beeped then rebooted my machine. After a few reboots I disconnected the wire from the board to the reset connector until I could figure out how to make the software work correctly.
I sent e-mail to Berkshire Products (email@example.com) for any information they might have on Linux. Simon Machell promptly replied referring me to Ken Hollis (firstname.lastname@example.org) who wrote the kernel driver for the PC Watchdog board.
While I waited to hear from Ken, I found a bug in the kernel driver. After I fixed this bug, the example watchdog daemon from linux/Documentation/watchdog.txt and the daemon from watchdog_2.0-0.tar.gz worked.
Listing 1 is my patch to fix the kernel driver included with Linux-2.0.28. It may also work with other kernels—your mileage may vary.
Ken directed me to the latest driver he has written: ftp://ftp.bitgate.com/pub/mirrors/bitgate/pcwd/pcwd-1.01.tar.gz. I got the tar file, looked at the contents, then patched my kernel source tree with the patch file patch-2.0.15.
Patching linux/drivers/char/pcwd.c and linux/include/linux/pcwd.h wasn't successful, so I copied pcwd-2.0.27.c to linux/drivers/char/pcwd.c and pcwd.h to linux/include/linux/pcwd.h. The watchdog driver then compiled successfully.
The new driver does not work with the daemons for the older driver; it comes with a new daemon. The driver works correctly with the included daemon. The daemon included with the driver lacks one useful feature: the daemon from watchdog_2.0-0.tar.gz. It doesn't fork when it writes to /dev/watchdog, so it won't reboot the machine if the process table gets full.
I modified the daemon to fork before writing to /dev/watchdog, so a full process table will cause a reboot of the machine. Listing 2 is the patch to watchdog.c from pcwd-1.01.tar.gz.
I did try compiling the PC Watchdog driver as part of the kernel, but it caused an error and wasn't initialized properly. It works fine compiled as a module.
The module must be loaded, and the watchdog daemon started before the file systems are fsck-ed. Fsck-ing the file systems can take longer than the delay built into the Watchdog board. I put the following commands to load the module and start the daemon in my /etc/rc.d/rc.S file (Slackware initialization files) before the file systems are checked.
# load the watchdog module and # start the watchdog daemon if [ -x /lib/modules/2.0.28/misc/pcwd.o ]; then echo -loading watchdog module' /sbin/insmod 'f /lib/modules/2.0.28/misc/pcwd.o if [ -x /usr/sbin/watchdog ]; then echo -starting watchdog daemon- /usr/sbin/watchdog -t 10 & fi
At this time, the root file system is mounted read-only so depmod cannot be run to build the modules.dep file. Therefore, kerneld won't be able to load the watchdog module when a new kernel is installed.
A generic link to the module directory can't be made at this time either; therefore, the full path name to the module must be used here. The path to the module must be updated when a new kernel is installed to insure that an old module is not loaded.
I tested the board by killing the watchdog daemon and running a program that forked until the process table was full. The system did not experience any failures on its own during testing.
The PC Watchdog can also monitor the temperature of the machine, although the kernel driver does not support reading the temperature. I wrote a short program to read and print the temperature reported by the board (see Listing 3). As I heated the board with a hair dryer, my program reported the rising temperature and the board started beeping an alarm when the temperature reached 56 degrees Celsius. The board does have an option to hold the PC in a reset state when the temperature exceeds 60 degrees Celsius by closing a relay. A daemon could be written to send e-mail or call a pager when the temperature gets too high or to shut down the PC.
Industrial Computer Source makes the WDT Watchdog Timer Hardware board, for which there is also a Linux kernel driver. It's available from Industrial Computer Source (619-677-0877 in the USA, 01-243-533900 in the UK, and (1) 18.104.22.168 France). It appears similar to the PC Watchdog board, though I've not used it.
A software watchdog driver is also available for the Linux kernel. The software watchdog cannot reboot the system from some lockups nor does it have a temperature sensor. The hardware boards should reboot the system after any lockup.
The PC Watchdog is a well-designed, well-made board. During my three weeks of testing, it operated dependably. The board never reset the PC unnecessarily, and it never failed to reset the machine when needed.