linkchk is a network interface link ping monitor.

Latest on Hackage:0.0.2

This package is not currently in any snapshots. If you're interested in using it, we recommend adding it to Stackage Nightly. Doing so will make builds more reliable, and allow to host generated Haddocks.

GPL licensed by Jens-Ulrik Petersen
Maintained by Jens-Ulrik Petersen
linkchk is an active network link monitor
(c) 2001 Jens-Ulrik Petersen <>

It is licensed under GPL 2 and comes with no warranty.

The latest version can be found at: <>


By default it repeatedly pings the IPv4 (or IPv6) address of
the default gateway of a given interface appearing in the
routing table and shows the link status in a small gtk
window or in a tty. With appropriate options it can be used
monitor any interface with a gateway or to ping any specific
host. gtk+hs is currently required to build it. The reason
for starting this project was to monitor an unreliable ppp
link at home with a tendency suddenly to start dropping
packets after a while.

Currently it uses some options of ping, ping6 and netstat
that are probably specific to Linux, but porting to most
unices should be straightforward I imagine. If you get
linkchk working on another platform and can send me patches,
or can send me "ifconfig" and "netstat" output from your
platform, then I will be happy to try to fold them into the

If you find linkchk useful, or have comments, feedback or
other contributions, I would be glad to hear from you.


In order to build linkchk you need to have installed

* gtk+hs: a recent version (I'm using 0.12.1 from cvs)
(available from <>).
* c2hs: a recent version (I'm using 0.10.1 from cvs)
* ghc: a recent version (I'm using 5.02)

Once you have those in place, you should be able to build in
the standard way; ie something like:

% ./configure
% make
% make install

should make and install the executable "linkchk", that
you can then test by running. "linkchk --help" lists its

See the generic INSTALL instructions for more information on building.


2001-11-13 Jens Petersen <>

* linkchk.hs: Simplified description. Updated todo list.
(gtksetup): No longer set window policy to auto_skrink.
Shorten initial label to just "...".
(hopchk): debug "hopchk:". Don't debug out when returning err.
(reportTime): Remove quotes around regexp string.
(ifaceDown): Use new ifconfig function. Check ifconfig output to
be sure interface is really UP with regexp.
(ifconfig): New function.
(peeraddr): debug "peeraddr:".
(ptpAddress): use new ifconfig function. Don't quote regexp string.
(popen): Add debug message for popen with commands and opts.

2001-11-01 Jens Petersen <>

* linkchk.hs: Updated todo list. Import elemIndex from List,
readFloat and showFFloat from Numeric.
(FlagNullary): New type for options with no arg.
(FlagUnary): New type for options with one arg.
(Flag): Redefined in terms of them.
(debugging): -V gone, -v is now --version. Added --interface,
and --host. Restructured to use FlagNullary and FlagUnary.
(unaryVal): New function that maybe returns value of option with
(unaryOpt): New function to test whether a unary option present.
(nullaryOpt): New function that tests whether a nullary opt present.
(main): Use FlagNullary and FlagUnary. Updated version. Implicit
parameter opts to start and optsOk.
(optsOk): Tests directly whether both --version and --help, or
--host and --interface specified in implicit ?opt.
(optOk): Removed.
(header): Interface is now an option.
(AF): Removed.
(start): Use implicit opts, and just test for --tty.
(delay): Removed.
(chkDelay): Removed.
(startTty): Use ?opts. labeltxt replaces ifname. doSleep for sleep.
(startGtk): Use ?opts.
(gtksetup): Use ?opts. labeltxt instead of ifname. Give window
autoshrink policy. signalConnect was widgetSignalConnect. Use
containerSetBorderWidth for containerBorderWidth. Rename label to
lbl. Fix width at 50 pixels for now.
(idleHandler): Use ?opts and doSleep.
(interface): New function to return interface. Use ?opts and unaryVal.
(labeltxt): was ifname. Use ?opts and interface.
(doSleep): New. Use ?opts to read --delay.
(hopchk): Use ?opts. Check ifconfig first if --interface given.
ifaceAddr is now pingOpts. debug out when failing with err.
(ping): Use ?opts.
(pingOpts): was ifaceAddr. Use ?opts.
(sigfig): New function in reportTime, to round up time to 3sf's.
(reportTime): Use it.
(ifaceDown): New function to test with ifconfig whether interface
is down.
(peeraddr): Use ?opts and only maybe return interface. If --host
then return host. Use interface and defaultRoute.
(maybeRead): New function which maybe ReadS from a string.
(readRtGwys): Use ?opts.
(gtwyHost): Use ?opts and defaultRoute.
(parseRT): Use ?opts and afOpt.
(adOpt): Use ?opts.
(doParseRTE): Ditto. Drop second guard.
(debug): Use ?opts.
(defaultRoute): New function.

* README: Rewrote description. Updated dependencies' versions.

* NEWS: New features in 0.02

2001-10-24 Jens Petersen <>

* Added defattr. Increased release number.

* index.html: add screenshot of window. Restructured Releases and
put Building at end.

* increment version number. Removed AC_CACHE_CHECK
for popenhs version.

2001-10-18 Jens Petersen <>

* linkchk.hs: changed description and updated todo list. Don't
import readHex from Numeric.
(main): Update version to 0.01.
(optsOk): use `and'.
(startTty): debug count.
(gtksetup): window title is now linkchk ++ interface.
(hopchk): peeraddr now returns (address, interface). Add
interface option to ping if necessary. Handle leaking fixed in
ghc-5.02, so drop guard hacks that read all of other stream.
"broken" to "dropped".
(ifaceAddr): return address arg for ping with interface option if
linklocal ipv6.
(reportTime): simplify regexp since handle leaking fixed in ghc.
(chkError): Removed for same reason.
(reportError): Ditto.
(linklocal): tests if an ipv6 address is linklocal.
(peeraddr): returns (address, interface).

* linkchk.hs:
* New file, based on

* screenshot.png: new file.

* index.html: Add image of window running. Restructured page.

* added AM_INIT_AUTOMAKE. Don't test for grep and
hstags. No more `cat VERSION`. Put gtk+hs cflags in
HCFLAGS. Test for popenhs-config. Add popenhs cflags to
HCFLAGS. Generate Makefile.

* aclocal.m4: Now autogenerated by aclocal from

* acinclude.m4: New file. Based on file in popenhs, which turn is
based on gtk+hs file, based on ghc....

* VERSION: removed. Version number is now in "" [and
"linkchk.hs" :-( ]

* README: updated for 0.01

* NEWS: 0.01 entries, describing --delay, -6, time, netstat,
openhs, automake and autoconf

* Makefile: now autogenerated by autoconf.

* autogenerated by automake.

* New file. Based on popenhs "".

* INSTALL: Moved contents to README. This is now generic GNU file.

2001-10-02 Jens Petersen <>

* linkchk.hs: changed license to GPL 2 only.
Program not library. Not LGPL.
Improve description.
Added Todo section.
Don't import IO, since no longer used.
Import Popen.
Import RegexString is back
(LinkState) gone.
(Flag) new flags added: Delay, IPv6 and Debug.
Derive Eq.
(debugging): new unsafe IORef to hold debug state.
(main): version 0.01. Pass all options to start.
(optsOk): handle multiple options.
(AF): new type to denote IP v6 or v4.
(start): Set debugging ioref if debug option set and decide
whether IP v4 or v6.
(delay): New. Converts delay option parameter to integer.
(chkDelay): Helper function to read decimal from string.
(startTty): Signature has maybe interface, af and delay.
pppchk changed to hopchk with af. Instead of report, use a case
to display result. sleep for delay.
(startGtk): Signature has maybe interface, af and delay.
(gtksetup): Ditto. Use ifname to decide name of interface.
(idlehandler): pppchk changed to hopchk with af. Instead of
report, use a case to display result. sleep for delay.
(ifname): new function returns given interface or default as
(Result): new type to denote result.
(hopchk): was pppchk. Signature includes af and Result. peeraddr
takes af. If no address return "no route". Use popen2 instead of
popen, and use ping. If succeeds and no error or jusr warning --
checking closes err handle! -- return time, report broken if
error, otherwise return ping error message.
(ping): new function that gives ping command depending on af.
(fdCat): removed.
(reportTime): new function to read ping time and format it.
(chkError): New. If err null or just warning, then fine.
(RtEntry): destination back again.
(findInterface): removed
(peeraddr): signature takes maybe interface and af to maybe
string address. readRtHosts renamed to readRtGwys with af.
Find with function cased on maybe interface and af. If no address
return nothing instead of raising error, otherwise just address.
(readRtGwys): was readRtHosts. Takes af. parseRT takes af.
(gtwyHost): handle ipv6 "::" too.
(parseRT): take af. Don't openFile "/proc/net/route", popen2
netstat -rn instead. afOpt gives inet6 or inet option. If ok,
then parse and return list route entries, otherwise empty list.
(afOpt): New. Returns inet or inet6 depending on af.
(linesRoutingTable): Gone.
(doParseRT): Reflect netstat -rn output instead of /proc/net/route
format. Don't need to convNtoA since netstat gives decimal ipv4
addresses. Handle both v4 and v6 output.
(convNtoA): Removed.
(debug): new program to print value when debugging.
(popenInOutErr): Moved to POpen, a new separate module.

2001-10-02 Jens Petersen <>

* INSTALL: updated to reflect current versions of dependencies.
Removed text about old versions of gtkhs-config.

* Makefile: change call of gtkhs-config from variable shell call
to backquote eval inside ghc call. Include popen module.

* README: GPL 2. Changed description including v4 and v6.
Changed text about /proc to Linux options of ping and netstat.

* VERSION: 0.01

* index.html: changed description. Added section headings.
Improved formatting of releases and add links to rpms.

2001-08-17 Jens Petersen <>

* version 0.00, first public release
Depends on 6 packages:
Used by 1 package:
comments powered byDisqus