You could use a "variable reluctance" sensor. Wrap a coil of wire around a small bar magnet, and any magnetic material moving by the end of the magnet will generate a voltage in the coil. You would need a comparator to digitize the output however.
These are used often in automotive applications.